fix shipping

This commit is contained in:
Ludovic CANDELLIER
2023-07-16 17:54:44 +02:00
parent 1675745e2a
commit b8c31f6049
36 changed files with 640 additions and 897 deletions

View File

@@ -18,9 +18,9 @@ class DeliveryPackagesDataTable extends DataTable
protected function getColumns()
{
return [
Column::make('weight')->title('Poids'),
Column::make('weight_flyer')->title('Flyer'),
Column::make('weight_packaging')->title('Packaging'),
Column::make('weight')->title('Poids')->addClass('text-right'),
Column::make('weight_flyer')->title('Flyer')->addClass('text-right'),
Column::make('weight_packaging')->title('Packaging')->addClass('text-right'),
$this->makeColumnButtons(),
];
}

View File

@@ -11,16 +11,12 @@ class DeliveryPackageController extends Controller
{
public function index(DeliveryPackagesDataTable $dataTable)
{
$data = [];
return $dataTable->render('Admin.Shop.DeliveryPackages.list', $data);
return $dataTable->render('Admin.Shop.DeliveryPackages.list');
}
public function create()
{
$data['sale_channels'] = SaleChannels::getOptions();
return view('Admin.Shop.DeliveryPackages.create', $data);
return view('Admin.Shop.DeliveryPackages.create');
}
public function store(Request $request)
@@ -30,17 +26,9 @@ class DeliveryPackageController extends Controller
return redirect()->route('Admin.Shop.DeliveryPackages.index');
}
public function show($id)
{
$data['delivery'] = DeliveryPackages::get($id);
return view('Admin.Shop.DeliveryPackages.view', $data);
}
public function edit($id)
{
$data['delivery'] = DeliveryPackages::get($id)->toArray();
$data['sale_channels'] = SaleChannels::getOptions();
$data['package'] = DeliveryPackages::get($id)->toArray();
return view('Admin.Shop.DeliveryPackages.edit', $data);
}
@@ -49,11 +37,4 @@ class DeliveryPackageController extends Controller
{
return DeliveryPackages::destroy($id);
}
public function toggleActive(Request $request)
{
$data = DeliveryPackages::toggle_active($request->input('id'), ($request->input('active') == 'true') ? 1 : 0);
return response()->json(['error' => 0]);
}
}

View File

@@ -4,21 +4,21 @@ namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Shop\DeliveryTypeCalculationsDataTable;
use App\Repositories\Shop\DeliveryTypeCalculations;
use App\Repositories\Shop\SaleChannels;
use App\Repositories\Shop\DeliveryTypes;
use Illuminate\Http\Request;
class DeliveryTypeCalculationController extends Controller
{
public function index(DeliveryTypeCalculationsDataTable $dataTable)
{
$data = [];
return $dataTable->render('Admin.Shop.DeliveryTypeCalculations.list', $data);
return $dataTable->render('Admin.Shop.DeliveryTypeCalculations.list');
}
public function create()
{
$data = [];
$data = [
'delivery_types' => DeliveryTypes::getOptions(),
];
return view('Admin.Shop.DeliveryTypeCalculations.create', $data);
}
@@ -30,18 +30,13 @@ class DeliveryTypeCalculationController extends Controller
return redirect()->route('Admin.Shop.DeliveryTypeCalculations.index');
}
public function show($id)
{
$data['delivery'] = DeliveryTypeCalculations::get($id);
return view('Admin.Shop.DeliveryTypeCalculations.view', $data);
}
public function edit($id)
{
$data['delivery'] = DeliveryTypeCalculations::get($id)->toArray();
$data['sale_channels'] = SaleChannels::getOptions();
$data = [
'calcul' => DeliveryTypeCalculations::get($id)->toArray(),
'delivery_types' => DeliveryTypes::getOptions(),
];
return view('Admin.Shop.DeliveryTypeCalculations.edit', $data);
}
@@ -49,11 +44,4 @@ class DeliveryTypeCalculationController extends Controller
{
return DeliveryTypeCalculations::destroy($id);
}
public function toggleActive(Request $request)
{
$data = DeliveryTypeCalculations::toggle_active($request->input('id'), ($request->input('active') == 'true') ? 1 : 0);
return response()->json(['error' => 0]);
}
}

View File

@@ -30,13 +30,6 @@ class DeliveryTypeController extends Controller
return redirect()->route('Admin.Shop.DeliveryTypes.index');
}
public function show($id)
{
$data['delivery'] = DeliveryTypes::get($id);
return view('Admin.Shop.DeliveryTypes.view', $data);
}
public function edit($id)
{
$data['delivery'] = DeliveryTypes::get($id)->toArray();
@@ -49,11 +42,4 @@ class DeliveryTypeController extends Controller
{
return DeliveryTypes::destroy($id);
}
public function toggleActive(Request $request)
{
$data = DeliveryTypes::toggle_active($request->input('id'), ($request->input('active') == 'true') ? 1 : 0);
return response()->json(['error' => 0]);
}
}

View File

@@ -15,24 +15,24 @@ class BasketController extends Controller
{
public function getPrice(Request $request)
{
$offer_id = $request->input('offer_id');
$offerId = $request->input('offer_id');
$quantity = $request->input('quantity') ?? 1;
$price = Offers::getPrice($offer_id, $quantity)->price_taxed;
$price = Offers::getPrice($offerId, $quantity)->price_taxed;
return number_format($quantity * $price, 2);
}
public function addBasket(Request $request)
{
$offer_id = $request->input('offer_id');
$offerId = $request->input('offer_id');
$quantity = $request->input('quantity') ?? 1;
$update = $request->input('update') ?? false;
return Baskets::addBasket($offer_id, $quantity, $update);
return Baskets::addBasket($offerId, $quantity, $update);
}
public function modalBasket($offer_id, $quantity)
public function modalBasket($offerId, $quantity)
{
$data['offer'] = Offers::getFull($offer_id)->toArray();
$data['basket'] = Baskets::addBasket($offer_id, $quantity);
$data['offer'] = Offers::getFull($offerId)->toArray();
$data['basket'] = Baskets::addBasket($offerId, $quantity);
return view('Shop.Baskets.partials.modalBasket', $data);
}
@@ -65,7 +65,7 @@ class BasketController extends Controller
$data = $request->all();
unset($data['_token']);
$data['user_id'] = Users::getId();
Orders::newOrder($data);
Orders::saveOrder($data);
return response()->json(['code' => '200']);
}

View File

