fixes
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user