This commit is contained in:
ludo
2025-01-03 03:46:45 +01:00
parent b3fbfc38e7
commit befaa40b48
44 changed files with 442 additions and 165 deletions

View File

@@ -25,6 +25,7 @@ class ContentsDataTable extends DataTable
protected function getColumns()
{
return [
Column::make('id')->title('id'),
Column::make('text')->title('Texte'),
$this->makeColumnButtons(),
];

View File

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Admin\Shop\InvoicePaymentsDataTable;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\InvoicePayments;
use App\Repositories\Shop\Invoices;
use Illuminate\Http\Request;
class InvoicePaymentController extends Controller
@@ -14,18 +15,21 @@ class InvoicePaymentController extends Controller
return $dataTable->render('Admin.Shop.InvoicePayments.list');
}
public function create()
public function create($invoice_id)
{
$data = InvoicePayments::init();
$data['invoice_id'] = $invoice_id;
return view('Admin.Shop.InvoicePayments.create', $data);
return view('Admin.Shop.InvoicePayments.form', $data);
}
public function store(Request $request)
{
$ret = InvoicePayments::store($request->all());
$data = $request->all();
$ret = InvoicePayments::store($data);
Invoices::checkPayments($data['invoice_id']);
return redirect()->route('Admin.Shop.InvoicePayments.index');
return redirect()->route('Admin.Shop.Invoices.edit', ['id' => $request->input('invoice_id')]);
}
public function show($id)
@@ -40,12 +44,15 @@ class InvoicePaymentController extends Controller
{
$data = InvoicePayments::init();
$data['invoice_payment'] = InvoicePayments::getArray($id);
$data['invoice_id'] = $data['invoice_payment']['invoice_id'];
return view('Admin.Shop.InvoicePayments.edit', $data);
return view('Admin.Shop.InvoicePayments.form', $data);
}
public function destroy($id)
{
return InvoicePayments::destroy($id);
$payment = InvoicePayments::get($id);
InvoicePayments::destroy($id);
Invoices::checkPayments($payment->invoice_id);
}
}

View File

@@ -10,7 +10,6 @@ use Illuminate\Foundation\Auth\EmailVerificationRequest;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Sebastienheyd\Boilerplate\Rules\Password;
class RegisterController extends Controller
@@ -24,14 +23,6 @@ class RegisterController extends Controller
public function register(RegisterCustomer $request)
{
$request->validateWithBag('Errors', [
'last_name' => 'required|max:255',
'first_name' => 'required|max:255',
'email' => 'required|email|max:255|unique:shop_customers,email,NULL,id,deleted_at,NULL',
'password' => ['required', 'confirmed', new Password()],
]);
if (back()->getTargetUrl() === route('Shop.Orders.store')) {
$route = 'Shop.Orders.order';
} else {

View File

@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Shop;
use App\Repositories\Shop\CustomerAddresses;
use App\Repositories\Shop\Customers;
use Illuminate\Http\Request;
@@ -54,4 +55,11 @@ class CustomerController extends Controller
return redirect()->route('Shop.Customers.edit');
}
public function delete_address($id)
{
$ret = CustomerAddresses::destroy($id);
return redirect()->route('Shop.Customers.edit');
}
}

View File

@@ -3,8 +3,10 @@
namespace App\Http\Controllers\Shop;
use App\Datatables\Shop\CustomerOrdersDataTable;
use App\Http\Requests\Shop\StoreOrderPost;
use App\Repositories\Core\User\ShopCart;
use App\Repositories\Shop\Baskets;
use App\Repositories\Shop\Contents;
use App\Repositories\Shop\Customers;
use App\Repositories\Shop\Deliveries;
use App\Repositories\Shop\DeliveryTypes;
@@ -61,13 +63,14 @@ class OrderController extends Controller
return redirect()->route('home');
}
public function store(Request $request)
public function store(StoreOrderPost $request)
{
$data = $request->all();
$data['customer_id'] = Customers::getId();
$data['sale_channel_id'] = $data['sale_channel_id'] ?? SaleChannels::getDefaultID();
$data['basket'] = Baskets::getBasketSummary($data['sale_channel_id'], $data['delivery_type_id'] ?? false);
$order = Orders::saveOrder($data);
if ($order) {
if ($data['payment_type'] === '1') {
return Paybox::makeAuthorizationRequest($order);
@@ -83,8 +86,9 @@ class OrderController extends Controller
public function confirmed()
{
ShopCart::clear();
$content = Contents::getOrderConfirmedContent();
return view('Shop.Orders.confirmed');
return view('Shop.Orders.confirmed', ['content' => $content]);
}
public function getPdf($uuid)

View File

@@ -3,38 +3,33 @@
namespace App\Http\Controllers\Shop;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\Contents;
use Illuminate\Http\Request;
class PayboxController extends Controller
{
public function accepted()
{
return view('paybox.accepted');
return view('paybox.paybox', ['content' => Contents::getPayboxConfirmedContent()]);
}
public function refused(Request $request)
{
dump($request->all());
exit;
return view('paybox.refused');
return view('paybox.paybox', ['content' => Contents::getPayboxRefusedContent()]);
}
public function aborted()
{
return view('paybox.aborted');
return view('paybox.paybox', ['content' => Contents::getPayboxAbortedContent()]);
}
public function waiting()
{
return view('paybox.waiting');
return view('paybox.waiting', ['content' => Contents::getPayboxWaitingContent()]);
}
public function process(Request $request)
{
dump($request);
exit;
return view('paybox.send');
}
}

View File

@@ -2,7 +2,9 @@
namespace App\Http\Requests\Shop;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\ValidationException;
use Sebastienheyd\Boilerplate\Rules\Password;
class RegisterCustomer extends FormRequest
@@ -21,4 +23,14 @@ class RegisterCustomer extends FormRequest
'password' => ['required', 'confirmed', new Password()],
];
}
protected function failedValidation(Validator $validator)
{
$response = redirect()
->back()
->withInput()
->withErrors($validator->errors(), 'registration');
throw new ValidationException($validator, $response);
}
}