@@ -19,72 +19,72 @@ class CategoryController extends Controller
return $dataTable->render('Shop.Categories.list');
}
public function show(Request $request, $category_id, $article_nature_id = false)
public function show(Request $request, $categoryId, $articleNatureId = false)
{
if ($article_nature_id) {
$product_type = ArticleNatures::getProductType($article_nature_id);
dump($product_type);
if ($articleNatureId) {
$productType = ArticleNatures::getProductType($articleNatureId);
dump($productType);
exit;
} else {
$article_nature = $request->input('article_nature');
if (!$article_nature) {
$articleNature = $request->input('article_nature');
if (!$articleNature) {
$articleNatures = Articles::getArticleNaturesWithOffers([
'category_id' => $category_id,
'category_id' => $categoryId,
]);
if (count($articleNatures) === 1) {
$article_nature = $articleNatures[0];
$articleNature = $articleNatures[0];
}
$productTypes = Articles::getProductTypesWithOffers([
'category_id' => $category_id,
'category_id' => $categoryId,
]);
if (count($productTypes) === 1) {
$product_type = $productTypes[0];
$productType = $productTypes[0];
}
}
switch ($article_nature) {
switch ($articleNature) {
case 'semences':
$product_type = 'botanic';
$article_nature_id = 1;
$productType = 'botanic';
$articleNatureId = 1;
break;
case 'plants':
$product_type = 'botanic';
$article_nature_id = 2;
$productType = 'botanic';
$articleNatureId = 2;
break;
case 'legumes':
$product_type = 'botanic';
$article_nature_id = 3;
$productType = 'botanic';
$articleNatureId = 3;
break;
default:
if (!($product_type ?? false)) {
$product_type = 'botanic';
$article_nature_id = 1;
$article_nature = 'semences';
if (!($productType ?? false)) {
$productType = 'botanic';
$articleNatureId = 1;
$articleNature = 'semences';
}
break;
}
// $product_type = ArticleNatures::getProductType($article_nature_id);
// dump($product_type);
// dump($article_nature_id);
// $productType = ArticleNatures::getProductType($articleNatureId);
// dump($productType);
// dump($articleNatureId);
// exit;
}
// exit;
$data = [
'category' => Categories::getFull($category_id),
'breadcrumb' => Categories::getAncestorsByCategory($category_id),
'category' => Categories::getFull($categoryId),
'breadcrumb' => Categories::getAncestorsByCategory($categoryId),
'display_by_rows' => $request->input('display_by_rows') ?? false,
'product_type' => $product_type,
'article_nature' => $article_nature,
'product_type' => $productType,
'article_nature' => $articleNature,
'article_natures' => $articleNatures ?? [],
'product_types' => $productTypes ?? [],
'tags_selected' => $request->input('tags') ?? [],
'articles' => Articles::getArticlesToSell([
'category_id' => $category_id,
'category_id' => $categoryId,
'tags' => $request->input('tags') ?? [],
'product_type' => $product_type ?? false,
'article_nature_id' => $article_nature_id ?? false,
'product_type' => $productType ?? false,
'article_nature_id' => $articleNatureId ?? false,
]),
'tags' => TagGroups::getWithTagsAndCountOffers($category_id),
'tags' => TagGroups::getWithTagsAndCountOffers($categoryId),
];
// dump($data);
// exit;

View File

@@ -13,13 +13,25 @@ class Orders
->activeIfRoute('orders')
->order(1);
$menu->addTo('orders', 'Commandes', [ 'route' => 'Admin.Shop.Orders.index', 'permission' => 'backend_access' ])
->activeIfRoute(['Admin.Shop.Orders.*'])->order(1);
$menu->addTo('orders', 'Factures', [ 'route' => 'Admin.Shop.Invoices.index', 'permission' => 'backend_access' ])
->activeIfRoute(['Admin.Shop.Invoices.*'])->order(2);
$menu->addTo('orders', 'Avoirs', [ 'route' => 'Admin.Shop.Invoices.index', 'permission' => 'backend_access' ])
->activeIfRoute(['Admin.Shop.Invoices.*'])->order(3);
$menu->addTo('orders', 'Bons de livraison', [ 'route' => 'Admin.Shop.Invoices.index', 'permission' => 'backend_access' ])
->activeIfRoute(['Admin.Shop.Invoices.*'])->order(4);
$menu->addTo('orders', 'Commandes', [
'route' => 'Admin.Shop.Orders.index',
'permission' => 'backend_access',
])->activeIfRoute(['Admin.Shop.Orders.*'])->order(1);
$menu->addTo('orders', 'Factures', [
'route' => 'Admin.Shop.Invoices.index',
'permission' => 'backend_access',
])->activeIfRoute(['Admin.Shop.Invoices.*'])->order(2);
/*
$menu->addTo('orders', 'Avoirs', [
'route' => 'Admin.Shop.Invoices.index',
'permission' => 'backend_access',
])->activeIfRoute(['Admin.Shop.Invoices.*'])->order(3);
$menu->addTo('orders', 'Bons de livraison', [
'route' => 'Admin.Shop.Invoices.index',
'permission' => 'backend_access',
])->activeIfRoute(['Admin.Shop.Invoices.*'])->order(4);
*/
}
}

View File

@@ -11,15 +11,21 @@ class Settings
$menu->add('Paramètres', [ 'permission' => 'backend_access', 'icon' => 'cogs' ])
->id('settings')
->activeIfRoute('settings')
->order(1);
->order(7);
$menu->addTo('settings', __('shop.delivery_types.title'), [ 'route' => 'Admin.Shop.DeliveryTypes.index', 'permission' => 'backend_access' ])
->activeIfRoute(['Admin.Shop.DeliveryTypes.*'])->order(1);
$menu->addTo('settings', __('shop.delivery_types.title'), [
'route' => 'Admin.Shop.DeliveryTypes.index',
'permission' => 'backend_access',
])->activeIfRoute(['Admin.Shop.DeliveryTypes.*'])->order(1);
$menu->addTo('settings', __('shop.delivery_type_calculations.title'), [ 'route' => 'Admin.Shop.DeliveryTypeCalculations.index', 'permission' => 'backend_access' ])
->activeIfRoute(['Admin.Shop.DeliveryTypeCalculations.*'])->order(2);
$menu->addTo('settings', __('shop.delivery_type_calculations.title'), [
'route' => 'Admin.Shop.DeliveryTypeCalculations.index',
'permission' => 'backend_access',
])->activeIfRoute(['Admin.Shop.DeliveryTypeCalculations.*'])->order(2);
$menu->addTo('settings', __('shop.delivery_packages.title'), [ 'route' => 'Admin.Shop.DeliveryPackages.index', 'permission' => 'backend_access' ])
->activeIfRoute(['Admin.Shop.DeliveryPackages.*'])->order(3);
$menu->addTo('settings', __('shop.delivery_packages.title'), [
'route' => 'Admin.Shop.DeliveryPackages.index',
'permission' => 'backend_access',
])->activeIfRoute(['Admin.Shop.DeliveryPackages.*'])->order(3);
}
}

View File

@@ -58,9 +58,9 @@ class Category extends parentCategory
return $this->tags()->withCount('Articles');
}
public function scopeByCategory($query, $category_id)
public function scopeByCategory($query, $categoryId)
{
return $query->where('category_id', $category_id);
return $query->where('category_id', $categoryId);
}
public function scopeVisible($query)
@@ -78,28 +78,28 @@ class Category extends parentCategory
return $query->where('id', '<>', 1);
}
public function scopeInRange($query, $_lft, $_rgt)
public function scopeInRange($query, $left, $right)
{
return $query->where('_lft', '>=', $_lft)->where('_rgt', '<=', $_rgt);
return $query->where('_lft', '>=', $left)->where('_rgt', '<=', $right);
}
public function scopeHasAvailableOffers($query, $sale_channel_id = false)
public function scopeHasAvailableOffers($query, $saleChannelId = false)
{
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
$saleChannelId = $saleChannelId ? $saleChannelId : SaleChannels::getDefaultID();
return $query->whereHas('articles', function ($query) use ($sale_channel_id) {
$query->WithAvailableOffers($sale_channel_id);
return $query->whereHas('articles', function ($query) use ($saleChannelId) {
$query->WithAvailableOffers($saleChannelId);
});
}
public function scopeHasAvailableOffersByCategoryParent($query, $sale_channel_id = false)
public function scopeHasAvailableOffersByCategoryParent($query, $saleChannelId = false)
{
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
$saleChannelId = $saleChannelId ? $saleChannelId : SaleChannels::getDefaultID();
return $query->whereHas('articles', function ($query) use ($sale_channel_id) {
$query->WithAvailableOffers($sale_channel_id);
})->orWhereHas('descendants.articles', function ($query) use ($sale_channel_id) {
$query->WithAvailableOffers($sale_channel_id);
return $query->whereHas('articles', function ($query) use ($saleChannelId) {
$query->WithAvailableOffers($saleChannelId);
})->orWhereHas('descendants.articles', function ($query) use ($saleChannelId) {
$query->WithAvailableOffers($saleChannelId);
});
}
}

View File

@@ -58,14 +58,14 @@ class Order extends Model
return $query->where('uuid', $uuid);
}
public function scopeByCustomer($query, $customer_id)
public function scopeByCustomer($query, $customerId)
{
return $query->where('customer_id', $customer_id);
return $query->where('customer_id', $customerId);
}
public function scopeByDelivery($query, $delivery_id)
public function scopeByDelivery($query, $deliveryId)
{
return $query->where('delivery_id', $delivery_id);
return $query->where('delivery_id', $deliveryId);
}
public function scopePreparation($query)
@@ -88,9 +88,9 @@ class Order extends Model
return $query->where('status', $status);
}
public function scopeByPaymentType($query, $payment_type)
public function scopeByPaymentType($query, $paymentType)
{
return $query->where('payment_type', $payment_type);
return $query->where('payment_type', $paymentType);
}
public function scopeByPeriod($query, $start, $end, $field = 'created_at')

View File

@@ -7,13 +7,11 @@ use App\Models\Botanic\Variety;
use App\Models\Shop\Article;
use App\Models\Shop\ArticleNature;
use App\Models\Shop\Merchandise;
use App\Traits\Model\Basic;
class ArticleNatures
{
public static function getOptions()
{
return ArticleNature::get()->pluck('name', 'id')->toArray();
}
use Basic;
public static function getProductType($id)
{
@@ -37,12 +35,16 @@ class ArticleNatures
switch ($model) {
case Specie::class:
case Variety::class:
return 1;
$type = 1;
break;
case Merchandise::class:
return 2;
$type = 2;
break;
default:
$type = false;
}
return false;
return $type;
}
public static function getProductTypes()
@@ -77,14 +79,9 @@ class ArticleNatures
return ArticleNature::byProductType($type)->get();
}
public static function getByCategory($category_id)
public static function getByCategory($categoryId)
{
return Article::byCategory($category_id)->select('article_nature_id')->distinct()->get();
}
public static function getAll()
{
return ArticleNature::orderBy('name', 'asc')->get();
return Article::byCategory($categoryId)->select('article_nature_id')->distinct()->get();
}
public static function getNamesByIds($ids)
@@ -94,34 +91,8 @@ class ArticleNatures
return array_map('strtolower', $names);
}
public static function get($id)
public static function getModel()
{
return ArticleNature::find($id);
}
public static function store($data)
{
$item = ($data['id'] ?? false) ? self::update($data) : self::create($data);
return $item->id;
}
public static function create($data)
{
return ArticleNature::create($data);
}
public static function update($data, $id = false)
{
$id = $id ? $id : $data['id'];
$item = self::get($id);
$ret = $item->update($data);
return $item;
}
public static function destroy($id)
{
return ArticleNature::destroy($id);
return ArticleNature::query();
}
}

