Compare commits

..

3 Commits

Author SHA1 Message Date
edmondlang 769b5dd050 multi payment ui 2023-01-09 22:57:30 +08:00
edmondlang 851e2e1815 multi payment ui 2022-12-24 16:39:17 +08:00
edmondlang 503bc90556 multiple payment ui 2022-12-23 16:37:06 +08:00
14 changed files with 315 additions and 213 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);
}
}
@@ -0,0 +1,66 @@
<?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,20 @@
<?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);
}
}
-1
View File
@@ -22,7 +22,6 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\RouteLogs::class,
];
/**
-51
View File
@@ -1,51 +0,0 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use App\Models\RouteLog;
use Auth;
// use Location;
class RouteLogs
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
$ip_address = getenv('REMOTE_ADDR');
$url = $request->fullUrl();
$call_metthod = $request->method();
$platform = $request->header('sec-ch-ua-platform');
// dd(\Location::get($ip_address));
$browser = Str::after($request->header('sec-ch-ua'),'Not?A_Brand";v="8", "Chromium";v="108", "');
$geo = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$ip_address"));
$longitude = $geo["geoplugin_longitude"];
$latitude = $geo["geoplugin_latitude"];
$last_page = url()->previous();
$countryName = $geo["geoplugin_countryName"];
RouteLog::create([
// 'user_id' => Auth::user()->id,
'user_id' => '1',
'ip_address' => $request->ip(),
'url' => $url,
'call_method'=> $call_metthod,
'browser' => $browser,
'platform' => $platform,
'longitude' =>$longitude,
'latitude' => $latitude,
'last_page' => $last_page,
'countryname' =>$countryName
]);
return $next($request);
}
}
-24
View File
@@ -1,24 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class RouteLog extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'ip_address',
'url',
'call_method',
'browser',
'platform',
'longitude',
'latitude',
'last_page',
'countryname'
];
}
@@ -1,42 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateRouteLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('route_logs', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->unsigned();
$table->string('ip_address');
$table->string('url');
$table->string('desc')->nullable();
$table->string('call_method');
$table->string('browser')->nullable();
$table->string('platform')->nullable();
$table->string('longitude');
$table->string('latitude');
$table->string('last_page')->nullable();
$table->string('countryname')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('route_logs');
}
}
@@ -0,0 +1,153 @@
<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>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="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="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,110 +4,36 @@
<div class="row">
<div class="col padding-20">
<div class="row align-items-center">
<div class="col-auto pointer align-items-center" @click="selected = !selected">
<div class="col-auto pointer align-items-center" @click="activate()">
<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.country.id}}05052021</h5>
<h5 class="no-margin">{{ item.bill_no }}</h5>
</div>
<div class="col">
<h5 class="no-margin">Invoice Date Invoice Date</h5>
<h5 class="no-margin">{{ item.created_at }}</h5>
</div>
<div class="col">
<h5 class="no-margin">Status</h5>
</div>
<div class="col">
<h5 class="no-margin">Amount</h5>
<h5 class="no-margin">MYR {{ item.amount.toFixed(2) }}</h5>
</div>
<div class="col-auto">
<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 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>
</div>
</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 v-else>
<div class="btn bg-grey no-border muted invisible">
<i class="fa fa-file-pdf-o"></i>
</div>
</div>
</div>
@@ -120,10 +46,33 @@
<script>
import componentHandler from '../../../general/mixins/componentHandler';
export default {
props: {
selectedInvoice: {
type: Array,
required: false,
}
},
data(){
return {
expanded: false,
selected: 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;
}
},
mixins: [componentHandler]
@@ -0,0 +1,4 @@
@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
View File
@@ -33,4 +33,6 @@ 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');
});
+8 -2
View File
@@ -160,6 +160,12 @@ 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);
@@ -198,9 +204,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('/payments-and-billing', function () {
Route::get('/payment-and-billing', function () {
return view('pages.templates.paymentsBilling');
})->name('payments-and-billing');
})->name('payment-and-billing');
Route::get('/shipping-queue', function () {
return view('pages.templates.shippingQueue');