View File

@@ -14,7 +14,19 @@ class StoreOrderPost extends FormRequest
public function rules()
{
return [
'user_id' => 'required',
'invoice.invoice_address_id' => 'required',
'delivery_id' => 'required',
'payment_type' => 'required',
'agree' => 'required',
];
}
public function messages()
{
return [
'delivery_id.required' => 'Il est nécessaire de choisir un mode de livraison',
'payment_type.required' => 'Il est nécessaire de choisir un mode de paiement',
'agree.required' => 'Il est nécessaire d\'adhérer à nos conditions de vente',
];
}
}

View File

@@ -42,14 +42,16 @@ 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;
$this->prenom = $order->customer->first_name;
$this->nom = $order->customer->last_name;
$this->facturation_adresse = $order->address->address;
$this->facturation_cp = $order->address->zipcode;
$this->facturation_ville = $order->address->city;
$this->livraison_adresse = $order->delivery_address->address;
$this->livraison_cp = $order->delivery_address->zipcode;
$this->livraison_ville = $order->delivery_address->city;
$this->facturation_adresse = $facturation_address->address;
$this->facturation_cp = $facturation_address->zipcode;
$this->facturation_ville = $facturation_address->city;
$this->livraison_adresse = $delivery_address->address;
$this->livraison_cp = $delivery_address->zipcode;
$this->livraison_ville = $delivery_address->city;
$this->societe = $order->customer->company;
$this->email = $order->customer->email;
$this->numero_commande = $order->ref;

View File

@@ -47,4 +47,18 @@ class Specie extends Model implements HasMedia
{
return $query->where($this->table.'.name', $name);
}
public function scopeByTag($query, $tagId)
{
return $tagId ? $query->whereHas('tags', function ($query) use ($tagId) {
$query->byId($tagId);
}) : $query;
}
public function scopeByTags($query, $tags)
{
return $tags ? $query->whereHas('tags', function ($query) use ($tags) {
$query->byIds($tags);
}) : $query;
}
}

View File

@@ -37,4 +37,22 @@ class Variety extends Model implements HasMedia
{
return $this->morphToMany(Tag::class, 'taggable');
}
public function scopeByTag($query, $tagId)
{
return $tagId ? $query->whereHas('tags', function ($query) use ($tagId) {
$query->byId($tagId);
})->orWhereHas('Specie', function($query) use ($tagId) {
$query->byTag($tagId);
}) : $query;
}
public function scopeByTags($query, $tags)
{
return $tags ? $query->whereHas('tags', function ($query) use ($tags) {
$query->byIds($tags);
})->orWhereHas('Specie', function($query) use ($tags) {
$query->byTags($tags);
}) : $query;
}
}

View File

@@ -191,6 +191,10 @@ class Article extends Model implements HasMedia
{
return $tagId ? $query->whereHas('tags', function ($query) use ($tagId) {
$query->byId($tagId);
})->orWhereHasMorph('product', [Variety::class], function($query) use ($tagId) {
$query->whereHas('tags', function ($query) use ($tagId) {
$query->where('id', $tagId);
});
}) : $query;
}
@@ -198,6 +202,10 @@ class Article extends Model implements HasMedia
{
return $tags ? $query->whereHas('tags', function ($query) use ($tags) {
$query->byIds($tags);
})->orWhereHasMorph('product', [Variety::class], function($query) use ($tags) {
$query->whereHas('tags', function ($query) use ($tags) {
$query->whereIntegerInRaw('id', $tags);
});
}) : $query;
}

View File

