fixes on mail templates, change order edit layout, add DeliveryTypes, DeliveryTypeCalculations & DeliveryPackages

This commit is contained in:
Ludovic CANDELLIER
2023-05-24 23:30:29 +02:00
parent c677dbd5fa
commit 9f9b7173d7
13 changed files with 220 additions and 43 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Repositories\Shop;
use Carbon\Carbon;
use App\Mail\Acheminement;
use App\Mail\ConfirmationCommande;
use App\Mail\Preparation;
use App\Models\Shop\Order;
use App\Repositories\Core\DateStats;
@@ -39,31 +40,28 @@ class Orders
public static function testSend($id)
{
$order = self::get($id, ['customer', 'address']);
dump($order->toArray());
exit;
self::sendPreparation($order);
self::sendPreparation($id);
}
public static function sendOrderConfirmed($order_id)
{
$order = self::get($order_id, ['customer']);
$mail = new Acheminement($order);
return Mail::to($order->email)->send($mail);
}
public static function sendShipping($order_id)
{
$order = self::get($order_id, ['customer']);
$mail = new Acheminement($order);
return Mail::to($order->email)->send($mail);
$order = self::get($order_id, ['customer', 'address']);
$mail = new ConfirmationCommande($order);
return Mail::to($order->customer->email)->send($mail);
}
public static function sendPreparation($order_id)
{
$order = self::get($order_id, ['customer']);
$order = self::get($order_id, ['customer', 'address']);
$mail = new Preparation($order);
return Mail::to($order->email)->send($mail);
return Mail::to($order->customer->email)->send($mail);
}
public static function sendShipping($order_id)
{
$order = self::get($order_id, ['customer', 'address']);
$mail = new Acheminement($order);
return Mail::to($order->customer->email)->send($mail);
}
public static function count()
@@ -99,8 +97,9 @@ class Orders
public static function edit($id)
{
return [
'order' => self::get($id, ['customer', 'address', 'detail']),
'order' => self::get($id, ['customer', 'address', 'delivery_address', 'detail']),
'statuses' => self::statuses(),
'delivery_types' => DeliveryTypes::getOptions(),
'payment_types' => self::paymentTypes(),
'sale_channels' => SaleChannels::getOptions(),
];