mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-23 06:24:10 +00:00
89 lines
2.7 KiB
PHP
89 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Companies\ControllersLogic;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\PackingLists\Services\ListsPackingLists;
|
|
use App\Classes\Modules\Transactions\Services\ListsTransactions;
|
|
use App\Classes\Modules\PackingLists\Standards\Rules\CanListPackingLists;
|
|
use App\Classes\ValueObjects\Constants\DocumentType;
|
|
use App\Classes\ValueObjects\Constants\TransactionType;
|
|
use App\Http\Resources\PackingListResource;
|
|
use App\Http\Resources\TransactionResource;
|
|
use ErrorException;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ListCompanyModuleInvoicesLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification(): array
|
|
{
|
|
return [
|
|
'title' => 'Retrieved Company Module Invoices',
|
|
'message' => 'You have successfully retrieved a list of Invoices'
|
|
];
|
|
}
|
|
|
|
/** @var CanListPackingLists */
|
|
private $canListPackingLists;
|
|
|
|
/** @var ListsPackingLists */
|
|
private $listsPackingLists;
|
|
|
|
/**
|
|
* ListCompanyModuleInvoicesLogic constructor.
|
|
* @param CanListPackingLists $canListPackingLists
|
|
* @param ListsPackingLists $listsPackingLists
|
|
*/
|
|
public function __construct(CanListPackingLists $canListPackingLists, ListsPackingLists $listsPackingLists, ListsTransactions $listsTransactions)
|
|
{
|
|
$this->canListPackingLists = $canListPackingLists;
|
|
$this->listsPackingLists = $listsPackingLists;
|
|
$this->listsTransactions = $listsTransactions;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
public function logic(Request $request): JsonResponse
|
|
{
|
|
$filterArray = [
|
|
"per_page" => 10,
|
|
"order_by" => (object)[
|
|
"column" => 'id',
|
|
"DESC" => true,
|
|
],
|
|
"type" => TransactionType::SHIPPING_INVOICE
|
|
];
|
|
|
|
// // dd($request->route('id'));
|
|
|
|
// $this->canListPackingLists->passes();
|
|
|
|
// $query = $this->listsPackingLists->execute($filterArray);
|
|
|
|
// return $this->collectionResponse(PackingListResource::collection($query));
|
|
|
|
$query = $this->listsTransactions->execute($filterArray);
|
|
|
|
return $this->collectionResponse(TransactionResource::collection($query));
|
|
|
|
// transaction -> type shipping invoice -> invoice belongs to company id
|
|
|
|
// transaction
|
|
|
|
// order has packing_list has transaction
|
|
// inside order can find (company_module_id)
|
|
}
|
|
}
|