@@ -2,6 +2,7 @@
namespace App\Models\Shop;
use App\Repositories\Core\DateTime;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Venturecraft\Revisionable\RevisionableTrait;
@@ -47,4 +48,14 @@ class InvoicePayment extends Model
{
return $query->where('payment_type', $paymentType);
}
public function getDateAttribute($value)
{
return DateTime::dateToLocale($value);
}
public function setDateAttribute($value)
{
$this->attributes['date'] = DateTime::convert($value);
}
}

View File

@@ -6,6 +6,7 @@ use App\Models\Botanic\Specie;
use App\Models\Botanic\Variety;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Support\Facades\DB;
use Rinvex\Tags\Models\Tag as parentTag;
class Tag extends parentTag
@@ -78,6 +79,65 @@ class Tag extends parentTag
]);
}
public static function countArticles($categoryId)
{
DB::table('tags')
// Articles directement liés au tag, filtrés par catégorie
->leftJoin('taggables as direct', function ($join) {
$join->on('tags.id', '=', 'direct.tag_id')
->where('direct.taggable_type', '=', Article::class);
})
->leftJoin('shop_articles', 'direct.taggable_id', '=', 'shop_articles.id')
->whereExists(function ($query) use ($categoryId) {
$query->select(DB::raw(1))
->from('categories')
->whereColumn('categories.id', 'shop_articles.category_id')
->where('_lft', '>=', DB::raw("(SELECT _lft FROM categories WHERE id = {$categoryId})"))
->where('_rgt', '<=', DB::raw("(SELECT _rgt FROM categories WHERE id = {$categoryId})"));
})
// Articles liés via une variété ayant le tag, filtrés par catégorie
->leftJoin('taggables as via_variety', function ($join) {
$join->on('tags.id', '=', 'via_variety.tag_id')
->where('via_variety.taggable_type', '=', Variety::class);
})
->leftJoin('botanic_varieties', 'via_variety.taggable_id', '=', 'botanic_varieties.id')
->leftJoin('shop_articles as indirect_articles', function ($join) {
$join->on('varieties.id', '=', 'indirect_articles.product_id')
->where('indirect_articles.product_type', '=', Variety::class);
})
->whereExists(function ($query) use ($categoryId) {
$query->select(DB::raw(1))
->from('categories')
->whereColumn('categories.id', 'indirect_articles.category_id')
->where('_lft', '>=', DB::raw("(SELECT _lft FROM categories WHERE id = {$categoryId})"))
->where('_rgt', '<=', DB::raw("(SELECT _rgt FROM categories WHERE id = {$categoryId})"));
})
// Combinaison des deux types de liens et comptage
->select('tags.id', 'tags.name', DB::raw('COUNT(DISTINCT shop_articles.id) + COUNT(DISTINCT indirect_articles.id) as article_count'))
->groupBy('tags.id', 'tags.name')
->get();
}
public function scopeWithFilteredArticleCounts($query, $categoryId)
{
return $query->withCount([
// Articles directement liés au tag et filtrés par catégorie
'articles as direct_article_count' => function ($query) use ($categoryId) {
$query->byCategoryParent($categoryId);
},
// Articles liés via Variety et filtrés par catégorie sur les articles eux-mêmes
'articles as indirect_article_count' => function ($query) use ($categoryId) {
$query->whereHasMorph('product', [Variety::class], function ($subQuery) {
// Pas de catégorie sur Variety, pas de filtre ici
})->byCategoryParent($categoryId);
},
])
->havingRaw('(COALESCE(direct_article_count, 0) + COALESCE(indirect_article_count, 0)) > 0'); // Filtre les tags avec au moins un article
}
public function scopeById($query, $id)
{
return $query->where($this->table.'.id', $id);
@@ -85,6 +145,6 @@ class Tag extends parentTag
public function scopeByIds($query, $ids)
{
return $query->whereIn($this->table.'.id', $ids);
return $query->whereIntegerInRaw($this->table.'.id', $ids);
}
}

View File

