mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Merge branch 'vapor/development' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into vapor/development
This commit is contained in:
@@ -57,13 +57,9 @@ class CreateSupplierTaxRebateLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
Log::info('finding order');
|
||||
|
||||
/** @var Order $order */
|
||||
$order = $this->fetchesOrder->execute(['id' => $request->route('id')]);
|
||||
|
||||
Log::info('taxRebate');
|
||||
|
||||
$taxRebate = SupplierTaxRebate::create([
|
||||
'order_id' => $order->id,
|
||||
'supplier_name' => $request->input('supplier_name'),
|
||||
@@ -76,7 +72,6 @@ class CreateSupplierTaxRebateLogic extends AbstractControllerLogic
|
||||
|
||||
public function generateUniqueReferenceNumber(?string $prefix = '', ?int $length = 9): string
|
||||
{
|
||||
Log::info('generating unique reference number');
|
||||
// regenerate new reference number until a new unique reference is found
|
||||
do {
|
||||
$reference = $prefix . rand((int)('1' . str_repeat('0', $length - 2) . '1'), (int) str_repeat('9', $length));
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Models\SupplierTaxRebate;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteSupplierTaxRebateLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Delete Supplier Tax Rebate',
|
||||
'message' => 'You have successfully deleted a Supplier Tax Rebate'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* DeleteSupplierTaxRebateLogic constructor.
|
||||
*/
|
||||
public function __construct() {}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
SupplierTaxRebate::find($request->route('id'))->delete();
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Orders;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Orders\ControllersLogic\DeleteSupplierTaxRebateLogic;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DeleteSupplierTaxRebateController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param DeleteSupplierTaxRebateLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function delete(Request $request, DeleteSupplierTaxRebateLogic $logic): JsonResponse
|
||||
{
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<div class="row" @keyup.enter="submitForm">
|
||||
<div class="col bg-white">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h5 class="all-caps">Delete Tax Rebate QR Code</h5>
|
||||
<div class="fs-11">Are you sure you want to delete this Tax Rebate QR Code?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none" @click="cancel">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-danger w-100 btn-sm" @click="submitForm"> Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
export default {
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.submit(this.route('api.order.tax_rebate.delete', this.id), 'post', this.section, true, true);
|
||||
},
|
||||
cancel() {
|
||||
this.$emit('cancel');
|
||||
},
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -28,6 +28,11 @@
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="row m-t-15">
|
||||
<div class="col text-center">
|
||||
<button class="btn btn-large btn-outline-danger" @click="deleteQrCode(i.id)">Delete QR Code</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -58,6 +63,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Delete QR Code -->
|
||||
<div v-if="step === 'delete_qr'">
|
||||
<delete-tax-rebate-qr-code-form-component :id="delete_qr_code_id" :section="section" v-on:cancel="resetStatus()"></delete-tax-rebate-qr-code-form-component>
|
||||
</div>
|
||||
|
||||
<!-- Create QR Code Form -->
|
||||
<div v-if="step === 'create_qr'">
|
||||
<div class="text-center m-b-30">
|
||||
@@ -106,6 +116,7 @@ export default {
|
||||
},
|
||||
step: this.data.supplier_tax_rebate.length ? 'list_qr' : '1',
|
||||
qr_code_img_url: this.$qr_code_img_url,
|
||||
delete_qr_code_id: null,
|
||||
fields: {
|
||||
// reference_number: 'Reference Number',
|
||||
supplier_name: 'Supplier Name',
|
||||
@@ -129,9 +140,16 @@ export default {
|
||||
}
|
||||
this.step = step;
|
||||
},
|
||||
resetStatus() {
|
||||
this.step = 'list_qr';
|
||||
},
|
||||
create() {
|
||||
this.submit(this.route('api.order.tax_rebate.create', this.data.id), 'post', this.section, true, true);
|
||||
},
|
||||
deleteQrCode(id) {
|
||||
this.delete_qr_code_id = id;
|
||||
this.step = 'delete_qr'
|
||||
},
|
||||
download(param) {
|
||||
this.isLoading = true;
|
||||
let url = route('order.taxt_rebate_qr.download', this.data.id) + '?tax_rebate_refeerence=' + param.reference_number;
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
<a @click="download(order)" target="_blank">
|
||||
<button class="btn btn-sm btn-success bg-master b-rad-none all-caps">Download QR Code Pdf</button>
|
||||
</a>
|
||||
<div class="btn btn-sm btn-primary b-rad-none all-caps requestModal" data-type="taxRebateQrCode">Tax Rebate QR Code</div>
|
||||
<div v-if="order.warehouse.name === 'Guangzhou' || order.supplier_tax_rebate.length" class="btn btn-sm btn-primary b-rad-none all-caps requestModal" data-type="taxRebateQrCode">Tax Rebate QR Code</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="taxRebateQrCode" size="large">
|
||||
<tax-rebate-qr-code-form-component :section="section" :data="order"></tax-rebate-qr-code-form-component>
|
||||
</modal-component>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<div class="tax-rebate">
|
||||
<!-- <h2 style="font-size: 60px;">Tax Rebate Order</h2> -->
|
||||
<h2 style="font-size: 60px;">退税单</h2>
|
||||
<p style="font-size: 25px; color: white;">供应商: {{$supplierTaxRebate['supplier_name']}}</p>
|
||||
<p style="font-size: 25px; color: white;">联络人: {{$supplierTaxRebate['supplier_name']}}</p>
|
||||
<p style="font-size: 25px; color: white;">联络号码: {{$supplierTaxRebate['supplier_contact_number']}}</p>
|
||||
<!-- <p style="font-size: 25px;">Tax Rebate No: {{$supplierTaxRebate['reference_number']}}</p> -->
|
||||
</div>
|
||||
@@ -44,8 +44,8 @@
|
||||
<table style="border-spacing:10px 10px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="border-bottom: solid 2px #000000;">
|
||||
<h3 style="font-size: 35px; line-height: 70px">{{$marking}}{{$order->reference}}</h3>
|
||||
<td style="border-bottom: solid 2p·x #000000;">
|
||||
<h3 style="font-size: 35px; line-height: 70px">{{$marking}}{{$order->reference}} 退税</h3>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -24,5 +24,6 @@ Route::group(['prefix' => 'order', 'as' => 'order.', 'namespace' => 'Orders'], f
|
||||
Route::get('/packages/{id}', 'FetchOrderPackagesController@fetch')->name('packages');
|
||||
|
||||
Route::post('/{id}/supplier-tax-rebate/create', 'CreateSupplierTaxRebateController@create')->name('tax_rebate.create');
|
||||
Route::post('/supplier-tax-rebate/{id}/delete', 'DeleteSupplierTaxRebateController@delete')->name('tax_rebate.delete');
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user