diff --git a/app/Datatables/Shop/CustomerOrdersDataTable.php b/app/Datatables/Shop/CustomerOrdersDataTable.php
index b51c713e..dc1eaa36 100644
--- a/app/Datatables/Shop/CustomerOrdersDataTable.php
+++ b/app/Datatables/Shop/CustomerOrdersDataTable.php
@@ -51,11 +51,11 @@ class CustomerOrdersDataTable extends DataTable
protected function getColumns()
{
return [
- Column::make('status')->title('Statut'),
- Column::make('ref')->title('Ref'),
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/Shop/OrdersDataTable.php b/app/Datatables/Shop/OrdersDataTable.php
index c61846ca..a6ed007d 100644
--- a/app/Datatables/Shop/OrdersDataTable.php
+++ b/app/Datatables/Shop/OrdersDataTable.php
@@ -47,19 +47,19 @@ class OrdersDataTable extends DataTable
public function getHtmlButtons()
{
- return self::getButtonShow();
+ return ' ';
}
protected function getColumns()
{
return [
- Column::make('ref')->title('Ref'),
- Column::make('status')->title('Statut'),
Column::make('created_at')->title('Date'),
+ Column::make('ref')->title('Ref'),
Column::make('customer.last_name')->title('Client'),
Column::make('delivery.name')->title('Point de distribution'),
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/Http/Controllers/Shop/BasketController.php b/app/Http/Controllers/Shop/BasketController.php
index 800036e2..f01f3b6f 100644
--- a/app/Http/Controllers/Shop/BasketController.php
+++ b/app/Http/Controllers/Shop/BasketController.php
@@ -16,7 +16,8 @@ class BasketController extends Controller
{
$offerId = $request->input('offer_id');
$quantity = $request->input('quantity') ?? 1;
- $price = Offers::getPrice($offerId, $quantity)->price_taxed;
+ $offer = Offers::getPrice($offerId, $quantity);
+ $price = $offer ? $offer->price_taxed : 0;
return number_format($quantity * $price, 2);
}
diff --git a/app/Http/Controllers/Shop/CustomerController.php b/app/Http/Controllers/Shop/CustomerController.php
index d23be811..16803569 100644
--- a/app/Http/Controllers/Shop/CustomerController.php
+++ b/app/Http/Controllers/Shop/CustomerController.php
@@ -2,16 +2,19 @@
namespace App\Http\Controllers\Shop;
-use App\Http\Controllers\Controller;
-use App\Repositories\Shop\Customers;
use Illuminate\Http\Request;
+use App\Http\Controllers\Controller;
+
+use App\Repositories\Shop\Customers;
use Illuminate\Support\Facades\Auth;
class CustomerController extends Controller
{
public function profile($id = false)
{
- return view('Shop.Customers.profile', Customers::editProfile($id));
+ $data = Customers::editProfile($id);
+
+ return view('Shop.Customers.profile', $data);
}
public function modalProfile($id = false)
@@ -23,15 +26,27 @@ class CustomerController extends Controller
public function edit()
{
- return view('Shop.Customers.edit', [
- 'customer' => Customers::getArray(Auth::id(), 'addresses'),
- ]);
+ $id = Auth::id();
+ $data['customer'] = Customers::edit($id);
+
+ return view('Shop.Customers.edit', $data);
}
public function storeProfileAjax(Request $request)
{
- $customer = Customers::store($request->all());
+ $data = $request->all();
+ $customer = Customers::store($data);
return response()->json(['error' => 0]);
}
+
+ public function store(Request $request)
+ {
+ $data = $request->all();
+ dump($data);
+ exit;
+ $customer = Customers::storeFull($data);
+
+ return response()->json(['error' => 0]);
+ }
}
diff --git a/app/Http/Controllers/Shop/OrderController.php b/app/Http/Controllers/Shop/OrderController.php
index eeaaa4b0..4610aebb 100644
--- a/app/Http/Controllers/Shop/OrderController.php
+++ b/app/Http/Controllers/Shop/OrderController.php
@@ -8,6 +8,7 @@ use App\Repositories\Core\User\ShopCart;
use App\Repositories\Shop\Baskets;
use App\Repositories\Shop\Customers;
use App\Repositories\Shop\Deliveries;
+use App\Repositories\Shop\DeliveryTypes;
use App\Repositories\Shop\OrderMails;
use App\Repositories\Shop\Orders;
use App\Repositories\Shop\Paybox;
@@ -18,17 +19,19 @@ class OrderController extends Controller
{
public function index(OrdersDataTable $dataTable)
{
- return $dataTable->render('Shop.Orders.partials.list', $data ?? []);
+ return $dataTable->render('Shop.Orders.partials.list');
}
public function view($uuid)
{
- $data = Orders::getByUUID($uuid);
+ $data['order'] = Orders::view($uuid);
+
+ return view('Shop.Orders.view', $data);
}
public function pdf($uuid)
{
- $data = Orders::getByUUID($uuid);
+ $data['order'] = Orders::getByUUID($uuid);
return view('Shop.Orders.pdf', $data);
}
@@ -43,6 +46,7 @@ class OrderController extends Controller
'basket' => ShopCart::getSummary(),
'deliveries' => Deliveries::getAllWithSaleChannel()->toArray(),
'sale_channel' => SaleChannels::getDefault()->toArray(),
+ 'delivery_types' => DeliveryTypes::getAll(),
];
return view('Shop.Orders.order', $data);
diff --git a/app/Http/Requests/Admin/Shop/StoreArticlePost.php b/app/Http/Requests/Admin/Shop/StoreArticlePost.php
new file mode 100644
index 00000000..91f080d4
--- /dev/null
+++ b/app/Http/Requests/Admin/Shop/StoreArticlePost.php
@@ -0,0 +1,23 @@
+ 'required|unique:articles,ref,'.$this->ref,
+ 'product_type' => 'required',
+ 'product_id' => 'required',
+ 'article_nature_id' => 'required',
+ ];
+ }
+}
diff --git a/app/Models/Shop/Customer.php b/app/Models/Shop/Customer.php
index a3450a23..aebb8fa9 100644
--- a/app/Models/Shop/Customer.php
+++ b/app/Models/Shop/Customer.php
@@ -4,8 +4,6 @@ namespace App\Models\Shop;
use App\Notifications\ResetPassword;
use App\Notifications\VerifyEmail;
-use Illuminate\Database\Eloquent\Relations\BelongsToMany;
-use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
@@ -23,37 +21,39 @@ class Customer extends Authenticatable
protected $casts = ['email_verified_at' => 'datetime'];
- public function addresses(): HasMany
+
+ public function delivery_addresses()
+ {
+ return $this->addresses()->byDelivery();
+ }
+
+ public function invoice_addresses()
+ {
+ return $this->addresses()->byInvoicing();
+ }
+
+
+ public function addresses()
{
return $this->hasMany(CustomerAddress::class);
}
- public function invoicing_addresses(): HasMany
- {
- return $this->addresses()->where('type', 2);
- }
-
- public function delivery_addresses(): HasMany
- {
- return $this->addresses()->where('type', 1);
- }
-
- public function customer_deliveries(): HasMany
+ public function customer_deliveries()
{
return $this->hasMany(CustomerDelivery::class);
}
- public function deliveries(): BelongsToMany
+ public function deliveries()
{
return $this->belongsToMany(Delivery::class, CustomerDelivery::class);
}
- public function invoices(): HasMany
+ public function invoices()
{
return $this->hasMany(Invoice::class);
}
- public function orders(): HasMany
+ public function orders()
{
return $this->hasMany(Order::class);
}
diff --git a/app/Repositories/Shop/Baskets.php b/app/Repositories/Shop/Baskets.php
index 7bed97ef..ad843b04 100644
--- a/app/Repositories/Shop/Baskets.php
+++ b/app/Repositories/Shop/Baskets.php
@@ -17,16 +17,17 @@ class Baskets
return $data ? ShopCart::add($data, $update) : false;
}
- public static function getBasketSummary($sale_channel_id = false)
+ public static function getBasketSummary($saleChannelId = false)
{
$basket = ShopCart::getContent();
$offers = Offer::with('variation')->whereIn('id', ShopCart::keys())->get();
$total = 0;
- $total_taxed = 0;
+ $totalTaxed = 0;
$shipping = 5;
foreach ($basket as $item) {
$offer = $offers->where('id', $item->id)->first();
- $prices = Offers::getPrice($item->id, $item->quantity, $sale_channel_id);
+ $prices = Offers::getPrice($item->id, $item->quantity, $saleChannelId);
+ $weight = $offer->weight * $item->quantity;
$detail[] = [
'offer_id' => (int) $item->id,
'name' => $offer->article->name.' ('.$offer->variation->name.')',
@@ -37,17 +38,18 @@ class Baskets
'total' => self::getTotal($item->quantity, $prices->price),
'total_tax' => self::getTotal($item->quantity, $prices->price_taxed - $prices->price),
'total_taxed' => self::getTotal($item->quantity, $prices->price_taxed),
+ 'weight' => $weight,
];
$total += self::getTotal($item->quantity, $prices->price);
- $total_taxed += self::getTotal($item->quantity, $prices->price_taxed);
+ $totalTaxed += self::getTotal($item->quantity, $prices->price_taxed);
}
$data = [
'detail' => $detail,
'total' => $total,
- 'taxes' => $total_taxed - $total,
- 'total_taxed' => $total_taxed,
+ 'taxes' => $totalTaxed - $total,
+ 'total_taxed' => $totalTaxed,
'shipping' => $shipping,
- 'total_shipped' => $total_taxed + $shipping,
+ 'total_shipped' => $totalTaxed + $shipping,
];
return $data ?? false;
@@ -58,9 +60,9 @@ class Baskets
return $quantity * $price;
}
- public static function getBasket($sale_channel_id = false)
+ public static function getBasket($saleChannelId = false)
{
- $sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
+ $saleChannelId = $saleChannelId ? $saleChannelId : SaleChannels::getDefaultID();
$basket = ShopCart::getContent();
// dump($basket->toArray());
$offers = Offer::with([
@@ -69,7 +71,7 @@ class Baskets
'article.product.Specie',
'article.image',
'price_lists.price_list_values',
- ])->withPriceListsBySaleChannel($sale_channel_id)
+ ])->withPriceListsBySaleChannel($saleChannelId)
->whereIn('id', ShopCart::keys())->get();
foreach ($basket as $item) {
$offer = $offers->where('id', $item->id)->first();
diff --git a/app/Repositories/Shop/Customers.php b/app/Repositories/Shop/Customers.php
index 68c0f308..4c89988d 100644
--- a/app/Repositories/Shop/Customers.php
+++ b/app/Repositories/Shop/Customers.php
@@ -84,7 +84,9 @@ class Customers
public static function getWithAddresses($id = false)
{
- return self::get($id, ['invoicing_addresses', 'delivery_addresses']);
+ $id = $id ? $id : self::getId();
+
+ return self::get($id, ['invoice_addresses', 'delivery_addresses']);
}
public static function getName($id = false)
@@ -99,18 +101,16 @@ class Customers
return self::guard()->user();
}
- public static function get($id, $relations = false, $relationsCount = false)
- {
- $id = $id ? $id : self::getId();
-
- return self::getModelRelations($relations, $relationsCount)->find($id);
- }
-
public static function getId()
{
return self::guard()->id();
}
+ public static function isNotConnected()
+ {
+ return ! self::isConnected();
+ }
+
public static function isConnected()
{
return self::guard()->check();
@@ -118,7 +118,7 @@ class Customers
public static function edit($id)
{
- $customer = self::get($id, 'addresses');
+ $customer = self::get($id, ['delivery_addresses', 'invoice_addresses']);
$data = $customer->toArray();
$data['deliveries'] = $customer->deliveries->pluck('id')->toArray();
@@ -128,12 +128,12 @@ class Customers
public static function storeFull($data)
{
$deliveries = $data['deliveries'];
- $addresses = $data['addresses'];
+ $invoices = $data['invoices'];
unset($data['deliveries']);
- unset($data['addresses']);
+ unset($data['invoices']);
$customer = self::store($data);
- self::storeDeliveries($customer, $deliveries);
- self::storeAddresses($customer, $addresses);
+ self::storeAddresses($customer, $deliveries);
+ self::storeAddresses($customer, $invoices);
return $customer->id;
}
diff --git a/app/Repositories/Shop/Offers.php b/app/Repositories/Shop/Offers.php
index b3971ebe..3ce58d6c 100644
--- a/app/Repositories/Shop/Offers.php
+++ b/app/Repositories/Shop/Offers.php
@@ -11,17 +11,24 @@ class Offers
return Offer::count();
}
- public static function getFull($id, $sale_channel_id = false)
+ public static function getWeight($id, $quantity = 1)
{
- $sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
+ $offer = self::get($id);
+
+ return $offer ? $offer->weight * $quantity : 0;
+ }
+
+ public static function getFull($id, $saleChannelId = false)
+ {
+ $saleChannelId = $saleChannelId ? $saleChannelId : SaleChannels::getDefaultID();
$offer = Offer::with([
'article.article_nature',
'article.product',
- 'tariff' => function ($query) use ($sale_channel_id) {
- $query->bySaleChannel($sale_channel_id);
+ 'tariff' => function ($query) use ($saleChannelId) {
+ $query->bySaleChannel($saleChannelId);
},
- 'tariff.price_lists' => function ($query) use ($sale_channel_id) {
- $query->BySaleChannel($sale_channel_id);
+ 'tariff.price_lists' => function ($query) use ($saleChannelId) {
+ $query->BySaleChannel($saleChannelId);
},
'tariff.price_lists.price_list_values',
'variation',
@@ -32,43 +39,43 @@ class Offers
return $offer;
}
- public static function getPrice($id, $quantity = 1, $sale_channel_id = false)
+ public static function getPrice($id, $quantity = 1, $saleChannelId = false)
{
- $sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
- $offer = Offer::withPriceBySaleChannelByQuantity($sale_channel_id, $quantity)->find($id);
+ $saleChannelId = $saleChannelId ? $saleChannelId : SaleChannels::getDefaultID();
+ $offer = Offer::withPriceBySaleChannelByQuantity($saleChannelId, $quantity)->find($id);
return $offer->price_lists->first()->price_list_values->first();
}
- public static function getOffersByArticles($article_ids, $sale_channel_id = false)
+ public static function getOffersByArticles($article_ids, $saleChannelId = false)
{
- return self::getOffersBySaleChannelRaw($sale_channel_id)->byArticles($article_ids)->get();
+ return self::getOffersBySaleChannelRaw($saleChannelId)->byArticles($article_ids)->get();
}
- public static function getOffersByArticle($article_id, $sale_channel_id = false)
+ public static function getOffersByArticle($article_id, $saleChannelId = false)
{
- return self::getOffersBySaleChannelRaw($sale_channel_id)->byArticle($article_id)->get();
+ return self::getOffersBySaleChannelRaw($saleChannelId)->byArticle($article_id)->get();
}
- public static function getOffersBySaleChannel($sale_channel_id = false)
+ public static function getOffersBySaleChannel($saleChannelId = false)
{
- return self::getOffersBySaleChannelRaw($sale_channel_id)->get();
+ return self::getOffersBySaleChannelRaw($saleChannelId)->get();
}
- public static function getOffersBySaleChannelRaw($sale_channel_id = false)
+ public static function getOffersBySaleChannelRaw($saleChannelId = false)
{
- $sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
+ $saleChannelId = $saleChannelId ? $saleChannelId : SaleChannels::getDefaultID();
return Offer::active()->byStockAvailable()
->with([
'article_nature',
'variation',
- 'tariff.price_lists' => function ($query) use ($sale_channel_id) {
- $query->bySaleChannel($sale_channel_id);
+ 'tariff.price_lists' => function ($query) use ($saleChannelId) {
+ $query->bySaleChannel($saleChannelId);
},
'tariff.price_lists.price_list_values',
])
- ->bySaleChannel($sale_channel_id);
+ ->bySaleChannel($saleChannelId);
}
public static function getThumbSrcById($id)
diff --git a/app/Repositories/Shop/Orders.php b/app/Repositories/Shop/Orders.php
index 00a71581..108e865a 100644
--- a/app/Repositories/Shop/Orders.php
+++ b/app/Repositories/Shop/Orders.php
@@ -16,6 +16,22 @@ class Orders
return Order::byUUID($uuid)->first();
}
+ public static function getFullByUUID($uuid)
+ {
+ return Order::with(['customer', 'delivery', 'delivery_address', 'detail', 'invoice.address', 'sale_channel'])
+ ->byUUID($uuid)->first();
+ }
+
+ public static function view($uuid)
+ {
+ $data = [];
+ $order = self::getFullByUUID($uuid);
+ $data = $order->toArray();
+ $data['payment_type'] = InvoicePayments::getPaymentType($order->payment_type);
+ $data['status'] = Orders::getStatus($order->status);
+ return $data;
+ }
+
public static function saveOrder($data)
{
$data += $data['basket'];
diff --git a/resources/views/Admin/Shop/Articles/partials/characteristics.blade.php b/resources/views/Admin/Shop/Articles/partials/characteristics.blade.php
index 10d11769..61554c65 100644
--- a/resources/views/Admin/Shop/Articles/partials/characteristics.blade.php
+++ b/resources/views/Admin/Shop/Articles/partials/characteristics.blade.php
@@ -1,199 +1,213 @@
-
-
-
- {{ Form::label('model', 'Familles de produit') }}
- @include('components.form.select', [
- 'name' => 'product_type',
- 'id_name' => 'product_type',
- 'list' => $models_options,
- 'value' => $article['product_type'] ?? null,
- 'class' => 'select2',
- 'with_empty' => '',
- 'required' => true
- ])
-
-
- {{ Form::label('model_id', 'Produit') }}
- @include('components.form.select', [
- 'name' => 'product_id',
- 'id_name' => 'product_id',
- 'list' => $products ?? [],
- 'value' => $article['product_id'] ?? null,
- 'class' => 'select2',
- 'with_empty' => ''
- ])
-
-
- {{ Form::label('article_nature_id', __('shop.article_natures.name')) }}
- @include('components.form.select', [
- 'name' => 'article_nature_id',
- 'id_name' => 'article_nature_id',
- 'list' => $natures_options,
- 'value' => $article['article_nature_id'] ?? null,
- 'class' => 'select2',
- 'with_empty' => '',
- 'required' => true
- ])
-
-
+
+
+
+ @include('components.form.select', [
+ 'name' => 'product_type',
+ 'id_name' => 'product_type',
+ 'list' => $models_options,
+ 'value' => $article['product_type'] ?? null,
+ 'class' => 'select2',
+ 'with_empty' => '',
+ 'label' => 'Familles de produit',
+ 'required' => true,
+ ])
+
+
+ @include('components.form.select', [
+ 'name' => 'product_id',
+ 'id_name' => 'product_id',
+ 'list' => $products ?? [],
+ 'value' => $article['product_id'] ?? null,
+ 'class' => 'select2',
+ 'with_empty' => '',
+ 'label' => 'Produit',
+ 'required' => true,
+ ])
+
+
+ @include('components.form.select', [
+ 'name' => 'article_nature_id',
+ 'id_name' => 'article_nature_id',
+ 'list' => $natures_options,
+ 'value' => $article['article_nature_id'] ?? null,
+ 'class' => 'select2',
+ 'with_empty' => '',
+ 'label' => __('shop.article_natures.name'),
+ 'required' => true,
+ ])
+
+
-
-
- {{ Form::label('name', 'Nom') }}
- @include('components.form.input', ['name' => 'name', 'value' => $article['name'] ?? null, 'required' => true])
-
-
- {{ Form::label('ref', 'Référence') }}
- @include('components.form.input', ['name' => 'ref', 'value' => $article['ref'] ?? null])
-
-
+
+
+ @include('components.form.input', [
+ 'name' => 'name',
+ 'value' => $article['name'] ?? null,
+ 'label' => 'Nom',
+ 'required' => true,
+ ])
+
+
+ @include('components.form.input', [
+ 'name' => 'ref',
+ 'value' => $article['ref'] ?? null,
+ 'label' => 'Référence',
+ 'required' => true,
+ ])
+
+
-
-
- {{ Form::label('categories', __('shop.shelves.title')) }}
- @include('components.form.select', [
- 'name' => 'categories[]',
- 'list' => $categories_options,
- 'values' => $article['categories'] ?? null,
- 'class' => 'select2',
- 'multiple' => true
- ])
-
-
- {{ Form::label('visible', 'Visible') }}
- @include('components.form.toggle', [
- 'name' => 'visible',
- 'value' => ($article['visible'] ?? null),
- 'on' => __('oui'),
- 'off' => __('non'),
- 'meta' => 'data-id=' . ($article['id'] ?? null),
- 'size' => 'sm',
- ])
-
-
- {{ Form::label('homepage', __('Accueil')) }}
- @include('components.form.toggle', [
- 'name' => 'homepage',
- 'value' => ($article['homepage'] ?? null),
- 'on' => __('oui'),
- 'off' => __('non'),
- 'meta' => 'data-id=' . ($article['id'] ?? null),
- 'size' => 'sm',
- ])
-
-
+
+
+ @include('components.form.select', [
+ 'name' => 'categories[]',
+ 'list' => $categories_options,
+ 'values' => $article['categories'] ?? null,
+ 'class' => 'select2',
+ 'multiple' => true,
+ 'label' => __('shop.shelves.title'),
+ ])
+
+
+ @include('components.form.toggle', [
+ 'name' => 'visible',
+ 'value' => $article['visible'] ?? null,
+ 'on' => __('oui'),
+ 'off' => __('non'),
+ 'meta' => 'data-id=' . ($article['id'] ?? null),
+ 'size' => 'sm',
+ 'label' => 'Visible',
+ ])
+
+
+ @include('components.form.toggle', [
+ 'name' => 'homepage',
+ 'value' => $article['homepage'] ?? null,
+ 'on' => __('oui'),
+ 'off' => __('non'),
+ 'meta' => 'data-id=' . ($article['id'] ?? null),
+ 'size' => 'sm',
+ 'label' => 'Accueil',
+ ])
+
+
-
-
- {{ Form::label('tags', 'Tags') }}
- @include('components.form.selects.select-tree', [
- 'name' => 'tags[]',
- 'list' => $tags_list,
- 'values' => $article['tags'] ?? null,
- 'class' => 'select2',
- 'multiple' => true
- ])
-
-
+
+
+ @include('components.form.selects.select-tree', [
+ 'name' => 'tags[]',
+ 'list' => $tags_list,
+ 'values' => $article['tags'] ?? null,
+ 'class' => 'select2',
+ 'multiple' => true,
+ 'label' => 'Tags',
+ ])
+
+
-
-
- @include('Admin.Shop.Articles.partials.product.description')
-
-
+
+
+ @include('Admin.Shop.Articles.partials.product.description')
+
+
-
-
- {{ Form::label('description', 'Description') }}
- @include('components.form.textarea', [
- 'name' => 'description',
- 'value' => $article['description'] ?? null,
- 'class' => 'editor',
- 'required' => true
- ])
-
-
+
+
+ @include('components.form.textarea', [
+ 'name' => 'description',
+ 'value' => $article['description'] ?? null,
+ 'class' => 'editor',
+ 'required' => false,
+ 'label' => 'Description',
+ ])
+
+
-
-
-
- @include('Admin.Shop.Articles.partials.product.images')
-
- @include('components.uploader.widget', [
- 'load_url' => route('Admin.Shop.Articles.getImages', ['id' => $article['id'] ?? false]),
- 'delete_url' => route('Admin.Shop.Articles.deleteImage'),
- 'title' => 'Photos',
- 'name' => 'images'
- ])
- @include('Admin.Core.Comments.partials.comments', [
- 'model' => 'Shop.Article',
- 'model_id' => $article['id'] ?? false,
- 'comments' => $article['comments'] ?? false
- ])
-
+
+
+
+ @include('Admin.Shop.Articles.partials.product.images')
+
+
+ @include('components.uploader.widget', [
+ 'load_url' => route('Admin.Shop.Articles.getImages', ['id' => $article['id'] ?? false]),
+ 'delete_url' => route('Admin.Shop.Articles.deleteImage'),
+ 'title' => 'Photos',
+ 'name' => 'images',
+ ])
+
+ @include('Admin.Core.Comments.partials.comments', [
+ 'model' => 'Shop.Article',
+ 'model_id' => $article['id'] ?? false,
+ 'comments' => $article['comments'] ?? false,
+ ])
+
@push('js')
-
-@endpush
\ No newline at end of file
+ function loadProducts(url) {
+ $.ajax({
+ url: url,
+ method: 'POST',
+ data: {
+ article_nature_id: $('#article_nature_id').val()
+ },
+ success: function(data) {
+ setOptions('#product_id', data);
+ // $("#product_id").select2({data: data});
+ // $("#product_id").trigger('change');
+ }
+ });
+ }
+
+@endpush
diff --git a/resources/views/Admin/Shop/Orders/partials/detail.blade.php b/resources/views/Admin/Shop/Orders/partials/detail.blade.php
index 00a9249d..8d4d3540 100644
--- a/resources/views/Admin/Shop/Orders/partials/detail.blade.php
+++ b/resources/views/Admin/Shop/Orders/partials/detail.blade.php
@@ -1,56 +1,58 @@
-
-
-
-
-
- Nom
- Quantité
- PU HT
- TVA
- PU TTC
- Total TTC
-
-
- @foreach ($order['detail'] as $detail)
-
- {{ $detail['name'] }}
- {{ $detail['quantity'] }}
- {{ $detail['price'] }}
- {{ $detail['tax'] }}
- {{ $detail['price_taxed'] }}
- {{ $detail['total_taxed'] }}
-
- @endforeach
-
-
-
- Total
-
-
-
-
- {{ $order['total_taxed'] }}
-
- @if ($order['shipping'] ?? false)
-
- Livraison
-
-
-
-
- {{ $order['shipping'] }}
-
-
- Total à payer
-
-
- {{ $order['taxes'] }}
-
- {{ $order['total_shipped'] }}
-
- @endif
-
-
-
-
+
+
+
+ Nom
+ Quantité
+ PU HT
+ TVA
+ PU TTC
+ Total TTC
+
+
+ @foreach ($order['detail'] as $detail)
+
+ {{ $detail['name'] }}
+ {{ $detail['quantity'] }}
+ {{ $detail['price'] }}
+ {{ $detail['tax'] }}
+ {{ $detail['price_taxed'] }}
+ {{ $detail['total_taxed'] }}
+
+ @endforeach
+
+
+
+ Total
+
+
+
+
+
+ {{ $order['total_taxed'] }}
+
+
+ @if ($order['shipping'] ?? false)
+
+ Livraison
+
+
+
+
+
+ {{ $order['shipping'] }}
+
+
+
+ Total à payer
+
+
+ {{ $order['taxes'] }}
+
+
+ {{ $order['total_shipped'] }}
+
+
+ @endif
+
+
diff --git a/resources/views/Shop/Customers/edit.blade.php b/resources/views/Shop/Customers/edit.blade.php
index 612e077c..153f8931 100644
--- a/resources/views/Shop/Customers/edit.blade.php
+++ b/resources/views/Shop/Customers/edit.blade.php
@@ -1,25 +1,54 @@
@extends('Shop.layout.layout', [
- 'title' => __('Editer son profil'),
+ 'title' => __('Editer son profil'),
])
@section('content')
-
-
-
- @include('Shop.Customers.partials.registration')
-
-
-
-
- @include('Shop.Customers.partials.addresses', ['addresses' => $customer['addresses']])
-
+ {{ Form::open([
+ 'route' => 'Shop.Customers.store',
+ 'id' => 'customer-form',
+ 'autocomplete' => 'off',
+ 'files' => true,
+ ]) }}
-
- @include('Shop.auth.passwords.password_confirmation')
-
-
-
-
+
+
+
+
+
+ @include('Shop.Customers.partials.registration')
+
+
+
+
+ @include('Shop.Customers.partials.addresses', [
+ 'prefix' => 'deliveries',
+ 'addresses' => $customer['delivery_addresses'],
+ ])
+
+
+
+ @include('Shop.Customers.partials.addresses', [
+ 'prefix' => 'invoices',
+ 'addresses' => $customer['invoice_addresses'],
+ ])
+
+
+
+ @include('Shop.auth.passwords.password_confirmation')
+
+
+
+
+
@endsection
+@include('load.form.save')
@include('load.layout.modal')
+
+@push('js')
+
+@endpush
diff --git a/resources/views/Shop/Customers/partials/address.blade.php b/resources/views/Shop/Customers/partials/address.blade.php
index 1686142c..413ffab5 100644
--- a/resources/views/Shop/Customers/partials/address.blade.php
+++ b/resources/views/Shop/Customers/partials/address.blade.php
@@ -1,7 +1,7 @@
@include('components.form.input', [
- 'name' => ($prefix ?? '') . 'address',
+ 'name' => $prefix ?? false ? $prefix . "['address']" : 'address',
'value' => $customer['address'] ?? '',
'label' => $label ?? '',
])
@@ -11,7 +11,7 @@
@include('components.form.input', [
- 'name' => ($prefix ?? '') . 'address2',
+ 'name' => $prefix ?? false ? $prefix . "['address2']" : 'address2',
'value' => $customer['address2'] ?? '',
'label' => 'Complément d\'adresse',
])
@@ -21,16 +21,16 @@
@include('components.form.input', [
- 'name' => ($prefix ?? '') . 'zipcode',
+ 'name' => $prefix ?? false ? $prefix . "['zipcode']" : 'zipcode',
'value' => $customer['zipcode'] ?? '',
'label' => 'Code postal',
])
@include('components.form.input', [
- 'name' => ($prefix ?? '') . 'city',
+ 'name' => $prefix ?? false ? $prefix . "['city']" : 'city',
'value' => $customer['city'] ?? '',
'label' => 'Ville',
])
-
\ No newline at end of file
+
diff --git a/resources/views/Shop/Customers/partials/addresses.blade.php b/resources/views/Shop/Customers/partials/addresses.blade.php
index b9cfedf0..f3a11651 100644
--- a/resources/views/Shop/Customers/partials/addresses.blade.php
+++ b/resources/views/Shop/Customers/partials/addresses.blade.php
@@ -1,39 +1,42 @@
@foreach ($addresses ?? [] as $address)
-
+
- {{ $address['address'] }}
+ {{ $address['address'] }}
@if ($address['address2'])
- {{ $address['address2'] }}
+ {{ $address['address2'] }}
@endif
{{ $address['zipcode'] }} {{ $address['city'] }}
@endforeach
-
+
@include('Shop.Customers.partials.address', [
- 'prefix' => 'deliveries',
+ 'prefix' => $prefix,
'with_country' => false,
'with_tab' => true,
'label' => 'Adresse',
+ 'customer' => [],
])
@push('js')
-@endpush
\ No newline at end of file
+@endpush
diff --git a/resources/views/Shop/Customers/partials/registration.blade.php b/resources/views/Shop/Customers/partials/registration.blade.php
index 5ff2c800..cf42b361 100644
--- a/resources/views/Shop/Customers/partials/registration.blade.php
+++ b/resources/views/Shop/Customers/partials/registration.blade.php
@@ -48,4 +48,4 @@
-@include('Shop.Customers.partials.address', ['label' => 'Adresse de facturation'])
+@include('Shop.Customers.partials.address', ['label' => 'Adresse'])
diff --git a/resources/views/Shop/Customers/partials/sale.blade.php b/resources/views/Shop/Customers/partials/sale.blade.php
index e2e7b866..00e840d5 100644
--- a/resources/views/Shop/Customers/partials/sale.blade.php
+++ b/resources/views/Shop/Customers/partials/sale.blade.php
@@ -1,9 +1,11 @@
@@ -11,9 +13,13 @@
- @include('Shop.Customers.partials.deliveries')
+
+ @include('Shop.Customers.partials.deliveries')
+
- @include('Shop.Customers.partials.invoices')
+
+ @include('Shop.Customers.partials.invoices')
+
diff --git a/resources/views/Shop/Customers/partials/user.blade.php b/resources/views/Shop/Customers/partials/user.blade.php
index 4270c7c6..eef35b99 100644
--- a/resources/views/Shop/Customers/partials/user.blade.php
+++ b/resources/views/Shop/Customers/partials/user.blade.php
@@ -1,4 +1,5 @@
-
+
@if ($customer['company'])
@@ -28,13 +29,6 @@
-@endpush
\ No newline at end of file
+@endpush
diff --git a/resources/views/Shop/Customers/profile.blade.php b/resources/views/Shop/Customers/profile.blade.php
index 2bee448a..080a621b 100644
--- a/resources/views/Shop/Customers/profile.blade.php
+++ b/resources/views/Shop/Customers/profile.blade.php
@@ -1,16 +1,16 @@
@extends('Shop.layout.layout', [
- 'title' => __('Profil'),
+ 'title' => __('Profil'),
])
@section('content')
-
-
- @include('Shop.Customers.partials.user')
-
-
- @include('Shop.Customers.partials.sale')
-
-
+
+
+ @include('Shop.Customers.partials.user')
+
+
+ @include('Shop.Customers.partials.sale')
+
+
@endsection
@include('load.layout.modal')
diff --git a/resources/views/Shop/Orders/order.blade.php b/resources/views/Shop/Orders/order.blade.php
index 78778060..66d4fa48 100644
--- a/resources/views/Shop/Orders/order.blade.php
+++ b/resources/views/Shop/Orders/order.blade.php
@@ -1,75 +1,66 @@
@extends('Shop.layout.layout', [
- 'title' => __('Commande'),
+ 'title' => __('Commande'),
])
@section('content')
-
-
- @if (!App\Repositories\Shop\Customers::isConnected())
-
- Déja client ?
- Créez mon compte
-
+
+
+ @if (App\Repositories\Shop\Customers::isNotConnected())
+
+ Déja client ?
+ Créez mon compte
+
-
- @include('Shop.auth.partials.login')
-
+
+ @include('Shop.auth.partials.login')
+
-
- @include('Shop.auth.partials.register')
-
- @else
- {{ Form::open(['route' => 'Shop.Orders.store', 'id' => 'order-form', 'autocomplete' => 'off']) }}
+
+ @include('Shop.auth.partials.register')
+
+ @else
+ {{ Form::open(['route' => 'Shop.Orders.store', 'id' => 'order-form', 'autocomplete' => 'off']) }}
+ @include('Shop.Orders.partials.registered')
+ {!! Form::close() !!}
+ @endif
-
-
- @include('Shop.Orders.partials.addresses', ['addresses' => $customer['invoicing_addresses'] ?? false])
-
-
-
- @include('Shop.Orders.partials.deliveries')
-
-
-
- @include('Shop.Orders.partials.addresses', ['addresses' => $customer['delivery_addresses'] ?? false])
-
-
-
- @include('Shop.Orders.partials.payments')
-
-
-
- {!! Form::close() !!}
-
- @endif
-
-
- @if ($basket['count'])
-
-
- @include('Shop.Baskets.partials.basketTotal')
-
-
- @endif
-
+
+ @if ($basket['count'])
+
+
+ @include('Shop.Baskets.partials.basketTotal')
+
+
+ @endif
+
@endsection
@include('load.layout.chevron')
@push('js')
-
-@endpush
\ No newline at end of file
+ $('#delivery_mode .delivery_mode').click(function() {
+ var test = $(this).hasClass('at_house');
+ if ($(this).hasClass('at_house')) {
+ $('#delivery_addresses').closest('.card').removeClass('d-none');
+ } else {
+ $('#delivery_addresses').closest('.card').addClass('d-none');
+ }
+ });
+
+ initChevron();
+
+@endpush
diff --git a/resources/views/Shop/Orders/partials/addresses.blade.php b/resources/views/Shop/Orders/partials/addresses.blade.php
index 14b8a2fc..8d24e34d 100644
--- a/resources/views/Shop/Orders/partials/addresses.blade.php
+++ b/resources/views/Shop/Orders/partials/addresses.blade.php
@@ -6,17 +6,17 @@
'name' => 'address_id',
'val' => $address['id'],
'id' => 'address_' . $address['id'],
- 'value' => (count($addresses) === 1) ? $address['id'] : false,
+ 'value' => count($addresses) === 1 ? $address['id'] : false,
])
- {{ $address['name'] }}
- {{ $address['address'] }}
+ {{ $address['name'] }}
+ {{ $address['address'] }}
@if ($address['address2'])
- {{ $address['address2'] }}
+ {{ $address['address2'] }}
@endif
- {{ $address['zipcode'] }} {{ $address['city'] }}
+ {{ $address['zipcode'] }} {{ $address['city'] }}
@endforeach
-@endif
\ No newline at end of file
+@endif
diff --git a/resources/views/Shop/Orders/partials/deliveries.blade.php b/resources/views/Shop/Orders/partials/deliveries.blade.php
index 3ab9c5e0..7ad772d4 100644
--- a/resources/views/Shop/Orders/partials/deliveries.blade.php
+++ b/resources/views/Shop/Orders/partials/deliveries.blade.php
@@ -5,17 +5,18 @@
'name' => 'delivery_id',
'val' => $delivery['id'],
'id' => 'delivery_' . $delivery['id'],
- 'class' => $delivery['at_house'] ? 'at_house' : '',
+ 'class' => 'delivery_mode' . ($delivery['at_house'] ? ' at_house' : ''),
])
- {{ $delivery['name'] }} - Tarif appliqué {{ $delivery['sale_channel']['name'] }}
+ {{ $delivery['name'] }} - Tarif appliqué {{ $delivery['sale_channel']['name'] }}
{!! $delivery['sale_channel']['description'] !!}
@endforeach
-Si vous voulez laisser un message à propos de votre commande, merci de bien vouloir le renseigner dans le champs ci-contre
+Si vous voulez laisser un message à propos de votre commande, merci de bien vouloir le renseigner dans le champs
+ci-contre
@include('components.form.textarea', [
'name' => 'content',
diff --git a/resources/views/Shop/Orders/partials/registered.blade.php b/resources/views/Shop/Orders/partials/registered.blade.php
new file mode 100644
index 00000000..575f2634
--- /dev/null
+++ b/resources/views/Shop/Orders/partials/registered.blade.php
@@ -0,0 +1,23 @@
+
+
+ @include('Shop.Orders.partials.addresses', [
+ 'addresses' => $customer['invoice_addresses'] ?? false,
+ ])
+
+
+
+ @include('Shop.Orders.partials.deliveries')
+
+
+
+ @include('Shop.Orders.partials.addresses', [
+ 'addresses' => $customer['delivery_addresses'] ?? false,
+ ])
+ @include('Shop.Orders.partials.shipping')
+
+
+
+ @include('Shop.Orders.partials.payments')
+
+
diff --git a/resources/views/Shop/Orders/partials/shipping.blade.php b/resources/views/Shop/Orders/partials/shipping.blade.php
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/resources/views/Shop/Orders/partials/shipping.blade.php
@@ -0,0 +1 @@
+
diff --git a/resources/views/Shop/Orders/view.blade.php b/resources/views/Shop/Orders/view.blade.php
new file mode 100644
index 00000000..0e4d2604
--- /dev/null
+++ b/resources/views/Shop/Orders/view.blade.php
@@ -0,0 +1,74 @@
+
+
+
{{ $order['delivery']['name'] ?? '' }}
+
+
+
+
+
+
+
+
+ {{ $order['customer']['last_name'] }} {{ $order['customer']['first_name'] }}
+
+
+
+
+ @if ($order['invoice']['address'])
+ {{ $order['invoice']['address']['address'] }}
+ @isset($order['invoice']['address']['address2'])
+ {{ $order['invoice']['address']['address2'] }}
+ @endisset
+ {{ $order['invoice']['address']['zipcode'] }}
+ {{ $order['invoice']['address']['city'] }}
+ @endif
+
+
+
+
+ @if ($order['delivery_address'])
+ {{ $order['delivery_address']['address'] }}
+ @isset($order['delivery_address']['address2'])
+ {{ $order['delivery_address']['address2'] }}
+ @endisset
+ {{ $order['delivery_address']['zipcode'] }}
+ {{ $order['delivery_address']['city'] }}
+ @endif
+
+
+
+
+
+
+
+ Commande N° {{ $order['ref'] }}
+ du {{ Carbon\Carbon::parse($order['created_at'])->isoFormat('LLLL') }}
+
+
+ Statut : {{ $order['status'] }}
+
+
+
+
+ Canal de vente : {{ $order['sale_channel']['name'] }}
+
+
+ Règlement : {{ $order['payment_type'] }}
+
+
+
+
+ Type de livraison : {{ $order['delivery_type_id'] }}
+
+
+ Référence Colis : {{ $order['delivery_ref'] }}
+
+
+ Lien suivi : {{ $order['delivery_link'] }}
+
+
+
+
+
+
+@include('Admin.Shop.Orders.partials.detail', ['detail_type' => 'commande'])
diff --git a/resources/views/Shop/auth/passwords/password_confirmation.blade.php b/resources/views/Shop/auth/passwords/password_confirmation.blade.php
index 8fedf357..73c002e3 100644
--- a/resources/views/Shop/auth/passwords/password_confirmation.blade.php
+++ b/resources/views/Shop/auth/passwords/password_confirmation.blade.php
@@ -1,7 +1,11 @@
diff --git a/resources/views/components/card.blade.php b/resources/views/components/card.blade.php
index 688b8222..10fde121 100644
--- a/resources/views/components/card.blade.php
+++ b/resources/views/components/card.blade.php
@@ -1,6 +1,8 @@
-
- @if($title ?? $header ?? false)
-