fixes
This commit is contained in:
@@ -25,6 +25,7 @@ class ContentsDataTable extends DataTable
|
|||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
Column::make('id')->title('id'),
|
||||||
Column::make('text')->title('Texte'),
|
Column::make('text')->title('Texte'),
|
||||||
$this->makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Admin\Shop;
|
|||||||
use App\Datatables\Admin\Shop\InvoicePaymentsDataTable;
|
use App\Datatables\Admin\Shop\InvoicePaymentsDataTable;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Repositories\Shop\InvoicePayments;
|
use App\Repositories\Shop\InvoicePayments;
|
||||||
|
use App\Repositories\Shop\Invoices;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class InvoicePaymentController extends Controller
|
class InvoicePaymentController extends Controller
|
||||||
@@ -14,18 +15,21 @@ class InvoicePaymentController extends Controller
|
|||||||
return $dataTable->render('Admin.Shop.InvoicePayments.list');
|
return $dataTable->render('Admin.Shop.InvoicePayments.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create($invoice_id)
|
||||||
{
|
{
|
||||||
$data = InvoicePayments::init();
|
$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)
|
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)
|
public function show($id)
|
||||||
@@ -40,12 +44,15 @@ class InvoicePaymentController extends Controller
|
|||||||
{
|
{
|
||||||
$data = InvoicePayments::init();
|
$data = InvoicePayments::init();
|
||||||
$data['invoice_payment'] = InvoicePayments::getArray($id);
|
$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)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
return InvoicePayments::destroy($id);
|
$payment = InvoicePayments::get($id);
|
||||||
|
InvoicePayments::destroy($id);
|
||||||
|
Invoices::checkPayments($payment->invoice_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
|||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Sebastienheyd\Boilerplate\Rules\Password;
|
|
||||||
|
|
||||||
|
|
||||||
class RegisterController extends Controller
|
class RegisterController extends Controller
|
||||||
@@ -24,14 +23,6 @@ class RegisterController extends Controller
|
|||||||
|
|
||||||
public function register(RegisterCustomer $request)
|
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')) {
|
if (back()->getTargetUrl() === route('Shop.Orders.store')) {
|
||||||
$route = 'Shop.Orders.order';
|
$route = 'Shop.Orders.order';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Shop;
|
namespace App\Http\Controllers\Shop;
|
||||||
|
|
||||||
|
use App\Repositories\Shop\CustomerAddresses;
|
||||||
use App\Repositories\Shop\Customers;
|
use App\Repositories\Shop\Customers;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -54,4 +55,11 @@ class CustomerController extends Controller
|
|||||||
|
|
||||||
return redirect()->route('Shop.Customers.edit');
|
return redirect()->route('Shop.Customers.edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete_address($id)
|
||||||
|
{
|
||||||
|
$ret = CustomerAddresses::destroy($id);
|
||||||
|
|
||||||
|
return redirect()->route('Shop.Customers.edit');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,10 @@
|
|||||||
namespace App\Http\Controllers\Shop;
|
namespace App\Http\Controllers\Shop;
|
||||||
|
|
||||||
use App\Datatables\Shop\CustomerOrdersDataTable;
|
use App\Datatables\Shop\CustomerOrdersDataTable;
|
||||||
|
use App\Http\Requests\Shop\StoreOrderPost;
|
||||||
use App\Repositories\Core\User\ShopCart;
|
use App\Repositories\Core\User\ShopCart;
|
||||||
use App\Repositories\Shop\Baskets;
|
use App\Repositories\Shop\Baskets;
|
||||||
|
use App\Repositories\Shop\Contents;
|
||||||
use App\Repositories\Shop\Customers;
|
use App\Repositories\Shop\Customers;
|
||||||
use App\Repositories\Shop\Deliveries;
|
use App\Repositories\Shop\Deliveries;
|
||||||
use App\Repositories\Shop\DeliveryTypes;
|
use App\Repositories\Shop\DeliveryTypes;
|
||||||
@@ -61,13 +63,14 @@ class OrderController extends Controller
|
|||||||
return redirect()->route('home');
|
return redirect()->route('home');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(StoreOrderPost $request)
|
||||||
{
|
{
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
$data['customer_id'] = Customers::getId();
|
$data['customer_id'] = Customers::getId();
|
||||||
$data['sale_channel_id'] = $data['sale_channel_id'] ?? SaleChannels::getDefaultID();
|
$data['sale_channel_id'] = $data['sale_channel_id'] ?? SaleChannels::getDefaultID();
|
||||||
$data['basket'] = Baskets::getBasketSummary($data['sale_channel_id'], $data['delivery_type_id'] ?? false);
|
$data['basket'] = Baskets::getBasketSummary($data['sale_channel_id'], $data['delivery_type_id'] ?? false);
|
||||||
$order = Orders::saveOrder($data);
|
$order = Orders::saveOrder($data);
|
||||||
|
|
||||||
if ($order) {
|
if ($order) {
|
||||||
if ($data['payment_type'] === '1') {
|
if ($data['payment_type'] === '1') {
|
||||||
return Paybox::makeAuthorizationRequest($order);
|
return Paybox::makeAuthorizationRequest($order);
|
||||||
@@ -83,8 +86,9 @@ class OrderController extends Controller
|
|||||||
public function confirmed()
|
public function confirmed()
|
||||||
{
|
{
|
||||||
ShopCart::clear();
|
ShopCart::clear();
|
||||||
|
$content = Contents::getOrderConfirmedContent();
|
||||||
|
|
||||||
return view('Shop.Orders.confirmed');
|
return view('Shop.Orders.confirmed', ['content' => $content]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPdf($uuid)
|
public function getPdf($uuid)
|
||||||
|
|||||||
@@ -3,38 +3,33 @@
|
|||||||
namespace App\Http\Controllers\Shop;
|
namespace App\Http\Controllers\Shop;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Repositories\Shop\Contents;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class PayboxController extends Controller
|
class PayboxController extends Controller
|
||||||
{
|
{
|
||||||
public function accepted()
|
public function accepted()
|
||||||
{
|
{
|
||||||
return view('paybox.accepted');
|
return view('paybox.paybox', ['content' => Contents::getPayboxConfirmedContent()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function refused(Request $request)
|
public function refused(Request $request)
|
||||||
{
|
{
|
||||||
dump($request->all());
|
return view('paybox.paybox', ['content' => Contents::getPayboxRefusedContent()]);
|
||||||
exit;
|
|
||||||
|
|
||||||
return view('paybox.refused');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function aborted()
|
public function aborted()
|
||||||
{
|
{
|
||||||
return view('paybox.aborted');
|
return view('paybox.paybox', ['content' => Contents::getPayboxAbortedContent()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function waiting()
|
public function waiting()
|
||||||
{
|
{
|
||||||
return view('paybox.waiting');
|
return view('paybox.waiting', ['content' => Contents::getPayboxWaitingContent()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process(Request $request)
|
public function process(Request $request)
|
||||||
{
|
{
|
||||||
dump($request);
|
|
||||||
exit;
|
|
||||||
|
|
||||||
return view('paybox.send');
|
return view('paybox.send');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Shop;
|
namespace App\Http\Requests\Shop;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\Validator;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
use Sebastienheyd\Boilerplate\Rules\Password;
|
use Sebastienheyd\Boilerplate\Rules\Password;
|
||||||
|
|
||||||
class RegisterCustomer extends FormRequest
|
class RegisterCustomer extends FormRequest
|
||||||
@@ -21,4 +23,14 @@ class RegisterCustomer extends FormRequest
|
|||||||
'password' => ['required', 'confirmed', new Password()],
|
'password' => ['required', 'confirmed', new Password()],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function failedValidation(Validator $validator)
|
||||||
|
{
|
||||||
|
$response = redirect()
|
||||||
|
->back()
|
||||||
|
->withInput()
|
||||||
|
->withErrors($validator->errors(), 'registration');
|
||||||
|
|
||||||
|
throw new ValidationException($validator, $response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,19 @@ class StoreOrderPost extends FormRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
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',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,14 +42,16 @@ class ConfirmationCommande extends TemplateMailable
|
|||||||
|
|
||||||
public function __construct($order)
|
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->prenom = $order->customer->first_name;
|
||||||
$this->nom = $order->customer->last_name;
|
$this->nom = $order->customer->last_name;
|
||||||
$this->facturation_adresse = $order->address->address;
|
$this->facturation_adresse = $facturation_address->address;
|
||||||
$this->facturation_cp = $order->address->zipcode;
|
$this->facturation_cp = $facturation_address->zipcode;
|
||||||
$this->facturation_ville = $order->address->city;
|
$this->facturation_ville = $facturation_address->city;
|
||||||
$this->livraison_adresse = $order->delivery_address->address;
|
$this->livraison_adresse = $delivery_address->address;
|
||||||
$this->livraison_cp = $order->delivery_address->zipcode;
|
$this->livraison_cp = $delivery_address->zipcode;
|
||||||
$this->livraison_ville = $order->delivery_address->city;
|
$this->livraison_ville = $delivery_address->city;
|
||||||
$this->societe = $order->customer->company;
|
$this->societe = $order->customer->company;
|
||||||
$this->email = $order->customer->email;
|
$this->email = $order->customer->email;
|
||||||
$this->numero_commande = $order->ref;
|
$this->numero_commande = $order->ref;
|
||||||
|
|||||||
@@ -47,4 +47,18 @@ class Specie extends Model implements HasMedia
|
|||||||
{
|
{
|
||||||
return $query->where($this->table.'.name', $name);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,4 +37,22 @@ class Variety extends Model implements HasMedia
|
|||||||
{
|
{
|
||||||
return $this->morphToMany(Tag::class, 'taggable');
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,6 +191,10 @@ class Article extends Model implements HasMedia
|
|||||||
{
|
{
|
||||||
return $tagId ? $query->whereHas('tags', function ($query) use ($tagId) {
|
return $tagId ? $query->whereHas('tags', function ($query) use ($tagId) {
|
||||||
$query->byId($tagId);
|
$query->byId($tagId);
|
||||||
|
})->orWhereHasMorph('product', [Variety::class], function($query) use ($tagId) {
|
||||||
|
$query->whereHas('tags', function ($query) use ($tagId) {
|
||||||
|
$query->where('id', $tagId);
|
||||||
|
});
|
||||||
}) : $query;
|
}) : $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,6 +202,10 @@ class Article extends Model implements HasMedia
|
|||||||
{
|
{
|
||||||
return $tags ? $query->whereHas('tags', function ($query) use ($tags) {
|
return $tags ? $query->whereHas('tags', function ($query) use ($tags) {
|
||||||
$query->byIds($tags);
|
$query->byIds($tags);
|
||||||
|
})->orWhereHasMorph('product', [Variety::class], function($query) use ($tags) {
|
||||||
|
$query->whereHas('tags', function ($query) use ($tags) {
|
||||||
|
$query->whereIntegerInRaw('id', $tags);
|
||||||
|
});
|
||||||
}) : $query;
|
}) : $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models\Shop;
|
namespace App\Models\Shop;
|
||||||
|
|
||||||
|
use App\Repositories\Core\DateTime;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Venturecraft\Revisionable\RevisionableTrait;
|
use Venturecraft\Revisionable\RevisionableTrait;
|
||||||
@@ -47,4 +48,14 @@ class InvoicePayment extends Model
|
|||||||
{
|
{
|
||||||
return $query->where('payment_type', $paymentType);
|
return $query->where('payment_type', $paymentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDateAttribute($value)
|
||||||
|
{
|
||||||
|
return DateTime::dateToLocale($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateAttribute($value)
|
||||||
|
{
|
||||||
|
$this->attributes['date'] = DateTime::convert($value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Models\Botanic\Specie;
|
|||||||
use App\Models\Botanic\Variety;
|
use App\Models\Botanic\Variety;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Rinvex\Tags\Models\Tag as parentTag;
|
use Rinvex\Tags\Models\Tag as parentTag;
|
||||||
|
|
||||||
class Tag extends 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)
|
public function scopeById($query, $id)
|
||||||
{
|
{
|
||||||
return $query->where($this->table.'.id', $id);
|
return $query->where($this->table.'.id', $id);
|
||||||
@@ -85,6 +145,6 @@ class Tag extends parentTag
|
|||||||
|
|
||||||
public function scopeByIds($query, $ids)
|
public function scopeByIds($query, $ids)
|
||||||
{
|
{
|
||||||
return $query->whereIn($this->table.'.id', $ids);
|
return $query->whereIntegerInRaw($this->table.'.id', $ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,32 @@ class Contents
|
|||||||
return self::get(4)->text ?? '';
|
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()
|
public static function getModel()
|
||||||
{
|
{
|
||||||
return Content::query();
|
return Content::query();
|
||||||
|
|||||||
@@ -10,18 +10,44 @@ class CustomerAddresses
|
|||||||
use Basic;
|
use Basic;
|
||||||
|
|
||||||
public static function add($userId, $data)
|
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'];
|
$name = $data['company'] ? $data['company'] : $data['first_name'].' '.$data['last_name'];
|
||||||
$delivery = $data['use_for_delivery'] ?? false;
|
$delivery = $data['use_for_delivery'] ?? false;
|
||||||
|
|
||||||
return self::store([
|
$data = [
|
||||||
'customer_id' => $userId,
|
'customer_id' => $userId,
|
||||||
|
'type' => 2,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'address' => $delivery ? $data['delivery_address'] : $data['address'],
|
'address' => $delivery ? $data['delivery_address'] : $data['address'],
|
||||||
'address2' => $delivery ? $data['delivery_address2'] : $data['address2'],
|
'address2' => $delivery ? $data['delivery_address2'] : $data['address2'],
|
||||||
'zipcode' => $delivery ? $data['delivery_zipcode'] : $data['zipcode'],
|
'zipcode' => $delivery ? $data['delivery_zipcode'] : $data['zipcode'],
|
||||||
'city' => $delivery ? $data['delivery_city'] : $data['city'],
|
'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)
|
public static function getInvoiceAddress($customerId)
|
||||||
|
|||||||
@@ -43,6 +43,31 @@ class Invoices
|
|||||||
return $data;
|
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)
|
public static function getFullByUUID($id)
|
||||||
{
|
{
|
||||||
return self::getByUUID($id, self::full());
|
return self::getByUUID($id, self::full());
|
||||||
@@ -61,6 +86,7 @@ class Invoices
|
|||||||
'order.delivery_address',
|
'order.delivery_address',
|
||||||
'order.detail',
|
'order.detail',
|
||||||
'order.sale_channel',
|
'order.sale_channel',
|
||||||
|
'order.customer',
|
||||||
'payments',
|
'payments',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -106,7 +132,7 @@ class Invoices
|
|||||||
|
|
||||||
public static function statuses()
|
public static function statuses()
|
||||||
{
|
{
|
||||||
return ['En attente', 'Paiement partiel', 'Soldée', 'Paiement rejeté'];
|
return ['En attente', 'Paiement partiel', 'Soldée'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getModel()
|
public static function getModel()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Repositories\Shop;
|
namespace App\Repositories\Shop;
|
||||||
|
|
||||||
|
use App\Models\Botanic\Variety;
|
||||||
use App\Models\Shop\Tag;
|
use App\Models\Shop\Tag;
|
||||||
use App\Models\Shop\TagGroup;
|
use App\Models\Shop\TagGroup;
|
||||||
use App\Traits\Model\Basic;
|
use App\Traits\Model\Basic;
|
||||||
@@ -15,6 +16,8 @@ class TagGroups
|
|||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
$tags = Tag::withCountArticlesByCategory($category_id)->get()->toArray();
|
$tags = Tag::withCountArticlesByCategory($category_id)->get()->toArray();
|
||||||
|
dump($tags);
|
||||||
|
exit;
|
||||||
$tagGroups = TagGroup::pluck('name', 'id')->toArray();
|
$tagGroups = TagGroup::pluck('name', 'id')->toArray();
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
if (! $tag['articles_count']) {
|
if (! $tag['articles_count']) {
|
||||||
@@ -31,6 +34,30 @@ class TagGroups
|
|||||||
return $data;
|
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)
|
public static function isTagGroupHaveSelected($tagsSelected, $tags)
|
||||||
{
|
{
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
@include('Admin.Shop.InvoicePayments.form')
|
|
||||||
@@ -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="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="row mb-3">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@@ -43,4 +45,5 @@ f{{ Form::open(['route' => 'Admin.Shop.InvoicePayments.store', 'id' => 'invoice_
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
initDatepicker();
|
initDatepicker();
|
||||||
|
initSaveForm('#invoice_payment-form', '.modal-content .bootbox-accept');
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@extends('layout.index', [
|
@extends('layout.index', [
|
||||||
'title' => 'Factures',
|
'title' => 'Factures',
|
||||||
'subtitle' => 'Edition d\'une facture',
|
'subtitle' => 'Edition d\'une facture',
|
||||||
'breadcrumb' => ['Articles'],
|
'breadcrumb' => ['Factures'],
|
||||||
])
|
])
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|||||||
@@ -67,3 +67,4 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
@include('load.layout.modal')
|
@include('load.layout.modal')
|
||||||
|
@include('load.form.save')
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
<td>{{ $payment_types[$payment['payment_type']] }}</td>
|
<td>{{ $payment_types[$payment['payment_type']] }}</td>
|
||||||
<td class="text-right font-weight-bold">{{ sprintf('%01.2f', $payment['amount']) }} €</td>
|
<td class="text-right font-weight-bold">{{ sprintf('%01.2f', $payment['amount']) }} €</td>
|
||||||
<td>{{ $payment['reference'] }}</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>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -34,9 +38,15 @@
|
|||||||
$('#add_payment').click(function() {
|
$('#add_payment').click(function() {
|
||||||
InvoicePaymentCreate();
|
InvoicePaymentCreate();
|
||||||
});
|
});
|
||||||
|
$('.payment-edit').click(function() {
|
||||||
|
InvoicePaymentEdit($(this).data('id'));
|
||||||
|
});
|
||||||
|
$('.payment-delete').click(function() {
|
||||||
|
InvoicePaymentDelete($(this).data('id'));
|
||||||
|
});
|
||||||
|
|
||||||
function InvoicePaymentCreate() {
|
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') }}";
|
var url_save = "{{ route('Admin.Shop.InvoicePayments.store') }}";
|
||||||
openModal("Ajouter un paiement", '#invoice_payment-form', url_open, url_save,
|
openModal("Ajouter un paiement", '#invoice_payment-form', url_open, url_save,
|
||||||
"InvoicePaymentRefresh();", 'sm');
|
"InvoicePaymentRefresh();", 'sm');
|
||||||
@@ -49,8 +59,11 @@
|
|||||||
"InvoicePaymentRefresh();", 'sm');
|
"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>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-6 text-right font-weight-bold">
|
<div class="col-6 text-right font-weight-bold">
|
||||||
<span id="basket-total">
|
<span id="basket-total">
|
||||||
{{ $basket['total_taxed'] ?? 0 }}
|
{{ number_format($basket['total_taxed'] ?? 0, 2, '.') }}
|
||||||
</span> €
|
</span> €
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-6 text-right font-weight-bold">
|
<div class="col-6 text-right font-weight-bold">
|
||||||
<span id="shipping">
|
<span id="shipping">
|
||||||
{{ $basket['shipping'] }}
|
{{ number_format($basket['shipping'], 2, '.') }}
|
||||||
</span> €
|
</span> €
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-6 text-right">
|
<div class="col-6 text-right">
|
||||||
<span id="basket-total-shipped">
|
<span id="basket-total-shipped">
|
||||||
{{ $basket['total_shipped'] ?? 0 }}
|
{{ number_format($basket['total_shipped'] ?? 0, 2, '.') }}
|
||||||
</span> €
|
</span> €
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@include('components.form.input', [
|
@include('components.form.input', [
|
||||||
'name' => $prefix ?? false ? $prefix . "['name']" : 'name',
|
'name' => $prefix ?? false ? $prefix . '[name]' : 'name',
|
||||||
'value' => $customer['name'] ?? '',
|
'value' => $customer['name'] ?? (old('name') ?? ''),
|
||||||
'label' => 'Nom',
|
'label' => 'Nom',
|
||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
@@ -13,9 +13,10 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@include('components.form.input', [
|
@include('components.form.input', [
|
||||||
'name' => $prefix ?? false ? $prefix . "['address']" : 'address',
|
'name' => $prefix ?? false ? $prefix . '[address]' : 'address',
|
||||||
'value' => $customer['address'] ?? '',
|
'value' => $customer['address'] ?? (old('address') ?? ''),
|
||||||
'label' => $label ?? '',
|
'label' => $label ?? '',
|
||||||
|
'required' => $required ?? false,
|
||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -23,9 +24,10 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@include('components.form.input', [
|
@include('components.form.input', [
|
||||||
'name' => $prefix ?? false ? $prefix . "['address2']" : 'address2',
|
'name' => $prefix ?? false ? $prefix . '[address2]' : 'address2',
|
||||||
'value' => $customer['address2'] ?? '',
|
'value' => $customer['address2'] ?? (old('address2') ?? ''),
|
||||||
'label' => 'Complément d\'adresse',
|
'label' => 'Complément d\'adresse',
|
||||||
|
'required' => false,
|
||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -33,16 +35,18 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
@include('components.form.input', [
|
@include('components.form.input', [
|
||||||
'name' => $prefix ?? false ? $prefix . "['zipcode']" : 'zipcode',
|
'name' => $prefix ?? false ? $prefix . '[zipcode]' : 'zipcode',
|
||||||
'value' => $customer['zipcode'] ?? '',
|
'value' => $customer['zipcode'] ?? (old('zipcode') ?? ''),
|
||||||
'label' => 'Code postal',
|
'label' => 'Code postal',
|
||||||
|
'required' => $required ?? false,
|
||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
@include('components.form.input', [
|
@include('components.form.input', [
|
||||||
'name' => $prefix ?? false ? $prefix . "['city']" : 'city',
|
'name' => $prefix ?? false ? $prefix . '[city]' : 'city',
|
||||||
'value' => $customer['city'] ?? '',
|
'value' => $customer['city'] ?? (old('city') ?? ''),
|
||||||
'label' => 'Ville',
|
'label' => 'Ville',
|
||||||
|
'required' => $required ?? false,
|
||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
<x-form.radios.icheck name="@if ($prefix ?? false) {{ $prefix }} . '[]' @endif address_id"
|
<x-form.radios.icheck name="@if ($prefix ?? false) {{ $prefix }} . '[]' @endif address_id"
|
||||||
val="{{ $address['id'] }}" id="address_{{ $address['id'] }}" />
|
val="{{ $address['id'] }}" id="address_{{ $address['id'] }}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-11">
|
<div class="col-10">
|
||||||
@if ($with_name ?? false)
|
@if ($with_name ?? false)
|
||||||
{{ $address['name'] }}<br />>
|
{{ $address['name'] }}<br />
|
||||||
@endif
|
@endif
|
||||||
{{ $address['address'] }}<br />
|
{{ $address['address'] }}<br />
|
||||||
@if ($address['address2'])
|
@if ($address['address2'])
|
||||||
@@ -14,6 +14,11 @@
|
|||||||
@endif
|
@endif
|
||||||
{{ $address['zipcode'] }} {{ $address['city'] }}
|
{{ $address['zipcode'] }} {{ $address['city'] }}
|
||||||
</div>
|
</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>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@if ($errors->any())
|
@if ($errors->registration->any())
|
||||||
<div class="alert alert-danger">
|
<div class="alert alert-danger">
|
||||||
<ul>
|
<ul>
|
||||||
@foreach ($errors->all() as $error)
|
@foreach ($errors->registration->all() as $error)
|
||||||
<li>{{ $error }}</li>
|
<li>{{ $error }}</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
</ul>
|
</ul>
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@include('components.form.input', [
|
@include('components.form.input', [
|
||||||
'name' => 'first_name',
|
'name' => 'first_name',
|
||||||
'value' => $customer['first_name'] ?? '',
|
'value' => $customer['first_name'] ?? (old('first_name') ?? ''),
|
||||||
'label' => 'Prénom',
|
'label' => 'Prénom',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
])
|
])
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@include('components.form.input', [
|
@include('components.form.input', [
|
||||||
'name' => 'last_name',
|
'name' => 'last_name',
|
||||||
'value' => $customer['last_name'] ?? '',
|
'value' => $customer['last_name'] ?? (old('last_name') ?? ''),
|
||||||
'label' => 'Nom',
|
'label' => 'Nom',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
])
|
])
|
||||||
@@ -30,14 +30,14 @@
|
|||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@include('components.form.input', [
|
@include('components.form.input', [
|
||||||
'name' => 'company',
|
'name' => 'company',
|
||||||
'value' => $customer['company'] ?? '',
|
'value' => $customer['company'] ?? (old('company') ?? ''),
|
||||||
'label' => 'Société',
|
'label' => 'Société',
|
||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@include('components.form.input', [
|
@include('components.form.input', [
|
||||||
'name' => 'tva',
|
'name' => 'tva',
|
||||||
'value' => $customer['tva'] ?? '',
|
'value' => $customer['tva'] ?? (old('tva') ?? ''),
|
||||||
'label' => 'N° de TVA',
|
'label' => 'N° de TVA',
|
||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
@@ -46,18 +46,19 @@
|
|||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@include('components.form.input', [
|
@include('components.form.input', [
|
||||||
'name' => 'email',
|
'name' => 'email',
|
||||||
'value' => $customer['email'] ?? '',
|
'value' => $customer['email'] ?? (old('email') ?? ''),
|
||||||
'label' => 'Email',
|
'label' => 'Email',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
])
|
])
|
||||||
|
{!! $errors->registration->first('email', '<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@include('components.form.input', [
|
@include('components.form.input', [
|
||||||
'name' => 'phone',
|
'name' => 'phone',
|
||||||
'value' => $customer['phone'] ?? '',
|
'value' => $customer['phone'] ?? (old('phone') ?? ''),
|
||||||
'label' => 'Téléphone',
|
'label' => 'Téléphone',
|
||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@include('Shop.Customers.partials.address', ['label' => 'Adresse'])
|
@include('Shop.Customers.partials.address', ['label' => 'Adresse', 'required' => true])
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
@extends('Shop.layout.layout', [
|
@extends('Shop.layout.layout', [
|
||||||
'title' => __('Commande confirmée'),
|
'title' => __('Commande confirmée'),
|
||||||
])
|
])
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-12">
|
||||||
Votre commande a été confirmée
|
{!! $content !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -3,6 +3,15 @@
|
|||||||
])
|
])
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
@php
|
||||||
|
if ($errors->registration) {
|
||||||
|
$classIdent = 'd-none';
|
||||||
|
$classRegister = '';
|
||||||
|
} else {
|
||||||
|
$classIdent = '';
|
||||||
|
$classRegister = 'd-none';
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="@if ($basket['count']) col-sm-12 col-lg-8 @else col-12 @endif">
|
<div class="@if ($basket['count']) col-sm-12 col-lg-8 @else col-12 @endif">
|
||||||
@if (App\Repositories\Shop\Customers::isNotConnected())
|
@if (App\Repositories\Shop\Customers::isNotConnected())
|
||||||
@@ -11,12 +20,13 @@
|
|||||||
<button class="btn btn-secondary" id="register">Créez mon compte</button>
|
<button class="btn btn-secondary" id="register">Créez mon compte</button>
|
||||||
</p>
|
</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')
|
@include('Shop.auth.partials.login')
|
||||||
</x-layout.collapse>
|
</x-layout.collapse>
|
||||||
|
|
||||||
<x-layout.collapse id="personal_data" title="Informations personnelles"
|
<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')
|
@include('Shop.auth.partials.register')
|
||||||
</x-layout.collapse>
|
</x-layout.collapse>
|
||||||
@else
|
@else
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
'name' => $name,
|
'name' => $name,
|
||||||
'val' => $address['id'],
|
'val' => $address['id'],
|
||||||
'id' => $prefix . '_address_' . $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>
|
||||||
<div class="col-11">
|
<div class="col-11">
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
@include('components.form.radios.icheck', [
|
@include('components.form.radios.icheck', [
|
||||||
'name' => 'delivery_id',
|
'name' => 'delivery_id',
|
||||||
'val' => $delivery['id'],
|
'val' => $delivery['id'],
|
||||||
|
'value' => (int) old('delivery_id') === $delivery['id'] ? $delivery['id'] : null,
|
||||||
'id' => 'delivery_' . $delivery['id'],
|
'id' => 'delivery_' . $delivery['id'],
|
||||||
'class' => 'delivery_mode' . ($delivery['at_house'] ? ' at_house' : ''),
|
'class' => 'delivery_mode' . ($delivery['at_house'] ? ' at_house' : ''),
|
||||||
])
|
])
|
||||||
@@ -15,11 +16,14 @@
|
|||||||
</div>
|
</div>
|
||||||
@endforeach
|
@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
|
ci-contre
|
||||||
|
|
||||||
@include('components.form.textarea', [
|
@include('components.form.textarea', [
|
||||||
'name' => 'comment',
|
'name' => 'comment',
|
||||||
|
'value' => old('comment') ?? '',
|
||||||
])
|
])
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-1">
|
<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>
|
||||||
<div class="col-11 pt-2">
|
<div class="col-11 pt-2">
|
||||||
PAIEMENT PAR CARTE BANCAIRE
|
PAIEMENT PAR CARTE BANCAIRE
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-1">
|
<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>
|
||||||
<div class="col-11 pt-2">
|
<div class="col-11 pt-2">
|
||||||
PAIEMENT PAR CHEQUE
|
PAIEMENT PAR CHEQUE
|
||||||
@@ -18,20 +18,23 @@
|
|||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-1">
|
<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>
|
||||||
<div class="col-11 pt-2">
|
<div class="col-11 pt-2">
|
||||||
PAIEMENT PAR VIREMENT BANCAIRE
|
PAIEMENT PAR VIREMENT BANCAIRE
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{!! $errors->first('payment_type', '<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||||
|
|
||||||
<div class="row pt-5">
|
<div class="row pt-5">
|
||||||
<div class="col-1">
|
<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>
|
||||||
<div class="col-11 pt-2">
|
<div class="col-11 pt-2">
|
||||||
J'ai lu les conditions générales de vente et j'y adhère sans réserve
|
J'ai lu les conditions générales de vente et j'y adhère sans réserve
|
||||||
</div>
|
</div>
|
||||||
|
{!! $errors->first('agree', '<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||||
</div>
|
</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>
|
||||||
|
|||||||
@@ -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="form-group has-feedback">
|
||||||
<div class="input-group form-group {{ $errors->has('email') ? 'has-error' : '' }}">
|
<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']) }}
|
{{ Form::email('email', old('email'), ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.email'), 'required', 'autofocus']) }}
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<div class="btn btn-outline-secondary">
|
<div class="btn btn-outline-secondary">
|
||||||
<i class="fa fa-at"></i>
|
<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>
|
</div>
|
||||||
</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>
|
</div>
|
||||||
@if ($errors->any())
|
</div>
|
||||||
<div class="form-group has-feedback">
|
<div class="form-group has-feedback">
|
||||||
<p class="text-danger">
|
<div class="input-group form-group {{ $errors->has('password') ? 'has-error' : '' }}">
|
||||||
<strong>{{ $errors->first('msg') }}</strong>
|
{{ Form::password('password', ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.password'), 'required']) }}
|
||||||
</p>
|
<div class="input-group-append">
|
||||||
</div>
|
<div class="btn btn-outline-secondary">
|
||||||
@endif
|
<i class="fa fa-lock"></i>
|
||||||
<div class="row">
|
</div>
|
||||||
<div class="col-12 col-lg-6 mbs">
|
|
||||||
<button type="submit" class="btn btn-primary btn-block btn-flat">{{ __('Se connecter') }}</button>
|
|
||||||
</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">
|
<div class="col-12 col-lg-6">
|
||||||
<a href="{{ route('Shop.password.request') }}">{{ __('Mot de passe oublié ?') }}</a><br>
|
<a href="{{ route('Shop.password.request') }}">{{ __('Mot de passe oublié ?') }}</a><br>
|
||||||
<!--
|
<!--
|
||||||
<div class="checkbox icheck">
|
<div class="checkbox icheck">
|
||||||
<label style="padding-left: 0">
|
<label style="padding-left: 0">
|
||||||
<input type="checkbox" name="remember" class="icheck" {{ old('remember') ? 'checked' : '' }}>
|
<input type="checkbox" name="remember" class="icheck" {{ old('remember') ? 'checked' : '' }}>
|
||||||
@@ -44,6 +44,6 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{!! Form::close() !!}
|
{!! Form::close() !!}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
'placeholder' => __('boilerplate::auth.fields.password'),
|
'placeholder' => __('boilerplate::auth.fields.password'),
|
||||||
'required',
|
'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>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@@ -25,7 +25,10 @@
|
|||||||
'placeholder' => __('boilerplate::auth.fields.password_confirm'),
|
'placeholder' => __('boilerplate::auth.fields.password_confirm'),
|
||||||
'required',
|
'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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script>
|
<script>
|
||||||
function initSaveForm(form, sel) {
|
function initSaveForm(form, sel) {
|
||||||
console.log('ici');
|
|
||||||
if (typeof initValidator === 'function') {
|
if (typeof initValidator === 'function') {
|
||||||
initValidator();
|
initValidator();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
@extends('Shop.layout.layout', [
|
|
||||||
'title' => __('Paiement annulé'),
|
|
||||||
])
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
Le paiement a été annulé.
|
|
||||||
@endsection
|
|
||||||
@@ -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>
|
|
||||||
11
resources/views/paybox/paybox.blade.php
Normal file
11
resources/views/paybox/paybox.blade.php
Normal 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
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
@extends('Shop.layout.layout', [
|
|
||||||
'title' => __('Paiement refusé'),
|
|
||||||
])
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
Le paiement a été refusé.
|
|
||||||
@endsection
|
|
||||||
@@ -1,19 +1,22 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Send Paybox payment</title>
|
<title>Send Paybox payment</title>
|
||||||
</head>
|
</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">
|
<body>
|
||||||
</form>
|
<form method="post" action="{{ $url }}" id="paybox-payment">
|
||||||
<script>
|
@foreach ($parameters as $name => $value)
|
||||||
document.getElementById("paybox-payment").submit();
|
<input type="hidden" name="{{ $name }}" value="{{ $value }}">
|
||||||
</script>
|
@endforeach
|
||||||
|
|
||||||
|
<input type="submit" value="Send payment">
|
||||||
|
</form>
|
||||||
|
<script>
|
||||||
|
document.getElementById("paybox-payment").submit();
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
Route::prefix('InvoicePayments')->name('InvoicePayments.')->group(function () {
|
Route::prefix('InvoicePayments')->name('InvoicePayments.')->group(function () {
|
||||||
Route::get('', 'InvoicePaymentController@index')->name('index');
|
Route::get('', 'InvoicePaymentController@index')->name('index');
|
||||||
Route::get('create', 'InvoicePaymentController@create')->name('create');
|
Route::get('create/{invoice_id?}', 'InvoicePaymentController@create')->name('create');
|
||||||
Route::delete('destroy', 'InvoicePaymentController@destroy')->name('destroy');
|
Route::get('destroy/{id?}', 'InvoicePaymentController@destroy')->name('destroy');
|
||||||
Route::post('update', 'InvoicePaymentController@update')->name('update');
|
Route::post('update', 'InvoicePaymentController@update')->name('update');
|
||||||
Route::post('store', 'InvoicePaymentController@store')->name('store');
|
Route::post('store', 'InvoicePaymentController@store')->name('store');
|
||||||
Route::get('edit/{id?}', 'InvoicePaymentController@edit')->name('edit');
|
Route::get('edit/{id?}', 'InvoicePaymentController@edit')->name('edit');
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ Route::prefix('Invoices')->name('Invoices.')->group(function () {
|
|||||||
Route::delete('destroy', 'InvoiceController@destroy')->name('destroy');
|
Route::delete('destroy', 'InvoiceController@destroy')->name('destroy');
|
||||||
Route::post('update', 'InvoiceController@update')->name('update');
|
Route::post('update', 'InvoiceController@update')->name('update');
|
||||||
Route::post('store', 'InvoiceController@store')->name('store');
|
Route::post('store', 'InvoiceController@store')->name('store');
|
||||||
Route::get('edit/{id}', 'InvoiceController@edit')->name('edit');
|
Route::get('edit/{id?}', 'InvoiceController@edit')->name('edit');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ Route::prefix('Clients')->name('Customers.')->group(function () {
|
|||||||
Route::get('edit', 'CustomerController@edit')->name('edit');
|
Route::get('edit', 'CustomerController@edit')->name('edit');
|
||||||
Route::post('storeProfileAjax', 'CustomerController@storeProfileAjax')->name('storeProfileAjax');
|
Route::post('storeProfileAjax', 'CustomerController@storeProfileAjax')->name('storeProfileAjax');
|
||||||
Route::post('store', 'CustomerController@store')->name('store');
|
Route::post('store', 'CustomerController@store')->name('store');
|
||||||
|
Route::get('delete_address/{$id?}', 'CustomerController@delete_address')->name('delete_address');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user