View File

@@ -3,30 +3,18 @@
namespace App\Repositories\Shop;
use App\Models\Shop\CustomerAddress;
use App\Traits\Model\Basic;
class CustomerAddresses
{
public static function getOptions()
{
return CustomerAddress::orderBy('name', 'asc')->get()->pluck('name', 'id')->toArray();
}
use Basic;
public static function getAll()
{
return CustomerAddress::orderBy('name', 'asc')->get();
}
public static function get($id)
{
return CustomerAddress::find($id);
}
public static function add($user_id, $data)
public static function add($userId, $data)
{
$name = $data['company'] ? $data['company'] : $data['first_name'].' '.$data['last_name'];
if ($data['use_for_delivery'] ?? false) {
return self::store([
'customer_id' => $user_id,
'customer_id' => $userId,
'name' => $name,
'address' => $data['delivery_address'],
'address2' => $data['delivery_address2'],
@@ -35,7 +23,7 @@ class CustomerAddresses
]);
} else {
return self::store([
'customer_id' => $user_id,
'customer_id' => $userId,
'name' => $name,
'address' => $data['address'],
'address2' => $data['address2'],
@@ -45,35 +33,13 @@ class CustomerAddresses
}
}
public static function store($data)
{
$id = $data['id'] ?? false;
$item = $id ? self::update($data, $id) : self::create($data);
return $item->id;
}
public static function create($data)
{
return CustomerAddress::create($data);
}
public static function update($data, $id = false)
{
$id = $id ? $id : $data['id'];
$delivery = self::get($id);
$delivery->update($data);
return $delivery;
}
public static function destroy($id)
{
return CustomerAddress::destroy($id);
}
public static function toggle_active($id, $active)
public static function toggleActive($id, $active)
{
return self::update(['active' => $active], $id);
}
public static function getModel()
{
return CustomerAddress::query();
}
}

View File

@@ -7,14 +7,14 @@ class Dashboards
public static function getStats($start, $end)
{
return [
'orders_count' => Orders::countByPeriod($start, $end),
'orders_sum' => Orders::sumByPeriod($start, $end, 'total_shipped'),
'orders_avg' => Orders::avgByPeriod($start, $end, 'total_shipped'),
'orders_count' => OrderMetrics::countByPeriod($start, $end),
'orders_sum' => OrderMetrics::sumByPeriod($start, $end, 'total_shipped'),
'orders_avg' => OrderMetrics::avgByPeriod($start, $end, 'total_shipped'),
'offers_count' => Offers::count(),
'clients_count' => Customers::count(),
'preparationLess24H' => Orders::countInPreparationLess24H(),
'preparationLess48H' => Orders::countInPreparationLess48H(),
'preparationMore48H' => Orders::countInPreparationMore48H(),
'preparationLess24H' => OrderMetrics::countInPreparationLess24H(),
'preparationLess48H' => OrderMetrics::countInPreparationLess48H(),
'preparationMore48H' => OrderMetrics::countInPreparationMore48H(),
];
}
}

View File

@@ -3,42 +3,14 @@
namespace App\Repositories\Shop;
use App\Models\Shop\DeliveryPackage;
use App\Traits\Model\Basic;
class DeliveryPackages
{
public static function getOptions()
use Basic;
public static function getModel()
{
return DeliveryPackage::pluck('name', 'id');
}
public static function get($id)
{
return DeliveryPackage::find($id);
}
public static function store($data)
{
$item = ($data['id'] ?? false) ? self::update($data) : self::create($data);
return $item->id;
}
public static function create($data)
{
return DeliveryPackage::create($data);
}
public static function update($data, $id = false)
{
$id = $id ? $id : $data['id'];
$item = self::get($id);
$item->update($data);
return $item;
}
public static function destroy($id)
{
return DeliveryPackage::destroy($id);
return DeliveryPackage::query();
}
}

View File

@@ -3,52 +3,14 @@
namespace App\Repositories\Shop;
use App\Models\Shop\DeliveryTypeCalculation;
use App\Traits\Model\Basic;
class DeliveryTypeCalculations
{
public static function getByDeliveryType($typeId)
use Basic;
public static function getModel()
{
return DeliveryTypeCalculation::byDeliveryTpe($typeId)->get();
}
public static function getPrice($typeId, $weight)
{
return DeliveryTypeCalculation::byDeliveryType($typeId)->byWeight($weight)->get();
}
public static function getOptions()
{
return DeliveryTypeCalculation::pluck('name', 'id');
}
public static function get($id)
{
return DeliveryTypeCalculation::find($id);
}
public static function store($data)
{
$item = ($data['id'] ?? false) ? self::update($data) : self::create($data);
return $item->id;
}
public static function create($data)
{
return DeliveryTypeCalculation::create($data);
}
public static function update($data, $id = false)
{
$id = $id ? $id : $data['id'];
$item = self::get($id);
$item->update($data);
return $item;
}
public static function destroy($id)
{
return DeliveryTypeCalculation::destroy($id);
return DeliveryTypeCalculation::query();
}
}

View File

@@ -3,42 +3,14 @@
namespace App\Repositories\Shop;
use App\Models\Shop\DeliveryType;
use App\Traits\Model\Basic;
class DeliveryTypes
{
public static function getOptions()
use Basic;
public static function getModel()
{
return DeliveryType::pluck('name', 'id');
}
public static function get($id)
{
return DeliveryType::find($id);
}
public static function store($data)
{
$item = ($data['id'] ?? false) ? self::update($data) : self::create($data);
return $item->id;
}
public static function create($data)
{
return DeliveryType::create($data);
}
public static function update($data, $id = false)
{
$id = $id ? $id : $data['id'];
$item = self::get($id);
$item->update($data);
return $item;
}
public static function destroy($id)
{
return DeliveryType::destroy($id);
return DeliveryType::query();
}
}

View File

@@ -28,9 +28,9 @@ class Invoices
return Invoice::byUUID($uuid)->first();
}
public static function saveInvoice($order_id, $data)
public static function saveInvoice($orderId, $data)
{
$data['order_id'] = $order_id;
$data['order_id'] = $orderId;
return self::store($data);
}
@@ -86,9 +86,9 @@ class Invoices
public static function getNewRef()
{
$ref = date('ym').'00000';
$last_ref = Invoice::orderBy('id', 'desc')->first();
$lastRef = Invoice::orderBy('id', 'desc')->first();
return $last_ref ? $last_ref->ref + 1 : $ref + 1;
return $lastRef ? $lastRef->ref + 1 : $ref + 1;
}
public static function getStatus($id)

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Repositories\Shop;
use App\Mail\Acheminement;
use App\Mail\ConfirmationCommande;
use App\Mail\Preparation;
use App\Models\Shop\Order;
use App\Repositories\Core\DateStats;
use Carbon\Carbon;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Str;
class OrderMails
{
public static function testSend($id)
{
self::sendPreparation($id);
}
public static function sendOrderConfirmed($orderId)
{
$order = Orders::get($orderId, ['customer', 'address']);
$mail = new ConfirmationCommande($order);
return Mail::to($order->customer->email)->send($mail);
}
public static function sendPreparation($orderId)
{
$order = Orders::get($orderId, ['customer', 'address']);
$mail = new Preparation($order);
return Mail::to($order->customer->email)->send($mail);
}
public static function sendShipping($orderId)
{
$order = Orders::get($orderId, ['customer', 'address']);
$mail = new Acheminement($order);
return Mail::to($order->customer->email)->send($mail);
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Repositories\Shop;
use App\Models\Shop\Order;
use App\Repositories\Core\DateStats;
use Carbon\Carbon;
class OrderMetrics
{
use DateStats;
public static function countInPreparationLess24H()
{
$start = Carbon::now()->subHours(24);
$end = Carbon::now();
return Order::preparation()->byPeriod($start, $end, 'updated_at')->count();
}
public static function countInPreparationLess48H()
{
$start = Carbon::now()->subHours(48);
$end = Carbon::now();
return Order::preparation()->byPeriod($start, $end, 'updated_at')->count();
}
public static function countInPreparationMore48H()
{
$start = Carbon::now()->subHours(48);
return Order::preparation()->where('updated_at', '>', $start)->count();
}
public static function getTotalByPeriod($start, $end)
{
return self::sumByPeriod($start, $end, 'total_shipped');
}
public static function getModel()
{
return Order::query();
}
}

View File

@@ -2,18 +2,14 @@
namespace App\Repositories\Shop;
use App\Mail\Acheminement;
use App\Mail\ConfirmationCommande;
use App\Mail\Preparation;
use App\Models\Shop\Order;
use App\Repositories\Core\DateStats;
use Carbon\Carbon;
use Illuminate\Support\Facades\Mail;
use App\Traits\Model\Basic;
use Illuminate\Support\Str;
class Orders
{
use DateStats;
use Basic, DateStats;
public static function getByUUID($uuid)
{
@@ -38,68 +34,6 @@ class Orders
return ($order && $detail) ? Invoices::saveInvoice($order->id, $data) : false;
}
public static function testSend($id)
{
self::sendPreparation($id);
}
public static function sendOrderConfirmed($order_id)
{
$order = self::get($order_id, ['customer', 'address']);
$mail = new ConfirmationCommande($order);
return Mail::to($order->customer->email)->send($mail);
}
public static function sendPreparation($order_id)
{
$order = self::get($order_id, ['customer', 'address']);
$mail = new Preparation($order);
return Mail::to($order->customer->email)->send($mail);
}
public static function sendShipping($order_id)
{
$order = self::get($order_id, ['customer', 'address']);
$mail = new Acheminement($order);
return Mail::to($order->customer->email)->send($mail);
}
public static function count()
{
return Order::count();
}
public static function countInPreparationLess24H()
{
$start = Carbon::now()->subHours(24);
$end = Carbon::now();
return Order::preparation()->byPeriod($start, $end, 'updated_at')->count();
}
public static function countInPreparationLess48H()
{
$start = Carbon::now()->subHours(48);
$end = Carbon::now();
return Order::preparation()->byPeriod($start, $end, 'updated_at')->count();
}
public static function countInPreparationMore48H()
{
$start = Carbon::now()->subHours(48);
return Order::preparation()->where('updated_at', '>', $start)->count();
}
public static function getTotalByPeriod($start, $end)
{
return self::sumByPeriod($start, $end, 'total_shipped');
}
public static function edit($id)
{
return [
@@ -111,16 +45,6 @@ class Orders
];
}
public static function get($id, $relations = false)
{
return $relations ? Order::with($relations)->findOrFail($id) : Order::findOrFail($id);
}
public static function store($data)
{
return ($data['id'] ?? false) ? self::update($data) : self::create($data);
}
public static function create($data)
{
OrderStats::increase();
@@ -130,20 +54,6 @@ class Orders
return Order::create($data);
}
public static function update($data, $id = false)
{
$id = $id ? $id : $data['id'];
$item = self::get($id);
$item->update($data);
return $item;
}
public static function delete($id)
{
return Order::destroy($id);
}
public static function download($id)
{
dump($id);
@@ -180,9 +90,9 @@ class Orders
public static function getNewRef()
{
$ref = date('ym').'00000';
$last_ref = Order::orderBy('id', 'desc')->first();
$lastRef = Order::orderBy('id', 'desc')->first();
return $last_ref ? $last_ref->ref + 1 : $ref + 1;
return $lastRef ? $lastRef->ref + 1 : $ref + 1;
}
public static function getModel()

View File

@@ -3,6 +3,8 @@
namespace App\Traits\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
trait Basic
{
@@ -24,14 +26,38 @@ trait Basic
return $data;
}
public static function getName($id)
public static function getName($id, $len = false)
{
return self::getField($id, 'name');
$name = self::getField($id, 'name');
return $len ? Str::limit($name, $len) : $name;
}
public static function getByUUID($uuid)
public static function getUUID($id)
{
return self::getByField('uuid', $uuid)->first();
return self::getField($id, 'uuid');
}
public static function getByUUID($uuid, $relations = [])
{
return self::getByField('uuid', $uuid, $relations)->first();
}
public static function getIdByUUID($uuid)
{
$model = self::getByUUID($uuid);
return $model ? $model->id : false;
}
public static function generateToken()
{
return Hash::make(self::generateUUID());
}
public static function generateUUID()
{
return Str::uuid()->toString();
}
public static function getFields($field)
@@ -39,9 +65,9 @@ trait Basic
return self::getAll()->pluck($field);
}
public static function getByField($field, $value)
public static function getByField($field, $value, $relations = [])
{
return self::getModel()->where($field, $value);
return self::getModel()->with($relations)->where($field, $value)->get();
}
public static function getField($id, $field)
@@ -58,7 +84,7 @@ trait Basic
public static function store($data)
{
return ($data['id'] ?? false) ? self::update($data) : self::create($data);
return $data['id'] ?? false ? self::update($data) : self::create($data);
}
public static function create($data)
@@ -87,25 +113,32 @@ trait Basic
return self::getModel()->count();
}
public static function firstOrCreate($search, $data)
public static function firstOrCreate($search, $data = false)
{
return self::getModel()::firstOrCreate($search, $data);
return self::getModel()->firstOrCreate($search, $data ? $data : $search);
}
public static function get($id, $relations = false, $relations_count = false)
public static function deleteByField($field, $value)
{
return self::getModelRelations($relations, $relations_count)->find($id);
$model = self::getModel()->where($field, $value);
return $model ? $model->delete() : false;
}
public static function getAll($relations = false, $relations_count = false)
public static function get($id, $relations = false, $relationscount = false)
{
return self::getModelRelations($relations, $relations_count)->get();
return self::getModelRelations($relations, $relationscount)->find($id);
}
public static function getModelRelations($relations = false, $relations_count = false)
public static function getAll($relations = false, $relationscount = false)
{
return self::getModelRelations($relations, $relationscount)->get();
}
public static function getModelRelations($relations = false, $relationscount = false)
{
$model = $relations ? self::getModelWithRelations($relations) : false;
$model = $relations_count ? self::getModelWithCountRelations($relations_count, $model) : $model;
$model = $relationscount ? self::getModelWithCountRelations($relationscount, $model) : $model;
return $model ? $model : self::getModel();
}

View File

@@ -1,55 +1,78 @@
<div class="row">
<div class="col-xs-12 col-xl-8">
<div class="row mb-3">
<div class="col-6">
{{ Form::label('sale_channel_id', __('shop.sale_channels.name')) }}
@include('components.form.select', ['name' => 'sale_channel_id', 'list' => $sale_channels ?? [], 'value' => $delivery['sale_channel_id'] ?? null, 'with_empty' => '', 'class' => 'select2'])
</div>
<div class="col-6">
<div class="row">
<div class="col-5">
{{ Form::label('active', __('Actif')) }}<br/>
@include("components.form.toggle", ['name' => 'active', 'value' => $delivery['active'] ?? false, 'on' => __('active'), 'off' => __('inactive')])
</div>
<div class="col-3">
{{ Form::label('is_public', __('Type')) }}
@include('components.form.toggle', ['name' => 'is_public', 'value' => $delivery['is_public'] ?? false, 'on' => __('public'), 'off' => __('administré')])
</div>
<div class="col-4">
{{ Form::label('at_house', __('Défaut')) }}
@include('components.form.checkboxes.icheck', ['name' => 'at_house', 'value' => $delivery['at_house'] ?? null])
</div>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('name', __('Nom')) }}
@include('components.form.input', ['name' => 'name', 'value' => $delivery['name'] ?? null, 'required' => true])
</div>
</div>
<div class="col-xs-12 col-xl-8">
<div class="row mb-3">
<div class="col-6">
{{ Form::label('sale_channel_id', __('shop.sale_channels.name')) }}
@include('components.form.select', [
'name' => 'sale_channel_id',
'list' => $sale_channels ?? [],
'value' => $delivery['sale_channel_id'] ?? null,
'with_empty' => '',
'class' => 'select2'
])
</div>
<div class="col-6">
<div class="row">
<div class="col-5">
{{ Form::label('active', __('Actif')) }}<br/>
@include("components.form.toggle", [
'name' => 'active',
'value' => $delivery['active'] ?? false,
'on' => __('active'),
'off' => __('inactive')
])
</div>
<div class="col-3">
{{ Form::label('is_public', __('Type')) }}
@include('components.form.toggle', [
'name' => 'is_public',
'value' => $delivery['is_public'] ?? false,
'on' => __('public'),
'off' => __('administré')
])
</div>
<div class="col-4">
{{ Form::label('at_house', __('Défaut')) }}
@include('components.form.checkboxes.icheck', [
'name' => 'at_house',
'value' => $delivery['at_house'] ?? null
])
</div>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('name', __('Nom')) }}
@include('components.form.input', [
'name' => 'name',
'value' => $delivery['name'] ?? null,
'required' => true
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('', __('Description')) }}
<textarea name="description" class="form-control">{{ $delivery['description'] ?? '' }}</textarea>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('', __('Description')) }}
<textarea name="description" class="form-control">{{ $delivery['description'] ?? '' }}</textarea>
</div>
</div>
@include('components.address', ['with_country' => false])
@include('components.address', ['with_country' => false])
<div class="row mb-3">
<div class="col-3">
{{ Form::label('event_date_begin', __('Date de début')) }}
@include('components.form.datepicker', ['name' => 'event_date_begin', 'value' => $delivery['event_date_begin'] ?? null])
</div>
<div class="col-3">
{{ Form::label('event_date_end', __('Date de fin')) }}
@include('components.form.datepicker', ['name' => 'event_date_end', 'value' => $delivery['event_date_end'] ?? null])
</div>
<div class="row mb-3">
<div class="col-3">
{{ Form::label('event_date_begin', __('Date de début')) }}
@include('components.form.datepicker', ['name' => 'event_date_begin', 'value' => $delivery['event_date_begin'] ?? null])
</div>
<div class="col-3">
{{ Form::label('event_date_end', __('Date de fin')) }}
@include('components.form.datepicker', ['name' => 'event_date_end', 'value' => $delivery['event_date_end'] ?? null])
</div>
</div>
</div>
</div>
</div>
</div>
@include('components.save')
@@ -59,11 +82,11 @@
@push('js')
<script>
$(function() {
initSelect2();
initDatepicker();
initSaveForm('#delivery-form');
});
</script>
@endpush
<script>
$(function() {
initSelect2();
initDatepicker();
initSaveForm('#delivery-form');
});
</script>
@endpush

