From 08fc49cb61c160ea143a0c84004b49c12020caf0 Mon Sep 17 00:00:00 2001 From: ludo Date: Sat, 15 Feb 2025 12:12:42 +0100 Subject: [PATCH] fixes --- .../Admin/Core/CommentsDataTable.php | 4 +- .../Admin/Shop/CustomerAddressesDataTable.php | 11 ++ .../Admin/Shop/CustomerInvoicesDataTable.php | 80 +++++++++++ .../Admin/Shop/CustomerOrdersDataTable.php | 69 +++++++++ .../Admin/Shop/PriceListValuesDataTable.php | 36 +++++ .../Admin/Shop/CustomerAddressController.php | 8 +- .../Admin/Shop/CustomerController.php | 16 ++- .../Admin/Shop/CustomerInvoiceController.php | 28 ++++ .../Admin/Shop/CustomerOrderController.php | 28 ++++ .../Admin/Shop/PriceListValueController.php | 27 ++-- .../Shop/Auth/RegisterController.php | 8 +- app/Mail/ConfirmationCommande.php | 4 +- app/Models/Shop/Unity.php | 25 +++- app/Models/Shop/Variation.php | 9 +- app/Repositories/Core/Auth/Passwords.php | 24 ++-- app/Repositories/Core/Auth/Teams.php | 2 - app/Repositories/Core/Comments.php | 40 ++---- app/Repositories/Shop/ArticleImages.php | 7 +- app/Repositories/Shop/CustomerAddresses.php | 127 ++++++++-------- app/Repositories/Shop/CustomerAvatars.php | 73 ++++++++++ .../Shop/CustomerSaleChannels.php | 7 + app/Repositories/Shop/Customers.php | 118 ++++----------- app/Repositories/Shop/Deliveries.php | 2 +- .../Shop/CustomerAddresses/edit.blade.php | 16 +-- .../Shop/CustomerAddresses/form.blade.php | 2 +- .../Shop/CustomerInvoices/create.blade.php | 15 ++ .../Shop/CustomerInvoices/edit.blade.php | 12 ++ .../Shop/CustomerInvoices/form.blade.php | 135 ++++++++++++++++++ .../Shop/CustomerInvoices/list.blade.php | 11 ++ .../partials/filters.blade.php | 3 + .../Shop/CustomerInvoices/show.blade.php | 36 +++++ .../Shop/CustomerOrders/create.blade.php | 15 ++ .../Admin/Shop/CustomerOrders/edit.blade.php | 12 ++ .../Admin/Shop/CustomerOrders/form.blade.php | 135 ++++++++++++++++++ .../Admin/Shop/CustomerOrders/list.blade.php | 11 ++ .../CustomerOrders/partials/filters.blade.php | 3 + .../Admin/Shop/CustomerOrders/show.blade.php | 36 +++++ .../views/Admin/Shop/Customers/form.blade.php | 10 +- .../_partials/latestOrders.blade.php | 6 +- .../DeliveryTypeCalculations/form.blade.php | 6 +- .../DeliveryTypeCalculations/list.blade.php | 7 +- .../Admin/Shop/DeliveryTypes/create.blade.php | 12 +- .../Admin/Shop/DeliveryTypes/edit.blade.php | 13 +- .../Admin/Shop/DeliveryTypes/form.blade.php | 86 ++++------- .../views/Admin/Shop/Orders/form.blade.php | 69 +++++---- resources/views/Shop/Customers/edit.blade.php | 1 + resources/views/Shop/Orders/order.blade.php | 2 +- resources/views/Shop/home.blade.php | 50 +++---- .../layout/partials/header-profile.blade.php | 7 +- resources/views/load/slick.blade.php | 22 ++- routes/Admin/Shop/CustomerInvoices.php | 7 + routes/Admin/Shop/CustomerOrders.php | 7 + routes/Admin/Shop/route.php | 2 + 53 files changed, 1098 insertions(+), 404 deletions(-) create mode 100644 app/Datatables/Admin/Shop/CustomerInvoicesDataTable.php create mode 100644 app/Datatables/Admin/Shop/CustomerOrdersDataTable.php create mode 100644 app/Datatables/Admin/Shop/PriceListValuesDataTable.php create mode 100644 app/Http/Controllers/Admin/Shop/CustomerInvoiceController.php create mode 100644 app/Http/Controllers/Admin/Shop/CustomerOrderController.php create mode 100644 app/Repositories/Shop/CustomerAvatars.php create mode 100644 resources/views/Admin/Shop/CustomerInvoices/create.blade.php create mode 100644 resources/views/Admin/Shop/CustomerInvoices/edit.blade.php create mode 100644 resources/views/Admin/Shop/CustomerInvoices/form.blade.php create mode 100644 resources/views/Admin/Shop/CustomerInvoices/list.blade.php create mode 100644 resources/views/Admin/Shop/CustomerInvoices/partials/filters.blade.php create mode 100644 resources/views/Admin/Shop/CustomerInvoices/show.blade.php create mode 100644 resources/views/Admin/Shop/CustomerOrders/create.blade.php create mode 100644 resources/views/Admin/Shop/CustomerOrders/edit.blade.php create mode 100644 resources/views/Admin/Shop/CustomerOrders/form.blade.php create mode 100644 resources/views/Admin/Shop/CustomerOrders/list.blade.php create mode 100644 resources/views/Admin/Shop/CustomerOrders/partials/filters.blade.php create mode 100644 resources/views/Admin/Shop/CustomerOrders/show.blade.php create mode 100644 routes/Admin/Shop/CustomerInvoices.php create mode 100644 routes/Admin/Shop/CustomerOrders.php diff --git a/app/Datatables/Admin/Core/CommentsDataTable.php b/app/Datatables/Admin/Core/CommentsDataTable.php index a4bdfc01..01e266b4 100644 --- a/app/Datatables/Admin/Core/CommentsDataTable.php +++ b/app/Datatables/Admin/Core/CommentsDataTable.php @@ -17,7 +17,7 @@ class CommentsDataTable extends DataTable public function query(Comment $model) { - $model = $model::with(['user'])->select('*'); + $model = $model::with(['commentator'])->select('*'); return $this->buildQuery($model); } @@ -26,7 +26,7 @@ class CommentsDataTable extends DataTable { return [ Column::make('updated_at')->title(__('date'))->width('80')->class('text-center')->searchable(false), - Column::make('user.name')->title(__('name'))->searchable(false), + Column::make('commentator.name')->title(__('name'))->searchable(false), Column::make('comment')->title(__('comments'))->searchable(false), $this->makeColumnButtons(), ]; diff --git a/app/Datatables/Admin/Shop/CustomerAddressesDataTable.php b/app/Datatables/Admin/Shop/CustomerAddressesDataTable.php index 43e2ae8f..6b6c6cf4 100644 --- a/app/Datatables/Admin/Shop/CustomerAddressesDataTable.php +++ b/app/Datatables/Admin/Shop/CustomerAddressesDataTable.php @@ -4,6 +4,7 @@ namespace App\Datatables\Admin\Shop; use App\Datatables\ParentDataTable as DataTable; use App\Models\Shop\CustomerAddress; +use App\Repositories\Shop\CustomerAddresses; use Yajra\DataTables\Html\Column; class CustomerAddressesDataTable extends DataTable @@ -29,10 +30,20 @@ class CustomerAddressesDataTable extends DataTable return $customerId ? $model->byCustomer($customerId) : $model; } + public function modifier($datatables) + { + $datatables->editColumn('type', function (CustomerAddress $address) { + return CustomerAddresses::getIconByType($address->type); + })->rawColumns(['type', 'action']); + + return parent::modifier($datatables); + } + protected function getColumns() { return [ + Column::make('type')->title('')->width(30), Column::make('address')->title('Adresse'), Column::make('zipcode')->title('Code postal'), Column::make('city')->title('Ville'), diff --git a/app/Datatables/Admin/Shop/CustomerInvoicesDataTable.php b/app/Datatables/Admin/Shop/CustomerInvoicesDataTable.php new file mode 100644 index 00000000..f9992525 --- /dev/null +++ b/app/Datatables/Admin/Shop/CustomerInvoicesDataTable.php @@ -0,0 +1,80 @@ +url = route('Shop.Invoices.index'); + } + + public function query(Invoice $model) + { + $customerId = Customers::getId(); + $model = $model->byCustomer($customerId)->with(['address']); + + return $this->buildQuery($model); + } + + public function getHtmlButtons() + { + $buttons = view('components.form.button', [ + 'dataId' => '{{$uuid}}', + 'class' => 'btn-sm btn-secondary btn-invoice mr-2', + 'icon' => 'fa-file-pdf', + 'title' => 'Télécharger la facture', + 'url' => route('Shop.Invoices.pdf').'/{{$uuid}}', + ]); + + $buttons .= self::getButtonShow('uuid', 'Voir la facture'); + + return $buttons; + } + + public function modifier($datatables) + { + $datatables + ->editColumn('status', function (Invoice $invoice) { + return Invoices::getStatus($invoice->status); + }) + ->editColumn('created_at', function (Invoice $invoice) { + return $invoice->created_at->isoFormat('DD/MM/YY HH:mm'); + }) + ->editColumn('payment_type', function (Invoice $invoice) { + return InvoicePayments::getPaymentType($invoice->payment_type); + }) + ->rawColumns(['action']); + + return parent::modifier($datatables); + } + + protected function getColumns() + { + return [ + Column::make('created_at')->title('Date'), + Column::make('ref')->title('Ref'), + Column::make('payment_type')->title('Règlement'), + Column::make('total_shipped')->title('Montant')->class('text-right'), + Column::make('status')->title('Statut'), + $this->makeColumnButtons(), + ]; + } +} diff --git a/app/Datatables/Admin/Shop/CustomerOrdersDataTable.php b/app/Datatables/Admin/Shop/CustomerOrdersDataTable.php new file mode 100644 index 00000000..68bb0d6e --- /dev/null +++ b/app/Datatables/Admin/Shop/CustomerOrdersDataTable.php @@ -0,0 +1,69 @@ +url = route('Shop.Orders.index'); + } + + public function query(Order $model) + { + $customerId = Customers::getId(); + $model = $model->byCustomer($customerId); + + return $this->buildQuery($model); + } + + public function getHtmlButtons() + { + $buttons = ''; + + $buttons .= self::getButtonShow('uuid', 'Voir la facture'); + + return $buttons; + } + + public function modifier($datatables) + { + $datatables + ->editColumn('status', function (Order $order) { + return Orders::getStatus($order->status); + }) + ->editColumn('created_at', function (Order $order) { + return $order->created_at->isoFormat('DD/MM/YY HH:mm'); + }) + ->rawColumns(['action']); + + return parent::modifier($datatables); + } + + protected function getColumns() + { + return [ + Column::make('created_at')->title('Date'), + Column::make('ref')->title('Ref'), + Column::make('total_shipped')->title('Montant')->class('text-right'), + Column::make('status')->title('Statut'), + $this->makeColumnButtons(), + ]; + } +} diff --git a/app/Datatables/Admin/Shop/PriceListValuesDataTable.php b/app/Datatables/Admin/Shop/PriceListValuesDataTable.php new file mode 100644 index 00000000..2fd33ce9 --- /dev/null +++ b/app/Datatables/Admin/Shop/PriceListValuesDataTable.php @@ -0,0 +1,36 @@ +url = route('Admin.Shop.PriceListValues.index'); + } + + public function query(PriceListValue $model) + { + $model = $model->with(['price_list']); + + return $this->buildQuery($model); + } + + protected function getColumns() + { + return [ + Column::make('price_list.name')->data('price_list')->title('etat'), + Column::make('code')->title('Code'), + Column::make('quantity')->title('Quantité'), + Column::make('price')->title('Prix HT'), + Column::make('price_taxed')->title('Prix TTC'), + $this->makeColumnButtons(), + ]; + } +} diff --git a/app/Http/Controllers/Admin/Shop/CustomerAddressController.php b/app/Http/Controllers/Admin/Shop/CustomerAddressController.php index 80741772..4b1b05eb 100644 --- a/app/Http/Controllers/Admin/Shop/CustomerAddressController.php +++ b/app/Http/Controllers/Admin/Shop/CustomerAddressController.php @@ -31,14 +31,18 @@ class CustomerAddressController extends Controller public function show($id) { - $data['customer'] = CustomerAddresses::get($id); + $data = [ + 'customer' => CustomerAddresses::get($id), + ]; return view('Admin.Shop.CustomerAddresses.view', $data); } public function edit($id) { - $data['customer'] = CustomerAddresses::edit($id); + $data = [ + 'customer' => CustomerAddresses::edit($id), + ]; return view('Admin.Shop.CustomerAddresses.edit', $data); } diff --git a/app/Http/Controllers/Admin/Shop/CustomerController.php b/app/Http/Controllers/Admin/Shop/CustomerController.php index 02a8a3b4..fe2611f9 100644 --- a/app/Http/Controllers/Admin/Shop/CustomerController.php +++ b/app/Http/Controllers/Admin/Shop/CustomerController.php @@ -3,6 +3,8 @@ namespace App\Http\Controllers\Admin\Shop; use App\Datatables\Admin\Shop\CustomerAddressesDataTable; +use App\Datatables\Admin\Shop\CustomerInvoicesDataTable; +use App\Datatables\Admin\Shop\CustomerOrdersDataTable; use App\Datatables\Admin\Shop\CustomersDataTable; use App\Repositories\Shop\Customers; use Illuminate\Http\Request; @@ -32,17 +34,21 @@ class CustomerController extends Controller public function show($id) { - $data['customer'] = Customers::get($id); + $data = [ + 'customer' => Customers::get($id), + ]; return view('Admin.Shop.Customers.view', $data); } public function edit($id) { - $data = Customers::init(); - $data['customer'] = Customers::edit($id); - $model = new CustomerAddressesDataTable(); - $data['customer_addresses'] = $model->html(); + $data = Customers::init() + [ + 'customer' => Customers::edit($id), + 'customer_addresses' => (new CustomerAddressesDataTable())->html(), + 'customer_invoices' => (new CustomerInvoicesDataTable())->html(), + 'customer_orders' => (new CustomerOrdersDataTable())->html(), + ]; return view('Admin.Shop.Customers.edit', $data); } diff --git a/app/Http/Controllers/Admin/Shop/CustomerInvoiceController.php b/app/Http/Controllers/Admin/Shop/CustomerInvoiceController.php new file mode 100644 index 00000000..cc43aa7f --- /dev/null +++ b/app/Http/Controllers/Admin/Shop/CustomerInvoiceController.php @@ -0,0 +1,28 @@ +render('Admin.Shop.CustomerInvoices.list'); + } + + public function show($id) + { + $data = [ + 'invoice' => Invoices::get($id), + ]; + + return view('Admin.Shop.CustomerInvoices.view', $data); + } + + public function destroy($id) + { + return Invoices::destroy($id); + } +} diff --git a/app/Http/Controllers/Admin/Shop/CustomerOrderController.php b/app/Http/Controllers/Admin/Shop/CustomerOrderController.php new file mode 100644 index 00000000..98aadb9b --- /dev/null +++ b/app/Http/Controllers/Admin/Shop/CustomerOrderController.php @@ -0,0 +1,28 @@ +render('Admin.Shop.CustomerOrders.list'); + } + + public function show($id) + { + $data = [ + 'order' => Orders::get($id), + ]; + + return view('Admin.Shop.CustomerOrders.view', $data); + } + + public function destroy($id) + { + return Orders::destroy($id); + } +} diff --git a/app/Http/Controllers/Admin/Shop/PriceListValueController.php b/app/Http/Controllers/Admin/Shop/PriceListValueController.php index 966b04a7..dc6d9a35 100644 --- a/app/Http/Controllers/Admin/Shop/PriceListValueController.php +++ b/app/Http/Controllers/Admin/Shop/PriceListValueController.php @@ -2,10 +2,9 @@ namespace App\Http\Controllers\Admin\Shop; -use App\Datatables\Shop\PriceListValuesDataTable; +use App\Datatables\Admin\Shop\PriceListValuesDataTable; use App\Http\Controllers\Controller; use App\Repositories\Shop\Packages; -use App\Repositories\Shop\PriceListValueCategories; use App\Repositories\Shop\PriceListValues; use App\Repositories\Shop\Taxes; use App\Repositories\Shop\Unities; @@ -15,27 +14,31 @@ class PriceListValueController extends Controller { public function index(PriceListValuesDataTable $dataTable) { - $data['categories'] = PriceListValueCategories::getOptions(); - return $dataTable->render('Admin.Shop.PriceListValues.list', $data); } public function create() { - $data['unities'] = Unities::getOptions(); - $data['taxes_options'] = Taxes::getOptions(); - $data['categories'] = PriceListValueCategories::getOptions(); + $data = [ + 'unities' => Unities::getOptions(), + 'taxes_options' => Taxes::getOptions(), + ]; return view('Admin.Shop.PriceListValues.create', $data); } public function edit($id) { - $data['generic'] = PriceListValues::getFull($id)->toArray(); - $data['packages'] = Packages::getSelectByFamily($data['generic']['category']['article_family_id']); - $data['unities'] = ($data['packages']['id'] ?? false) ? Unities::getSelectByPackage($data['packages']['id']) : []; - $data['taxes_options'] = Taxes::getOptions(); - $data['categories'] = PriceListValueCategories::getOptions(); + $priceListValue = PriceListValues::getFull($id)->toArray(); + $familyId = $priceListValue['category']['article_family_id']; + // $packages = Packages::getSelectByFamily($familyId); + $data = [ + 'generic' => $priceListValue, + 'packages' => $packages, + 'unities' => $packages['id'] ?? false ? Unities::getSelectByPackage($packages['id']) : [], + 'taxes_options' => Taxes::getOptions(), + 'categories' => PriceListValueCategories::getOptions(), + ]; return view('Admin.Shop.PriceListValues.edit', $data); } diff --git a/app/Http/Controllers/Shop/Auth/RegisterController.php b/app/Http/Controllers/Shop/Auth/RegisterController.php index 0aab6ed2..1f879c2a 100644 --- a/app/Http/Controllers/Shop/Auth/RegisterController.php +++ b/app/Http/Controllers/Shop/Auth/RegisterController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Shop\Auth; use App\Http\Controllers\Controller; use App\Http\Requests\Shop\RegisterCustomer; +use App\Repositories\Shop\CustomerSaleChannels; use App\Repositories\Shop\CustomerAddresses; use App\Repositories\Shop\Customers; use Illuminate\Foundation\Auth\EmailVerificationRequest; @@ -63,10 +64,11 @@ class RegisterController extends Controller protected function create(array $data) { - $user = Customers::create($data); - CustomerAddresses::add($user->id, $data); + $customer = Customers::create($data); + CustomerAddresses::createByCustomer($customer->id, $data); + CustomerSaleChannels::createByCustomer($customer->id); - return $user; + return $customer; } protected function guard() diff --git a/app/Mail/ConfirmationCommande.php b/app/Mail/ConfirmationCommande.php index 3d5335f3..305694c1 100644 --- a/app/Mail/ConfirmationCommande.php +++ b/app/Mail/ConfirmationCommande.php @@ -42,8 +42,8 @@ class ConfirmationCommande extends TemplateMailable public function __construct($order) { - $facturation_address = $order->invoice->address ? $order->invoice->address : $customer; - $delivery_address = $order->delivery_address ? $order->delivery_address : $customer; + $facturation_address = $order->invoice->address; + $delivery_address = $order->delivery_address; $this->prenom = $order->customer->first_name; $this->nom = $order->customer->last_name; $this->facturation_adresse = $facturation_address->address; diff --git a/app/Models/Shop/Unity.php b/app/Models/Shop/Unity.php index 845171b2..7f9a2d19 100644 --- a/app/Models/Shop/Unity.php +++ b/app/Models/Shop/Unity.php @@ -3,7 +3,10 @@ namespace App\Models\Shop; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; +use Znck\Eloquent\Relations\BelongsToThrough as RelationsBelongsToThrough; use Znck\Eloquent\Traits\BelongsToThrough; class Unity extends Model @@ -14,19 +17,33 @@ class Unity extends Model protected $table = 'shop_unities'; - public function package() + public function package(): BelongsTo { return $this->belongsTo(Package::class); } - public function article_family() + public function variations(): HasMany { - return $this->belongsToThrough(ArticleNature::class, Package::class, null, '', ['App\Models\Shop\ArticleNature' => 'article_family_id', 'App\Models\Shop\Package' => 'package_id']); + return $this->hasMany(Variation::class); + } + + public function article_family(): RelationsBelongsToThrough + { + return $this->belongsToThrough( + ArticleNature::class, + Package::class, + null, + '', + [ + 'App\Models\Shop\ArticleNature' => 'article_family_id', + 'App\Models\Shop\Package' => 'package_id' + ] + ); } public function scopeByPackage($query, $id) { - return $query->where($this->table.'.package_id', $id); + return $query->where($this->table . '.package_id', $id); } public function scopeByArticleNature($query, $id) diff --git a/app/Models/Shop/Variation.php b/app/Models/Shop/Variation.php index f3ff54de..a2a32341 100644 --- a/app/Models/Shop/Variation.php +++ b/app/Models/Shop/Variation.php @@ -30,8 +30,13 @@ class Variation extends Model return $this->hasMany(Offer::class); } - public function scopeByPackage($query, $package_id) + public function scopeByPackage($query, $packageId) { - return $query->where($this->table.'.package_id', $package_id); + return $query->where($this->table . '.package_id', $packageId); + } + + public function scopeByUnity($query, $unityId) + { + return $query->where($this->table . '.unity_id', $unityId); } } diff --git a/app/Repositories/Core/Auth/Passwords.php b/app/Repositories/Core/Auth/Passwords.php index 5ce753e0..feb7ec5b 100644 --- a/app/Repositories/Core/Auth/Passwords.php +++ b/app/Repositories/Core/Auth/Passwords.php @@ -2,22 +2,20 @@ namespace App\Repositories\Core\Auth; +use Illuminate\Support\Facades\Validator; +use Illuminate\Validation\Rules\Password; + class Passwords { - public static function validator() + public static function validator($request) { - $validator = new \Password\Validator(new \Password\StringHelper()); - $validator->setMinLength(5); - $validator->setMinLowerCaseLetters(2); - $validator->setMinUpperCaseLetters(1); - $validator->setMinNumbers(1); - $validator->setMinSymbols(3); + return Validator::make($request->all(), [ + 'password' => ['required', 'confirmed', self::rules()], + ]); + } - if ($validator->isValid($password)) { - printf('password %s is valid'.PHP_EOL, $password); - } else { - printf('password %s is invalid'.PHP_EOL, $password); - var_dump($validator->getErrors()); - } + public static function rules() + { + return Password::min(10)->mixedCase()->numbers()->symbols()->uncompromised(); } } diff --git a/app/Repositories/Core/Auth/Teams.php b/app/Repositories/Core/Auth/Teams.php index b8495429..ea095a24 100644 --- a/app/Repositories/Core/Auth/Teams.php +++ b/app/Repositories/Core/Auth/Teams.php @@ -41,8 +41,6 @@ class Teams public static function delete($id) { - Users::destroyByUniqueTeam($id); - return Team::destroy($id); } diff --git a/app/Repositories/Core/Comments.php b/app/Repositories/Core/Comments.php index 5e2b6595..74bfcc1d 100644 --- a/app/Repositories/Core/Comments.php +++ b/app/Repositories/Core/Comments.php @@ -3,28 +3,22 @@ namespace App\Repositories\Core; use App\Datatables\Admin\Core\CommentsDataTable; -use App\Models\Core\Comment as rawComment; +use App\Models\Core\Comment; use App\Repositories\Core\Auth\Users; +use App\Traits\Model\Basic; class Comments { - public static function get($id) - { - return rawComment::find($id); - } + use Basic; public static function getDatatable() { - $model = new CommentsDataTable(); - - return $model->html(); + return (new CommentsDataTable())->html(); } public static function getCommentsByModel($model, $model_id) { - $class = self::getClass($model); - - return self::getCommentsByClass($class, $model_id); + return self::getCommentsByClass(self::getClass($model), $model_id); } public static function getCommentsByClass($class, $id) @@ -32,14 +26,14 @@ class Comments return self::getByModel(self::getModel($class, $id)); } - public static function getModel($class, $id) + public static function getItem($class, $id) { return $class::find($id); } public static function getClass($model) { - return 'App\Models\\'.str_replace('.', '\\', $model); + return 'App\Models\\' . str_replace('.', '\\', $model); } public static function getByModel($model) @@ -75,25 +69,11 @@ class Comments $data['is_approved'] = true; $data['user_id'] = Users::getId(); - return rawComment::create($data); + return Comment::create($data); } - public static function update($data, $id = false) + public static function getModel() { - $id = $id ? $id : $data['id']; - $model = self::get($id); - $model->update($data); - - return $model; - } - - public static function deleteComments($model) - { - return true; - } - - public static function deleteComment($model, $index) - { - return true; + return Comment::query(); } } diff --git a/app/Repositories/Shop/ArticleImages.php b/app/Repositories/Shop/ArticleImages.php index f4dc6af2..9eb3b2ff 100644 --- a/app/Repositories/Shop/ArticleImages.php +++ b/app/Repositories/Shop/ArticleImages.php @@ -4,23 +4,22 @@ namespace App\Repositories\Shop; use App\Repositories\Botanic\Species; use App\Repositories\Botanic\Varieties; -use App\Traits\Model\Basic; use App\Traits\Repository\Imageable; class ArticleImages { - use Basic, Imageable; + use Imageable; public static function getFullImagesByArticleId($id) { - $article = self::get($id); + $article = Articles::get($id); return $article ? self::getFullImagesByArticle($article) : false; } public static function countFullImagesByArticleId($id) { - $article = self::get($id); + $article = Articles::get($id); return $article ? self::countFullImagesByArticle($article) : 0; } diff --git a/app/Repositories/Shop/CustomerAddresses.php b/app/Repositories/Shop/CustomerAddresses.php index f384bbf1..052d1a2f 100644 --- a/app/Repositories/Shop/CustomerAddresses.php +++ b/app/Repositories/Shop/CustomerAddresses.php @@ -9,67 +9,6 @@ class CustomerAddresses { use Basic; - public static function add($userId, $data) - { - self::addDeliveryAddress($userId, $data); - self::addInvoiceAddress($userId, $data); - } - - public static function addDeliveryAddress($userId, $data) - { - $name = $data['company'] ? $data['company'] : $data['first_name'].' '.$data['last_name']; - $delivery = $data['use_for_delivery'] ?? false; - - $data = [ - 'customer_id' => $userId, - 'type' => 2, - 'name' => $name, - 'address' => $delivery ? $data['delivery_address'] : $data['address'], - 'address2' => $delivery ? $data['delivery_address2'] : $data['address2'], - 'zipcode' => $delivery ? $data['delivery_zipcode'] : $data['zipcode'], - 'city' => $delivery ? $data['delivery_city'] : $data['city'], - ]; - - return self::store($data); - } - - public static function addInvoiceAddress($userId, $data) - { - $name = $data['company'] ? $data['company'] : $data['first_name'].' '.$data['last_name']; - - $data = [ - 'customer_id' => $userId, - 'type' => 1, - 'name' => $name, - 'address' => $data['address'], - 'address2' => $data['address2'], - 'zipcode' => $data['zipcode'], - 'city' => $data['city'], - ]; - - return self::store($data); - } - - 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) { $deliveries = $data['deliveries'] ?? false; @@ -87,6 +26,72 @@ class CustomerAddresses } } + public static function createByCustomer($customerId, $data) + { + self::addDeliveryAddress($customerId, $data); + self::addInvoiceAddress($customerId, $data); + } + + public static function addDeliveryAddress($customerId, $data) + { + $delivery = $data['use_for_delivery'] ?? false; + $data = array_merge($data, [ + 'address' => $delivery ? $data['delivery_address'] : $data['address'], + 'address2' => $delivery ? $data['delivery_address2'] : $data['address2'], + 'zipcode' => $delivery ? $data['delivery_zipcode'] : $data['zipcode'], + 'city' => $delivery ? $data['delivery_city'] : $data['city'], + ]); + + return self::addAddress($customerId, $data, 2); + } + + public static function addInvoiceAddress($customerId, $data) + { + return self::addAddress($customerId, $data, 1); + + } + + public static function addAddress($customerId, $data, $type) + { + $name = $data['company'] ? $data['company'] : $data['first_name'] . ' ' . $data['last_name']; + + $data = [ + 'customer_id' => $customerId, + 'type' => $type, + 'name' => $name, + 'address' => $data['address'], + 'address2' => $data['address2'], + 'zipcode' => $data['zipcode'], + 'city' => $data['city'], + ]; + + return self::store($data); + } + + public static function getInvoiceAddress($customerId) + { + $addresses = CustomerAddress::byCustomer($customerId)->byInvoicing()->get(); + return count($addresses) ? $addresses->first() : self::getByCustomer($customerId); + } + + public static function getDeliveryAddress($customerId) + { + $addresses = CustomerAddress::byCustomer($customerId)->byDelivery()->get(); + return count($addresses) ? $addresses->first() : self::getByCustomer($customerId); + } + + public static function getByCustomer($customerId = false) + { + $customer = Customers::get($customerId); + + return $customer ? $customer->only(['address', 'adress2', 'zipcode', 'city']) : false; + } + + public static function getIconByType($type) + { + return ((int) $type === 1) ? '' : ''; + } + public static function toggleActive($id, $active) { return self::update(['active' => $active], $id); diff --git a/app/Repositories/Shop/CustomerAvatars.php b/app/Repositories/Shop/CustomerAvatars.php new file mode 100644 index 00000000..16aa727a --- /dev/null +++ b/app/Repositories/Shop/CustomerAvatars.php @@ -0,0 +1,73 @@ +"; + } + + public static function getAvatar($id = false) + { + $customer = $id ? Customers::get($id) : Customers::getAuth(); + $file = self::makeAvatarFilename($customer); + if (!File::checkFile($file)) { + self::createAvatar($customer); + } + + return self::getPublic(self::getAvatarFilename($customer)); + } + + public static function createAvatar($customer) + { + $filename = self::makeAvatarFilename($customer); + $name = $customer->first_name . ' ' . $customer->last_name; + $avatar = new Avatar(); + + return $avatar->create($name) + ->setBackground('#F2B90F') + ->setForeground('#335012') + ->setBorder(1, '#28a745') + ->setFontFamily('Roboto Condensed') + ->setDimension(36) + ->setFontSize(16) + ->save($filename); + } + + public static function makeAvatarFilename($customer) + { + $path = storage_path(self::getStorage()); + if (File::checkDirOrCreate($path)) { + $filename = $path . self::getAvatarFilename($customer); + } + + return $filename ?? false; + } + + public static function getAvatarFilename($customer) + { + return 'user-' . $customer->uuid . '.png'; + } + + public static function getStorage($filename = false) + { + $path = '/app/public/Customers/'; + + return $filename ? $path . $filename : $path; + } + + public static function getPublic($filename = false) + { + $path = '/storage/Customers/'; + + return $filename ? $path . $filename : $path; + } +} diff --git a/app/Repositories/Shop/CustomerSaleChannels.php b/app/Repositories/Shop/CustomerSaleChannels.php index 35c4119b..009ddb98 100644 --- a/app/Repositories/Shop/CustomerSaleChannels.php +++ b/app/Repositories/Shop/CustomerSaleChannels.php @@ -9,6 +9,13 @@ class CustomerSaleChannels { use Basic; + public static function createByCustomer($customerId) + { + $customer = Customers::get($customerId); + + return $customer->sale_channels()->sync(SaleChannels::getDefault()); + } + public static function destroyByCustomerAndSaleChannel($customerId, $saleChannelId) { return CustomerSaleChannel::byCustomer($customerId)->bySaleChannel($saleChannelId)->delete(); diff --git a/app/Repositories/Shop/Customers.php b/app/Repositories/Shop/Customers.php index b57e2bc4..b3dc71b1 100644 --- a/app/Repositories/Shop/Customers.php +++ b/app/Repositories/Shop/Customers.php @@ -5,11 +5,9 @@ namespace App\Repositories\Shop; use App\Datatables\Shop\CustomerInvoicesDataTable; use App\Datatables\Shop\CustomerOrdersDataTable; use App\Models\Shop\Customer; -use App\Repositories\Core\File; use App\Traits\Model\Basic; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Str; -use Laravolt\Avatar\Avatar; class Customers { @@ -32,20 +30,24 @@ class Customers public static function getSaleChannels($customerId = false) { $customer = $customerId ? self::get($customerId) : self::getAuth(); + $saleChannels = $customer ? $customer->sale_channels : false; - return $customer ? $customer->sale_channels : SaleChannels::getDefault(); + return $saleChannels ? $saleChannels : SaleChannels::getDefault(); } - public static function getSaleChannel() + public static function getSaleChannel($customerId = false) { - return SaleChannels::getDefault(); + $saleChannels = self::getSaleChannels($customerId); + + return $saleChannels->first(); } public static function getDeliveries() { $customer = self::getAuth(); + $deliveries = $customer ? $customer->deliveries : false; - return $customer ? $customer->deliveries : Deliveries::getDefault(); + return $deliveries ? $deliveries : [Deliveries::getDefault()]; } public static function getOptions() @@ -63,48 +65,6 @@ class Customers ] : abort('403'); } - public static function getAvatar($id = false) - { - $customer = $id ? self::get($id) : self::getAuth(); - $file = self::makeAvatarFilename($customer); - if (!File::checkFile($file)) { - self::createAvatar($customer); - } - - return self::getPublic(self::getAvatarFilename($customer)); - } - - public static function createAvatar($customer) - { - $filename = self::makeAvatarFilename($customer); - $name = $customer->first_name . ' ' . $customer->last_name; - $avatar = new Avatar(); - - return $avatar->create($name) - ->setBackground('#F2B90F') - ->setForeground('#335012') - ->setBorder(1, '#28a745') - ->setFontFamily('Roboto Condensed') - ->setDimension(36) - ->setFontSize(16) - ->save($filename); - } - - public static function makeAvatarFilename($customer) - { - $path = storage_path(self::getStorage()); - if (File::checkDirOrCreate($path)) { - $filename = $path . self::getAvatarFilename($customer); - } - - return $filename ?? false; - } - - public static function getAvatarFilename($customer) - { - return 'user-' . $customer->uuid . '.png'; - } - public static function getAddresses($id = false) { $customer = self::getWithAddresses($id); @@ -126,26 +86,6 @@ class Customers return $user ? $user->name : ''; } - public static function getAuth() - { - return self::guard()->user(); - } - - public static function getId() - { - return self::guard()->id(); - } - - public static function isNotConnected() - { - return !self::isConnected(); - } - - public static function isConnected() - { - return self::guard()->check(); - } - public static function edit($id) { if (!$id) { @@ -178,14 +118,9 @@ class Customers return $customer->id; } - public static function storeDeliveries($customer, $deliveries) + public static function storeDeliveries($customerId, $deliveries) { - if (!$deliveries) { - return false; - } - $deliveries = collect($deliveries)->transform(function ($item) { - return (int) $item; - })->toArray(); + $customer = self::get($customerId); return $customer->deliveries()->sync($deliveries); } @@ -200,18 +135,9 @@ class Customers public static function storeSaleChannels($customerId, $saleChannels) { - $oldSaleChannels = self::getSaleChannelIds($customerId); - $deleteSaleChannels = array_diff($oldSaleChannels, $saleChannels); - $newSaleChannels = array_diff($saleChannels, $oldSaleChannels); + $customer = self::get($customerId); - $data = ['customer_id' => $customerId]; - foreach ($newSaleChannels as $saleChannelId) { - $data['sale_channel_id'] = $saleChannelId; - CustomerSaleChannels::store($data); - } - foreach ($deleteSaleChannels as $saleChannelId) { - CustomerSaleChannels::destroyByCustomerAndSaleChannel($customerId, $saleChannelId); - } + return $customer->sale_channels()->sync($saleChannels); } public static function create($data) @@ -223,18 +149,24 @@ class Customers return Customer::create($data); } - public static function getStorage($filename = false) + public static function getAuth() { - $path = '/app/public/Customers/'; - - return $filename ? $path . $filename : $path; + return self::guard()->user(); } - public static function getPublic($filename = false) + public static function getId() { - $path = '/storage/Customers/'; + return self::guard()->id(); + } - return $filename ? $path . $filename : $path; + public static function isNotConnected() + { + return !self::isConnected(); + } + + public static function isConnected() + { + return self::guard()->check(); } public static function guard() diff --git a/app/Repositories/Shop/Deliveries.php b/app/Repositories/Shop/Deliveries.php index 49ed10bf..5bcfceaa 100644 --- a/app/Repositories/Shop/Deliveries.php +++ b/app/Repositories/Shop/Deliveries.php @@ -19,7 +19,7 @@ class Deliveries public static function getByCustomer($customerId = false) { $customer = $customerId ? Customers::get($customerId) : Customers::getAuth(); - $saleChannels = $customer ? $customer->sale_channels->pluck('id')->toArray() : false; + $saleChannels = $customer ? $customer->sale_channels->pluck('id')->toArray() : [SaleChannels::getDefaultID()]; return $saleChannels ? self::getBySaleChannels($saleChannels) : false; } diff --git a/resources/views/Admin/Shop/CustomerAddresses/edit.blade.php b/resources/views/Admin/Shop/CustomerAddresses/edit.blade.php index 98cbf194..cb415159 100644 --- a/resources/views/Admin/Shop/CustomerAddresses/edit.blade.php +++ b/resources/views/Admin/Shop/CustomerAddresses/edit.blade.php @@ -1,14 +1,12 @@ @extends('layout.index', [ - 'title' => __('shop.customers.title'), - 'subtitle' => __('shop.customers.edit'), - 'breadcrumb' => [__('shop.customers.title')] + 'title' => __('shop.customer_addresses.title'), + 'subtitle' => __('shop.customer_addresses.edit'), + 'breadcrumb' => [__('shop.customer_addresses.title')], ]) @section('content') - - {{ Form::open(['route' => 'Admin.Shop.Customers.store', 'id' => 'customer-form', 'autocomplete' => 'off']) }} - - @include('Admin.Shop.Customers.form') - - + {{ Form::open(['route' => 'Admin.Shop.CustomerAddresses.store', 'id' => 'customer_address-form', 'autocomplete' => 'off']) }} + + @include('Admin.Shop.CustomerAddresses.form') + @endsection diff --git a/resources/views/Admin/Shop/CustomerAddresses/form.blade.php b/resources/views/Admin/Shop/CustomerAddresses/form.blade.php index d8f27319..0f871a53 100644 --- a/resources/views/Admin/Shop/CustomerAddresses/form.blade.php +++ b/resources/views/Admin/Shop/CustomerAddresses/form.blade.php @@ -96,8 +96,8 @@
- {{ Form::label('sale_delivery_id', __('shop.deliveries.name')) }} @include('components.form.select', [ + 'label' => __('shop.deliveries.name'), 'name' => 'deliveries[]', 'list' => $deliveries ?? [], 'values' => $customer['deliveries'] ?? null, diff --git a/resources/views/Admin/Shop/CustomerInvoices/create.blade.php b/resources/views/Admin/Shop/CustomerInvoices/create.blade.php new file mode 100644 index 00000000..30138636 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerInvoices/create.blade.php @@ -0,0 +1,15 @@ +@extends('layout.index', [ + 'title' => __('shop.customer_addresses.title'), + 'subtitle' => __('shop.customer_addresses.add'), + 'breadcrumb' => [__('shop.customers.title')], +]) + +@section('content') + {{ Form::open([ + 'route' => 'Admin.Shop.CustomerAddresses.store', + 'id' => 'customer_address-form', + 'autocomplete' => 'off', + ]) }} + @include('components.address') + +@endsection diff --git a/resources/views/Admin/Shop/CustomerInvoices/edit.blade.php b/resources/views/Admin/Shop/CustomerInvoices/edit.blade.php new file mode 100644 index 00000000..cb415159 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerInvoices/edit.blade.php @@ -0,0 +1,12 @@ +@extends('layout.index', [ + 'title' => __('shop.customer_addresses.title'), + 'subtitle' => __('shop.customer_addresses.edit'), + 'breadcrumb' => [__('shop.customer_addresses.title')], +]) + +@section('content') + {{ Form::open(['route' => 'Admin.Shop.CustomerAddresses.store', 'id' => 'customer_address-form', 'autocomplete' => 'off']) }} + + @include('Admin.Shop.CustomerAddresses.form') + +@endsection diff --git a/resources/views/Admin/Shop/CustomerInvoices/form.blade.php b/resources/views/Admin/Shop/CustomerInvoices/form.blade.php new file mode 100644 index 00000000..0f871a53 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerInvoices/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, + ]) +
+
+ +
+
+ @include('components.form.select', [ + 'label' => __('shop.deliveries.name'), + '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 diff --git a/resources/views/Admin/Shop/CustomerInvoices/list.blade.php b/resources/views/Admin/Shop/CustomerInvoices/list.blade.php new file mode 100644 index 00000000..373ad20d --- /dev/null +++ b/resources/views/Admin/Shop/CustomerInvoices/list.blade.php @@ -0,0 +1,11 @@ + + @include('components.datatable', [ + 'route' => route('Admin.Shop.CustomerInvoices.index'), + 'model' => 'customer_invoices', + 'with_print' => false, + 'with_filters' => false, + ]) + + @include('Admin.Shop.CustomerInvoices.partials.filters', ['model' => 'customer_invoices']) + + diff --git a/resources/views/Admin/Shop/CustomerInvoices/partials/filters.blade.php b/resources/views/Admin/Shop/CustomerInvoices/partials/filters.blade.php new file mode 100644 index 00000000..06f11853 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerInvoices/partials/filters.blade.php @@ -0,0 +1,3 @@ +
+ +
diff --git a/resources/views/Admin/Shop/CustomerInvoices/show.blade.php b/resources/views/Admin/Shop/CustomerInvoices/show.blade.php new file mode 100644 index 00000000..1e1cd729 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerInvoices/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/CustomerOrders/create.blade.php b/resources/views/Admin/Shop/CustomerOrders/create.blade.php new file mode 100644 index 00000000..30138636 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerOrders/create.blade.php @@ -0,0 +1,15 @@ +@extends('layout.index', [ + 'title' => __('shop.customer_addresses.title'), + 'subtitle' => __('shop.customer_addresses.add'), + 'breadcrumb' => [__('shop.customers.title')], +]) + +@section('content') + {{ Form::open([ + 'route' => 'Admin.Shop.CustomerAddresses.store', + 'id' => 'customer_address-form', + 'autocomplete' => 'off', + ]) }} + @include('components.address') + +@endsection diff --git a/resources/views/Admin/Shop/CustomerOrders/edit.blade.php b/resources/views/Admin/Shop/CustomerOrders/edit.blade.php new file mode 100644 index 00000000..cb415159 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerOrders/edit.blade.php @@ -0,0 +1,12 @@ +@extends('layout.index', [ + 'title' => __('shop.customer_addresses.title'), + 'subtitle' => __('shop.customer_addresses.edit'), + 'breadcrumb' => [__('shop.customer_addresses.title')], +]) + +@section('content') + {{ Form::open(['route' => 'Admin.Shop.CustomerAddresses.store', 'id' => 'customer_address-form', 'autocomplete' => 'off']) }} + + @include('Admin.Shop.CustomerAddresses.form') + +@endsection diff --git a/resources/views/Admin/Shop/CustomerOrders/form.blade.php b/resources/views/Admin/Shop/CustomerOrders/form.blade.php new file mode 100644 index 00000000..0f871a53 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerOrders/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, + ]) +
+
+ +
+
+ @include('components.form.select', [ + 'label' => __('shop.deliveries.name'), + '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 diff --git a/resources/views/Admin/Shop/CustomerOrders/list.blade.php b/resources/views/Admin/Shop/CustomerOrders/list.blade.php new file mode 100644 index 00000000..42b4e155 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerOrders/list.blade.php @@ -0,0 +1,11 @@ + + @include('components.datatable', [ + 'route' => route('Admin.Shop.CustomerOrders.index'), + 'model' => 'customer_orders', + 'with_print' => false, + 'with_filters' => false, + ]) + + @include('Admin.Shop.CustomerOrders.partials.filters', ['model' => 'customer_orders']) + + diff --git a/resources/views/Admin/Shop/CustomerOrders/partials/filters.blade.php b/resources/views/Admin/Shop/CustomerOrders/partials/filters.blade.php new file mode 100644 index 00000000..06f11853 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerOrders/partials/filters.blade.php @@ -0,0 +1,3 @@ +
+ +
diff --git a/resources/views/Admin/Shop/CustomerOrders/show.blade.php b/resources/views/Admin/Shop/CustomerOrders/show.blade.php new file mode 100644 index 00000000..1e1cd729 --- /dev/null +++ b/resources/views/Admin/Shop/CustomerOrders/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 54cce750..db3c55c3 100644 --- a/resources/views/Admin/Shop/Customers/form.blade.php +++ b/resources/views/Admin/Shop/Customers/form.blade.php @@ -114,9 +114,15 @@
- + @include('Admin.Shop.CustomerAddresses.list', ['dataTable' => $customer_addresses]) + + @include('Admin.Shop.CustomerInvoices.list', ['dataTable' => $customer_invoices]) + + + @include('Admin.Shop.CustomerOrders.list', ['dataTable' => $customer_orders]) +
@@ -124,12 +130,14 @@ @include('load.form.save') @include('load.form.select2') +@include('load.layout.chevron') @push('js') {!! JsValidator::formRequest('App\Http\Requests\Admin\Shop\StoreCustomerPost', '#customer-form') !!} diff --git a/resources/views/Admin/Shop/DeliveryTypes/create.blade.php b/resources/views/Admin/Shop/DeliveryTypes/create.blade.php index bcaacd01..33a2a09b 100644 --- a/resources/views/Admin/Shop/DeliveryTypes/create.blade.php +++ b/resources/views/Admin/Shop/DeliveryTypes/create.blade.php @@ -1,11 +1,11 @@ @extends('layout.index', [ - 'title' => __('shop.deliveries.title'), - 'subtitle' => __('shop.deliveries.add'), - 'breadcrumb' => [__('shop.deliveries.title'), __('shop.deliveries.add')] + 'title' => __('shop.delivery_types.title'), + 'subtitle' => __('shop.delivery_types.add'), + 'breadcrumb' => [__('shop.delivery_types.title')], ]) @section('content') - {{ Form::open(['route' => 'Admin.Shop.Deliveries.store', 'id' => 'delivery-form', 'autocomplete' => 'off']) }} - @include('Admin.Shop.Deliveries.form') - + {{ Form::open(['route' => 'Admin.Shop.Deliveries.store', 'id' => 'delivery-form', 'autocomplete' => 'off']) }} + @include('Admin.Shop.DeliveryTypes.form') + @endsection diff --git a/resources/views/Admin/Shop/DeliveryTypes/edit.blade.php b/resources/views/Admin/Shop/DeliveryTypes/edit.blade.php index 1e867bf6..0d11f575 100644 --- a/resources/views/Admin/Shop/DeliveryTypes/edit.blade.php +++ b/resources/views/Admin/Shop/DeliveryTypes/edit.blade.php @@ -1,12 +1,11 @@ @extends('layout.index', [ - 'title' => __('shop.deliveries.title'), - 'subtitle' => __('shop.deliveries.edit'), - 'breadcrumb' => [__('shop.deliveries.title')] + 'title' => __('shop.delivery_types.title'), + 'subtitle' => __('shop.delivery_types.edit'), + 'breadcrumb' => [__('shop.delivery_types.title')], ]) @section('content') - {{ Form::open(['route' => 'Admin.Shop.Deliveries.store', 'id' => 'delivery-form', 'autocomplete' => 'off']) }} - - @include('Admin.Shop.Deliveries.form') - + {{ Form::open(['route' => 'Admin.Shop.Deliveries.store', 'id' => 'delivery-form', 'autocomplete' => 'off']) }} + @include('Admin.Shop.DeliveryTypes.form') + @endsection diff --git a/resources/views/Admin/Shop/DeliveryTypes/form.blade.php b/resources/views/Admin/Shop/DeliveryTypes/form.blade.php index 27547196..9db6f7f8 100644 --- a/resources/views/Admin/Shop/DeliveryTypes/form.blade.php +++ b/resources/views/Admin/Shop/DeliveryTypes/form.blade.php @@ -1,69 +1,33 @@ -
-
-
-
- {{ Form::label('sale_channel_id', __('shop.sale_channels.name')) }} - @include('components.form.select', ['name' => 'sale_channel_id', 'list' => $sale_channels ?? [], 'value' => $delivery['sale_channel_id'] ?? null, 'with_empty' => '', 'class' => 'select2']) -
-
-
-
- {{ Form::label('active', __('Actif')) }}
- @include("components.form.toggle", ['name' => 'active', 'value' => $delivery['active'] ?? false, 'on' => __('active'), 'off' => __('inactive')]) -
-
- {{ Form::label('is_public', __('Type')) }} - @include('components.form.toggle', ['name' => 'is_public', 'value' => $delivery['is_public'] ?? false, 'on' => __('public'), 'off' => __('administré')]) -
-
- {{ Form::label('at_house', __('Défaut')) }} - @include('components.form.checkboxes.icheck', ['name' => 'at_house', 'value' => $delivery['at_house'] ?? null]) -
-
-
-
-
-
- {{ Form::label('name', __('Nom')) }} - @include('components.form.input', ['name' => 'name', 'value' => $delivery['name'] ?? null, 'required' => true]) -
-
- -
-
- {{ Form::label('', __('Description')) }} - -
-
- - @include('components.address', ['with_country' => false]) - -
-
- {{ Form::label('event_date_begin', __('Date de début')) }} - @include('components.form.datepicker', ['name' => 'event_date_begin', 'value' => $delivery['event_date_begin'] ?? null]) -
-
- {{ Form::label('event_date_end', __('Date de fin')) }} - @include('components.form.datepicker', ['name' => 'event_date_end', 'value' => $delivery['event_date_end'] ?? null]) -
- -
-
+
+
+ {{ Form::label('name', __('Nom')) }} + @include('components.form.input', [ + 'name' => 'name', + 'value' => $delivery['name'] ?? null, + 'required' => true, + ]) +
-@include('components.save') +
+
+ {{ Form::label('', __('Description')) }} + +
+
+ + @include('load.form.select2') @include('load.form.save') @push('js') - -@endpush \ No newline at end of file + +@endpush diff --git a/resources/views/Admin/Shop/Orders/form.blade.php b/resources/views/Admin/Shop/Orders/form.blade.php index 6accd7fb..f9a86760 100644 --- a/resources/views/Admin/Shop/Orders/form.blade.php +++ b/resources/views/Admin/Shop/Orders/form.blade.php @@ -1,38 +1,37 @@ +
+
+ {{ Form::label('name', 'Nom') }} + @include('components.form.input', [ + 'name' => 'name', + 'value' => $family['name'] ?? null, + 'required' => true, + ]) + + {{ Form::label('description', 'Description') }} + @include('components.form.textarea', [ + 'name' => 'description', + 'value' => $description ?? null, + 'class' => 'editor', + 'required' => false, + ]) + +
+
+ +
+
+
+ +
+
+
+ @include('boilerplate::load.tinymce') - -
-
- {{ Form::label('name', 'Nom') }} - @include('components.form.input', [ - 'name' => 'name', - 'value' => $family['name'] ?? null, - 'required' => true, - ]) - - {{ Form::label('description', 'Description') }} - @include('components.form.textarea', [ - 'name' => 'description', - 'value' => $description ?? null, - 'class' => 'editor', - 'required' => false, - ]) - -
-
- -
-
-
- @include('components.form.buttons.button-save') -
-
-
- @push('js') - -@endpush \ No newline at end of file + +@endpush diff --git a/resources/views/Shop/Customers/edit.blade.php b/resources/views/Shop/Customers/edit.blade.php index ee62619a..7547c1e6 100644 --- a/resources/views/Shop/Customers/edit.blade.php +++ b/resources/views/Shop/Customers/edit.blade.php @@ -32,6 +32,7 @@ 'prefix' => 'invoices', 'addresses' => $customer['invoice_addresses'], 'with_name' => true, + 'route_del' => route(''), ]) diff --git a/resources/views/Shop/Orders/order.blade.php b/resources/views/Shop/Orders/order.blade.php index d0e09ae4..006d1f8f 100644 --- a/resources/views/Shop/Orders/order.blade.php +++ b/resources/views/Shop/Orders/order.blade.php @@ -4,7 +4,7 @@ @section('content') @php - if ($errors->registration) { + if ($errors->registration->all()) { $classIdent = 'd-none'; $classRegister = ''; } else { diff --git a/resources/views/Shop/home.blade.php b/resources/views/Shop/home.blade.php index 3baaa44b..cddb4e0c 100644 --- a/resources/views/Shop/home.blade.php +++ b/resources/views/Shop/home.blade.php @@ -1,39 +1,31 @@ @extends('Shop.layout.layout', [ - 'title' => __('home.title'), + 'title' => __('home.title'), ]) @section('content') - @include('Shop.Tags.partials.filter') - - @if (!empty($text)) -
-
{!! $text !!}
-
- @endif - -
-
- @foreach ($shelves as $shelve) - @include('Shop.Homepage.partials.sliderByShelve') - @endforeach -
-
+ @include('Shop.Tags.partials.filter') + + @if (!empty($text)) +
+
{!! $text !!}
+
+ @endif + +
+
+ @foreach ($shelves as $shelve) + @include('Shop.Homepage.partials.sliderByShelve') + @endforeach +
+
@endsection @include('load.slick') @push('js') - + @endpush - diff --git a/resources/views/Shop/layout/partials/header-profile.blade.php b/resources/views/Shop/layout/partials/header-profile.blade.php index c38280d8..4e5adeb6 100644 --- a/resources/views/Shop/layout/partials/header-profile.blade.php +++ b/resources/views/Shop/layout/partials/header-profile.blade.php @@ -1,12 +1,13 @@ -