List customer's pending payment invoices

This commit is contained in:
Dillon
2022-12-24 12:35:27 +08:00
parent 503bc90556
commit c1343f45a5
3 changed files with 34 additions and 4 deletions
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class Receiver implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('receiver', '=', $value);
}
}
@@ -6,6 +6,7 @@ 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\Companies\Services\FetchesCompanyModule;
use App\Classes\Modules\PackingLists\Standards\Rules\CanListPackingLists;
use App\Classes\ValueObjects\Constants\DocumentType;
use App\Classes\ValueObjects\Constants\TransactionType;
@@ -35,16 +36,21 @@ class ListCompanyModuleInvoicesLogic extends AbstractControllerLogic
/** @var ListsPackingLists */
private $listsPackingLists;
/** @var FetchesCompanyModule */
private $fetchesCompanyModule;
/**
* ListCompanyModuleInvoicesLogic constructor.
* @param CanListPackingLists $canListPackingLists
* @param ListsPackingLists $listsPackingLists
* @param FetchesCompanyModule $fetchesCompanyModule
*/
public function __construct(CanListPackingLists $canListPackingLists, ListsPackingLists $listsPackingLists, ListsTransactions $listsTransactions)
public function __construct(CanListPackingLists $canListPackingLists, ListsPackingLists $listsPackingLists, ListsTransactions $listsTransactions, FetchesCompanyModule $fetchesCompanyModule)
{
$this->canListPackingLists = $canListPackingLists;
$this->listsPackingLists = $listsPackingLists;
$this->listsTransactions = $listsTransactions;
$this->fetchesCompanyModule = $fetchesCompanyModule;
}
@@ -57,12 +63,16 @@ class ListCompanyModuleInvoicesLogic extends AbstractControllerLogic
*/
public function logic(Request $request): JsonResponse
{
$companyModule = $this->fetchesCompanyModule->execute(['company_id' => $request->route('id')]);
$filterArray = [
"per_page" => 10,
"order_by" => (object)[
"column" => 'id',
"DESC" => true,
],
"status_in" => [2],
"receiver" => intval($companyModule->id),
"type" => TransactionType::SHIPPING_INVOICE
];
@@ -80,9 +90,9 @@ class ListCompanyModuleInvoicesLogic extends AbstractControllerLogic
// transaction -> type shipping invoice -> invoice belongs to company id
// transaction
// transaction
// order has packing_list has transaction
// order has packing_list has transaction
// inside order can find (company_module_id)
}
}
@@ -1,7 +1,7 @@
<template>
<div class="row" v-if="company">
<div class="col">
<p>ok</p>
<p>{{ company }}</p>
</div>
</div>
</template>