View File

@@ -1,11 +1,14 @@
@extends('layout.index', [
'title' => __('shop.deliveries.title'),
'subtitle' => __('shop.deliveries.add'),
'breadcrumb' => [__('shop.deliveries.title'), __('shop.deliveries.add')]
'title' => __('shop.delivery_packages.title'),
'subtitle' => __('shop.delivery_packages.add'),
])
@section('content')
{{ Form::open(['route' => 'Admin.Shop.Deliveries.store', 'id' => 'delivery-form', 'autocomplete' => 'off']) }}
@include('Admin.Shop.Deliveries.form')
</form>
{{ Form::open([
'route' => 'Admin.Shop.DeliveryPackages.store',
'id' => 'delivery_package-form',
'autocomplete' => 'off'
]) }}
@include('Admin.Shop.DeliveryPackage.form')
</form>
@endsection

View File

@@ -1,12 +1,15 @@
@extends('layout.index', [
'title' => __('shop.deliveries.title'),
'subtitle' => __('shop.deliveries.edit'),
'breadcrumb' => [__('shop.deliveries.title')]
'title' => __('shop.delivery_packages.title'),
'subtitle' => __('shop.delivery_packages.edit'),
])
@section('content')
{{ Form::open(['route' => 'Admin.Shop.Deliveries.store', 'id' => 'delivery-form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" value="{{ $delivery['id'] }}">
@include('Admin.Shop.Deliveries.form')
</form>
{{ Form::open([
'route' => 'Admin.Shop.DeliveryPackages.store',
'id' => 'delivery_package-form',
'autocomplete' => 'off'
]) }}
<input type="hidden" name="id" value="{{ $package['id'] }}">
@include('Admin.Shop.DeliveryPackages.form')
</form>
@endsection

View File

@@ -1,69 +1,27 @@
<div class="row">
<div class="col-xs-12 col-xl-8">
<div class="row mb-3">
<div class="col-6">
{{ Form::label('sale_channel_id', __('shop.sale_channels.name')) }}
@include('components.form.select', ['name' => 'sale_channel_id', 'list' => $sale_channels ?? [], 'value' => $delivery['sale_channel_id'] ?? null, 'with_empty' => '', 'class' => 'select2'])
</div>
<div class="col-6">
<div class="row">
<div class="col-5">
{{ Form::label('active', __('Actif')) }}<br/>
@include("components.form.toggle", ['name' => 'active', 'value' => $delivery['active'] ?? false, 'on' => __('active'), 'off' => __('inactive')])
</div>
<div class="col-3">
{{ Form::label('is_public', __('Type')) }}
@include('components.form.toggle', ['name' => 'is_public', 'value' => $delivery['is_public'] ?? false, 'on' => __('public'), 'off' => __('administré')])
</div>
<div class="col-4">
{{ Form::label('at_house', __('Défaut')) }}
@include('components.form.checkboxes.icheck', ['name' => 'at_house', 'value' => $delivery['at_house'] ?? null])
</div>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('name', __('Nom')) }}
@include('components.form.input', ['name' => 'name', 'value' => $delivery['name'] ?? null, 'required' => true])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('', __('Description')) }}
<textarea name="description" class="form-control">{{ $delivery['description'] ?? '' }}</textarea>
</div>
</div>
@include('components.address', ['with_country' => false])
<div class="row mb-3">
<div class="col-3">
{{ Form::label('event_date_begin', __('Date de début')) }}
@include('components.form.datepicker', ['name' => 'event_date_begin', 'value' => $delivery['event_date_begin'] ?? null])
</div>
<div class="col-3">
{{ Form::label('event_date_end', __('Date de fin')) }}
@include('components.form.datepicker', ['name' => 'event_date_end', 'value' => $delivery['event_date_end'] ?? null])
</div>
</div>
</div>
<div class="col-xs-3">
<x-form.inputs.number name="weight" value="{{ $package['weight'] ?? 0 }}" label="Poids" />
</div>
<div class="col-xs-3">
<x-form.inputs.number name="weight_flyer" value="{{ $package['weight_flyer'] ?? 0 }}" label="Poids Flyer" />
</div>
<div class="col-xs-3">
<x-form.inputs.number name="weight_packaging" value="{{ $package['weight_packaging'] ?? 0 }}" label="Poids packaging" />
</div>
<div class="col-xs-3">
<x-form.inputs.number name="weight" value="{{ $package['weight_useful'] ?? 0 }}" label="Poids utile" />
</div>
</div>
@include('components.save')
<x-save />
@include('load.form.select2')
@include('load.form.save')
@push('js')
<script>
$(function() {
initSelect2();
initDatepicker();
initSaveForm('#delivery-form');
});
</script>
<script>
$(function() {
initSaveForm('#delivery_package-form');
});
</script>
@endpush

