add datatables on orders
This commit is contained in:
@@ -573,8 +573,8 @@ module.exports = function(grunt) {
|
|||||||
watch: {
|
watch: {
|
||||||
dist: {
|
dist: {
|
||||||
files: ['build/js/*', 'build/css/*'],
|
files: ['build/js/*', 'build/css/*'],
|
||||||
tasks: ['concat', 'copy']
|
// tasks: ['concat', 'copy']
|
||||||
// tasks: ['concat']
|
tasks: ['concat']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,9 +12,20 @@ use App\Repositories\Shop\Orders;
|
|||||||
use App\Repositories\Shop\Paybox;
|
use App\Repositories\Shop\Paybox;
|
||||||
use App\Repositories\Shop\Baskets;
|
use App\Repositories\Shop\Baskets;
|
||||||
use App\Repositories\Shop\SaleChannels;
|
use App\Repositories\Shop\SaleChannels;
|
||||||
|
use App\Datatables\Shop\OrdersDataTable;
|
||||||
|
|
||||||
class OrderController extends Controller
|
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()
|
public function order()
|
||||||
{
|
{
|
||||||
$customer = Customers::getWithAddresses();
|
$customer = Customers::getWithAddresses();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Repositories\Shop;
|
namespace App\Repositories\Shop;
|
||||||
|
|
||||||
|
use App\Datatables\Shop\OrdersDataTable;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
@@ -20,9 +21,11 @@ class Customers
|
|||||||
public static function editProfile($id = false)
|
public static function editProfile($id = false)
|
||||||
{
|
{
|
||||||
$id = $id ? $id : self::getId();
|
$id = $id ? $id : self::getId();
|
||||||
|
$orders_datatable = new OrdersDataTable;
|
||||||
$data = [
|
$data = [
|
||||||
'customer' => self::get($id, ['addresses', 'deliveries', 'orders'])->toArray(),
|
'customer' => self::get($id, ['addresses', 'deliveries', 'orders'])->toArray(),
|
||||||
'deliveries' => Deliveries::getAll('sale_channel')->toArray(),
|
'deliveries' => Deliveries::getAll('sale_channel')->toArray(),
|
||||||
|
'orders' => $orders_datatable->html(),
|
||||||
];
|
];
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ use App\Models\Shop\Invoice;
|
|||||||
|
|
||||||
class Invoices
|
class Invoices
|
||||||
{
|
{
|
||||||
|
public static function getByUUID($uuid)
|
||||||
|
{
|
||||||
|
return Order::byUUID($uuid)->first();
|
||||||
|
}
|
||||||
|
|
||||||
public static function saveInvoice($order_id, $data)
|
public static function saveInvoice($order_id, $data)
|
||||||
{
|
{
|
||||||
$data['order_id'] = $order_id;
|
$data['order_id'] = $order_id;
|
||||||
|
|||||||
@@ -10,9 +10,13 @@ use Illuminate\Support\Str;
|
|||||||
|
|
||||||
class Orders
|
class Orders
|
||||||
{
|
{
|
||||||
|
|
||||||
use DateStats;
|
use DateStats;
|
||||||
|
|
||||||
|
public static function getByUUID($uuid)
|
||||||
|
{
|
||||||
|
return Order::byUUID($uuid)->first();
|
||||||
|
}
|
||||||
|
|
||||||
public static function saveOrder($data)
|
public static function saveOrder($data)
|
||||||
{
|
{
|
||||||
$data += $data['basket'];
|
$data += $data['basket'];
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@include('Shop.Orders.partials.list', ['dataTable' => $orders])
|
||||||
|
|
||||||
@if ($customer['orders'] ?? false)
|
@if ($customer['orders'] ?? false)
|
||||||
<table class="table table-striped gradient-green1 green-fluo">
|
<table class="table table-striped gradient-green1 green-fluo">
|
||||||
@foreach ($customer['orders'] as $order)
|
@foreach ($customer['orders'] as $order)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
@if ($customer['company'])
|
@if ($customer['company'])
|
||||||
<i class="fa fa-building pr-2"></i>
|
<i class="fa fa-building pr-2"></i>
|
||||||
{{ $customer['company'] }}
|
{{ $customer['company'] }}<br>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<i class="fa fa-fw fa-user pr-2"></i>
|
<i class="fa fa-fw fa-user pr-2"></i>
|
||||||
|
|||||||
2
resources/views/Shop/Orders/partials/filters.blade.php
Normal file
2
resources/views/Shop/Orders/partials/filters.blade.php
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<form id="{{ $model }}-filters">
|
||||||
|
</form>
|
||||||
29
resources/views/Shop/Orders/partials/list.blade.php
Normal file
29
resources/views/Shop/Orders/partials/list.blade.php
Normal file
@@ -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')
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function OrderView(id) {
|
||||||
|
var url_open = "{{ route('Shop.Orders.view') }}/" + id;
|
||||||
|
openModal("Voir une commande", '#model-form', url_open, false, false, 'xl', {{ !($with_add ?? false) }});
|
||||||
|
}
|
||||||
|
|
||||||
|
function OrderRefresh()
|
||||||
|
{
|
||||||
|
reloadDatatable("orders");
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
@@ -4,5 +4,7 @@ Route::prefix('Orders')->name('Orders.')->group(function () {
|
|||||||
Route::get('order', 'OrderController@order')->name('order');
|
Route::get('order', 'OrderController@order')->name('order');
|
||||||
Route::get('confirmed', 'OrderController@confirmed')->name('confirmed');
|
Route::get('confirmed', 'OrderController@confirmed')->name('confirmed');
|
||||||
Route::post('order', 'OrderController@store')->name('store');
|
Route::post('order', 'OrderController@store')->name('store');
|
||||||
|
Route::any('', 'OrderController@index')->name('index');
|
||||||
|
Route::get('view/{uuid?}', 'OrderController@view')->name('view');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user