add datatbles for invoices, add pdf icon, refactor icons components, add autocomplete on search, adapt searching to meilisearch
This commit is contained in:
@@ -14,6 +14,15 @@ class Orders
|
||||
{
|
||||
use Basic, DateStats;
|
||||
|
||||
public static function view($uuid)
|
||||
{
|
||||
$data = self::getFullByUUID($uuid)->toArray();
|
||||
$data['payment_type'] = InvoicePayments::getPaymentType($data['payment_type']);
|
||||
$data['status'] = self::getStatus($data['status']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getLast($nb = 10)
|
||||
{
|
||||
return Order::with('customer')->orderBy('id', 'DESC')->take($nb)->get();
|
||||
@@ -40,24 +49,12 @@ class Orders
|
||||
|
||||
public static function getFullByUUID($uuid)
|
||||
{
|
||||
return self::getFull(self::getIdByUUID($uuid));
|
||||
return self::getByUUID($uuid, self::full());
|
||||
}
|
||||
|
||||
public static function getFull($id)
|
||||
{
|
||||
return Order::with(['customer', 'delivery', 'delivery_address', 'detail', 'invoice.address', 'sale_channel'])
|
||||
->byID($id)->first();
|
||||
}
|
||||
|
||||
public static function view($uuid)
|
||||
{
|
||||
$data = [];
|
||||
$order = self::getFullByUUID($uuid);
|
||||
$data = $order->toArray();
|
||||
$data['payment_type'] = InvoicePayments::getPaymentType($order->payment_type);
|
||||
$data['status'] = Orders::getStatus($order->status);
|
||||
|
||||
return $data;
|
||||
return self::get($id, self::full());
|
||||
}
|
||||
|
||||
public static function saveOrder($data)
|
||||
@@ -160,6 +157,11 @@ class Orders
|
||||
return $lastRef ? $lastRef->ref + 1 : $ref + 1;
|
||||
}
|
||||
|
||||
public static function full()
|
||||
{
|
||||
return ['customer', 'delivery', 'delivery_address', 'detail', 'invoice.address', 'sale_channel'];
|
||||
}
|
||||
|
||||
public static function getModel()
|
||||
{
|
||||
return Order::query();
|
||||
|
||||
Reference in New Issue
Block a user