View File

@@ -1,26 +1,23 @@
@extends('layout.index', [
'title' => __('shop.deliveries.title'),
'subtitle' => __('shop.deliveries.list'),
'breadcrumb' => [__('shop.deliveries.title')]
'title' => __('shop.delivery_packages.title'),
'subtitle' => __('shop.delivery_packages.list'),
])
@section('content')
@component('components.card')
@include('components.datatable', ['route' => route('Admin.Shop.Deliveries.index'), 'model' => 'deliveries', 'callback' => 'handleDelivery();'])
@endcomponent
<x-card>
@include('components.datatable', [
'route' => route('Admin.Shop.DeliveryPackages.index'),
'model' => 'delivery_packages',
])
</x-card>
@endsection
@include('load.form.select2')
@include('load.form.toggle')
@push('js')
<script>
function handleDelivery() {
initToggle("{{ route('Admin.Shop.Deliveries.toggleActive') }}");
}
$(document).ready(function () {
initSelect2();
});
</script>
@endpush
<script>
$(document).ready(function () {
initSelect2();
});
</script>
@endpush

View File

@@ -1,36 +0,0 @@
@extends('layout.index', [
'title' => __('products.title'),
'subtitle' => __('products.title'),
'breadcrumb' => [__('products.title')]
])
@section('content')
<form action="{{ route('Shop.Products') }}" method="GET">
<div class="row">
<div class="col-md-offset-2 col-md-8">
<div class="box box-info">
<div class="box-body">
<div class="col-md-6">
<h3>{{ name }}</h3>
<h4>
{{ $product.section.name }}<br>
</h4>
</div>
<div class="col-md-6 text-right">
<h2>{{ $prix_total }} </h2>
<h4>{{ $residence['type_produit']['name'] }}</h4>
</div>
<div class="col-md-12">
@include('Hestimmo.modules.Lot.partials.carousel')
</div>
</div>
</div>
</div>
</div>
</form>
@endsection

