diff --git a/Gruntfile.js b/Gruntfile.js index 587e801c..b71e6adb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -573,8 +573,8 @@ module.exports = function(grunt) { watch: { dist: { files: ['build/js/*', 'build/css/*'], - tasks: ['concat', 'copy'] - // tasks: ['concat'] + // tasks: ['concat', 'copy'] + tasks: ['concat'] } }, }); diff --git a/app/Http/Controllers/Shop/OrderController.php b/app/Http/Controllers/Shop/OrderController.php index fc0faff5..a94f740d 100644 --- a/app/Http/Controllers/Shop/OrderController.php +++ b/app/Http/Controllers/Shop/OrderController.php @@ -12,9 +12,20 @@ use App\Repositories\Shop\Orders; use App\Repositories\Shop\Paybox; use App\Repositories\Shop\Baskets; use App\Repositories\Shop\SaleChannels; +use App\Datatables\Shop\OrdersDataTable; class OrderController extends Controller { + public function index(OrdersDataTable $dataTable) + { + return $dataTable->render('Shop.Orders.partials.list', $data ?? []); + } + + public function view($uuid) + { + $data = Orders::getByUUID($uuid); + } + public function order() { $customer = Customers::getWithAddresses(); diff --git a/app/Repositories/Shop/Customers.php b/app/Repositories/Shop/Customers.php index 3d132448..22512f29 100644 --- a/app/Repositories/Shop/Customers.php +++ b/app/Repositories/Shop/Customers.php @@ -2,6 +2,7 @@ namespace App\Repositories\Shop; +use App\Datatables\Shop\OrdersDataTable; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Str; @@ -20,9 +21,11 @@ class Customers public static function editProfile($id = false) { $id = $id ? $id : self::getId(); + $orders_datatable = new OrdersDataTable; $data = [ 'customer' => self::get($id, ['addresses', 'deliveries', 'orders'])->toArray(), 'deliveries' => Deliveries::getAll('sale_channel')->toArray(), + 'orders' => $orders_datatable->html(), ]; return $data; } diff --git a/app/Repositories/Shop/Invoices.php b/app/Repositories/Shop/Invoices.php index 250b72b6..c0257dac 100644 --- a/app/Repositories/Shop/Invoices.php +++ b/app/Repositories/Shop/Invoices.php @@ -8,6 +8,11 @@ use App\Models\Shop\Invoice; class Invoices { + public static function getByUUID($uuid) + { + return Order::byUUID($uuid)->first(); + } + public static function saveInvoice($order_id, $data) { $data['order_id'] = $order_id; diff --git a/app/Repositories/Shop/Orders.php b/app/Repositories/Shop/Orders.php index 29e739b5..c54885a9 100644 --- a/app/Repositories/Shop/Orders.php +++ b/app/Repositories/Shop/Orders.php @@ -10,9 +10,13 @@ use Illuminate\Support\Str; class Orders { - use DateStats; + public static function getByUUID($uuid) + { + return Order::byUUID($uuid)->first(); + } + public static function saveOrder($data) { $data += $data['basket']; diff --git a/resources/views/Shop/Customers/partials/invoices.blade.php b/resources/views/Shop/Customers/partials/invoices.blade.php index a05686f5..5ac52600 100644 --- a/resources/views/Shop/Customers/partials/invoices.blade.php +++ b/resources/views/Shop/Customers/partials/invoices.blade.php @@ -1,3 +1,5 @@ +@include('Shop.Orders.partials.list', ['dataTable' => $orders]) + @if ($customer['orders'] ?? false) @foreach ($customer['orders'] as $order) diff --git a/resources/views/Shop/Customers/partials/user.blade.php b/resources/views/Shop/Customers/partials/user.blade.php index c68bc066..4270c7c6 100644 --- a/resources/views/Shop/Customers/partials/user.blade.php +++ b/resources/views/Shop/Customers/partials/user.blade.php @@ -2,7 +2,7 @@ @if ($customer['company']) - {{ $customer['company'] }} + {{ $customer['company'] }}
@endif diff --git a/resources/views/Shop/Orders/partials/filters.blade.php b/resources/views/Shop/Orders/partials/filters.blade.php new file mode 100644 index 00000000..b696f04d --- /dev/null +++ b/resources/views/Shop/Orders/partials/filters.blade.php @@ -0,0 +1,2 @@ + + diff --git a/resources/views/Shop/Orders/partials/list.blade.php b/resources/views/Shop/Orders/partials/list.blade.php new file mode 100644 index 00000000..41d0dbbe --- /dev/null +++ b/resources/views/Shop/Orders/partials/list.blade.php @@ -0,0 +1,29 @@ +@include('components.datatable', [ + 'route' => route('Shop.Orders.index'), + 'model' => 'orders', + 'with_add' => false, + 'with_filters' => true, + 'with_exports' => false, + 'with_print' => false, + 'show_callback' => 'OrderView(id);', +]) + +@component('components.layout.modal-filters', ['title' => 'Filters', 'id' => 'modal-aml_risks-filters']) + @include('Shop.Orders.partials.filters', ['model' => 'aml_risks']) +@endcomponent + +@push('js') + +@endpush diff --git a/routes/Shop/Orders.php b/routes/Shop/Orders.php index cc2c8f17..4dc912dd 100644 --- a/routes/Shop/Orders.php +++ b/routes/Shop/Orders.php @@ -4,5 +4,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'); + Route::any('', 'OrderController@index')->name('index'); + Route::get('view/{uuid?}', 'OrderController@view')->name('view'); });