minor fixes

This commit is contained in:
ludo
2023-12-09 21:02:28 +01:00
parent bbf4bc4232
commit 7561a8e8ba
49 changed files with 448 additions and 266 deletions

View File

@@ -13,10 +13,18 @@ class CustomersDataTable extends DataTable
public function query(Customer $model)
{
$model = $model->with('addresses');
$model = self::filterBySaleChannel($model);
return $this->buildQuery($model);
}
public static function filterBySaleChannel($model, $sale_channel_id = false)
{
$sale_channel_id = $sale_channel_id ? $sale_channel_id : self::isFilteredByField('sale_channel_id');
return $sale_channel_id ? $model->bySaleChannel($sale_channel_id) : $model;
}
protected function getColumns()
{
return [

View File

@@ -13,10 +13,18 @@ class DeliveriesDataTable extends DataTable
public function query(Delivery $model)
{
$model = $model->with('sale_channel');
$model = self::filterBySaleChannel($model);
return $this->buildQuery($model);
}
public static function filterBySaleChannel($model, $sale_channel_id = false)
{
$sale_channel_id = $sale_channel_id ? $sale_channel_id : self::isFilteredByField('sale_channel_id');
return $sale_channel_id ? $model->bySaleChannel($sale_channel_id) : $model;
}
public function modifier($datatables)
{
$datatables
@@ -26,7 +34,7 @@ class DeliveriesDataTable extends DataTable
'on' => __('active'),
'off' => __('inactive'),
'meta' => 'data-id='.$delivery->id,
'size' => 'sm',
'size' => 'xs',
]);
})
->editColumn('is_public', function (Delivery $delivery) {

View File

@@ -12,7 +12,7 @@ class SaleChannelsDataTable extends DataTable
public function query(SaleChannel $model)
{
$model = $model->withCount(['deliveries', 'tariffs']);
$model = $model->withCount(['customers', 'deliveries', 'tariffs']);
return $this->buildQuery($model);
}
@@ -22,6 +22,7 @@ class SaleChannelsDataTable extends DataTable
return [
Column::make('code')->title('Code abrégé')->width(100),
Column::make('name')->title('Nom'),
Column::make('customers_count')->title('#Clients')->searchable(false)->class('text-right'),
Column::make('deliveries_count')->title('#Distrib')->searchable(false)->class('text-right'),
Column::make('tariffs_count')->title('#Tarifs')->searchable(false)->class('text-right'),
$this->makeColumnButtons(),

View File

@@ -2,7 +2,7 @@
namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Shop\CustomerAddressesDataTable;
use App\Datatables\Admin\Shop\CustomerAddressesDataTable;
use App\Repositories\Shop\CustomerAddresses;
use Illuminate\Http\Request;

View File

@@ -5,21 +5,20 @@ namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Admin\Shop\CustomerAddressesDataTable;
use App\Datatables\Admin\Shop\CustomersDataTable;
use App\Repositories\Shop\Customers;
use App\Repositories\Shop\Deliveries;
use Illuminate\Http\Request;
class CustomerController extends Controller
{
public function index(CustomersDataTable $dataTable)
{
$data = [];
$data = Customers::init();
return $dataTable->render('Admin.Shop.Customers.list', $data);
}
public function create()
{
$data['deliveries'] = Deliveries::getOptions();
$data = Customers::init();
return view('Admin.Shop.Customers.create', $data);
}
@@ -40,8 +39,8 @@ class CustomerController extends Controller
public function edit($id)
{
$data = Customers::init();
$data['customer'] = Customers::edit($id);
$data['deliveries'] = Deliveries::getOptions();
$model = new CustomerAddressesDataTable();
$data['customer_addresses'] = $model->html();

View File

@@ -4,21 +4,20 @@ namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Admin\Shop\DeliveriesDataTable;
use App\Repositories\Shop\Deliveries;
use App\Repositories\Shop\SaleChannels;
use Illuminate\Http\Request;
class DeliveryController extends Controller
{
public function index(DeliveriesDataTable $dataTable)
{
return $dataTable->render('Admin.Shop.Deliveries.list');
$data = Deliveries::init();
return $dataTable->render('Admin.Shop.Deliveries.list', $data);
}
public function create()
{
$data = [
'sale_channels' => SaleChannels::getOptions(),
];
$data = Deliveries::init();
return view('Admin.Shop.Deliveries.create', $data);
}
@@ -41,10 +40,8 @@ class DeliveryController extends Controller
public function edit($id)
{
$data = [
'delivery' => Deliveries::get($id)->toArray(),
'sale_channels' => SaleChannels::getOptions(),
];
$data = Deliveries::init();
$data['delivery'] = Deliveries::getArray($id);
return view('Admin.Shop.Deliveries.edit', $data);
}

View File

@@ -2,8 +2,8 @@
namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Admin\Shop\InvoicesDataTable;
use App\Datatables\Admin\Shop\InvoicePaymentsDataTable;
use App\Datatables\Admin\Shop\InvoicesDataTable;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\Invoices;
use Illuminate\Http\Request;

View File

@@ -18,7 +18,7 @@ class InvoicePaymentController extends Controller
{
$data = InvoicePayments::init();
return view('Admin.Shop.InvoicePayments.create' , $data);
return view('Admin.Shop.InvoicePayments.create', $data);
}
public function store(Request $request)

View File

@@ -5,9 +5,6 @@ namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Admin\Shop\PriceListsDataTable;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\PriceLists;
use App\Repositories\Shop\SaleChannels;
use App\Repositories\Shop\Tariffs;
use App\Repositories\Shop\Taxes;
use Illuminate\Http\Request;
class PriceListController extends Controller

View File

@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Admin\Shop\ProducersDataTable;
use App\Repositories\Shop\Producers;
use App\Repositories\Shop\TagGroups;
use Illuminate\Http\Request;
class ProducerController extends Controller

View File

@@ -2,11 +2,8 @@
namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Admin\Shop\PriceListsDataTable;
use App\Datatables\Admin\Shop\TariffsDataTable;
use App\Repositories\Shop\SaleChannels;
use App\Repositories\Shop\Tariffs;
use App\Repositories\Shop\TariffUnities;
use Illuminate\Http\Request;
class TariffController extends Controller

View File

@@ -4,8 +4,6 @@ namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Admin\Shop\VariationsDataTable;
use App\Http\Requests\Admin\Shop\StoreVariationPost;
use App\Repositories\Shop\Packages;
use App\Repositories\Shop\Unities;
use App\Repositories\Shop\Variations;
use Illuminate\Http\Request;

View File

@@ -5,7 +5,6 @@ namespace App\Http\Controllers\Shop;
use App\Http\Controllers\Controller;
use App\Repositories\Core\User\ShopCart;
use App\Repositories\Shop\Baskets;
use App\Repositories\Shop\Customers;
use App\Repositories\Shop\Offers;
use App\Repositories\Shop\Orders;
use App\Repositories\Users;

View File

@@ -3,11 +3,8 @@
namespace App\Http\Controllers\Shop;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\ArticleNatures;
use App\Repositories\Shop\Articles;
use App\Repositories\Shop\Categories;
use App\Repositories\Shop\Shelves;
use App\Repositories\Shop\TagGroups;
use Illuminate\Http\Request;
class CategoryController extends Controller

View File

@@ -2,10 +2,9 @@
namespace App\Http\Controllers\Shop;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\Customers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class CustomerController extends Controller

View File

@@ -67,7 +67,7 @@ class OrderController extends Controller
if ($order) {
if ($data['payment_type'] == '1') {
return Paybox::makeAuthorizationRequest($data['basket']['total_shipped']);
// return redirect()->route('Shop.Payments.online');
// return redirect()->route('Shop.Payments.online');
} else {
return redirect()->route('Shop.Orders.confirmed');
}

View File

@@ -60,7 +60,7 @@ class ArticleNature extends Model implements HasMedia
return $query->whereIn($this->table.'.id', $ids);
}
public function registerMediaConversions(Media $media = null): void
public function registerMediaConversions(?Media $media = null): void
{
$this->addMediaConversion('thumb')->fit(Manipulations::FIT_MAX, 60, 32)->keepOriginalImageFormat()->nonQueued();
$this->addMediaConversion('normal')->fit(Manipulations::FIT_MAX, 360, 192)->keepOriginalImageFormat()->nonQueued();

View File

@@ -21,7 +21,6 @@ class Customer extends Authenticatable
protected $casts = ['email_verified_at' => 'datetime'];
public function delivery_addresses()
{
return $this->addresses()->byDelivery();
@@ -32,7 +31,6 @@ class Customer extends Authenticatable
return $this->addresses()->byInvoicing();
}
public function addresses()
{
return $this->hasMany(CustomerAddress::class);
@@ -43,11 +41,21 @@ class Customer extends Authenticatable
return $this->hasMany(CustomerDelivery::class);
}
public function customer_sale_channels()
{
return $this->hasMany(CustomerSaleChannel::class);
}
public function deliveries()
{
return $this->belongsToMany(Delivery::class, CustomerDelivery::class);
}
public function sale_channels()
{
return $this->belongsToMany(SaleChannel::class, CustomerSaleChannel::class)->wherePivotNull('deleted_at');
}
public function invoices()
{
return $this->hasMany(Invoice::class);
@@ -58,6 +66,13 @@ class Customer extends Authenticatable
return $this->hasMany(Order::class);
}
public function scopeBySaleChannel($query, $saleChannelId)
{
return $query->whereHas('sale_channels', function ($query) use ($saleChannelId) {
return $query->byId($saleChannelId);
});
}
public function sendEmailVerificationNotification()
{
if (config('boilerplate.auth.verify_email')) {

View File

@@ -20,13 +20,13 @@ class CustomerDelivery extends Model
return $this->belongsTo(Delivery::class);
}
public function scopeByCustomer($query, $customer_id)
public function scopeByCustomer($query, $customerId)
{
return $query->where($this->table.'.customer_id', $customer_id);
return $query->where($this->table.'.customer_id', $customerId);
}
public function scopeByDelivery($query, $customer_id)
public function scopeByDelivery($query, $deliveryId)
{
return $query->where($this->table.'.delivery_id', $customer_id);
return $query->where($this->table.'.delivery_id', $deliveryId);
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Wildside\Userstamps\Userstamps;
class CustomerSaleChannel extends Model
{
use SoftDeletes, Userstamps;
protected $guarded = ['id'];
protected $table = 'shop_customer_sale_channels';
public function customer()
{
return $this->belongsTo(Customer::class);
}
public function sale_channel()
{
return $this->belongsTo(SaleChannel::class);
}
public function scopeByCustomer($query, $customerId)
{
return $query->where($this->table.'.customer_id', $customerId);
}
public function scopeBySaleChannel($query, $saleChannelId)
{
return $query->where($this->table.'.sale_channel_id', $saleChannelId);
}
}

View File

@@ -67,6 +67,11 @@ class Delivery extends Model
return $query->where($this->table.'.at_house', 1);
}
public function scopeBySaleChannel($query)
{
return $query->where($this->table.'.sale_channel_id', 1);
}
public function scopeManaged($query)
{
return $query->byPublic(0);

View File

@@ -10,6 +10,16 @@ class SaleChannel extends Model
protected $table = 'shop_sale_channels';
public function customer_sale_channels()
{
return $this->hasMany(CustomerSaleChannel::class);
}
public function customers()
{
return $this->belongsToMany(Customer::class, CustomerSaleChannel::class)->wherePivotNull('deleted_at');
}
public function deliveries()
{
return $this->hasMany(Delivery::class);
@@ -29,4 +39,9 @@ class SaleChannel extends Model
{
return $query->where($this->table.'.code', $code);
}
public function scopeById($query, $id)
{
return $query->where($this->table.'.id', $id);
}
}

View File

@@ -4,11 +4,11 @@ namespace App\Repositories\Shop;
use App\Models\Shop\Article;
use App\Models\Shop\Merchandise;
use App\Traits\Model\Basic;
use App\Repositories\Botanic\Species;
use App\Repositories\Botanic\Varieties;
use App\Repositories\Core\Comments;
use App\Repositories\Core\Tag;
use App\Traits\Model\Basic;
use App\Traits\Repository\Imageable;
use Illuminate\Support\Str;
@@ -342,7 +342,7 @@ class Articles
switch ($product_type) {
case 'App\Models\Botanic\Variety':
$product = Varieties::get($product_id);
if (!$product) {
if (! $product) {
break;
}
$data[] = [
@@ -358,7 +358,7 @@ class Articles
break;
case 'App\Models\Botanic\Specie':
$product = Species::get($product_id);
if (!$product) {
if (! $product) {
break;
}
$data[] = [
@@ -369,7 +369,7 @@ class Articles
break;
case 'App\Models\Shop\Merchandise':
$product = Merchandises::get($product_id);
if (!$product) {
if (! $product) {
break;
}
$data[] = [

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Repositories\Shop;
use App\Models\Shop\CustomerSaleChannel;
use App\Traits\Model\Basic;
class CustomerSaleChannels
{
use Basic;
public static function destroyByCustomerAndSaleChannel($customerId, $saleChannelId)
{
return CustomerSaleChannel::byCustomer($customerId)->bySaleChannel($saleChannelId)->delete();
}
public static function getModel()
{
return CustomerSaleChannel::query();
}
}

View File

@@ -14,6 +14,27 @@ class Customers
{
use Basic;
public static function init()
{
return [
'sale_channels' => SaleChannels::getOptions(),
];
}
public static function getSaleChannelIds($customerId = false)
{
$channels = self::getSaleChannels($customerId);
return $channels ? $channels->pluck('id')->toArray() : false;
}
public static function getSaleChannels($customerId = false)
{
$customer = $customerId ? self::get($customerId) : self::getAuth();
return $customer ? $customer->sale_channels : SaleChannels::getDefault();
}
public static function getSaleChannel()
{
return SaleChannels::getDefault();
@@ -129,22 +150,25 @@ class Customers
public static function edit($id)
{
$customer = self::get($id, ['delivery_addresses', 'invoice_addresses']);
$customer = self::get($id, ['delivery_addresses', 'invoice_addresses', 'sale_channels']);
$data = $customer->toArray();
$data['deliveries'] = $customer->deliveries->pluck('id')->toArray();
$data['sale_channels'] = $customer->sale_channels->pluck('id')->toArray();
return $data;
}
public static function storeFull($data)
{
$deliveries = $data['deliveries'];
$invoices = $data['invoices'];
unset($data['deliveries']);
unset($data['invoices']);
// $invoices = $data['invoices'];
$saleChannels = $data['sale_channels'];
// unset($data['invoices']);
unset($data['sale_channels']);
$customer = self::store($data);
self::storeAddresses($customer, $deliveries);
self::storeAddresses($customer, $invoices);
if ($customer) {
// self::storeAddresses($customer->id, $deliveries);
// self::storeAddresses($customer->id, $invoices);
self::storeSaleChannels($customer->id, $saleChannels);
}
return $customer->id;
}
@@ -163,31 +187,37 @@ class Customers
return $customer->deliveries()->sync($deliveries);
}
public static function storeAddresses($customer, $addresses)
public static function storeAddresses($customerId, $addresses)
{
foreach ($addresses as $address) {
$address['customer_id'] = $customer->id;
$address['customer_id'] = $customerId;
CustomerAddresses::store($address);
}
}
public static function storeSaleChannels($customerId, $saleChannels)
{
$oldSaleChannels = self::getSaleChannelIds($customerId);
$deleteSaleChannels = array_diff($oldSaleChannels, $saleChannels);
$newSaleChannels = array_diff($saleChannels, $oldSaleChannels);
$data = ['customer_id' => $customerId];
foreach ($newSaleChannels as $saleChannelId) {
$data['sale_channel_id'] = $saleChannelId;
CustomerSaleChannels::store($data);
}
foreach ($deleteSaleChannels as $saleChannelId) {
CustomerSaleChannels::destroyByCustomerAndSaleChannel($customerId, $saleChannelId);
}
}
public static function create($data)
{
return Customer::create([
'uuid' => Str::uuid(),
'active' => true,
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
'company' => $data['company'],
'tva' => $data['tva'],
'phone' => $data['phone'],
'address' => $data['address'],
'address2' => $data['address2'],
'zipcode' => $data['zipcode'],
'city' => $data['city'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
$data['uuid'] = Str::uuid();
$data['active'] = true;
$data['password'] = bcrypt($data['password']);
return Customer::create($data);
}
public static function getStorage($filename = false)

View File

@@ -9,6 +9,13 @@ class Deliveries
{
use Basic;
public static function init()
{
return [
'sale_channels' => SaleChannels::getOptions(),
];
}
public static function getSaleChannelId($deliveryId)
{
return $deliveryId ? Deliveries::getField($deliveryId, 'sale_channel_id') : SaleChannels::getDefaultID();

View File

@@ -3,8 +3,8 @@
namespace App\Repositories\Shop;
use App\Models\Shop\Merchandise;
use App\Traits\Model\Basic;
use App\Repositories\Core\Tag;
use App\Traits\Model\Basic;
use App\Traits\Repository\Imageable;
class Merchandises
@@ -68,7 +68,6 @@ class Merchandises
return Tag::storeTags($merchandise, $tags);
}
public static function getModel()
{
return Merchandise::query();

View File

@@ -3,7 +3,6 @@
namespace App\Repositories\Shop;
use App\Models\Shop\Offer;
use App\Models\Shop\PriceList;
use App\Traits\Model\Basic;
class Offers
@@ -30,6 +29,7 @@ class Offers
{
return Offer::with('variation')->byIds($ids)->get();
}
public static function getWithPricesByIds($ids, $saleChannelId = false)
{
$saleChannelId = $saleChannelId ? $saleChannelId : SaleChannels::getDefaultID();

View File

@@ -29,6 +29,7 @@ class Orders
$data = $order->toArray();
$data['payment_type'] = InvoicePayments::getPaymentType($order->payment_type);
$data['status'] = Orders::getStatus($order->status);
return $data;
}

View File

@@ -47,7 +47,6 @@ class PriceLists
return PriceList::byTariff($id)->get();
}
public static function edit($id)
{
$price_list = self::getFull($id)->toArray();

View File

@@ -2,10 +2,6 @@
namespace App\Repositories\Shop;
use App\Models\Shop\Category;
use App\Repositories\Core\Categories as CategoryTrees;
use App\Repositories\Core\Tag;
class Shelves
{
public static function getOffersByCategoryAndNature($categoryId, $articleNatureId = false, $tags = [], $articleNature = false, $displayByRows = false)
@@ -29,6 +25,7 @@ class Shelves
$productType = ArticleNatures::getProductTypeBySlug($articleNature);
$articleNatureId = ArticleNatures::getIdBySlug($articleNature);
}
return [
'category' => Categories::getFull($categoryId),
'breadcrumb' => Categories::getAncestorsByCategory($categoryId),

View File

@@ -23,6 +23,7 @@ class Tariffs
],
];
}
public static function autocomplete($str)
{
$data = Tariff::byAutocomplete($str)->orderBy('name')->limit(30)->get()->pluck('name', 'id');

View File

@@ -17,6 +17,7 @@ class Variations
'unities' => Unities::getOptions(),
];
}
public static function autocomplete($str)
{
$data = Variation::where('name', 'LIKE', "%${str}%")->orderBy('name')->limit(30)->get()->pluck('name', 'id');
@@ -57,7 +58,6 @@ class Variations
return Packages::getName($data['package_id']).' '.$data['quantity'].' '.Unities::getName($data['unity_id']);
}
public static function getFull($id)
{
return Variation::with(['package', 'unity'])->findOrFail($id);

View File

@@ -190,6 +190,7 @@ trait Basic
if ($stopStamping) {
$model->stopUserstamping();
}
return $model;
}
}

View File

@@ -20,7 +20,7 @@ trait Imageable
return $this->hasOne(Media::class, 'model_id')->where('model_type', get_class($this))->latest();
}
public function registerMediaConversions(Media $media = null): void
public function registerMediaConversions(?Media $media = null): void
{
$watermark = public_path('img/watermark.png');

View File

@@ -46,10 +46,9 @@
"kmlaravel/laravel-geographical-calculator": "^2.1",
"knplabs/knp-snappy": "^1.2",
"laracasts/utilities": "^3.0",
"laracraft-tech/laravel-date-scopes": "^1.1",
"laracraft-tech/laravel-date-scopes": "^2.0",
"laravel/framework": "^9.0",
"laravel/helpers": "^1.1",
"laravel/pint": "^1.10",
"laravel/scout": "^9.1",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.0",
@@ -70,7 +69,7 @@
"proengsoft/laravel-jsvalidation": "^4.5",
"protonemedia/laravel-cross-eloquent-search": "^3.0",
"rahul900day/laravel-captcha": "^1.0",
"ralphjsmit/laravel-seo": "^1.0",
"ralphjsmit/laravel-seo": "^1.4",
"reedware/laravel-relation-joins": "^3.0",
"respect/validation": "^2.2",
"rinvex/laravel-categories": "^6.0",
@@ -114,6 +113,7 @@
"fossbarrow/laravel-phpcs": "dev-main",
"kevincobain2000/laravel-erd": "^1.3",
"kitloong/laravel-migrations-generator": "^6.0",
"laravel/pint": "^1.13",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.6",

View File

@@ -173,17 +173,17 @@ return [
'confirmdelete' => 'Confirmez-vous la suppression de l\'offre ?',
],
'packages' => [
'title' => 'Déclinaisons',
'name' => 'Déclinaison',
'description' => 'Gérer les déclinaisons',
'add' => 'Ajouter une déclinaison',
'edit' => 'Editer une déclinaison',
'del' => 'Effacer une déclinaison',
'list' => 'Liste des déclinaisons',
'successadd' => 'La déclinaison été correctement ajoutée',
'successmod' => 'La déclinaison a été correctement modifiée',
'successdel' => 'La déclinaison a été correctement effacée',
'confirmdelete' => 'Confirmez-vous la suppression de la déclinaison ?',
'title' => 'Packages',
'name' => 'Package',
'description' => 'Gérer les packages',
'add' => 'Ajouter un package',
'edit' => 'Editer un package',
'del' => 'Effacer un package',
'list' => 'Liste des packages',
'successadd' => 'Le package été correctement ajouté',
'successmod' => 'Le package a été correctement modifié',
'successdel' => 'Le package a été correctement effacé',
'confirmdelete' => 'Confirmez-vous la suppression du package ?',
],
'producers' => [
'title' => 'Producteurs',

View File

@@ -1,35 +1,35 @@
@extends('layout.index', [
'title' => __('shop.articles.title'),
'subtitle' => __('shop.articles.list'),
'breadcrumb' => [__('shop.articles.title')]
'title' => __('shop.articles.title'),
'subtitle' => __('shop.articles.list'),
'breadcrumb' => [__('shop.articles.title')],
])
@section('content')
@component('components.card')
@include('components.datatable', [
'route' => route('Admin.Shop.Articles.index'),
'model' => 'articles',
'with_filters' => true,
'callback' => 'handleArticle()',
])
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-articles-filters'])
@include('Admin.Shop.Articles.partials.filters', ['model' => 'articles'])
@endcomponent
@endcomponent
<x-card>
@include('components.datatable', [
'route' => route('Admin.Shop.Articles.index'),
'model' => 'articles',
'with_filters' => true,
'callback' => 'handleArticle()',
])
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-articles-filters'])
@include('Admin.Shop.Articles.partials.filters', ['model' => 'articles'])
@endcomponent
</x-card>
@endsection
@include('load.form.select2')
@include('load.form.toggle')
@push('js')
<script>
function handleArticle() {
initToggle("{{ route('Admin.Shop.Articles.toggleVisible') }}", '.visible');
initToggle("{{ route('Admin.Shop.Articles.toggleHomepage') }}", '.homepage');
}
<script>
function handleArticle() {
initToggle("{{ route('Admin.Shop.Articles.toggleVisible') }}", '.visible');
initToggle("{{ route('Admin.Shop.Articles.toggleHomepage') }}", '.homepage');
}
$(document).ready(function () {
initSelect2();
});
</script>
$(document).ready(function() {
initSelect2();
});
</script>
@endpush

View File

@@ -1,121 +1,123 @@
<div class="row">
<div class="col-md-6">
<div class="row mb-3">
<div class="col-6">
{{ Form::label('first_name', 'Prénom') }}
@include('components.form.input', [
'name' => 'first_name',
'value' => $customer['first_name'] ?? null,
'required' => true,
])
<div class="col-6">
<x-card>
<div class="row mb-3">
<div class="col-6">
@include('components.form.input', [
'name' => 'first_name',
'value' => $customer['first_name'] ?? null,
'required' => true,
'label' => 'Prénom',
])
</div>
<div class="col-6">
@include('components.form.input', [
'name' => 'last_name',
'value' => $customer['last_name'] ?? null,
'required' => true,
'label' => 'Nom',
])
</div>
</div>
<div class="col-6">
{{ Form::label('last_name', 'Nom') }}
@include('components.form.input', [
'name' => 'last_name',
'value' => $customer['last_name'] ?? null,
'required' => true,
])
<div class="row mb-3">
<div class="col-12">
@include('components.form.input', [
'name' => 'company',
'value' => $customer['company'] ?? null,
'label' => 'Société',
])
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('company', 'Société') }}
@include('components.form.input', [
'name' => 'company',
'value' => $customer['company'] ?? null,
])
<div class="row mb-3">
<div class="col-12">
@include('components.form.input', [
'name' => 'tva',
'value' => $customer['tva'] ?? null,
'label' => 'TVA',
])
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('tva', 'TVA') }}
@include('components.form.input', [
'name' => 'tva',
'value' => $customer['tva'] ?? null,
])
<div class="row mb-3">
<div class="col-6">
@include('components.form.input', [
'name' => 'email',
'value' => $customer['email'] ?? null,
'required' => true,
'label' => 'Email',
])
</div>
<div class="col-6">
@include('components.form.input', [
'name' => 'phone',
'value' => $customer['phone'] ?? null,
'label' => 'Téléphone',
])
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-6">
{{ Form::label('email', 'Email') }}
@include('components.form.input', [
'name' => 'email',
'value' => $customer['email'] ?? null,
'required' => true,
])
</div>
<div class="col-6">
{{ Form::label('phone', 'Téléphone') }}
@include('components.form.input', [
'name' => 'phone',
'value' => $customer['phone'] ?? null,
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('address', 'Adresse') }}
@include('components.form.input', [
'name' => 'address',
'value' => $customer['address'] ?? null,
'required' => true,
])
<div class="row mb-3">
<div class="col-12">
@include('components.form.input', [
'name' => 'address',
'value' => $customer['address'] ?? null,
'required' => true,
'label' => 'Adresse',
])
</div>
</div>
</div>
<div class="row">
<div class="col-12">
{{ Form::label('address2', 'Adresse complémentaire') }}
@include('components.form.input', [
'name' => 'address2',
'value' => $customer['address2'] ?? null,
])
<div class="row mb-3">
<div class="col-12">
@include('components.form.input', [
'name' => 'address2',
'value' => $customer['address2'] ?? null,
'label' => 'Adresse complémentaire',
])
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-4">
{{ Form::label('zipcode', 'Code postal') }}
@include('components.form.input', [
'name' => 'zipcode',
'value' => $customer['zipcode'] ?? null,
'required' => true,
])
<div class="row mb-3">
<div class="col-4">
@include('components.form.input', [
'name' => 'zipcode',
'value' => $customer['zipcode'] ?? null,
'required' => true,
'label' => 'Code postal',
])
</div>
<div class="col-8">
@include('components.form.input', [
'name' => 'city',
'value' => $customer['city'] ?? null,
'required' => true,
'label' => 'Ville',
])
</div>
</div>
<div class="col-8">
{{ Form::label('city', 'Ville') }}
@include('components.form.input', [
'name' => 'city',
'value' => $customer['city'] ?? null,
'required' => true,
])
</div>
</div>
<div class="row mb-3">
<div class="col-6">
{{ 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,
])
<div class="row mb-3">
<div class="col-12">
@include('components.form.select', [
'name' => 'sale_channels[]',
'list' => $sale_channels ?? [],
'values' => $customer['sale_channels'] ?? null,
'with_empty' => '',
'class' => 'select2',
'multiple' => true,
'label' => __('shop.sale_channels.name'),
])
</div>
</div>
</div>
</x-card>
</div>
<div class="col-md-6">
@component('components.layout.box-collapse', ['title' => __('Adresses'), 'id' => 'form-customer-address'])
<div class="col-6">
<x-layout.box-collapse title='Adresses' id='form-customer-address'>
@include('Admin.Shop.CustomerAddresses.list', ['dataTable' => $customer_addresses])
@endcomponent
</x-layout.box-collapse>
</div>
</div>
@include('components.save')
<x-save />
@include('load.form.save')
@include('load.form.select2')

View File

@@ -1,11 +1,18 @@
@extends('layout.index', [
'title' => __('shop.customers.title'),
'subtitle' => __('shop.customers.list'),
'breadcrumb' => [__('shop.customers.title')]
'title' => __('shop.customers.title'),
'subtitle' => __('shop.customers.list'),
'breadcrumb' => [__('shop.customers.title')],
])
@section('content')
@component('components.card')
@include('components.datatable', ['route' => route('Admin.Shop.Customers.index'), 'model' => 'customers'])
@endcomponent
<x-card>
@include('components.datatable', [
'route' => route('Admin.Shop.Customers.index'),
'model' => 'customers',
'with_filters' => true,
])
<x-layout.modal title="Filtres" id="modal-customers-filters">
@include('Admin.Shop.Customers.partials.filters', ['model' => 'customers'])
</x-layout.modal>
</x-card>
@endsection

View File

@@ -0,0 +1,14 @@
<form id="{{ $model }}-filters">
<div class="row mb-3">
<label class="col-4">{{ __('shop.sale_channels.name') }}</label>
<div class="col-8">
@include('components.form.select', [
'name' => 'sale_channel_id',
'list' => $sale_channels ?? [],
'value' => $filters['sale_channel_id'] ?? null,
'with_empty' => '',
'class' => 'select2',
])
</div>
</div>
</form>

View File

@@ -1,26 +1,34 @@
@extends('layout.index', [
'title' => __('shop.deliveries.title'),
'subtitle' => __('shop.deliveries.list'),
'breadcrumb' => [__('shop.deliveries.title')]
'title' => __('shop.deliveries.title'),
'subtitle' => __('shop.deliveries.list'),
'breadcrumb' => [__('shop.deliveries.title')],
])
@section('content')
@component('components.card')
@include('components.datatable', ['route' => route('Admin.Shop.Deliveries.index'), 'model' => 'deliveries', 'callback' => 'handleDelivery();'])
@endcomponent
<x-card>
@include('components.datatable', [
'route' => route('Admin.Shop.Deliveries.index'),
'model' => 'deliveries',
'with_filters' => true,
'callback' => 'handleDelivery();',
])
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-deliveries-filters'])
@include('Admin.Shop.Deliveries.partials.filters', ['model' => 'deliveries'])
@endcomponent
</x-card>
@endsection
@include('load.form.select2')
@include('load.form.toggle')
@push('js')
<script>
function handleDelivery() {
initToggle("{{ route('Admin.Shop.Deliveries.toggleActive') }}");
}
<script>
function handleDelivery() {
initToggle("{{ route('Admin.Shop.Deliveries.toggleActive') }}");
}
$(document).ready(function () {
initSelect2();
});
</script>
$(document).ready(function() {
initSelect2();
});
</script>
@endpush

View File

@@ -1,5 +1,14 @@
<form id="{{ $model }}-filters">
<div class="row mb-3">
</div>
<div class="row mb-3">
<label class="col-4">{{ __('shop.sale_channels.name') }}</label>
<div class="col-8">
@include('components.form.select', [
'name' => 'sale_channel_id',
'list' => $sale_channels ?? [],
'value' => $filters['sale_channel_id'] ?? null,
'with_empty' => '',
'class' => 'select2',
])
</div>
</div>
</form>

View File

@@ -1,6 +1,13 @@
<div class="row">
<div class="row mb-3">
<div class="col-6">
@include('components.form.select', [
@include('components.form.datepicker', [
'label' => 'Date',
'name' => 'date',
'value' => $invoice_payment['date'] ?? null,
])
</div>
<div class="col-6">
@include('components.form.select', [
'label' => 'Règlement',
'name' => 'payment_type',
'list' => $payment_types ?? [],
@@ -8,8 +15,10 @@
'class' => 'select2',
])
</div>
</div>
<div class="row mb-3">
<div class="col-6">
@include('components.form.input', [
@include('components.form.inputs.money', [
'label' => 'Montant',
'name' => 'amount',
'value' => $invoice_payment['amount'] ?? null,

View File

@@ -1,14 +1,21 @@
@extends('layout.index', [
'title' => __('shop.packages.title'),
'subtitle' => __('shop.packages.list'),
'breadcrumb' => [__('shop.packages.title')]
'title' => __('shop.packages.title'),
'subtitle' => __('shop.packages.list'),
'breadcrumb' => [__('shop.packages.title')],
])
@section('content')
@component('components.card')
@include('components.datatable', ['route' => route('Admin.Shop.Packages.index'), 'model' => 'packages', 'with_filters' => true])
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-packages-filters'])
@include('Admin.Shop.Packages.partials.filters')
@endcomponent
@endcomponent
<x-card>
@include('components.datatable', [
'route' => route('Admin.Shop.Packages.index'),
'model' => 'packages',
'with_filters' => true,
])
@component('components.layout.modal', [
'title' => 'Filtres',
'id' => 'modal-packages-filters',
])
@include('Admin.Shop.Packages.partials.filters')
@endcomponent
</x-card>
@endsection