View File

@@ -1,11 +1,14 @@
@extends('layout.index', [
'title' => __('shop.deliveries.title'),
'subtitle' => __('shop.deliveries.add'),
'breadcrumb' => [__('shop.deliveries.title'), __('shop.deliveries.add')]
'title' => __('shop.delivery_type_calculations.title'),
'subtitle' => __('shop.delivery_type_calculations.add'),
])
@section('content')
{{ Form::open(['route' => 'Admin.Shop.Deliveries.store', 'id' => 'delivery-form', 'autocomplete' => 'off']) }}
@include('Admin.Shop.Deliveries.form')
</form>
{{ Form::open([
'route' => 'Admin.Shop.DeliveryTypeCalculations.store',
'id' => 'delivery_type_calculation-form',
'autocomplete' => 'off'
]) }}
@include('Admin.Shop.DeliveryTypeCalculations.form')
</form>
@endsection

View File

@@ -1,12 +1,15 @@
@extends('layout.index', [
'title' => __('shop.deliveries.title'),
'subtitle' => __('shop.deliveries.edit'),
'breadcrumb' => [__('shop.deliveries.title')]
'title' => __('shop.delivery_type_calculations.title'),
'subtitle' => __('shop.delivery_type_calculations.edit'),
])
@section('content')
{{ Form::open(['route' => 'Admin.Shop.Deliveries.store', 'id' => 'delivery-form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" value="{{ $delivery['id'] }}">
@include('Admin.Shop.Deliveries.form')
</form>
{{ Form::open([
'route' => 'Admin.Shop.DeliveryTypeCalculations.store',
'id' => 'delivery_type_calculation-form',
'autocomplete' => 'off'
]) }}
<input type="hidden" name="id" value="{{ $calcul['id'] ?? null }}">
@include('Admin.Shop.DeliveryTypeCalculations.form')
</form>
@endsection

View File

@@ -1,69 +1,34 @@
<div class="row">
<div class="col-xs-12 col-xl-8">
<div class="row mb-3">
<div class="col-6">
{{ Form::label('sale_channel_id', __('shop.sale_channels.name')) }}
@include('components.form.select', ['name' => 'sale_channel_id', 'list' => $sale_channels ?? [], 'value' => $delivery['sale_channel_id'] ?? null, 'with_empty' => '', 'class' => 'select2'])
</div>
<div class="col-6">
<div class="row">
<div class="col-5">
{{ Form::label('active', __('Actif')) }}<br/>
@include("components.form.toggle", ['name' => 'active', 'value' => $delivery['active'] ?? false, 'on' => __('active'), 'off' => __('inactive')])
</div>
<div class="col-3">
{{ Form::label('is_public', __('Type')) }}
@include('components.form.toggle', ['name' => 'is_public', 'value' => $delivery['is_public'] ?? false, 'on' => __('public'), 'off' => __('administré')])
</div>
<div class="col-4">
{{ Form::label('at_house', __('Défaut')) }}
@include('components.form.checkboxes.icheck', ['name' => 'at_house', 'value' => $delivery['at_house'] ?? null])
</div>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('name', __('Nom')) }}
@include('components.form.input', ['name' => 'name', 'value' => $delivery['name'] ?? null, 'required' => true])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('', __('Description')) }}
<textarea name="description" class="form-control">{{ $delivery['description'] ?? '' }}</textarea>
</div>
</div>
@include('components.address', ['with_country' => false])
<div class="row mb-3">
<div class="col-3">
{{ Form::label('event_date_begin', __('Date de début')) }}
@include('components.form.datepicker', ['name' => 'event_date_begin', 'value' => $delivery['event_date_begin'] ?? null])
</div>
<div class="col-3">
{{ Form::label('event_date_end', __('Date de fin')) }}
@include('components.form.datepicker', ['name' => 'event_date_end', 'value' => $delivery['event_date_end'] ?? null])
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.select', [
'name' => 'type_id',
'value' => $calcul['type_id'] ?? false,
'list' => $delivery_types ?? [],
'label' => __('shop.delivery_types.name'),
])
</div>
</div>
@include('components.save')
<div class="row mb-3">
<div class="col-6">
<x-form.inputs.number name="weight" value="{{ $calcul['weight'] ?? 0}}" label="Poids" />
</div>
<div class="col-6">
<x-form.inputs.money name="price" value="{{ $calcul['price'] ?? 0}}" label="Prix" />
</div>
</div>
<x-save />
@include('load.form.select2')
@include('load.form.save')
@push('js')
<script>
$(function() {
initSelect2();
initDatepicker();
initSaveForm('#delivery-form');
});
</script>
@endpush
<script>
$(function() {
initSelect2();
initSaveForm('#delivery_type_calculation-form');
});
</script>
@endpush

