Skip to content

Commit

Permalink
fixed panel order status filters.
Browse files Browse the repository at this point in the history
code format
  • Loading branch information
jack authored and yushine committed Jan 2, 2025
1 parent 3e1cb51 commit 09ee129
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions innopacks/common/src/Repositories/OrderRepo.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,34 @@

namespace InnoShop\Common\Repositories;

use Exception;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Database\Eloquent\Builder;
use InnoShop\Common\Models\Address;
use InnoShop\Common\Models\Customer;
use InnoShop\Common\Models\Order;
use InnoShop\Common\Resources\AddressListItem;
use InnoShop\Common\Services\StateMachineService;
use Throwable;

class OrderRepo extends BaseRepo
{
/**
* @return array[]
* @throws Exception
*/
public static function getCriteria(): array
{
$statuses = StateMachineService::getAllStatuses();

return [
['name' => 'number', 'type' => 'input', 'label' => trans('panel/order.number')],
['name' => 'customer_name', 'type' => 'input', 'label' => trans('panel/order.customer_name')],
['name' => 'email', 'type' => 'input', 'label' => trans('panel/order.email')],
['name' => 'telephone', 'type' => 'input', 'label' => trans('panel/order.telephone')],
['name' => 'shipping_method_name', 'type' => 'input', 'label' => trans('panel/order.shipping_method_name')],
['name' => 'billing_method_name', 'type' => 'input', 'label' => trans('panel/order.billing_method_name')],
['name' => 'status', 'type' => 'input', 'label' => trans('panel/order.status')],
['name' => 'status', 'type' => 'select', 'label' => trans('panel/order.status'), 'options' => $statuses, 'options_key' => 'status', 'options_label' => 'name'],
['name' => 'total', 'type' => 'range', 'label' => trans('panel/order.total'),
'start' => ['name' => 'start'],
'end' => ['name' => 'end'],
Expand Down Expand Up @@ -145,9 +150,9 @@ public function builder(array $filters = []): Builder
/**
* @param $data
* @return mixed
* @throws \Throwable
* @throws Throwable
*/
public function create($data): mixed
public function create($data): Order
{
$data = $this->handleData($data);
$order = new Order($data);
Expand Down

0 comments on commit 09ee129

Please sign in to comment.