@@ -36,6 +36,32 @@ class Contents
return self::get(4)->text ?? '';
}
public static function getOrderConfirmedContent()
{
return self::get(5)->text ?? 'Votre commande a été confirmée';
}
public static function getPayboxConfirmedContent()
{
return self::get(6)->text ?? 'Merci pour votre règlement. Votre commande sera traitée sous peu.';
}
public static function getPayboxRefusedContent()
{
return self::get(7)->text ?? 'Le paiement a été refusé.';
}
public static function getPayboxAbortedContent()
{
return self::get(8)->text ?? 'Le paiement a été annulé.';
}
public static function getPayboxWaitingContent()
{
return self::get(9)->text ?? 'Votre paiement est en attente. Cela peut prendre un certain temps jusqu\'à ce qu\'il soit terminé.';
}
public static function getModel()
{
return Content::query();

View File

@@ -10,18 +10,44 @@ 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;
return self::store([
$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)

View File

@@ -43,6 +43,31 @@ class Invoices
return $data;
}
public static function checkPayments($invoice_id)
{
$invoice = self::get($invoice_id);
$total = self::getPayments($invoice_id);
if ($total) {
$status = $total === (float) $invoice->total_shipped ? 2 : 1;
} else {
$status = 0;
}
$invoice->status = $status;
$invoice->save();
}
public static function getPayments($invoice_id)
{
$total = 0;
$invoice = self::get($invoice_id);
$payments = $invoice->payments;
foreach ($payments as $payment) {
$total += $payment->amount;
}
return $total;
}
public static function getFullByUUID($id)
{
return self::getByUUID($id, self::full());
@@ -61,6 +86,7 @@ class Invoices
'order.delivery_address',
'order.detail',
'order.sale_channel',
'order.customer',
'payments',
];
}
@@ -106,7 +132,7 @@ class Invoices
public static function statuses()
{
return ['En attente', 'Paiement partiel', 'Soldée', 'Paiement rejeté'];
return ['En attente', 'Paiement partiel', 'Soldée'];
}
public static function getModel()

View File