View File

@@ -9,6 +9,7 @@
@include('components.datatable', [
'route' => route('Admin.Shop.DeliveryTypeCalculations.index'),
'model' => 'delivery_type_calculations',
'with_filters' => true,
])
@endcomponent
@endsection

View File

@@ -1,5 +1,10 @@
<form id="{{ $model }}-filters">
<div class="row mb-3">
</div>
<div class="row mb-3">
@include('components.form.select', [
'name' => 'type_id',
'value' => $filters['type_id'] ?? false,
'list' => $delivery_types ?? [],
'label' => __('shop.delivery_types.name'),
])
</div>
</form>

View File

@@ -1,36 +0,0 @@
@extends('layout.index', [
'title' => __('products.title'),
'subtitle' => __('products.title'),
'breadcrumb' => [__('products.title')]
])
@section('content')
<form action="{{ route('Shop.Products') }}" method="GET">
<div class="row">
<div class="col-md-offset-2 col-md-8">
<div class="box box-info">
<div class="box-body">
<div class="col-md-6">
<h3>{{ name }}</h3>
<h4>
{{ $product.section.name }}<br>
</h4>
</div>
<div class="col-md-6 text-right">
<h2>{{ $prix_total }} </h2>
<h4>{{ $residence['type_produit']['name'] }}</h4>
</div>
<div class="col-md-12">
@include('Hestimmo.modules.Lot.partials.carousel')
</div>
</div>
</div>
</div>
</div>
</form>
@endsection

View File

