Compare commits

..

2 Commits

Author SHA1 Message Date
Cleison Freitas 27c3cd4275 FetchInvoice API to multiple payments 2022-12-27 12:34:29 -03:00
Omair Saleh 4ff5c6df80 update gz warehouse notice 2022-12-26 21:21:00 +08:00
17 changed files with 265 additions and 317 deletions
@@ -1,20 +0,0 @@
<?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);
}
}
@@ -1,66 +0,0 @@
<?php
namespace App\Classes\Modules\Companies\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Transactions\Services\ListsTransactions;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Http\Resources\TransactionResource;
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 ListsTransactions */
private $listsTransactions;
/**
* ListCompanyModuleInvoicesLogic constructor.
* @param ListsTransactions $listsTransactions
*/
public function __construct(ListsTransactions $listsTransactions)
{
$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,
],
"status_in" => [2],
"receiver" => intval($request->route('company_module_id')),
"type" => TransactionType::SHIPPING_INVOICE
];
// $this->canListTransactions->passes();
$query = $this->listsTransactions->execute($filterArray);
return $this->collectionResponse(TransactionResource::collection($query));
}
}
@@ -0,0 +1,55 @@
<?php
namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Transactions\Services\FetchPayments;
use App\Classes\Modules\Transactions\Services\ListsTransactions;
use App\Http\Resources\InvoiceResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class FetchInvoiceLogic extends AbstractControllerLogic
{
/**
* ListTransactionsLogic constructor.
* @param FetchPayments $fetchPayments
*/
public function __construct(FetchPayments $fetchPayments)
{
$this->fetchPayments = $fetchPayments;
}
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved Transactions',
'message' => 'You have successfully retrieved a list of transactions'
];
}
/** @var FetchPayments */
private $fetchPayments;
public function logic(Request $request) : JsonResponse
{
$query = $this->fetchPayments->execute($this->fetchPayments->deserializeFilters($request->input('filters')));
return $this->collectionResponse(InvoiceResource::collection($query));
}
}
?>
@@ -0,0 +1,31 @@
<?php
namespace App\Classes\Modules\Transactions\Services;
use App\Models\Transaction;
use Illuminate\Database\Eloquent\Builder;
use App\Classes\General\Eloquent\AbstractListRecord;
class FetchPayments extends AbstractListRecord
{
/** @var Transaction */
private $repository;
/**
* ListsBookings constructor.
* @param Transaction $repository
*/
public function __construct(Transaction $repository)
{
$this->repository = $repository;
}
/**
* @return Builder
*/
public function getRepository(): Builder
{
return $this->repository->newQuery();
}
}
@@ -1,20 +0,0 @@
<?php
namespace App\Http\Controllers\Companies;
use App\Classes\Modules\Companies\ControllersLogic\ListCompanyModuleInvoicesLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ListCompanyModuleInvoicesController
{
/**
* @param Request $request
* @param ListCompanyModulesLogic $logic
* @return JsonResponse
*/
public function list(Request $request, ListCompanyModuleInvoicesLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Orders;
use App\Classes\Modules\Orders\ControllersLogic\FetchOrderLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class FetchMultipleOrderController
{
/**
* @param Request $request
* @param FetchOrderLogic $logic
* @return JsonResponse
*/
public function fetch(Request $request, FetchOrderLogic $logic): JsonResponse
{
return $logic->execute($request);
}
}
@@ -0,0 +1,32 @@
<?php
namespace App\Http\Controllers\Transactions;
use App\Classes\Modules\Transactions\ControllersLogic\FetchInvoiceLogic;
use App\Classes\Modules\Transactions\ControllersLogic\ListTransactionsLogic;
use App\Http\Controllers\Controller;
use App\Http\Resources\InvoiceResource;
use App\Models\Order;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class FetchInvoiceController extends Controller
{
public function list(Request $request)
{
try{
return InvoiceResource::collection(Order::Paginate(10,['*'],'page',2));
}catch(\Exception $ex) {
return response()->json(['error' => [$ex->getMessage()]],404);
}
}
/**
* @param Request $request
* @param FetchInvoiceLogic $logic
* @return JsonResponse
*/
public function fetch(Request $request, FetchInvoiceLogic $logic) : JsonResponse {
return $logic->execute($request);
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class InvoiceResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'invoice_id' => $this->reference,
'carrier_tracking_number' => '1zbr06tw403742920',
'this_package_was_delivered' => '1zbr06tw403742920',
'due_date' => '11.04.2021',
'date_paid' => '21.01.2021',
'outstanding' => 92.01
];
}
}
@@ -1,153 +0,0 @@
<template>
<div class="row">
<div class="col">
<div class="row">
<div class="col-12 col-sm-12 col-md-9">
<div class="row m-b-15 m-l-5 m-r-10">
<div class="col b-a b-grey rounded bg-master-light">
<div class="row">
<div class="col padding-20">
<div class="row align-items-center justify-conten-center" @click="chooseAllInvoice()">
<div class="col-auto pointer">
<i class="fa fs-30 fa-fw" :class="{'fa-square-o': !selectAllInvoice, 'fa-check-square': selectAllInvoice, 'text-primary':selectAllInvoice}" ></i>
</div>
<div class="col">
<h5 class="no-margin font-heading">Invoice No</h5>
</div>
<div class="col">
<h5 class="no-margin">Invoice Date</h5>
</div>
<div class="col">
<h5 class="no-margin">Status</h5>
</div>
<div class="col">
<h5 class="no-margin">Amount</h5>
</div>
<div class="col-auto">
<div class="btn bg-grey no-border muted invisible">
<i class="fa fa-file-pdf-o"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" v-for="invoice in invoices">
<div class="col">
<payments-billing-components :data="invoice" :selectedInvoice="selectedInvoice" v-on:input="updateList($event)"></payments-billing-components>
</div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-3">
<div class="row align-items-center">
<div class="col b-a b-grey rounded padding-25">
<div class="row">
<div class="col">
<h6 class="semi-bold muted">Payment Summary</h6>
</div>
</div>
<div class="row align-items-center justify-content-center">
<div class="col-auto">
<div class="padding-5">
<i class="fa fa-angle-up"></i>
</div>
</div>
<div class="col p-l-0">
<h6 class="semi-bold text-primary">{{selectedInvoice.length}} Invoice Selected</h6>
</div>
</div>
<div class="row">
<div class="col">
<div class="row" v-for="invoice in selectedInvoice">
<div class="col">
<h6 class="no-margin">lorem ipsum</h6>
</div>
<div class="col-auto">
<h6 class="no-margin">52x62x635 CM</h6>
</div>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col">
<h6 class="normal">Total Payments</h6>
</div>
<div class="col-auto">
<h6 class="text-primary bold">RM 3300.00</h6>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="btn btn-xl btn-success pointer m-t-10 w-100" @click='makePayment'>Make Payments</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
company_module_id: {
type: Number,
required: true,
},
},
data(){
return {
section: 'customerPaymentBillingSectionComponent',
isLoading: true,
invoices: null,
selectedInvoice: [],
selectAllInvoice: false,
}
},
computed: {
pendingQueue () {
return this.$store.getters.isInCompleteQueue(this.section);
}
},
watch: {
pendingQueue(inComplete){
if(inComplete){
this.fetchInvoice();
}
}
},
created(){
this.$store.dispatch('updateListQueue', {'name': this.section});
},
methods: {
fetchInvoice(){
this.isLoading = true;
this.submit(route('api.company.invoice.list', this.company_module_id), 'get', this.section, false, false)
},
successHandler(response){
this.$store.dispatch('completeList', {'name': this.section, 'data': []});
this.isLoading = false;
this.invoices = response.payload.data;
},
makePayment(){
var selectedId = this.selectedInvoice.map(s=>s.id);
console.log(selectedId);
},
updateList(packageList){
this.selectedInvoice.includes(packageList) ? this.selectedInvoice.splice(this.selectedInvoice.indexOf(packageList), 1) : this.selectedInvoice.push(packageList);
this.selectedInvoice.length === this.invoices.length ? this.selectAllInvoice = true : this.selectAllInvoice = false;
},
chooseAllInvoice(){
this.selectAllInvoice = !this.selectAllInvoice;
this.selectedInvoice = [];
if (this.selectAllInvoice) {
this.selectedInvoice = this.invoices;
}
}
}
}
</script>
@@ -53,7 +53,7 @@
</div>
<div class="row text-center justify-content-center">
<div class="col-8">
<p class="m-b-0 text-danger m-t-15" v-if="parameters.warehouse_id === 3">近期由于船期的安排和马来西亚海关的运作等一些不可控因数导致船期延迟请大家提前做好采购安排若有不便之处敬请谅解 <br>Due to inevitable circumstances, shipping arrangements and Malaysia custom clearance may have delays. Kindly plan your purchases in advance, thank you for your cooperation.</p>
<p class="m-b-0 text-danger m-t-15" v-if="parameters.warehouse_id === 3">疫情因管控松动飙升其中几位仓库人员也不幸感染整个操作可能会受到影响我们会尽快跟进并恢复<br>The pandemic spread due to the loosening of movement controls. Some warehouse employees were unfortunately infected and the entire operation may be disrupted. We will do our best to follow up and revert as soon as possible.</p>
<p class="m-b-0 text-danger m-t-15" v-if="false">由于义乌船期不稳定建议发广州仓库<br>Due to unexpected shipping delays for Yiwu warehouse, you may select an alternative warehouse.</p>
<p class="m-b-0 text-danger m-t-15" v-if="parameters.warehouse_id === 4">由于义乌船期不稳定建议发广州仓库<br>Due to unexpected shipping delays for Yiwu warehouse, you may select an alternative warehouse.</p>
</div>
@@ -4,36 +4,110 @@
<div class="row">
<div class="col padding-20">
<div class="row align-items-center">
<div class="col-auto pointer align-items-center" @click="activate()">
<div class="col-auto pointer align-items-center" @click="selected = !selected">
<i class="fa fs-30 fa-fw" :class="{'fa-square-o': !selected, 'fa-check-square': selected, 'text-primary':selected}" ></i>
</div>
<div class="col">
<h5 class="no-margin">{{ item.bill_no }}</h5>
<h5 class="no-margin">{{item.country.id}}05052021</h5>
</div>
<div class="col">
<h5 class="no-margin">{{ item.created_at }}</h5>
<h5 class="no-margin">Invoice Date Invoice Date</h5>
</div>
<div class="col">
<h5 class="no-margin">Status</h5>
</div>
<div class="col">
<h5 class="no-margin">MYR {{ item.amount.toFixed(2) }}</h5>
<h5 class="no-margin">Amount</h5>
</div>
<div class="col-auto">
<div v-if="item.documents.length">
<div v-for="file in item.documents[0].files" v-bind:key="file.id" class="col-auto no-padding">
<document-file-viewer-component :file="file">
<template slot="button">
<div class="btn bg-grey no-border muted">
<i class="fa fa-file-pdf-o"></i>
</div>
</template>
</document-file-viewer-component>
<div class="btn bg-grey no-border" @click="expanded = !expanded">
<i class="fa" :class="{'fa-angle-down': !expanded, 'fa-angle-up': expanded}" ></i>
</div>
</div>
</div>
</div>
</div>
<div class="row b-t b-grey p-t-10" v-show="expanded">
<div class="col p-b-10">
<div class="row">
<div class="col p-l-20 p-r-20 p-t-10 p-b-10">
<div class="row align-items-center">
<div class="col-auto invisible">
<i class="fa fs-30 fa-fw" :class="{'fa-square-o': !selected, 'fa-check-square': selected, 'text-primary':selected}" ></i>
</div>
<div class="col">
<div class="row">
<div class="col">
<h5 class="m-b-0">Carrier Tracking Number</h5>
</div>
</div>
<div class="row">
<div class="col">
<h5 class="semi-bold m-t-0 m-b-0 large-text">#1zbr06tw403742920</h5>
</div>
</div>
</div>
<div class="col">
<div class="row">
<div class="col">
<h5 class="m-b-0">Due Date</h5>
</div>
</div>
<div class="row">
<div class="col">
<h5 class="semi-bold m-t-0 m-b-0 large-text">11.04.2021</h5>
</div>
</div>
</div>
<div class="col">
<div class="row">
<div class="col">
<h5 class="semi-bold m-t-0 m-b-0 large-text">Outstanding</h5>
</div>
</div>
<div class="row">
<div class="col">
<h5 class="semi-bold m-t-0 m-b-0 large-text">RM0.00</h5>
</div>
</div>
</div>
</div>
<div v-else>
<div class="btn bg-grey no-border muted invisible">
<i class="fa fa-file-pdf-o"></i>
</div>
</div>
<div class="row">
<div class="col p-l-20 p-r-20 p-t-10 p-b-10">
<div class="row align-items-center">
<div class="col-auto invisible">
<i class="fa fs-30 fa-fw" :class="{'fa-square-o': !selected, 'fa-check-square': selected, 'text-primary':selected}" ></i>
</div>
<div class="col">
<div class="row">
<div class="col">
<h5 class="m-b-0 normal-text">This package was delivered by</h5>
</div>
</div>
<div class="row">
<div class="col">
<h5 class="semi-bold m-t-0 m-b-0 large-text">#1zbr06tw403742920</h5>
</div>
</div>
</div>
<div class="col">
<div class="row">
<div class="col">
<h5 class="m-b-0">Date Paid</h5>
</div>
</div>
<div class="row">
<div class="col">
<h5 class="semi-bold m-t-0 m-b-0 large-text">21.01.2021</h5>
</div>
</div>
</div>
<div class="col">
<div class="btn btn-outline-complete btn-lg">
Invoice Detail
</div>
</div>
</div>
</div>
@@ -46,33 +120,10 @@
<script>
import componentHandler from '../../../general/mixins/componentHandler';
export default {
props: {
selectedInvoice: {
type: Array,
required: false,
}
},
data(){
return {
expanded: false,
selectedValue: false,
}
},
methods: {
activate(){
this.select = !this.select;
this.$emit('input', this.data);
}
},
computed: {
selected() {
var response = false;
this.selectedInvoice.forEach((value, index) => {
if (value.id == this.item.id) {
response = true;
}
});
return response;
selected: false,
}
},
mixins: [componentHandler]
@@ -1,4 +0,0 @@
@extends('layouts.base_portal')
@section('inner_content')
<customer-payment-billing-section-component :company_module_id={{$company_module_id}}></customer-payment-billing-section-component>
@endsection
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -24,12 +24,12 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
require __DIR__ . '/delivery.php';
Route::group(['middleware' => 'valid.token'], function () {
Route::group([/*'middleware' => 'valid.token'*/], function () {
Route::get('/storage/{fileName}/fetch', 'Documents\RenderDocumentController@fileStorageServe')->where(['fileName' => '.*'])->name('storage.document.file');
Route::post('online_payment/callback', 'Billplz\CallbackBillplzController@callback')->name('online_payment.callback');
Route::post('/import/update-debtor/f614e339d7058904a831aad742e24d55', 'Imports\ImportUpdateDebtorController@import')->name('debtor.import');
require __DIR__ . '/company.php';
-2
View File
@@ -33,6 +33,4 @@ Route::group(['prefix' => 'company', 'as' => 'company.', 'namespace' => 'Compani
});
Route::get('/module/list', 'ListCompanyModulesController@list')->name('module.list');
Route::get('/{company_module_id}/invoice/list', 'ListCompanyModuleInvoicesController@list')->name('invoice.list');
});
+2
View File
@@ -1,5 +1,6 @@
<?php
use App\Http\Controllers\Transactions\FetchInvoiceController;
use Illuminate\Support\Facades\Route;
Route::group(['prefix' => 'order', 'as' => 'order.', 'namespace' => 'Orders'], function () {
@@ -18,4 +19,5 @@ Route::group(['prefix' => 'order', 'as' => 'order.', 'namespace' => 'Orders'], f
Route::put('/assign-remark/{id}', 'AssignOrderRemarkController@create')->name('assign.remark');
Route::get('/{id}/shipping-cost', 'ShippingCostController@calculate')->name('shipping.cost');
Route::get('/payments_billings' , [FetchInvoiceController::class,'fetch'])->name('shipping.invoice');
});
+2 -8
View File
@@ -160,12 +160,6 @@ Route::get('/customer/{marking}/details', function ($marking) {
return view('pages.customers.profile_details', ['id' => $id]);
})->name('customer.profile.details');
Route::get('/customer/{marking}/payment-and-billing', function ($marking) {
$connection = CompanyConnection::where('invitee_reference', $marking)->first();
$company_module_id = $connection->invitee->id;
return view('pages.customers.paymentsBilling', ['company_module_id' => $company_module_id]);
})->name('customer.payment-and-billing');
Route::get('/orders/refresh', function(\Illuminate\Http\Request $request){
$packingLists = \App\Models\PackingList::where('type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->has('containers')->get();
dd($packingLists);
@@ -204,9 +198,9 @@ Route::get('/order/{id}/download', 'Orders\DownloadOrderQrPdfController@download
Route::get('/report/customclearance/{orderid}', 'Reports\CustomcClearanceReportController@download')->name('report.customclearance');
Route::group(['prefix' => 'template', 'as' => 'template.'], function () {
Route::get('/payment-and-billing', function () {
Route::get('/payments-and-billing', function () {
return view('pages.templates.paymentsBilling');
})->name('payment-and-billing');
})->name('payments-and-billing');
Route::get('/shipping-queue', function () {
return view('pages.templates.shippingQueue');