diff --git a/app/Datatables/Shop/CustomerAddressesDataTable.php b/app/Datatables/Shop/CustomerAddressesDataTable.php new file mode 100644 index 00000000..e4d5b2e6 --- /dev/null +++ b/app/Datatables/Shop/CustomerAddressesDataTable.php @@ -0,0 +1,32 @@ +url = route('Admin.Shop.CustomerAddresses.index'); + } + + public function query(CustomerAddress $model) + { + return $this->buildQuery($model); + } + + protected function getColumns() + { + return [ + Column::make('address')->title('Adresse'), + Column::make('zipcode')->title('Code postal'), + Column::make('city')->title('Ville'), + $this->makeColumnButtons(), + ]; + } +} diff --git a/app/Http/Controllers/Admin/Shop/CustomerAddressController.php b/app/Http/Controllers/Admin/Shop/CustomerAddressController.php new file mode 100644 index 00000000..909628d4 --- /dev/null +++ b/app/Http/Controllers/Admin/Shop/CustomerAddressController.php @@ -0,0 +1,45 @@ +render('Admin.Shop.Customers.list', $data); + } + + public function create() + { + return view('Admin.Shop.CustomerAddresses.create', $data); + } + + public function store(Request $request) + { + $ret = CustomerAddresses::storeFull($request->all()); + return redirect()->route('Admin.Shop.CustomerAddresses.index'); + } + + public function show($id) + { + $data['customer'] = CustomerAddresses::get($id); + return view('Admin.Shop.CustomerAddresses.view', $data); + } + + public function edit($id) + { + $data['customer'] = CustomerAddresses::edit($id); + return view('Admin.Shop.CustomerAddresses.edit', $data); + } + + public function destroy($id) + { + return CustomerAddresses::destroy($id); + } +} diff --git a/app/Http/Controllers/Admin/Shop/CustomerController.php b/app/Http/Controllers/Admin/Shop/CustomerController.php index 3fe02d7c..37398c42 100644 --- a/app/Http/Controllers/Admin/Shop/CustomerController.php +++ b/app/Http/Controllers/Admin/Shop/CustomerController.php @@ -7,6 +7,7 @@ use Illuminate\Http\Request; use App\Repositories\Shop\Customers; use App\Repositories\Shop\Deliveries; use App\Datatables\Shop\CustomersDataTable; +use App\Datatables\Shop\CustomerAddressesDataTable; class CustomerController extends Controller { @@ -38,8 +39,8 @@ class CustomerController extends Controller { $data['customer'] = Customers::edit($id); $data['deliveries'] = Deliveries::getOptions(); - // dump($data); - // exit; + $model = new CustomerAddressesDataTable(); + $data['customer_addresses'] = $model->html(); return view('Admin.Shop.Customers.edit', $data); } diff --git a/app/Http/Controllers/Shop/CategoryController.php b/app/Http/Controllers/Shop/CategoryController.php index 3a36845c..46f0e4c7 100644 --- a/app/Http/Controllers/Shop/CategoryController.php +++ b/app/Http/Controllers/Shop/CategoryController.php @@ -75,8 +75,8 @@ class CategoryController extends Controller 'display_by_rows' => $request->input('display_by_rows') ?? false, 'product_type' => $product_type, 'article_nature' => $article_nature, - 'article_natures' => $article_natures, - 'product_types' => $product_types, + 'article_natures' => $article_natures ?? [], + 'product_types' => $product_types ?? [], 'tags_selected' => $request->input('tags') ?? [], 'articles' => Articles::getArticlesToSell([ 'category_id' => $category_id, diff --git a/resources/views/Admin/Shop/CustomerAddresses/create.blade.php b/resources/views/Admin/Shop/CustomerAddresses/create.blade.php new file mode 100644 index 00000000..53c18680 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerAddresses/create.blade.php @@ -0,0 +1,11 @@ +@extends('layout.index', [ + 'title' => __('shop.customers.title'), + 'subtitle' => __('shop.customers.add'), + 'breadcrumb' => [__('shop.customers.title')] +]) + +@section('content') + {{ Form::open(['route' => 'Admin.Shop.Customers.store', 'id' => 'customer-form', 'autocomplete' => 'off']) }} + @include('Admin.Shop.Customers.form') + +@endsection diff --git a/resources/views/Admin/Shop/CustomerAddresses/edit.blade.php b/resources/views/Admin/Shop/CustomerAddresses/edit.blade.php new file mode 100644 index 00000000..98cbf194 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerAddresses/edit.blade.php @@ -0,0 +1,14 @@ +@extends('layout.index', [ + 'title' => __('shop.customers.title'), + 'subtitle' => __('shop.customers.edit'), + 'breadcrumb' => [__('shop.customers.title')] +]) + +@section('content') + + {{ Form::open(['route' => 'Admin.Shop.Customers.store', 'id' => 'customer-form', 'autocomplete' => 'off']) }} + + @include('Admin.Shop.Customers.form') + + +@endsection diff --git a/resources/views/Admin/Shop/CustomerAddresses/form.blade.php b/resources/views/Admin/Shop/CustomerAddresses/form.blade.php new file mode 100644 index 00000000..8b9a0eb9 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerAddresses/form.blade.php @@ -0,0 +1,135 @@ +
+
+
+
+ {{ Form::label('first_name', 'Prénom') }} + @include('components.form.input', [ + 'name' => 'first_name', + 'value' => $customer['first_name'] ?? null, + 'required' => true, + ]) +
+
+ {{ Form::label('last_name', 'Nom') }} + @include('components.form.input', [ + 'name' => 'last_name', + 'value' => $customer['last_name'] ?? null, + 'required' => true, + ]) +
+
+
+
+ {{ Form::label('company', 'Société') }} + @include('components.form.input', [ + 'name' => 'company', + 'value' => $customer['company'] ?? null, + ]) +
+
+
+
+ {{ Form::label('tva', 'TVA') }} + @include('components.form.input', [ + 'name' => 'tva', + 'value' => $customer['tva'] ?? null, + ]) +
+
+
+
+ {{ Form::label('email', 'Email') }} + @include('components.form.input', [ + 'name' => 'email', + 'value' => $customer['email'] ?? null, + 'required' => true, + ]) +
+
+ {{ Form::label('phone', 'Téléphone') }} + @include('components.form.input', [ + 'name' => 'phone', + 'value' => $customer['phone'] ?? null, + ]) +
+
+ +
+
+ {{ Form::label('address', 'Adresse') }} + @include('components.form.input', [ + 'name' => 'address', + 'value' => $customer['address'] ?? null, + 'required' => true, + ]) +
+
+ +
+
+ {{ Form::label('address2', 'Adresse complémentaire') }} + @include('components.form.input', [ + 'name' => 'address2', + 'value' => $customer['address2'] ?? null, + ]) +
+
+ +
+
+ {{ Form::label('zipcode', 'Code postal') }} + @include('components.form.input', [ + 'name' => 'zipcode', + 'value' => $customer['zipcode'] ?? null, + 'required' => true, + ]) +
+
+ {{ Form::label('city', 'Ville') }} + @include('components.form.input', [ + 'name' => 'city', + 'value' => $customer['city'] ?? null, + 'required' => true, + ]) +
+
+ +
+
+ {{ Form::label('sale_delivery_id', __('shop.deliveries.name')) }} + @include('components.form.select', [ + 'name' => 'deliveries[]', + 'list' => $deliveries ?? [], + 'values' => $customer['deliveries'] ?? null, + 'with_empty' => '', + 'class' => 'select2', + 'multiple' => true, + ]) +
+
+
+
+ @if ($customer['addresses']) + @include('components.address', [ + 'with_country' => false, + 'prefix' => 'addresses[0]', + 'with_tab' => true, + 'item' => $customer['addresses'][0], + ]) + @endif +
+
+ +@include('components.save') + +@include('load.form.save') +@include('load.form.select2') + +@push('js') + +@endpush \ No newline at end of file diff --git a/resources/views/Admin/Shop/CustomerAddresses/list.blade.php b/resources/views/Admin/Shop/CustomerAddresses/list.blade.php new file mode 100644 index 00000000..761138d4 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerAddresses/list.blade.php @@ -0,0 +1,3 @@ +@component('components.card') + @include('components.datatable', ['route' => route('Admin.Shop.CustomerAddresses.index'), 'model' => 'customer_addresses']) +@endcomponent diff --git a/resources/views/Admin/Shop/CustomerAddresses/show.blade.php b/resources/views/Admin/Shop/CustomerAddresses/show.blade.php new file mode 100644 index 00000000..1e1cd729 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerAddresses/show.blade.php @@ -0,0 +1,36 @@ +@extends('layout.index', [ + 'title' => __('products.title'), + 'subtitle' => __('products.title'), + 'breadcrumb' => [__('products.title')] +]) + +@section('content') +
+ +
+ +
+ +
+
+
+

{{ name }}

+

+ {{ $product.section.name }}
+

+
+
+

{{ $prix_total }} €

+

{{ $residence['type_produit']['name'] }}

+
+ +
+ @include('Hestimmo.modules.Lot.partials.carousel') +
+
+
+
+
+
+ +@endsection diff --git a/resources/views/Admin/Shop/Customers/form.blade.php b/resources/views/Admin/Shop/Customers/form.blade.php index 53670092..97e8251f 100644 --- a/resources/views/Admin/Shop/Customers/form.blade.php +++ b/resources/views/Admin/Shop/Customers/form.blade.php @@ -1,73 +1,117 @@
-
+
{{ Form::label('first_name', 'Prénom') }} - @include('components.form.input', ['name' => 'first_name', 'value' => $customer['first_name'] ?? null, 'required' => true]) + @include('components.form.input', [ + 'name' => 'first_name', + 'value' => $customer['first_name'] ?? null, + 'required' => true, + ])
{{ Form::label('last_name', 'Nom') }} - @include('components.form.input', ['name' => 'last_name', 'value' => $customer['last_name'] ?? null, 'required' => true]) + @include('components.form.input', [ + 'name' => 'last_name', + 'value' => $customer['last_name'] ?? null, + 'required' => true, + ])
{{ Form::label('company', 'Société') }} - @include('components.form.input', ['name' => 'company', 'value' => $customer['company'] ?? null]) + @include('components.form.input', [ + 'name' => 'company', + 'value' => $customer['company'] ?? null, + ])
{{ Form::label('tva', 'TVA') }} - @include('components.form.input', ['name' => 'tva', 'value' => $customer['tva'] ?? null]) + @include('components.form.input', [ + 'name' => 'tva', + 'value' => $customer['tva'] ?? null, + ])
{{ Form::label('email', 'Email') }} - @include('components.form.input', ['name' => 'email', 'value' => $customer['email'] ?? null, 'required' => true]) + @include('components.form.input', [ + 'name' => 'email', + 'value' => $customer['email'] ?? null, + 'required' => true, + ])
{{ Form::label('phone', 'Téléphone') }} - @include('components.form.input', ['name' => 'phone', 'value' => $customer['phone'] ?? null]) + @include('components.form.input', [ + 'name' => 'phone', + 'value' => $customer['phone'] ?? null, + ])
{{ Form::label('address', 'Adresse') }} - @include('components.form.input', ['name' => 'address', 'value' => $customer['address'] ?? null, 'required' => true]) + @include('components.form.input', [ + 'name' => 'address', + 'value' => $customer['address'] ?? null, + 'required' => true, + ])
{{ Form::label('address2', 'Adresse complémentaire') }} - @include('components.form.input', ['name' => 'address2', 'value' => $customer['address2'] ?? null]) + @include('components.form.input', [ + 'name' => 'address2', + 'value' => $customer['address2'] ?? null, + ])
{{ Form::label('zipcode', 'Code postal') }} - @include('components.form.input', ['name' => 'zipcode', 'value' => $customer['zipcode'] ?? null, 'required' => true]) + @include('components.form.input', [ + 'name' => 'zipcode', + 'value' => $customer['zipcode'] ?? null, + 'required' => true, + ])
{{ Form::label('city', 'Ville') }} - @include('components.form.input', ['name' => 'city', 'value' => $customer['city'] ?? null, 'required' => true]) + @include('components.form.input', [ + 'name' => 'city', + 'value' => $customer['city'] ?? null, + 'required' => true, + ])
{{ Form::label('sale_delivery_id', __('shop.deliveries.name')) }} - @include('components.form.select', ['name' => 'deliveries[]', 'list' => $deliveries ?? [], 'values' => $customer['deliveries'] ?? null, 'with_empty' => '', 'class' => 'select2', 'multiple' => true]) + @include('components.form.select', [ + 'name' => 'deliveries[]', + 'list' => $deliveries ?? [], + 'values' => $customer['deliveries'] ?? null, + 'with_empty' => '', + 'class' => 'select2', + 'multiple' => true, + ])
- - @if ($customer['addresses']) - @include('components.address', ['with_country' => false, 'prefix' => 'addresses[0]', 'with_tab' => true, 'item' => $customer['addresses'][0]]) - @endif +
+
+ @component('components.layout.box-collapse', ['title' => __('Adresses'), 'id' => 'form-customer-address']) + @include('Admin.Shop.CustomerAddresses.list', ['dataTable' => $customer_addresses]) + @endcomponent
diff --git a/routes/Admin/Shop/route.php b/routes/Admin/Shop/route.php index 25c290e3..810faa55 100644 --- a/routes/Admin/Shop/route.php +++ b/routes/Admin/Shop/route.php @@ -2,26 +2,27 @@ Route::middleware('auth')->prefix('Shop')->namespace('Shop')->name('Shop.')->group(function () { Route::get('dashboard', 'DashboardController@index')->name('dashboard'); - include __DIR__ . '/ArticleNatures.php'; - include __DIR__ . '/Articles.php'; - include __DIR__ . '/Categories.php'; - include __DIR__ . '/Customers.php'; - include __DIR__ . '/Deliveries.php'; - include __DIR__ . '/Homepages.php'; - include __DIR__ . '/InvoiceItems.php'; - include __DIR__ . '/Invoices.php'; - include __DIR__ . '/Merchandises.php'; - include __DIR__ . '/Offers.php'; - include __DIR__ . '/Orders.php'; - include __DIR__ . '/Packages.php'; - include __DIR__ . '/PriceLists.php'; - include __DIR__ . '/PriceListValues.php'; - include __DIR__ . '/Producers.php'; - include __DIR__ . '/SaleChannels.php'; - include __DIR__ . '/Tags.php'; - include __DIR__ . '/TagGroups.php'; - include __DIR__ . '/Tariffs.php'; - include __DIR__ . '/TariffUnities.php'; - include __DIR__ . '/Unities.php'; - include __DIR__ . '/Variations.php'; + include_once __DIR__ . '/ArticleNatures.php'; + include_once __DIR__ . '/Articles.php'; + include_once __DIR__ . '/Categories.php'; + include_once __DIR__ . '/Customers.php'; + include_once __DIR__ . '/CustomerAddresses.php'; + include_once __DIR__ . '/Deliveries.php'; + include_once __DIR__ . '/Homepages.php'; + include_once __DIR__ . '/InvoiceItems.php'; + include_once __DIR__ . '/Invoices.php'; + include_once __DIR__ . '/Merchandises.php'; + include_once __DIR__ . '/Offers.php'; + include_once __DIR__ . '/Orders.php'; + include_once __DIR__ . '/Packages.php'; + include_once __DIR__ . '/PriceLists.php'; + include_once __DIR__ . '/PriceListValues.php'; + include_once __DIR__ . '/Producers.php'; + include_once __DIR__ . '/SaleChannels.php'; + include_once __DIR__ . '/Tags.php'; + include_once __DIR__ . '/TagGroups.php'; + include_once __DIR__ . '/Tariffs.php'; + include_once __DIR__ . '/TariffUnities.php'; + include_once __DIR__ . '/Unities.php'; + include_once __DIR__ . '/Variations.php'; }); diff --git a/routes/Shop/route.php b/routes/Shop/route.php index 7f1d5e3d..8fc1761d 100644 --- a/routes/Shop/route.php +++ b/routes/Shop/route.php @@ -13,14 +13,14 @@ Route::prefix('')->namespace('Shop')->name('Shop.')->group(function () { }); Route::prefix('')->namespace('Shop')->name('Shop.')->group(function () { - include __DIR__ . '/Articles.php'; - include __DIR__ . '/Baskets.php'; - include __DIR__ . '/Categories.php'; - include __DIR__ . '/Customers.php'; - include __DIR__ . '/Invoices.php'; - include __DIR__ . '/Offers.php'; - include __DIR__ . '/Orders.php'; - include __DIR__ . '/Orders.php'; - include __DIR__ . '/OrderPayments.php'; - include __DIR__ . '/Searches.php'; + include_once __DIR__ . '/Articles.php'; + include_once __DIR__ . '/Baskets.php'; + include_once __DIR__ . '/Categories.php'; + include_once __DIR__ . '/Customers.php'; + include_once __DIR__ . '/Invoices.php'; + include_once __DIR__ . '/Offers.php'; + include_once __DIR__ . '/Orders.php'; + include_once __DIR__ . '/Orders.php'; + include_once __DIR__ . '/OrderPayments.php'; + include_once __DIR__ . '/Searches.php'; });