@@ -1,115 +1,122 @@
@extends('layout.index', [
'title' => __('shop.orders.title'),
'subtitle' => __('shop.orders.edit'),
'breadcrumb' => ['Commandes']
'title' => __('shop.orders.title'),
'subtitle' => __('shop.orders.edit'),
'breadcrumb' => ['Commandes']
])
@section('content')
{{ Form::open(['route' => 'Admin.Shop.Orders.store', 'id' => 'order-form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" value="{{ $order['id'] ?? null }}">
<x-card>
<div class="row">
<div class="col-6">
<h4>{{ $order['delivery']['name'] }} </h4>
</div>
<div class="col-6 text-right">
@include('components.form.buttons.button-save')
</div>
</div>
{{ Form::open(['route' => 'Admin.Shop.Orders.store', 'id' => 'order-form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" value="{{ $order['id'] ?? null }}">
<x-card>
<div class="row">
<div class="col-6">
<h4>{{ $order['delivery']['name'] }} </h4>
</div>
<div class="col-6 text-right">
@include('components.form.buttons.button-save')
</div>
</div>
<div class="row mb-3">
<div class="col-6">
<h3>{{ $order['customer']['last_name'] }} {{ $order['customer']['first_name'] }}</h3>
<div class="row">
<div class="col-6">
<x-card title="Adresse de facturation" classBody="mt-3">
@if ($order['address'])
{{ $order['address']['address'] }}<br/>
@isset ($order['address']['address2']) {{ $order['address']['address2'] }}<br/> @endisset
{{ $order['address']['zipcode'] }} {{ $order['address']['city'] }}<br/>
@endif
</x-card>
</div>
<div class="col-6">
<x-card title="Adresse de livraison" classBody="mt-3">
@if ($order['delivery_address'])
{{ $order['delivery_address']['address'] }}<br/>
@isset ($order['delivery_address']['address2']) {{ $order['delivery_address']['address2'] }}<br/> @endisset
{{ $order['delivery_address']['zipcode'] }} {{ $order['delivery_address']['city'] }}<br/>
@endif
</x-card>
</div>
</div>
</div>
<div class="col-6">
<div class="row mb-3">
<div class="col-6" style="font-size: 1.2em; font-weight: 500;">
Commande <br/>
du {{ Carbon\Carbon::parse($order['created_at'])->isoFormat('LLLL') }}
</div>
<div class="col-6">
@include('components.form.select', [
'label' => 'Statut',
'name' => 'status',
'list' => $statuses ?? [],
'value' => $order['status'],
'class' => 'select2',
])
</div>
</div>
<div class="row mb-3">
<div class="col-6">
@include('components.form.select', [
'label' => 'Canal de vente',
'name' => 'sale_channel_id',
'list' => $sale_channels ?? [],
'value' => $order['sale_channel_id'],
'class' => 'select2',
])
</div>
<div class="col-6">
@include('components.form.select', [
'label' => 'Règlement',
'name' => 'payment_type',
'list' => $payment_types ?? [],
'value' => $order['payment_type'],
'class' => 'select2',
])
</div>
</div>
<div class="row mb-3">
<div class="col-4">
@include('components.form.select', [
'label' => 'Type de livraison',
'name' => 'delivery_type_id',
'list' => $delivery_types ?? [],
'value' => $order['delivery_type_id'],
'with_empty' => '',
])
</div>
<div class="col-4">
@include('components.form.input', [
'label' => 'Référence colis',
'name' => 'delivery_ref',
'value' => $order['delivery_ref'] ?? null,
])
</div>
<div class="col-4">
@include('components.form.input', [
'label' => 'Lien suivi',
'name' => 'delivery_link',
'value' => $order['delivery_link'] ?? null,
])
</div>
<div class="row mb-3">
<div class="col-6">
<h3>
{{ $order['customer']['last_name'] }} {{ $order['customer']['first_name'] }}
</h3>
<div class="row">
<div class="col-6">
<x-card title="Adresse de facturation" classBody="mt-3">
@if ($order['address'])
{{ $order['address']['address'] }}<br/>
@isset ($order['address']['address2'])
{{ $order['address']['address2'] }}<br/>
@endisset
{{ $order['address']['zipcode'] }} {{ $order['address']['city'] }}<br/>
@endif
</x-card>
</div>
<div class="col-6">
<x-card title="Adresse de livraison" classBody="mt-3">
@if ($order['delivery_address'])
{{ $order['delivery_address']['address'] }}<br/>
@isset ($order['delivery_address']['address2'])
{{ $order['delivery_address']['address2'] }}<br/>
@endisset
{{ $order['delivery_address']['zipcode'] }}
{{ $order['delivery_address']['city'] }}<br/>
@endif
</x-card>
</div>
</div>
</div>
<div class="col-6">
<div class="row mb-3">
<div class="col-6" style="font-size: 1.2em; font-weight: 500;">
Commande <br/>
du {{ Carbon\Carbon::parse($order['created_at'])->isoFormat('LLLL') }}
</div>
<div class="col-6">
@include('components.form.select', [
'label' => 'Statut',
'name' => 'status',
'list' => $statuses ?? [],
'value' => $order['status'],
'class' => 'select2',
])
</div>
</div>
<div class="row mb-3">
<div class="col-6">
@include('components.form.select', [
'label' => 'Canal de vente',
'name' => 'sale_channel_id',
'list' => $sale_channels ?? [],
'value' => $order['sale_channel_id'],
'class' => 'select2',
])
</div>
<div class="col-6">
@include('components.form.select', [
'label' => 'Règlement',
'name' => 'payment_type',
'list' => $payment_types ?? [],
'value' => $order['payment_type'],
'class' => 'select2',
])
</div>
</div>
<div class="row mb-3">
<div class="col-4">
@include('components.form.select', [
'label' => 'Type de livraison',
'name' => 'delivery_type_id',
'list' => $delivery_types ?? [],
'value' => $order['delivery_type_id'],
'with_empty' => '',
])
</div>
<div class="col-4">
@include('components.form.input', [
'label' => 'Référence colis',
'name' => 'delivery_ref',
'value' => $order['delivery_ref'] ?? null,
])
</div>
<div class="col-4">
@include('components.form.input', [
'label' => 'Lien suivi',
'name' => 'delivery_link',
'value' => $order['delivery_link'] ?? null,
])
</div>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('Admin.Shop.Orders.partials.detail', ['detail_type' => 'commande'])
</div>
</div>
</x-card>
{{ Form::close() }}
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('Admin.Shop.Orders.partials.detail', ['detail_type' => 'commande'])
</div>
</div>
</x-card>
{{ Form::close() }}
@endsection

View File

@@ -1,53 +1,53 @@
@extends('Shop.layout.layout', [
'title' => __('home.title'),
'title' => __('home.title'),
])
@section('content')
<div class="row">
<div class="col-12">
<h1>{{ $article['name'] }}</h1>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-xs-12">
<div style="max-width: 360px;">
@include('components.multi-images', ['image' => $article['image'], 'images' => $article['images']])
</div>
</div>
<div class="col-lg-5 col-xs-12 text-justify">
{!! $article['description']['semences'] ?? null !!}
{!! $article['description']['plants'] ?? null !!}
{!! $article['description']['variety'] ?? null !!}
{!! $article['description']['merchandise'] ?? null !!}
<div class="row">
<div class="col-12">
<h1>{{ $article['name'] }}</h1>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-xs-12">
<div style="max-width: 360px;">
@include('components.multi-images', ['image' => $article['image'], 'images' => $article['images']])
</div>
</div>
<div class="col-lg-5 col-xs-12 text-justify">
{!! $article['description']['semences'] ?? null !!}
{!! $article['description']['plants'] ?? null !!}
{!! $article['description']['variety'] ?? null !!}
{!! $article['description']['merchandise'] ?? null !!}
@if ($article['description']['plus'] ?? false)
<h3>Spécificités</h3>
{!! $article['description']['plus'] !!}
@endif
@if ($article['description']['plus'] ?? false)
<h3>Spécificités</h3>
{!! $article['description']['plus'] !!}
@endif
@if (count($article['tags'] ?? []))
<h3>Caractéristiques</h3>
@foreach ($article['tags'] as $tag_group => $items)
<div class="mb-2">
{{ $tag_group }} :
@foreach ($items as $tag)
<span class="btn btn-xs btn-secondary pt-0 pb-0">{{ $tag }}</span>
@endforeach
</div>
@endforeach
@endif
@if (count($article['tags'] ?? []))
<h3>Caractéristiques</h3>
@foreach ($article['tags'] as $tag_group => $items)
<div class="mb-2">
{{ $tag_group }} :
@foreach ($items as $tag)
<span class="btn btn-xs btn-secondary pt-0 pb-0">{{ $tag }}</span>
@endforeach
</div>
@endforeach
@endif
@if ($article['description']['specie'] ?? false)
<h3 class="mt-3">Complément</h3>
{!! $article['description']['specie'] ?? null !!}
{!! $article['description']['producer'] ?? null !!}
@endif
@if ($article['description']['specie'] ?? false)
<h3 class="mt-3">Complément</h3>
{!! $article['description']['specie'] ?? null !!}
{!! $article['description']['producer'] ?? null !!}
@endif
</div>
<div class="col-lg-3 col-xs-12">
@include('Shop.Articles.partials.ArticleAddBasket')
</div>
</div>
</div>
<div class="col-lg-3 col-xs-12">
@include('Shop.Articles.partials.ArticleAddBasket')
</div>
</div>
@endsection
@include('load.layout.modal')
@include('load.layout.modal')

View File

@@ -7,5 +7,4 @@ Route::prefix('DeliveryTypes')->name('DeliveryTypes.')->group(function () {
Route::post('update', 'DeliveryTypeController@update')->name('update');
Route::post('store', 'DeliveryTypeController@store')->name('store');
Route::get('edit/{id}', 'DeliveryTypeController@edit')->name('edit');
Route::post('toggleActive', 'DeliveryTypeController@toggleActive')->name('toggleActive');
});