From dae81561640d233d13b5ff9ec3f6749e6e7cf53a Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Fri, 19 Aug 2022 22:04:44 +0200 Subject: [PATCH] [WIP] Working on orders & invoices --- app/Datatables/Shop/OrdersDataTable.php | 30 +++++- .../Admin/Shop/OrderController.php | 6 +- .../Admin/Shop/OrderPaymentController.php | 86 --------------- .../Controllers/Shop/BasketController.php | 9 +- .../Controllers/Shop/CustomerController.php | 22 +--- app/Http/Controllers/Shop/OrderController.php | 28 +++-- app/Models/Shop/Invoice.php | 1 + app/Models/Shop/InvoiceItem.php | 20 ---- app/Models/Shop/InvoicePayment.php | 21 ++++ app/Models/Shop/Order.php | 45 +++++++- app/Models/Shop/OrderDetail.php | 18 +++- app/Models/Shop/OrderPayment.php | 15 --- app/Repositories/Shop/Baskets.php | 100 ++++++++++++++++++ app/Repositories/Shop/CustomerStats.php | 12 +++ app/Repositories/Shop/InvoicePayments.php | 54 ++++++++++ app/Repositories/Shop/InvoiceStats.php | 12 +++ app/Repositories/Shop/Invoices.php | 45 ++++---- app/Repositories/Shop/Offers.php | 58 +--------- app/Repositories/Shop/OrderDetails.php | 9 +- app/Repositories/Shop/Orders.php | 17 +++ .../2021_07_25_182012_create_media_table.php | 2 +- ..._02_15_233439_modify_categories_tables.php | 15 --- .../2022_05_11_202752_create_media_table.php | 32 ------ .../views/Admin/Shop/Orders/edit.blade.php | 56 +++++++--- .../Shop/Orders/partials/filters.blade.php | 3 + .../views/Shop/Customers/profile.blade.php | 7 ++ .../views/Shop/Orders/confirmed.blade.php | 11 ++ .../Shop/Orders/partials/payments.blade.php | 14 +-- .../views/Shop/Profile/profile.blade.php | 8 -- routes/Shop/Customers.php | 2 +- routes/Shop/Invoices.php | 4 +- routes/Shop/Orders.php | 1 + 32 files changed, 440 insertions(+), 323 deletions(-) delete mode 100644 app/Http/Controllers/Admin/Shop/OrderPaymentController.php delete mode 100644 app/Models/Shop/InvoiceItem.php create mode 100644 app/Models/Shop/InvoicePayment.php delete mode 100644 app/Models/Shop/OrderPayment.php create mode 100644 app/Repositories/Shop/Baskets.php create mode 100644 app/Repositories/Shop/CustomerStats.php create mode 100644 app/Repositories/Shop/InvoicePayments.php create mode 100644 app/Repositories/Shop/InvoiceStats.php delete mode 100644 database/migrations/2022_02_15_233439_modify_categories_tables.php delete mode 100644 database/migrations/2022_05_11_202752_create_media_table.php create mode 100644 resources/views/Admin/Shop/Orders/partials/filters.blade.php create mode 100644 resources/views/Shop/Customers/profile.blade.php create mode 100644 resources/views/Shop/Orders/confirmed.blade.php delete mode 100644 resources/views/Shop/Profile/profile.blade.php diff --git a/app/Datatables/Shop/OrdersDataTable.php b/app/Datatables/Shop/OrdersDataTable.php index aa10145d..2a6f5217 100644 --- a/app/Datatables/Shop/OrdersDataTable.php +++ b/app/Datatables/Shop/OrdersDataTable.php @@ -3,8 +3,11 @@ namespace App\Datatables\Shop; use Yajra\DataTables\Html\Column; + use App\Datatables\ParentDataTable as DataTable; use App\Models\Shop\Order; +use App\Repositories\Shop\InvoicePayments; +use App\Repositories\Shop\Orders; class OrdersDataTable extends DataTable { @@ -12,13 +15,38 @@ class OrdersDataTable extends DataTable public function query(Order $model) { + $model = $model->with(['customer', 'delivery']); return $this->buildQuery($model); } + public function modifier($datatables) + { + $datatables + ->editColumn('status', function (Order $order) { + return Orders::getStatus($order->status); + }) + ->editColumn('created_at', function (Order $order) { + return $order->created_at->toDateTimeString(); + }) + ->editColumn('customer.last_name', function (Order $order) { + return $order->customer->last_name . ' ' . $order->customer->first_name; + }) + ->editColumn('payment_type', function (Order $order) { + return InvoicePayments::getPaymentType($order->payment_type); + }) + ->rawColumns(['action']); + return parent::modifier($datatables); + } + protected function getColumns() { return [ - Column::make('name'), + Column::make('status')->title('Statut'), + Column::make('created_at')->title('Date'), + Column::make('customer.last_name')->title('Client'), + Column::make('delivery.name')->title('Point de distribution'), + Column::make('payment_type')->title('Règlement'), + Column::make('total_shipped')->title('Montant')->class('text-right'), $this->makeColumnButtons(), ]; } diff --git a/app/Http/Controllers/Admin/Shop/OrderController.php b/app/Http/Controllers/Admin/Shop/OrderController.php index 5ea669fd..dc8f501d 100644 --- a/app/Http/Controllers/Admin/Shop/OrderController.php +++ b/app/Http/Controllers/Admin/Shop/OrderController.php @@ -34,11 +34,13 @@ class OrderController extends Controller public function edit($id) { - $data['customer'] = Orders::get($id)->toArray(); + $data['order'] = Orders::get($id, ['customer', 'detail'])->toArray(); + dump($data['order']); + exit; return view('Admin.Shop.Orders.edit', $data); } - public function destroy($id) + public function delete($id) { return Orders::destroy($id); } diff --git a/app/Http/Controllers/Admin/Shop/OrderPaymentController.php b/app/Http/Controllers/Admin/Shop/OrderPaymentController.php deleted file mode 100644 index 5be39849..00000000 --- a/app/Http/Controllers/Admin/Shop/OrderPaymentController.php +++ /dev/null @@ -1,86 +0,0 @@ -input('offer_id'); $quantity = $request->input('quantity') ?? 1; $update = $request->input('update') ?? false; - return Offers::addBasket($offer_id, $quantity, $update); + return Baskets::addBasket($offer_id, $quantity, $update); } public function modalBasket($offer_id, $quantity) { $data['offer'] = Offers::getFull($offer_id)->toArray(); - $data['basket'] = Offers::addBasket($offer_id, $quantity); + $data['basket'] = Baskets::addBasket($offer_id, $quantity); return view('Shop.Baskets.partials.modalBasket', $data); } public function basket() { - $data['basket'] = Offers::getBasket(); + $data['basket'] = Baskets::getBasket(); return view('Shop.Baskets.basket', $data); } diff --git a/app/Http/Controllers/Shop/CustomerController.php b/app/Http/Controllers/Shop/CustomerController.php index ceba4f82..fd838ab0 100644 --- a/app/Http/Controllers/Shop/CustomerController.php +++ b/app/Http/Controllers/Shop/CustomerController.php @@ -9,28 +9,8 @@ use App\Repositories\Shop\Customers; class CustomerController extends Controller { - public function show($id) - { - // - } - - public function edit(C$id) - { - // - } - - public function update(Request $request) - { - // - } - - public function destroy($id) - { - // - } - public function profile($id = false) { - return view('Shop.Profile.profile'); + return view('Shop.Customers.profile'); } } diff --git a/app/Http/Controllers/Shop/OrderController.php b/app/Http/Controllers/Shop/OrderController.php index 7b5c7c90..3c0fb146 100644 --- a/app/Http/Controllers/Shop/OrderController.php +++ b/app/Http/Controllers/Shop/OrderController.php @@ -9,17 +9,20 @@ use App\Repositories\Core\User\ShopCart; use App\Repositories\Shop\Customers; use App\Repositories\Shop\Deliveries; use App\Repositories\Shop\Orders; -use App\Repositories\Shop\Offers; +use App\Repositories\Shop\Baskets; use App\Repositories\Shop\SaleChannels; class OrderController extends Controller { public function order() { - $data['customer'] = Customers::getWithAddresses()->toArray(); - $data['basket'] = ShopCart::getSummary(); - $data['deliveries'] = Deliveries::getAllWithSaleChannel()->toArray(); - $data['sale_channel'] = SaleChannels::getDefault()->toArray(); + $customer = Customers::getWithAddresses(); + $data = [ + 'customer' => $customer ? $customer->toArray() : false, + 'basket' => ShopCart::getSummary(), + 'deliveries' => Deliveries::getAllWithSaleChannel()->toArray(), + 'sale_channel' => SaleChannels::getDefault()->toArray(), + ]; return view('Shop.Orders.order', $data); } @@ -27,18 +30,23 @@ class OrderController extends Controller { $data = $request->all(); $data['customer_id'] = Customers::getId(); - $data['basket'] = ShopCart::getSummary(); + $data['basket'] = Baskets::getBasketSummary(); dump($data); exit; $order = Orders::saveOrder($data); if ($order) { - if (intval($data['payment']) === 1) { - return redirect('Shop.Payments.online'); + if ($data['payment'] == '1') { + return redirect()->route('Shop.Payments.online'); } else { - return redirect('Shop.Orders.confirmed'); + return redirect()->route('Shop.Orders.confirmed'); } } else { - return view('Shop.Orders.order'); + return view('Shop.Orders.order'); } } + + public function confirmed() + { + return view('Shop.Orders.confirmed'); + } } diff --git a/app/Models/Shop/Invoice.php b/app/Models/Shop/Invoice.php index 6aa875f6..e9b24d88 100644 --- a/app/Models/Shop/Invoice.php +++ b/app/Models/Shop/Invoice.php @@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model; class Invoice extends Model { protected $guarded = ['id']; + protected $table = 'shop_invoices'; public function InvoiceItems() { diff --git a/app/Models/Shop/InvoiceItem.php b/app/Models/Shop/InvoiceItem.php deleted file mode 100644 index dc153e20..00000000 --- a/app/Models/Shop/InvoiceItem.php +++ /dev/null @@ -1,20 +0,0 @@ -belongsTo(Product::class); - } - - public function Invoice() - { - return $this->belongsTo(Invoice::class); - } -} diff --git a/app/Models/Shop/InvoicePayment.php b/app/Models/Shop/InvoicePayment.php new file mode 100644 index 00000000..95ad21da --- /dev/null +++ b/app/Models/Shop/InvoicePayment.php @@ -0,0 +1,21 @@ +belongsTo(Invoice::class); + } + + public function scopeByInvoice($query, $invoice_id) + { + return $query->where('invoice_id', $invoice_id); + } +} diff --git a/app/Models/Shop/Order.php b/app/Models/Shop/Order.php index 53a82718..9cec3501 100644 --- a/app/Models/Shop/Order.php +++ b/app/Models/Shop/Order.php @@ -7,14 +7,55 @@ use Illuminate\Database\Eloquent\Model; class Order extends Model { protected $guarded = ['id']; + protected $table = 'shop_orders'; public function customer() { return $this->belongsTo(Customer::class); } - public function payments() + public function address() { - return $this->hasMany(OrderPayment::class); + return $this->belongsTo(CustomerAddress::class, 'customer_address_id'); + } + + public function delivery() + { + return $this->belongsTo(Delivery::class); + } + + public function detail() + { + return $this->hasMany(OrderDetail::class); + } + + public function invoice() + { + return $this->hasOne(Invoice::class); + } + + public function sale_channel() + { + return $this->belongsTo(SaleChannel::class); + } + + public function scopeByCustomer($query, $customer_id) + { + return $query->where('customer_id', $customer_id); + } + + public function scopeByDelivery($query, $delivery_id) + { + return $query->where('delivery_id', $delivery_id); + } + + public function scopeByStatus($query, $status) + { + return $query->where('status', $status); + } + + public function scopeByPaymentType($query, $payment_type) + { + return $query->where('payment_type', $payment_type); } } diff --git a/app/Models/Shop/OrderDetail.php b/app/Models/Shop/OrderDetail.php index 047eec76..066ffbb0 100644 --- a/app/Models/Shop/OrderDetail.php +++ b/app/Models/Shop/OrderDetail.php @@ -7,9 +7,25 @@ use Illuminate\Database\Eloquent\Model; class OrderDetail extends Model { protected $guarded = ['id']; - + protected $table = 'shop_order_details'; + public function order() { return $this->belongsTo(Order::class); } + + public function offer() + { + return $this->belongsTo(Offer::class); + } + + public function scopeByOrder($query, $order_id) + { + return $query->where('order_id', $order_id); + } + + public function scopeByOffer($query, $offer_id) + { + return $query->where('offer_id', $offer_id); + } } diff --git a/app/Models/Shop/OrderPayment.php b/app/Models/Shop/OrderPayment.php deleted file mode 100644 index d937d97b..00000000 --- a/app/Models/Shop/OrderPayment.php +++ /dev/null @@ -1,15 +0,0 @@ -belongsTo(Order::class); - } -} diff --git a/app/Repositories/Shop/Baskets.php b/app/Repositories/Shop/Baskets.php new file mode 100644 index 00000000..38b6b8b2 --- /dev/null +++ b/app/Repositories/Shop/Baskets.php @@ -0,0 +1,100 @@ +whereIn('id', ShopCart::keys())->get(); + $total = 0; + $total_taxed = 0; + foreach ($basket as $item) { + $offer = $offers->where('id', $item->id)->first(); + $detail[] = [ + 'id' => (int) $item->id, + 'name' => $offer->article->name . ' (' . $offer->variation->name . ')', + 'quantity' => (int) $item->quantity, + 'price' => $item->price, + 'tax' => '', + 'price_taxed' => $item->price, + 'total' => self::getTotal($item->quantity, $item->price), + 'total_taxed' => self::getTotal($item->quantity, $item->price), + ]; + $total += self::getTotal($item->quantity, $item->price); + $total_taxed += self::getTotal($item->quantity, $item->price); + } + $data = [ + 'detail' => $detail, + 'total' => $total, + 'taxes' => $total_taxed - $total, + 'total_taxed' => $total_taxed, + ]; + return $data ?? false; + } + + public static function getTotal($quantity, $price) + { + return (int) $quantity * $price; + } + + public static function getBasket($sale_channel_id = false) + { + $sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID(); + $basket = ShopCart::getContent(); + // dump($basket->toArray()); + $offers = Offer::with([ + 'variation', + 'article.article_nature', + 'article.product.Specie', + 'article.image', + 'price_lists.price_list_values', + ])->withPriceListsBySaleChannel($sale_channel_id) + ->whereIn('id', ShopCart::keys())->get(); + foreach ($basket as $item) { + $offer = $offers->where('id', $item->id)->first(); + $article_nature = strtolower($offer->article->article_nature->name); + $data[$article_nature][] = [ + 'id' => (int) $item->id, + 'name' => $item->name, + 'quantity' => (int) $item->quantity, + 'price' => $item->price, + 'variation' => $offer->variation->name, + 'image' => Articles::getPreviewSrc(Articles::getFullImageByArticle($offer->article)), + 'latin' => $offer->article->product->specie->latin ?? false, + ]; + } + return $data ?? false; + } + + public static function getBasketData($id, $quantity = 1) + { + $offer = Offers::get($id, ['article', 'variation']); + return [ + 'id' => $id, + 'name' => self::getArticleName($offer), + 'price' => Offers::getPrice($id, $quantity)->price_taxed, + 'quantity' => $quantity, + 'attributes' => [], + ]; + } + + public static function getArticleName(&$offer) + { + return $offer->article->name; + // return $offer->article->name . ' (' . $offer->variation->name . ')'; + } +} diff --git a/app/Repositories/Shop/CustomerStats.php b/app/Repositories/Shop/CustomerStats.php new file mode 100644 index 00000000..47e1e4c3 --- /dev/null +++ b/app/Repositories/Shop/CustomerStats.php @@ -0,0 +1,12 @@ +findOrFail($id) : InvoicePayment::findOrFail($id); + } + + public static function store($data) + { + return ($data['id'] ?? false) ? self::update($data) : self::create($data); + } + + public static function create($data) + { + return InvoicePayment::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 InvoicePayment::destroy($id); + } + + public static function getPaymentType($id) + { + return self::PaymentTypes()[$id] ?? false; + } + + public static function PaymentTypes() + { + return [ + '', + 'CB', + 'CHEQUE', + 'VIREMENT', + ]; + } +} diff --git a/app/Repositories/Shop/InvoiceStats.php b/app/Repositories/Shop/InvoiceStats.php new file mode 100644 index 00000000..cf71ae0e --- /dev/null +++ b/app/Repositories/Shop/InvoiceStats.php @@ -0,0 +1,12 @@ +get()->pluck('value', 'id')->toArray(); + $data['order_id'] = $order_id; + dump($data); + exit; + return self::store($data); } - public static function getOptionsByPackage($package_id) + public static function get($id, $relations = false) { - return Invoice::byPackage($package_id)->orderBy('value', 'asc')->get()->pluck('value', 'id')->toArray(); - } - - public static function getAll() - { - return Invoice::orderBy('value', 'asc')->get(); - } - - public static function get($id) - { - return Invoice::find($id); + return $relations ? Invoice::with($relations)->findOrFail($id) : Invoice::findOrFail($id); } public static function store($data) { - $id = isset($data['id']) ? $data['id'] : false; - $item = $id ? self::update($data, $id) : self::create($data); - return $item->id; + return ($data['id'] ?? false) ? self::update($data) : self::create($data); } public static function create($data) { + $data['uuid'] = Str::uuid()->toString(); + $data['ref'] = self::getNewRef(); return Invoice::create($data); } public static function update($data, $id = false) { - $id = isset($data['id']) ? $data['id'] : false; - return self::get($id)->update($data); + $id = $id ? $id : $data['id']; + $item = self::get($id); + $item->update($data); + return $item; } - public static function destroy($id) + public static function delete($id) { return Invoice::destroy($id); } + + public static function getNewRef() + { + $ref = date('ym') . '00000'; + $last_ref = Invoice::orderBy('ref', 'desc')->where('ref', '>', $ref)->first(); + return $last_ref ? $last_ref + 1 : $ref + 1; + } } diff --git a/app/Repositories/Shop/Offers.php b/app/Repositories/Shop/Offers.php index 03466b71..5010863b 100644 --- a/app/Repositories/Shop/Offers.php +++ b/app/Repositories/Shop/Offers.php @@ -7,15 +7,6 @@ use App\Repositories\Core\User\ShopCart; class Offers { - public static function addBasket($offer_id, $quantity = 1, $update = false) - { - if (ShopCart::has($offer_id) && !$quantity) { - $ret = ShopCart::remove($offer_id); - } - $data = $quantity ? Offers::getBasketData($offer_id, $quantity) : false; - return $data ? ShopCart::add($data, $update) : false; - } - public static function getFull($id, $sale_channel_id = false) { $sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID(); @@ -43,47 +34,6 @@ class Offers return $offer->price_lists->first()->price_list_values->first(); } - public static function getBasket($sale_channel_id = false) - { - $sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID(); - $basket = ShopCart::getContent(); - // dump($basket->toArray()); - $offers = Offer::with([ - 'variation', - 'article.article_nature', - 'article.product.Specie', - 'article.image', - 'price_lists.price_list_values', - ])->withPriceListsBySaleChannel($sale_channel_id) - ->whereIn('id', ShopCart::keys())->get(); - foreach ($basket as $item) { - $offer = $offers->where('id', $item->id)->first(); - $article_nature = strtolower($offer->article->article_nature->name); - $data[$article_nature][] = [ - 'id' => (int) $item->id, - 'name' => $item->name, - 'quantity' => (int) $item->quantity, - 'price' => $item->price, - 'variation' => $offer->variation->name, - 'image' => Articles::getPreviewSrc(Articles::getFullImageByArticle($offer->article)), - 'latin' => $offer->article->product->specie->latin ?? false, - ]; - } - return $data ?? false; - } - - public static function getBasketData($id, $quantity = 1) - { - $offer = Offer::with(['article'])->findOrFail($id); - return [ - 'id' => $id, - 'name' => $offer->article->name, - 'price' => self::getPrice($id, $quantity)->price_taxed, - 'quantity' => $quantity, - 'attributes' => [], - ]; - } - public static function getOffersByArticles($article_ids, $sale_channel_id = false) { return self::getOffersBySaleChannelRaw($sale_channel_id)->byArticles($article_ids)->get(); @@ -155,16 +105,14 @@ class Offers return Offer::get(); } - public static function get($id) + public static function get($id, $relations = false) { - return Offer::findOrFail($id); + return $relations ? Offer::with($relations)->findOrFail($id) : Offer::findOrFail($id); } public static function store($data) { - $id = isset($data['id']) ? $data['id'] : false; - $item = $id ? self::update($data, $id) : self::create($data); - return $item->id; + return ($data['id'] ?? false) ? self::update($data) : self::create($data); } public static function create($data) diff --git a/app/Repositories/Shop/OrderDetails.php b/app/Repositories/Shop/OrderDetails.php index 8c77fefb..41b37304 100644 --- a/app/Repositories/Shop/OrderDetails.php +++ b/app/Repositories/Shop/OrderDetails.php @@ -6,12 +6,15 @@ use App\Models\Shop\OrderDetail; class OrderDetails { - public static function saveBasket($order_id, $data) { foreach ($data as $item) { - $item['order_id'] = $order_id; - $detail = self::store($item); + $detail = self::store([ + 'order_id' => $order_id, + 'offer_id' => $item['id'], + 'quantity' => $item['quantity'], + 'price_taxed' => $item['price'], + ]); } return true; } diff --git a/app/Repositories/Shop/Orders.php b/app/Repositories/Shop/Orders.php index 4a7250dc..8d8d5bbc 100644 --- a/app/Repositories/Shop/Orders.php +++ b/app/Repositories/Shop/Orders.php @@ -11,7 +11,10 @@ class Orders { $basket = $data['basket']; unset($data['basket']); + dump($data); + exit; $order = self::store($data); + $invoice = Invoices::saveInvoice($order->id, $data); return $order ? OrderDetails::saveBasket($order->id, $basket) : false; } @@ -42,4 +45,18 @@ class Orders { return Order::destroy($id); } + + public static function getStatus($id) + { + return self::statuses()[$id] ?? false; + } + + public static function statuses() + { + return [ + 'En attente', + 'Expédié', + 'Livré', + ]; + } } diff --git a/database/migrations/2021_07_25_182012_create_media_table.php b/database/migrations/2021_07_25_182012_create_media_table.php index 378b0461..df5dac1d 100644 --- a/database/migrations/2021_07_25_182012_create_media_table.php +++ b/database/migrations/2021_07_25_182012_create_media_table.php @@ -24,7 +24,7 @@ class CreateMediaTable extends Migration $table->json('custom_properties'); $table->json('generated_conversions'); $table->json('responsive_images'); - $table->unsignedInteger('order_column')->nullable(); + $table->unsignedInteger('order_column')->nullable()->index(); $table->nullableTimestamps(); }); diff --git a/database/migrations/2022_02_15_233439_modify_categories_tables.php b/database/migrations/2022_02_15_233439_modify_categories_tables.php deleted file mode 100644 index b09acafd..00000000 --- a/database/migrations/2022_02_15_233439_modify_categories_tables.php +++ /dev/null @@ -1,15 +0,0 @@ -tinyInteger('visible')->nullable()->after('id'); - }); - } -}; diff --git a/database/migrations/2022_05_11_202752_create_media_table.php b/database/migrations/2022_05_11_202752_create_media_table.php deleted file mode 100644 index df5dac1d..00000000 --- a/database/migrations/2022_05_11_202752_create_media_table.php +++ /dev/null @@ -1,32 +0,0 @@ -bigIncrements('id'); - - $table->morphs('model'); - $table->uuid('uuid')->nullable()->unique(); - $table->string('collection_name'); - $table->string('name'); - $table->string('file_name'); - $table->string('mime_type')->nullable(); - $table->string('disk'); - $table->string('conversions_disk')->nullable(); - $table->unsignedBigInteger('size'); - $table->json('manipulations'); - $table->json('custom_properties'); - $table->json('generated_conversions'); - $table->json('responsive_images'); - $table->unsignedInteger('order_column')->nullable()->index(); - - $table->nullableTimestamps(); - }); - } -} diff --git a/resources/views/Admin/Shop/Orders/edit.blade.php b/resources/views/Admin/Shop/Orders/edit.blade.php index 32b1d868..f3a2cc03 100644 --- a/resources/views/Admin/Shop/Orders/edit.blade.php +++ b/resources/views/Admin/Shop/Orders/edit.blade.php @@ -1,29 +1,51 @@ @extends('layout.index', [ - 'title' => 'Famille d\'articles', - 'subtitle' => 'Edition d\'une famille d\'article', - 'breadcrumb' => ['Articles'] + 'title' => 'Commandes', + 'subtitle' => 'Edition d\'une commandes', + 'breadcrumb' => ['Commandes'] ]) -@include('boilerplate::load.fileinput') - @section('content') - {{ Form::open(['route' => 'Admin.Shop.ArticleFamilies.update', 'id' => 'article-family-form', 'autocomplete' => 'off', 'files' => true]) }} - + {{ Form::open(['route' => 'Admin.Shop.Orders.update', 'id' => 'order-form', 'autocomplete' => 'off']) }} + +
-
- - {{ __('article_families.list.title') }} - - - - @include('components.form.buttons.button-save') - +
+ {{ $order['last_name'] }} {{ $order['first_name'] }}
- - @include('Admin.Shop.ArticleFamilies.form') +
+
+ {{ $order['delivery']['name'] }} +
+
+ +
+
+ {{ $order['address'] }}
+ {{ $order['address2'] }}
+ {{ $order['zipcode'] }} {{ $order['city'] }}
+
+
+ + +
+
+ + @foreach ($order['details'] as $detail) + + + + + + + @endforeach +
{{ $detail['quantity'] }}{{ $detail['name'] }}{{ $detail['price'] }}{{ $detail['total'] }}
+
+
+
+ @endsection diff --git a/resources/views/Admin/Shop/Orders/partials/filters.blade.php b/resources/views/Admin/Shop/Orders/partials/filters.blade.php new file mode 100644 index 00000000..14e13557 --- /dev/null +++ b/resources/views/Admin/Shop/Orders/partials/filters.blade.php @@ -0,0 +1,3 @@ +
+ +
diff --git a/resources/views/Shop/Customers/profile.blade.php b/resources/views/Shop/Customers/profile.blade.php new file mode 100644 index 00000000..2753d172 --- /dev/null +++ b/resources/views/Shop/Customers/profile.blade.php @@ -0,0 +1,7 @@ +@extends('Shop.layout.layout', [ + 'title' => __('Profil'), +]) + +@section('content') +Profil +@endsection diff --git a/resources/views/Shop/Orders/confirmed.blade.php b/resources/views/Shop/Orders/confirmed.blade.php new file mode 100644 index 00000000..0fe7c0be --- /dev/null +++ b/resources/views/Shop/Orders/confirmed.blade.php @@ -0,0 +1,11 @@ +@extends('Shop.layout.layout', [ + 'title' => __('Commande confirmée'), +]) + +@section('content') +
+
+ Votre commande a été confirmée +
+
+@endsection diff --git a/resources/views/Shop/Orders/partials/payments.blade.php b/resources/views/Shop/Orders/partials/payments.blade.php index 13445a42..3c232001 100644 --- a/resources/views/Shop/Orders/partials/payments.blade.php +++ b/resources/views/Shop/Orders/partials/payments.blade.php @@ -1,26 +1,26 @@
- +
-
+
PAIEMENT PAR CARTE BANCAIRE
- +
-
+
PAIEMENT PAR CHEQUE
- +
-
+
PAIEMENT PAR VIREMENT BANCAIRE
@@ -29,7 +29,7 @@
-
+
J'ai lu les conditions générales de vente et j'y adhère sans réserve
diff --git a/resources/views/Shop/Profile/profile.blade.php b/resources/views/Shop/Profile/profile.blade.php deleted file mode 100644 index bc68392b..00000000 --- a/resources/views/Shop/Profile/profile.blade.php +++ /dev/null @@ -1,8 +0,0 @@ -
-
- Livraison -
-
- Mon nom -
-
\ No newline at end of file diff --git a/routes/Shop/Customers.php b/routes/Shop/Customers.php index 85fcfa0b..b694ed02 100644 --- a/routes/Shop/Customers.php +++ b/routes/Shop/Customers.php @@ -1,6 +1,6 @@ prefix('Customers')->name('Customers.')->group(function () { +Route::prefix('Customers')->name('Customers.')->group(function () { Route::get('show/{id}', 'CustomerController@show')->name('show'); Route::get('profile/{id?}', 'CustomerController@profile')->name('profile'); }); diff --git a/routes/Shop/Invoices.php b/routes/Shop/Invoices.php index 4ab95c8b..b26985d2 100644 --- a/routes/Shop/Invoices.php +++ b/routes/Shop/Invoices.php @@ -1,6 +1,6 @@ prefix('Invoices')->name('Invoices.')->group(function () { - Route::get('show/{id}', 'InvoiceController@show')->name('show'); +Route::prefix('Invoices')->name('Invoices.')->group(function () { + Route::get('show/{id}', 'InvoiceController@show')->name('show'); }); diff --git a/routes/Shop/Orders.php b/routes/Shop/Orders.php index ebe69cb0..cc2c8f17 100644 --- a/routes/Shop/Orders.php +++ b/routes/Shop/Orders.php @@ -2,6 +2,7 @@ Route::prefix('Orders')->name('Orders.')->group(function () { Route::get('order', 'OrderController@order')->name('order'); + Route::get('confirmed', 'OrderController@confirmed')->name('confirmed'); Route::post('order', 'OrderController@store')->name('store'); });