fixes
This commit is contained in:
@@ -36,7 +36,11 @@ class CustomerOrdersDataTable extends DataTable
|
|||||||
|
|
||||||
public function getHtmlButtons()
|
public function getHtmlButtons()
|
||||||
{
|
{
|
||||||
return self::getButtonShow('uuid', 'Voir la commande');
|
$buttons = '';
|
||||||
|
|
||||||
|
$buttons .= self::getButtonShow('uuid', 'Voir la facture');
|
||||||
|
|
||||||
|
return $buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function modifier($datatables)
|
public function modifier($datatables)
|
||||||
|
|||||||
@@ -24,6 +24,26 @@ class CustomerAddresses
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getInvoiceAddress($customerId)
|
||||||
|
{
|
||||||
|
$addresses = CustomerAddress::byCustomer($customerId)->byInvoicing()->get();
|
||||||
|
if (count($addresses)) {
|
||||||
|
$address = $addresses->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getDeliveryAddress($customerId)
|
||||||
|
{
|
||||||
|
$addresses = CustomerAddress::byCustomer($customerId)->byDelivery()->get();
|
||||||
|
if (count($addresses)) {
|
||||||
|
$address = $addresses->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $address;
|
||||||
|
}
|
||||||
|
|
||||||
public static function storeByCustomer($customer, $data)
|
public static function storeByCustomer($customer, $data)
|
||||||
{
|
{
|
||||||
$deliveries = $data['deliveries'] ?? false;
|
$deliveries = $data['deliveries'] ?? false;
|
||||||
|
|||||||
@@ -55,15 +55,12 @@ class Customers
|
|||||||
|
|
||||||
public static function editProfile($id = false)
|
public static function editProfile($id = false)
|
||||||
{
|
{
|
||||||
$datatableOrders = new CustomerOrdersDataTable();
|
return $id ? [
|
||||||
$datatableInvoices = new CustomerInvoicesDataTable();
|
|
||||||
|
|
||||||
return [
|
|
||||||
'customer' => self::get($id, ['addresses', 'deliveries'])->toArray(),
|
'customer' => self::get($id, ['addresses', 'deliveries'])->toArray(),
|
||||||
'deliveries' => Deliveries::getAllWithSaleChannel()->toArray(),
|
'deliveries' => Deliveries::getAllWithSaleChannel()->toArray(),
|
||||||
'orders' => $datatableOrders->html(),
|
'orders' => (new CustomerOrdersDataTable())->html(),
|
||||||
'invoices' => $datatableInvoices->html(),
|
'invoices' => (new CustomerInvoicesDataTable())->html(),
|
||||||
];
|
] : abort('403');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAvatar($id = false)
|
public static function getAvatar($id = false)
|
||||||
@@ -151,6 +148,9 @@ class Customers
|
|||||||
|
|
||||||
public static function edit($id)
|
public static function edit($id)
|
||||||
{
|
{
|
||||||
|
if (!$id) {
|
||||||
|
abort('403');
|
||||||
|
}
|
||||||
$customer = self::get($id, ['delivery_addresses', 'invoice_addresses', 'sale_channels']);
|
$customer = self::get($id, ['delivery_addresses', 'invoice_addresses', 'sale_channels']);
|
||||||
$data = $customer->toArray();
|
$data = $customer->toArray();
|
||||||
$data['sale_channels'] = $customer->sale_channels->pluck('id')->toArray();
|
$data['sale_channels'] = $customer->sale_channels->pluck('id')->toArray();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
'id_name' => 'delivery_id_' . $delivery['id'],
|
'id_name' => 'delivery_id_' . $delivery['id'],
|
||||||
'value' => $delivery['id'],
|
'value' => $delivery['id'],
|
||||||
'checked' => $customer['sale_delivery_id'] ?? false,
|
'checked' => $customer['sale_delivery_id'] ?? false,
|
||||||
|
'class' => 'delivery',
|
||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
<div class="col-11 pt-3">
|
<div class="col-11 pt-3">
|
||||||
@@ -14,3 +15,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script>
|
||||||
|
$('.delivery').off().change(function() {
|
||||||
|
console.log($(this).val());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
@push('css')
|
@push('css')
|
||||||
|
|||||||
Reference in New Issue
Block a user