From f6668a6dd3a5e1b1d0613cfffc06adedb1273b24 Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Sun, 7 Nov 2021 23:41:17 +0100 Subject: [PATCH] fixes --- app/Datatables/Shop/DeliveriesDataTable.php | 11 ++++++----- app/Models/Shop/Customer.php | 4 ++-- .../views/Admin/Shop/Customers/form.blade.php | 4 ++-- .../Admin/Shop/Deliveries/form.blade.php | 19 ++++++++++++------- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app/Datatables/Shop/DeliveriesDataTable.php b/app/Datatables/Shop/DeliveriesDataTable.php index 07e399b4..afbc3258 100644 --- a/app/Datatables/Shop/DeliveriesDataTable.php +++ b/app/Datatables/Shop/DeliveriesDataTable.php @@ -24,11 +24,14 @@ class DeliveriesDataTable extends DataTable 'value' => $delivery->active, 'on' => __('active'), 'off' => __('inactive'), - 'meta' => 'data-id='.$delivery->id, + 'meta' => 'data-id=' . $delivery->id, 'size' => 'sm', ]); }) - ->rawColumns(['active', 'action']); + ->editColumn('address', function (Delivery $delivery) { + return $delivery->address . ' ' . $delivery->zipcode . ' ' . $delivery->city; + }) + ->rawColumns(['active', 'address', 'action']); return parent::modifier($datatables); } @@ -38,9 +41,7 @@ class DeliveriesDataTable extends DataTable Column::make('active')->title(__('active'))->width(60)->class('text-center'), Column::make('name')->title('Nom'), Column::make('sale_channel.name')->title(__('shop.sale_channels.name')), - Column::make('address')->title('Adresse'), - Column::make('zipcode')->title('Code postal'), - Column::make('city')->title('Ville'), + Column::make('address')->title('Adresse')->searchable(false), $this->makeColumnButtons(), ]; } diff --git a/app/Models/Shop/Customer.php b/app/Models/Shop/Customer.php index 3269329e..72d9431d 100644 --- a/app/Models/Shop/Customer.php +++ b/app/Models/Shop/Customer.php @@ -19,9 +19,9 @@ class Customer extends Model return $this->hasMany(Invoice::class); } - public function Deliveries() + public function Delivery() { - return $this->hasMany(Delivery::class); + return $this->belongsTo(Delivery::class); } public function Orders() diff --git a/resources/views/Admin/Shop/Customers/form.blade.php b/resources/views/Admin/Shop/Customers/form.blade.php index c40ab09b..9393e9d2 100644 --- a/resources/views/Admin/Shop/Customers/form.blade.php +++ b/resources/views/Admin/Shop/Customers/form.blade.php @@ -16,8 +16,8 @@ @include('components.form.inputs.email', ['name' => 'email', 'value' => $customer['email'] ?? null, 'required' => true])
- {{ Form::label('sale_channel_id', __('shop.sale_channels.name')) }} - @include('components.form.select', ['name' => 'sale_channel_id', 'list' => $sale_channels ?? [], 'value' => $customer['sale_channel_id'] ?? null, 'with_empty' => '', 'class' => 'select2']) + {{ Form::label('sale_delivery_id', __('shop.deliveries.name')) }} + @include('components.form.select', ['name' => 'sale_delivery_id', 'list' => $sale_deliveries ?? [], 'value' => $customer['sale_delivery_id'] ?? null, 'with_empty' => '', 'class' => 'select2'])
@include('components.address', ['with_country' => false]) diff --git a/resources/views/Admin/Shop/Deliveries/form.blade.php b/resources/views/Admin/Shop/Deliveries/form.blade.php index 363c3e85..02b15dcf 100644 --- a/resources/views/Admin/Shop/Deliveries/form.blade.php +++ b/resources/views/Admin/Shop/Deliveries/form.blade.php @@ -9,14 +9,14 @@
{{ Form::label('active', __('active')) }}
- @include("components.form.toggle", ['value' => $delivery['active'] ?? false, 'on' => __('active'), 'off' => __('inactive')]) + @include("components.form.toggle", ['name' => 'active', 'value' => $delivery['active'] ?? false, 'on' => __('active'), 'off' => __('inactive')])
- {{ Form::label('is_public', __('public')) }} - @include('components.form.checkboxes.icheck', ['name' => 'is_public', 'value' => $delivery['is_public'] ?? null]) + {{ Form::label('is_public', __('type')) }} + @include('components.form.toggle', ['name' => 'is_public', 'value' => $delivery['is_public'] ?? false, 'on' => __('public'), 'off' => __('administré')])
- {{ Form::label('is_public', __('A domicile')) }} + {{ Form::label('at_house', __('defaut')) }} @include('components.form.checkboxes.icheck', ['name' => 'at_house', 'value' => $delivery['at_house'] ?? null])
@@ -32,10 +32,15 @@ @include('components.address', ['with_country' => false])
-
- {{ Form::label('event_date', __('date')) }} - @include('components.form.datepicker', ['name' => 'event_date', 'value' => $delivery['event_date'] ?? null]) +
+ {{ Form::label('event_date_begin', __('date')) }} + @include('components.form.datepicker', ['name' => 'event_date_begin', 'value' => $delivery['event_date_begin'] ?? null])
+
+ {{ Form::label('event_date_end', __('date')) }} + @include('components.form.datepicker', ['name' => 'event_date_end', 'value' => $delivery['event_date_end'] ?? null]) +
+