@@ -2,6 +2,7 @@
namespace App\Repositories\Shop;
use App\Models\Botanic\Variety;
use App\Models\Shop\Tag;
use App\Models\Shop\TagGroup;
use App\Traits\Model\Basic;
@@ -15,6 +16,8 @@ class TagGroups
{
$data = [];
$tags = Tag::withCountArticlesByCategory($category_id)->get()->toArray();
dump($tags);
exit;
$tagGroups = TagGroup::pluck('name', 'id')->toArray();
foreach ($tags as $tag) {
if (! $tag['articles_count']) {
@@ -31,6 +34,30 @@ class TagGroups
return $data;
}
public static function getWithTagsAndCountOffers2($categoryId = false)
{
return Tag::withCount([
'articles as direct_article_count' => function ($query) use ($categoryId) {
$query->byCategoryParent($categoryId);
},
'articles as indirect_article_count' => function ($query) use ($categoryId) {
$query->whereHasMorph('product', [Variety::class], function ($subQuery) use ($categoryId) {
$subQuery->whereHas('categories', function ($categoryQuery) use ($categoryId) {
$categoryQuery->byCategoryParent($categoryId);
});
});
},
])
->get()
->map(function ($tag) {
$tag->total_articles = $tag->direct_article_count + $tag->indirect_article_count;
return $tag;
})
->filter(function ($tag) {
return $tag->total_articles > 0; // Garde uniquement les tags ayant des articles
});
}
public static function isTagGroupHaveSelected($tagsSelected, $tags)
{
foreach ($tags as $tag) {

View File

@@ -1 +0,0 @@
@include('Admin.Shop.InvoicePayments.form')

View File

@@ -1,5 +1,7 @@
f{{ Form::open(['route' => 'Admin.Shop.InvoicePayments.store', 'id' => 'invoice_payment-form', 'autocomplete' => 'off']) }}
{{ Form::open(['route' => 'Admin.Shop.InvoicePayments.store', 'id' => 'invoice_payment-form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" id="id" value="{{ $invoice_payment['id'] ?? false }}">
<input type="hidden" name="invoice_id" id="invoice_id" value="{{ $invoice_id ?? false }}">
<div class="row mb-3">
<div class="col-12">
@@ -43,4 +45,5 @@ f{{ Form::open(['route' => 'Admin.Shop.InvoicePayments.store', 'id' => 'invoice_
<script>
initDatepicker();
initSaveForm('#invoice_payment-form', '.modal-content .bootbox-accept');
</script>

View File

@@ -1,7 +1,7 @@
@extends('layout.index', [
'title' => 'Factures',
'subtitle' => 'Edition d\'une facture',
'breadcrumb' => ['Articles'],
'breadcrumb' => ['Factures'],
])
@section('content')

View File

@@ -67,3 +67,4 @@
</form>
@include('load.layout.modal')
@include('load.form.save')

View File

@@ -21,6 +21,10 @@
<td>{{ $payment_types[$payment['payment_type']] }}</td>
<td class="text-right font-weight-bold">{{ sprintf('%01.2f', $payment['amount']) }} </td>
<td>{{ $payment['reference'] }}</td>
<td class="text-right">
<x-form.buttons.edit :dataId="$payment['id']" class="payment-edit btn-xs" />
<x-form.buttons.delete :dataId="$payment['id']" class="payment-delete btn-xs" />
</td>
</tr>
@endforeach
</tbody>
@@ -34,9 +38,15 @@
$('#add_payment').click(function() {
InvoicePaymentCreate();
});
$('.payment-edit').click(function() {
InvoicePaymentEdit($(this).data('id'));
});
$('.payment-delete').click(function() {
InvoicePaymentDelete($(this).data('id'));
});
function InvoicePaymentCreate() {
var url_open = "{{ route('Admin.Shop.InvoicePayments.create') }}";
var url_open = "{{ route('Admin.Shop.InvoicePayments.create') }}/{{ $invoice['id'] }}";
var url_save = "{{ route('Admin.Shop.InvoicePayments.store') }}";
openModal("Ajouter un paiement", '#invoice_payment-form', url_open, url_save,
"InvoicePaymentRefresh();", 'sm');
@@ -49,8 +59,11 @@
"InvoicePaymentRefresh();", 'sm');
}
function InvoicePaymentRefresh() {
function InvoicePaymentDelete(id) {
var url = "{{ route('Admin.Shop.InvoicePayments.destroy') }}/" + id;
$.get(url, function() {
window.location = "{{ route('Admin.Shop.Invoices.edit') }}/{{ $invoice['id'] }}";
});
}
</script>
@endpush

View File

@@ -14,7 +14,7 @@
</div>
<div class="col-6 text-right font-weight-bold">
<span id="basket-total">
{{ $basket['total_taxed'] ?? 0 }}
{{ number_format($basket['total_taxed'] ?? 0, 2, '.') }}
</span>
</div>
</div>
@@ -25,7 +25,7 @@
</div>
<div class="col-6 text-right font-weight-bold">
<span id="shipping">
{{ $basket['shipping'] }}
{{ number_format($basket['shipping'], 2, '.') }}
</span>
</div>
</div>
@@ -38,7 +38,7 @@
</div>
<div class="col-6 text-right">
<span id="basket-total-shipped">
{{ $basket['total_shipped'] ?? 0 }}
{{ number_format($basket['total_shipped'] ?? 0, 2, '.') }}
</span>
</div>
</div>

View File

@@ -2,8 +2,8 @@
<div class="row">
<div class="col-12">
@include('components.form.input', [
'name' => $prefix ?? false ? $prefix . "['name']" : 'name',
'value' => $customer['name'] ?? '',
'name' => $prefix ?? false ? $prefix . '[name]' : 'name',
'value' => $customer['name'] ?? (old('name') ?? ''),
'label' => 'Nom',
])
</div>
@@ -13,9 +13,10 @@
<div class="row">
<div class="col-12">
@include('components.form.input', [
'name' => $prefix ?? false ? $prefix . "['address']" : 'address',
'value' => $customer['address'] ?? '',
'name' => $prefix ?? false ? $prefix . '[address]' : 'address',
'value' => $customer['address'] ?? (old('address') ?? ''),
'label' => $label ?? '',
'required' => $required ?? false,
])
</div>
</div>
@@ -23,9 +24,10 @@
<div class="row">
<div class="col-12">
@include('components.form.input', [
'name' => $prefix ?? false ? $prefix . "['address2']" : 'address2',
'value' => $customer['address2'] ?? '',
'name' => $prefix ?? false ? $prefix . '[address2]' : 'address2',
'value' => $customer['address2'] ?? (old('address2') ?? ''),
'label' => 'Complément d\'adresse',
'required' => false,
])
</div>
</div>
@@ -33,16 +35,18 @@
<div class="row">
<div class="col-4">
@include('components.form.input', [
'name' => $prefix ?? false ? $prefix . "['zipcode']" : 'zipcode',
'value' => $customer['zipcode'] ?? '',
'name' => $prefix ?? false ? $prefix . '[zipcode]' : 'zipcode',
'value' => $customer['zipcode'] ?? (old('zipcode') ?? ''),
'label' => 'Code postal',
'required' => $required ?? false,
])
</div>
<div class="col-8">
@include('components.form.input', [
'name' => $prefix ?? false ? $prefix . "['city']" : 'city',
'value' => $customer['city'] ?? '',
'name' => $prefix ?? false ? $prefix . '[city]' : 'city',
'value' => $customer['city'] ?? (old('city') ?? ''),
'label' => 'Ville',
'required' => $required ?? false,
])
</div>
</div>

View File

@@ -4,9 +4,9 @@
<x-form.radios.icheck name="@if ($prefix ?? false) {{ $prefix }} . '[]' @endif address_id"
val="{{ $address['id'] }}" id="address_{{ $address['id'] }}" />
</div>
<div class="col-11">
<div class="col-10">
@if ($with_name ?? false)
{{ $address['name'] }}<br />>
{{ $address['name'] }}<br />
@endif
{{ $address['address'] }}<br />
@if ($address['address2'])
@@ -14,6 +14,11 @@
@endif
{{ $address['zipcode'] }} {{ $address['city'] }}
</div>
<div class="col-1">
<a href="{{ route('Shop.Customers.delete_address') }}/{{ $address['id'] }}">
<i class="fa fa-trash" class="delete" data-id="{{ $address['id'] }}"></i>
</a>
</div>
</div>
@endforeach

View File

@@ -1,7 +1,7 @@
@if ($errors->any())
@if ($errors->registration->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
@foreach ($errors->registration->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
@@ -12,7 +12,7 @@
<div class="col-6">
@include('components.form.input', [
'name' => 'first_name',
'value' => $customer['first_name'] ?? '',
'value' => $customer['first_name'] ?? (old('first_name') ?? ''),
'label' => 'Prénom',
'required' => true,
])
@@ -20,7 +20,7 @@
<div class="col-6">
@include('components.form.input', [
'name' => 'last_name',
'value' => $customer['last_name'] ?? '',
'value' => $customer['last_name'] ?? (old('last_name') ?? ''),
'label' => 'Nom',
'required' => true,
])
@@ -30,14 +30,14 @@
<div class="col-6">
@include('components.form.input', [
'name' => 'company',
'value' => $customer['company'] ?? '',
'value' => $customer['company'] ?? (old('company') ?? ''),
'label' => 'Société',
])
</div>
<div class="col-6">
@include('components.form.input', [
'name' => 'tva',
'value' => $customer['tva'] ?? '',
'value' => $customer['tva'] ?? (old('tva') ?? ''),
'label' => 'N° de TVA',
])
</div>
@@ -46,18 +46,19 @@
<div class="col-6">
@include('components.form.input', [
'name' => 'email',
'value' => $customer['email'] ?? '',
'value' => $customer['email'] ?? (old('email') ?? ''),
'label' => 'Email',
'required' => true,
])
{!! $errors->registration->first('email', '<p class="text-danger"><strong>:message</strong></p>') !!}
</div>
<div class="col-6">
@include('components.form.input', [
'name' => 'phone',
'value' => $customer['phone'] ?? '',
'value' => $customer['phone'] ?? (old('phone') ?? ''),
'label' => 'Téléphone',
])
</div>
</div>
@include('Shop.Customers.partials.address', ['label' => 'Adresse'])
@include('Shop.Customers.partials.address', ['label' => 'Adresse', 'required' => true])

View File

@@ -1,11 +1,11 @@
@extends('Shop.layout.layout', [
'title' => __('Commande confirmée'),
'title' => __('Commande confirmée'),
])
@section('content')
<div class="row">
<div class="col-8">
Votre commande a été confirmée
</div>
</div>
<div class="row">
<div class="col-12">
{!! $content !!}
</div>
</div>
@endsection

View File

@@ -3,6 +3,15 @@
])
@section('content')
@php
if ($errors->registration) {
$classIdent = 'd-none';
$classRegister = '';
} else {
$classIdent = '';
$classRegister = 'd-none';
}
@endphp
<div class="row">
<div class="@if ($basket['count']) col-sm-12 col-lg-8 @else col-12 @endif">
@if (App\Repositories\Shop\Customers::isNotConnected())
@@ -11,12 +20,13 @@
<button class="btn btn-secondary" id="register">Créez mon compte</button>
</p>
<x-layout.collapse id="identification" title="Déjà client" class="identification rounded-lg" uncollapsed=true>
<x-layout.collapse id="identification" title="Déjà client"
class="{{ $classIdent }} identification rounded-lg" uncollapsed=true>
@include('Shop.auth.partials.login')
</x-layout.collapse>
<x-layout.collapse id="personal_data" title="Informations personnelles"
class="d-none personal_data rounded-lg" uncollapsed=true>
class="{{ $classRegister }} personal_data rounded-lg" uncollapsed=true>
@include('Shop.auth.partials.register')
</x-layout.collapse>
@else

View File

@@ -6,7 +6,8 @@
'name' => $name,
'val' => $address['id'],
'id' => $prefix . '_address_' . $address['id'],
'value' => $address['priority'] || count($addresses) === 1 ? $address['id'] : false,
'value' =>
old($name) ?? $address['priority'] || count($addresses) === 1 ? $address['id'] : false,
])
</div>
<div class="col-11">

View File

@@ -4,6 +4,7 @@
@include('components.form.radios.icheck', [
'name' => 'delivery_id',
'val' => $delivery['id'],
'value' => (int) old('delivery_id') === $delivery['id'] ? $delivery['id'] : null,
'id' => 'delivery_' . $delivery['id'],
'class' => 'delivery_mode' . ($delivery['at_house'] ? ' at_house' : ''),
])
@@ -15,11 +16,14 @@
</div>
@endforeach
Si vous voulez laisser un message à propos de votre commande, merci de bien vouloir le renseigner dans le champs
{!! $errors->first('delivery_id', '<p class="text-danger"><strong>:message</strong></p>') !!}
Si vous voulez laisser un message à propos de votre commande, merci de bien vouloir le renseigner dans le champ
ci-contre
@include('components.form.textarea', [
'name' => 'comment',
'value' => old('comment') ?? '',
])
@push('js')

View File

@@ -1,6 +1,6 @@
<div class="row mb-3">
<div class="col-1">
<x-form.radios.icheck name="payment_type" val="1" id="payment_card"/>
<x-form.radios.icheck name="payment_type" val="1" id="payment_card" :value="old('payment_type') === '1' ? 1 : null" />
</div>
<div class="col-11 pt-2">
PAIEMENT PAR CARTE BANCAIRE
@@ -9,7 +9,7 @@
<div class="row mb-3">
<div class="col-1">
<x-form.radios.icheck name="payment_type" val="2" id="payment_check"/>
<x-form.radios.icheck name="payment_type" val="2" id="payment_check" :value="old('payment_type') === '2' ? 2 : null" />
</div>
<div class="col-11 pt-2">
PAIEMENT PAR CHEQUE
@@ -18,20 +18,23 @@
<div class="row mb-3">
<div class="col-1">
<x-form.radios.icheck name="payment_type" val="3" id="payment_transfer"/>
<x-form.radios.icheck name="payment_type" val="3" id="payment_transfer" :value="old('payment_type') === '3' ? 3 : null" />
</div>
<div class="col-11 pt-2">
PAIEMENT PAR VIREMENT BANCAIRE
</div>
</div>
{!! $errors->first('payment_type', '<p class="text-danger"><strong>:message</strong></p>') !!}
<div class="row pt-5">
<div class="col-1">
<x-form.checkboxes.icheck name="agree" val="1" required=true/>
<x-form.checkboxes.icheck name="agree" val="1" required=true />
</div>
<div class="col-11 pt-2">
J'ai lu les conditions générales de vente et j'y adhère sans réserve
</div>
{!! $errors->first('agree', '<p class="text-danger"><strong>:message</strong></p>') !!}
</div>
<button type="submit" class="btn btn-primary mt-5">COMMANDE AVEC OBLIGATION DE PAIEMENT</button>
<button type="submit" class="btn btn-primary mt-5">COMMANDE AVEC OBLIGATION DE PAIEMENT</button>

View File

@@ -1,42 +1,42 @@
{!! Form::open(['route' => 'Shop.login.post', 'method' => 'post', 'autocomplete'=> 'off']) !!}
{!! Form::open(['route' => 'Shop.login.post', 'method' => 'post', 'autocomplete' => 'off']) !!}
<div class="form-group has-feedback">
<div class="input-group form-group {{ $errors->has('email') ? 'has-error' : '' }}">
{{ Form::email('email', old('email'), ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.email'), 'required', 'autofocus']) }}
<div class="input-group-append">
<div class="btn btn-outline-secondary">
<i class="fa fa-at"></i>
</div>
</div>
{!! $errors->first('email','<p class="text-danger"><strong>:message</strong></p>') !!}
</div>
</div>
<div class="form-group has-feedback">
<div class="input-group form-group {{ $errors->has('password') ? 'has-error' : '' }}">
{{ Form::password('password', ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.password'), 'required']) }}
<div class="input-group-append">
<div class="btn btn-outline-secondary">
<i class="fa fa-lock"></i>
</div>
<div class="form-group has-feedback">
<div class="input-group form-group {{ $errors->has('email') ? 'has-error' : '' }}">
{{ Form::email('email', old('email'), ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.email'), 'required', 'autofocus']) }}
<div class="input-group-append">
<div class="btn btn-outline-secondary">
<i class="fa fa-at"></i>
</div>
</div>
{!! $errors->first('password','<p class="text-danger"><strong>:message</strong></p>') !!}
{!! $errors->first('email', '<p class="text-danger"><strong>:message</strong></p>') !!}
</div>
@if ($errors->any())
<div class="form-group has-feedback">
<p class="text-danger">
<strong>{{ $errors->first('msg') }}</strong>
</p>
</div>
@endif
<div class="row">
<div class="col-12 col-lg-6 mbs">
<button type="submit" class="btn btn-primary btn-block btn-flat">{{ __('Se connecter') }}</button>
</div>
<div class="form-group has-feedback">
<div class="input-group form-group {{ $errors->has('password') ? 'has-error' : '' }}">
{{ Form::password('password', ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.password'), 'required']) }}
<div class="input-group-append">
<div class="btn btn-outline-secondary">
<i class="fa fa-lock"></i>
</div>
</div>
</div>
{!! $errors->first('password', '<p class="text-danger"><strong>:message</strong></p>') !!}
</div>
@if ($errors->any())
<div class="form-group has-feedback">
<p class="text-danger">
<strong>{{ $errors->first('msg') }}</strong>
</p>
</div>
@endif
<div class="row">
<div class="col-12 col-lg-6 mbs">
<button type="submit" class="btn btn-primary btn-block btn-flat">{{ __('Se connecter') }}</button>
</div>
<div class="col-12 col-lg-6">
<a href="{{ route('Shop.password.request') }}">{{ __('Mot de passe oublié ?') }}</a><br>
<!--
<div class="col-12 col-lg-6">
<a href="{{ route('Shop.password.request') }}">{{ __('Mot de passe oublié ?') }}</a><br>
<!--
<div class="checkbox icheck">
<label style="padding-left: 0">
<input type="checkbox" name="remember" class="icheck" {{ old('remember') ? 'checked' : '' }}>
@@ -44,6 +44,6 @@
</label>
</div>
-->
</div>
</div>
</div>
{!! Form::close() !!}

View File

@@ -14,7 +14,7 @@
'placeholder' => __('boilerplate::auth.fields.password'),
'required',
]) }}
{!! $errors->first('password', '<p class="text-danger"><strong>:message</strong></p>') !!}
{!! $errors->registration->first('password', '<p class="text-danger"><strong>:message</strong></p>') !!}
</div>
</div>
<div class="col-6">
@@ -25,7 +25,10 @@
'placeholder' => __('boilerplate::auth.fields.password_confirm'),
'required',
]) }}
{!! $errors->first('password_confirmation', '<p class="text-danger"><strong>:message</strong></p>') !!}
{!! $errors->registration->first(
'password_confirmation',
'<p class="text-danger"><strong>:message</strong></p>',
) !!}
</div>
</div>
</div>

View File

@@ -2,7 +2,6 @@
@push('scripts')
<script>
function initSaveForm(form, sel) {
console.log('ici');
if (typeof initValidator === 'function') {
initValidator();
}

View File

@@ -1,7 +0,0 @@
@extends('Shop.layout.layout', [
'title' => __('Paiement annulé'),
])
@section('content')
Le paiement a été annulé.
@endsection

View File

@@ -1,9 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
Thank you for your payment. Your payment should be accepted soon.
</body>
</html>

View File

@@ -0,0 +1,11 @@
@extends('Shop.layout.layout', [
'title' => __('Paiement CB'),
])
@section('content')
<div class="row">
<div class="col-12">
{!! $content !!}
</div>
</div>
@endsection

View File

@@ -1,7 +0,0 @@
@extends('Shop.layout.layout', [
'title' => __('Paiement refusé'),
])
@section('content')
Le paiement a été refusé.
@endsection

View File

@@ -1,19 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Send Paybox payment</title>
</head>
<body>
<form method="post" action="{{ $url }}" id="paybox-payment">
@foreach ($parameters as $name => $value)
<input type="hidden" name="{{ $name }}" value="{{ $value }}">
@endforeach
<input type="submit" value="Send payment">
</form>
<script>
document.getElementById("paybox-payment").submit();
</script>
<body>
<form method="post" action="{{ $url }}" id="paybox-payment">
@foreach ($parameters as $name => $value)
<input type="hidden" name="{{ $name }}" value="{{ $value }}">
@endforeach
<input type="submit" value="Send payment">
</form>
<script>
document.getElementById("paybox-payment").submit();
</script>
</body>
</html>

View File

@@ -1,9 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
Your payment is waiting. It might take some time until it is completed.
</body>
</html>

View File

@@ -2,8 +2,8 @@
Route::prefix('InvoicePayments')->name('InvoicePayments.')->group(function () {
Route::get('', 'InvoicePaymentController@index')->name('index');
Route::get('create', 'InvoicePaymentController@create')->name('create');
Route::delete('destroy', 'InvoicePaymentController@destroy')->name('destroy');
Route::get('create/{invoice_id?}', 'InvoicePaymentController@create')->name('create');
Route::get('destroy/{id?}', 'InvoicePaymentController@destroy')->name('destroy');
Route::post('update', 'InvoicePaymentController@update')->name('update');
Route::post('store', 'InvoicePaymentController@store')->name('store');
Route::get('edit/{id?}', 'InvoicePaymentController@edit')->name('edit');

View File

@@ -6,5 +6,5 @@ Route::prefix('Invoices')->name('Invoices.')->group(function () {
Route::delete('destroy', 'InvoiceController@destroy')->name('destroy');
Route::post('update', 'InvoiceController@update')->name('update');
Route::post('store', 'InvoiceController@store')->name('store');
Route::get('edit/{id}', 'InvoiceController@edit')->name('edit');
Route::get('edit/{id?}', 'InvoiceController@edit')->name('edit');
});

View File

@@ -7,4 +7,5 @@ Route::prefix('Clients')->name('Customers.')->group(function () {
Route::get('edit', 'CustomerController@edit')->name('edit');
Route::post('storeProfileAjax', 'CustomerController@storeProfileAjax')->name('storeProfileAjax');
Route::post('store', 'CustomerController@store')->name('store');
Route::get('delete_address/{$id?}', 'CustomerController@delete_address')->name('delete_address');
});