mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 12:24:09 +00:00
integrated frontend/backend for show/update rate
This commit is contained in:
+1
-1
@@ -15,4 +15,4 @@ Homestead.yaml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
.env
|
||||
|
||||
package-lock.json
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"CurrentProjectSetting": null
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ExpandedNodes": [
|
||||
""
|
||||
],
|
||||
"SelectedNode": "\\laradock",
|
||||
"PreviewInSolutionExplorer": false
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
+ eslint@4.19.1
|
||||
added 67 packages and updated 1 package in 41.428s
|
||||
+2
-2
@@ -32,8 +32,8 @@ class Booking extends Model
|
||||
return $this->belongsTo('app\User');
|
||||
}
|
||||
|
||||
public function bookingSupplier(){
|
||||
return $this->belongsTo('app\BookingSupplier ');
|
||||
public function supplierBooking(){
|
||||
return $this->hasOne(SupplierBooking::class);
|
||||
}
|
||||
|
||||
public function chinaBankSlip(){
|
||||
|
||||
@@ -22,6 +22,7 @@ class BookingController extends Controller
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->where('user_id', $user->id)
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
|
||||
|
||||
@@ -77,7 +78,8 @@ class BookingController extends Controller
|
||||
public function adminIndex(){
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->get();
|
||||
->orderby('updated_at','desc')
|
||||
->get();
|
||||
|
||||
// reformat to fit frontend structure
|
||||
foreach ($bookings as $booking) {
|
||||
@@ -328,6 +330,7 @@ class BookingController extends Controller
|
||||
// $booking->usd_book_bank_branch = $request->input('usd_book_bank_branch');
|
||||
// $booking->verification_status = $request->input('verification_status');
|
||||
$booking->save();
|
||||
//return response()->json('error', 400);
|
||||
return response()->json($booking, 201);
|
||||
}
|
||||
|
||||
@@ -523,6 +526,16 @@ class BookingController extends Controller
|
||||
$term = $request->input('term');
|
||||
$china_beneficiary = $request->input('china_beneficiary');
|
||||
$rates = Rate::orderby('updated_at','desc')->first();
|
||||
|
||||
$creditLimit = SettingCredit::orderby('updated_at','desc')->first();
|
||||
|
||||
if (!$creditLimit){
|
||||
return response()->json("Credit limit not set, please contact admin", 405);
|
||||
}
|
||||
|
||||
if($amount > $creditLimit->rmb_credit_limit){
|
||||
return response()->json(["message" => "Exceed credit limit, please contact our sales team for larger quantitiy"], 400);
|
||||
}
|
||||
|
||||
// TODO : get marking
|
||||
$marking = "123X";
|
||||
|
||||
@@ -29,20 +29,24 @@ class BookingSupplierController extends Controller
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$bookingsupplier = SupplierBooking::has('supplier-booking')->findOrFail($id);
|
||||
$booking = Booking::where('id', $id)->first();
|
||||
|
||||
$response = [
|
||||
'supplier-booking' => $bookingsupplier
|
||||
];
|
||||
if (!$booking){
|
||||
return response()->json(['message' => 'Booking not found'], 404);
|
||||
}
|
||||
|
||||
return response()->json($response, 200);
|
||||
$supplier_booking = $booking->supplierBooking()->first();
|
||||
$dt = new \DateTime($supplier_booking->created_at);
|
||||
$supplier_booking->date = $dt->format('j F Y');
|
||||
|
||||
|
||||
return response()->json($supplier_booking ,200);
|
||||
}
|
||||
|
||||
// Only for single booking
|
||||
// TODO : Multiple booking
|
||||
public function store(Request $request)
|
||||
{
|
||||
|
||||
$transfer_amount = $request->input("transfer_amount");
|
||||
$supplier_id = $request->input("supplier_id");
|
||||
$booking_id = $request->input("booking_id");
|
||||
@@ -62,7 +66,7 @@ class BookingSupplierController extends Controller
|
||||
$booking = Booking::find($booking_id);
|
||||
|
||||
// update existing booking supplier if exist
|
||||
$bookingsupplier = SupplierBooking::where('book_id', $booking_id)->first();
|
||||
$bookingsupplier = SupplierBooking::where('booking_id', $booking_id)->first();
|
||||
|
||||
if (!$bookingsupplier){
|
||||
$bookingsupplier = new SupplierBooking();
|
||||
@@ -73,19 +77,19 @@ class BookingSupplierController extends Controller
|
||||
$bookingsupplier->payment_method = $request->input('payment_method');
|
||||
$bookingsupplier->transfer_amount = $transfer_amount;
|
||||
$bookingsupplier->rate = $rate;
|
||||
$bookingsupplier->billing_amount = $billing;
|
||||
$bookingsupplier->salestax_amount = $sales_tax;
|
||||
$bookingsupplier->rebate = $rebate;
|
||||
$bookingsupplier->amountInRMB = $amountInRMB;
|
||||
$bookingsupplier->rmbBankAmount = $rmbBankAmount;
|
||||
$bookingsupplier->book_id = $booking->id;
|
||||
$bookingsupplier->booking_id = $booking->id;
|
||||
$bookingsupplier->save();
|
||||
|
||||
// update booking status
|
||||
$booking->status = 4;
|
||||
$booking->admin_status = 4;
|
||||
$booking->save();
|
||||
|
||||
// TODO : generate a jpg version of report and save the path
|
||||
|
||||
|
||||
return response()->json($bookingsupplier, 201);
|
||||
}
|
||||
|
||||
@@ -111,6 +115,7 @@ class BookingSupplierController extends Controller
|
||||
$bookingsupplier->rmbBankAmount = $rmbBankAmount;
|
||||
$bookingsupplier->save();
|
||||
|
||||
/* For multiple booking */
|
||||
// $supplierbookingitems = $request->input("supplierbookingitem");
|
||||
// foreach ($bookings as $booking)
|
||||
// {
|
||||
|
||||
@@ -35,7 +35,7 @@ class RateController extends Controller
|
||||
|
||||
public function show()
|
||||
{
|
||||
$rate = DB::table('rates')->latest()->first();
|
||||
$rate = Rate::latest()->first();
|
||||
|
||||
return response()->json($rate, 200);
|
||||
}
|
||||
|
||||
@@ -7,4 +7,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Marking extends Model
|
||||
{
|
||||
protected $fillable = ['email','marking'];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\User');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,5 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Rate extends Model
|
||||
{
|
||||
protected $fillable = ['x1_cash','x1_cheque','x1_ba','x2_cash','x2_cheque','x2_ba'];
|
||||
protected $hidden = ['id'];
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class SupplierBooking extends Model
|
||||
}
|
||||
|
||||
public function booking(){
|
||||
return $this->hasOne('App\Booking');
|
||||
return $this->belongTo('App\Booking');
|
||||
}
|
||||
|
||||
public function supplierBookingTtem()
|
||||
|
||||
@@ -102,4 +102,8 @@ class User extends Authenticatable implements JWTSubject
|
||||
return $this->hasMany(Booking::class);
|
||||
}
|
||||
|
||||
public function marking(){
|
||||
return $this->hasOne(Booking::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
*.sqlite
|
||||
vendor/composer/autoload_static.php
|
||||
package-lock.json
|
||||
@@ -29,7 +29,7 @@ class CreateUsersTable extends Migration
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
{
|
||||
Schema::drop('users');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,6 @@ class CreateRatesTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
Schema::dropIfExists('rates');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,14 @@ class CreateBookingsTable extends Migration
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
{
|
||||
Schema::table('bookings', function(Blueprint $table)
|
||||
{
|
||||
$table->dropForeign('bookings_rate_id_foreign');
|
||||
$table->dropColumn('rate_id');
|
||||
});
|
||||
|
||||
Schema::dropIfExists('bookings');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@ class ChangeUserIdInBookingsTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
Schema::table('bookings', function(Blueprint $table)
|
||||
{
|
||||
$table->dropForeign('bookings_user_id_foreign');
|
||||
$table->dropColumn('user_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,7 @@ class AddBookingsTable extends Migration
|
||||
$table->string('usd_book_swift_code')->default(' ');
|
||||
$table->string('usd_book_cnap')->default(' ');
|
||||
$table->string('usd_book_bank_branch')->default(' ');
|
||||
$table->boolean('verification_status')->default('1'); // Results in a default value of 1.
|
||||
|
||||
// $table->foreign('status_id')
|
||||
// ->references('id')->on('status')
|
||||
// ->onDelete('cascade');
|
||||
$table->boolean('verification_status')->default('1');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -43,8 +39,6 @@ class AddBookingsTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('bookings', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,7 @@ class MakeNullableFieldBookingsTable extends Migration
|
||||
$table->string('usd_book_swift_code')->nullable()->change();
|
||||
$table->string('usd_book_cnap')->nullable()->change();
|
||||
$table->string('usd_book_bank_branch')->nullable()->change();
|
||||
$table->boolean('verification_status')->nullable()->change(); // Results in a default value of 1.
|
||||
|
||||
// $table->foreign('status_id')
|
||||
// ->references('id')->on('status')
|
||||
// ->onDelete('cascade');
|
||||
$table->boolean('verification_status')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,11 @@ class CreateUserBankSlipsTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('user_bank_slips', function(Blueprint $table)
|
||||
{
|
||||
$table->dropForeign('user_bank_slips_book_id_foreign');
|
||||
});
|
||||
|
||||
Schema::dropIfExists('user_bank_slips');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,11 @@ class CreatePurchaseOrdersTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('purchase_orders', function(Blueprint $table)
|
||||
{
|
||||
$table->dropForeign('purchase_orders_booking_id_foreign');
|
||||
$table->dropColumn('booking_id');
|
||||
});
|
||||
Schema::dropIfExists('purchase_orders');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ class CreateMarkingTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('marking');
|
||||
Schema::dropIfExists('markings');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,12 @@ class CreateInvoiceTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('invoices', function(Blueprint $table)
|
||||
{
|
||||
$table->dropForeign('invoices_booking_id_foreign');
|
||||
$table->dropColumn('booking_id');
|
||||
});
|
||||
|
||||
Schema::dropIfExists('invoices');
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -27,6 +27,10 @@ class AddBookingidForeignkeyToChinabankslipTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::table('china_bank_slips', function(Blueprint $table)
|
||||
{
|
||||
$table->dropForeign('china_bank_slips_booking_id_foreign');
|
||||
$table->dropColumn('booking_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RenameBookingForeignkeyFromSupplierbookingTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('supplier_bookings', function($table)
|
||||
{
|
||||
$table->dropForeign(['book_id']);
|
||||
$table->dropColumn('book_id');
|
||||
$table->integer('booking_id')->unsigned();
|
||||
$table->foreign('booking_id')->references('id')->on('bookings');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddBillingFieldToSupplierbookingTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('supplier_bookings', function($table)
|
||||
{
|
||||
$table->double('billing_amount');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddSalestaxFieldToSupplierbookingTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('supplier_bookings', function($table)
|
||||
{
|
||||
$table->double('salestax_amount');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Generated
+3271
-4589
File diff suppressed because it is too large
Load Diff
+6
-4
@@ -20,6 +20,7 @@
|
||||
"@xkeshi/vue-countdown": "^0.6.0",
|
||||
"axios": "^0.18.0",
|
||||
"bootstrap": "^4.0.0",
|
||||
"canvas2image": "^1.0.5",
|
||||
"element-ui": "^2.3.9",
|
||||
"jquery": "^3.3.1",
|
||||
"js-cookie": "^2.2.0",
|
||||
@@ -33,8 +34,7 @@
|
||||
"vue-meta": "^1.4.4",
|
||||
"vue-router": "^3.0.1",
|
||||
"vuex": "^3.0.1",
|
||||
"vuex-router-sync": "^5.0.0",
|
||||
"webpack": "^3.11.0"
|
||||
"vuex-router-sync": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-eslint": "^3.0.0-beta.6",
|
||||
@@ -42,9 +42,11 @@
|
||||
"@vue/eslint-config-standard": "^3.0.0-beta.6",
|
||||
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
||||
"cross-env": "^5.1.4",
|
||||
"eslint": "^4.19.1",
|
||||
"laravel-mix": "^2.1.1",
|
||||
"vue-template-compiler": "^2.5.16",
|
||||
"webpack-bundle-analyzer": "^2.11.1",
|
||||
"webpack-cli": "^2.1.3"
|
||||
"webpack": "^3.11.0",
|
||||
"webpack-bundle-analyzer": "^2.13.1",
|
||||
"webpack-cli": "^3.0.8"
|
||||
}
|
||||
}
|
||||
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="nav-item dropdown">
|
||||
<!-- <li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button"
|
||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{ locales[locale] }}
|
||||
@@ -12,7 +12,7 @@
|
||||
{{ value }}
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</li> -->
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li v-if="(user && role == 'admin')" class="nav-item">
|
||||
<el-popover placement="top" width="300" v-model="UpdateRatePopoverVisible">
|
||||
@@ -27,35 +27,31 @@
|
||||
<a class="nav-link" href="#" role="button" slot="reference">Update Rate</a>
|
||||
</el-popover>
|
||||
</li></ul>
|
||||
<li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.complete-order' }" class="nav-link">{{ $t('Complete Order') }}</router-link></li>
|
||||
<!-- <li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.complete' }" class="nav-link">{{ $t('Complete Order') }}</router-link></li> -->
|
||||
<li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.transaction-history' }" class="nav-link">{{ $t('Transaction History') }}</router-link></li>
|
||||
<li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.upload-supplier-bank-slip' }" class="nav-link">{{ $t('Upload Supplier Bank Slip to System') }}</router-link></li>
|
||||
<!-- <li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.upload-supplier-bank-slip' }" class="nav-link">{{ $t('Upload Supplier Bank Slip to System') }}</router-link></li> -->
|
||||
|
||||
</ul>
|
||||
<!-- update rate dialog start -->
|
||||
<el-dialog align="center" :visible.sync="UpdateRateDialogVisible" width="60%">
|
||||
<el-form :inline="true" align="center" ref="rateForm" :model="rateForm" :rules="rules">
|
||||
|
||||
<!-- update rate dialog -->
|
||||
<el-dialog align="center" :visible.sync="UpdateRateDialogVisible">
|
||||
<el-form :inline="true" align="center">
|
||||
<el-form-item>X1 :
|
||||
Cash : <el-input style=width:10% ></el-input>
|
||||
Cheque : <el-input style=width:10%></el-input>
|
||||
BA : <el-input style=width:10%></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :inline="true" align="center">
|
||||
<el-form-item>X2 :
|
||||
Cash : <el-input style=width:10% ></el-input>
|
||||
Cheque : <el-input style=width:10%></el-input>
|
||||
BA : <el-input style=width:10%></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="x1_cash" >X1: Cash : <el-input v-model.number="rateForm.x1_cash" style=width:25% ></el-input></el-form-item>
|
||||
<el-form-item prop="x1_cheque" >Cheque : <el-input v-model.number="rateForm.x1_cheque" style=width:25%></el-input></el-form-item>
|
||||
<el-form-item prop="x1_ba">BA : <el-input v-model.number="rateForm.x1_ba" style=width:25%></el-input></el-form-item>
|
||||
<br>
|
||||
<el-form-item prop="x2_cash" >X2: Cash : <el-input v-model.number="rateForm.x2_cash" style=width:25% ></el-input></el-form-item>
|
||||
<el-form-item prop="x2_cheque" >Cheque : <el-input v-model.number="rateForm.x2_cheque" style=width:25%></el-input></el-form-item>
|
||||
<el-form-item prop="x2_ba" >BA : <el-input v-model.number="rateForm.x2_ba" style=width:25%></el-input></el-form-item>
|
||||
</el-form>
|
||||
<br>
|
||||
<div align="center">
|
||||
<el-button type="text" @click="UpdateRateDialogVisible = false">Cancel</el-button>
|
||||
<el-button type="primary" @click="UpdateRateDialogVisible = false; DoneUpdateRateDialogVisible = true">Save</el-button>
|
||||
<el-button type="primary" @click="updateRate('rateForm'); UpdateRateDialogVisible = false; DoneUpdateRateDialogVisible = true" >Save</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- update rate dialog end -->
|
||||
</el-dialog>
|
||||
<!-- update rate dialog done -->
|
||||
|
||||
<el-dialog align="center" :visible.sync="DoneUpdateRateDialogVisible" width="30%">
|
||||
<span>Rate Successfully Updated</span><br><br>
|
||||
<div align="center">
|
||||
@@ -77,14 +73,48 @@ export default {
|
||||
UpdateRatePopoverVisible: false,
|
||||
UpdateRateDialogVisible: false,
|
||||
DoneUpdateRateDialogVisible: false,
|
||||
rate:{
|
||||
x1_cash: '1.60',
|
||||
x1_cheque: '1.63',
|
||||
x1_ba: '1.66',
|
||||
x2_cash: '1.40',
|
||||
x2_cheque: '1.44',
|
||||
x2_ba: '1.66'
|
||||
}
|
||||
rate: {
|
||||
x1_ba: null,
|
||||
x1_cheque: null,
|
||||
x1_cash: null,
|
||||
x2_ba: null,
|
||||
x2_cash: null,
|
||||
x2_cheque: null,
|
||||
},
|
||||
rateForm: {
|
||||
x1_cash: '',
|
||||
x1_cheque: '',
|
||||
x1_ba: '',
|
||||
x1_cash: '',
|
||||
x1_cheque: '',
|
||||
x1_ba: '',
|
||||
},
|
||||
rules: {
|
||||
x1_cash: [
|
||||
{ required: true, message: 'Please input rate for X1 Cash', trigger: 'change'},
|
||||
{ type: 'number', message: 'Rate must be a number'}
|
||||
],
|
||||
x1_cheque: [
|
||||
{ required: true, message: 'Please input rate for X1 Cheque', trigger: 'change'},
|
||||
{ type: 'number', message: 'Rate must be a number'}
|
||||
],
|
||||
x1_ba: [
|
||||
{ required: true, message: 'Please input rate for X1 BA', trigger: 'change'},
|
||||
{ type: 'number', message: 'Rate must be a number'}
|
||||
],
|
||||
x2_cash: [
|
||||
{ required: true, message: 'Please input rate for X2 Cash', trigger: 'change'},
|
||||
{ type: 'number', message: 'Rate must be a number'}
|
||||
],
|
||||
x2_cheque: [
|
||||
{ required: true, message: 'Please input rate for X2 Cheque', trigger: 'change'},
|
||||
{ type: 'number', message: 'Rate must be a number'}
|
||||
],
|
||||
x2_ba: [
|
||||
{ required: true, message: 'Please input rate for X2 BA', trigger: 'change'},
|
||||
{ type: 'number', message: 'Rate must be a number'}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: mapGetters({
|
||||
@@ -94,6 +124,10 @@ export default {
|
||||
role: 'auth/role'
|
||||
}),
|
||||
|
||||
mounted () {
|
||||
this.getRate()
|
||||
},
|
||||
|
||||
methods: {
|
||||
setLocale (locale) {
|
||||
if (this.$i18n.locale !== locale) {
|
||||
@@ -101,23 +135,88 @@ export default {
|
||||
|
||||
this.$store.dispatch('lang/setLocale', { locale })
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeCreate() {
|
||||
axios
|
||||
.get('/api/rate/' + this.$route.params.id)
|
||||
.then((response) => {
|
||||
},
|
||||
getRate() {
|
||||
let $this = this
|
||||
axios.get('api/rate').then(response => {
|
||||
this.rate = response.data
|
||||
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
this.$router.push({
|
||||
name: 'notfound'
|
||||
})
|
||||
console.log(this.rate)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
|
||||
createRate: function () {
|
||||
this.loading = true,
|
||||
this.dialogFormVisible1 = true
|
||||
let newRate = {
|
||||
x1_cash: this.rateForm.x1_cash,
|
||||
x1_cheque: this.rateForm.x1_cheque,
|
||||
x1_ba: this.rateForm.x1_ba,
|
||||
x2_cash: this.rateForm.x2_cash,
|
||||
x2_cheque: this.rateForm.x2_cheque,
|
||||
x2_ba: this.rateForm.x2_ba
|
||||
}
|
||||
|
||||
console.log(newRate)
|
||||
axios.post('api/update-rate', newRate)
|
||||
.then((response) => {
|
||||
this.loading = false
|
||||
this.rate = response.data
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
this.loading = false
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Error : All rate must be inserted',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
updateRate(formName) {
|
||||
this.loading = true
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
let newRate = {
|
||||
x1_cash: this.rateForm.x1_cash,
|
||||
x1_cheque: this.rateForm.x1_cheque,
|
||||
x1_ba: this.rateForm.x1_ba,
|
||||
x2_cash: this.rateForm.x2_cash,
|
||||
x2_cheque: this.rateForm.x2_cheque,
|
||||
x2_ba: this.rateForm.x2_ba,
|
||||
}
|
||||
|
||||
axios.post('/api/update-rate', newRate)
|
||||
.then((response) => {
|
||||
this.loading = false
|
||||
this.rate = response.data
|
||||
|
||||
})
|
||||
.catch((error) => {
|
||||
this.loading = false
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Error : All rate must be inserted',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.loading = false
|
||||
DoneUpdateRateDialogVisible = false
|
||||
UpdateRateDialogVisible = true
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Please fill the form',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -353,11 +353,16 @@
|
||||
console.log(error)
|
||||
|
||||
// TODO : Show error message
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
this.loading_btn = false
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Please fill the supplier form',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -200,12 +200,14 @@
|
||||
</div>
|
||||
<el-row :gutter="12" style="text-align:center">
|
||||
<el-col :span="20" style="text-align:center">
|
||||
|
||||
|
||||
<canvas id="myCanvas" ref="myCanvas" v-insert-message="supplier_booking"></canvas>
|
||||
<img id="banklogo" src="/banklogo.png" style="display: none"/>
|
||||
<br>
|
||||
<el-button @click="downloadReport()" type="text">Download Now</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<br>
|
||||
<br>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>User BankinSlip</span>
|
||||
@@ -217,11 +219,11 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<br>
|
||||
<br>
|
||||
<el-card class="box-card">
|
||||
<el-row :gutter="12">
|
||||
<el-col :span="22" style="text-align:center">
|
||||
<el-button :loading="loading_btn" @click="$router.go(-1)" type="primary">Edit</el-button>
|
||||
<el-button :loading="loading_btn" @click="goToSupplierBooking" type="primary">Edit</el-button>
|
||||
<el-button :loading="loading_btn" @click="completeReport" type="success">Done</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -237,6 +239,7 @@
|
||||
<script>
|
||||
import ProgressTrack from '~/components/AdminProgressTrack'
|
||||
import axios from 'axios'
|
||||
import Canvas2Image from 'canvas2image'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -252,9 +255,11 @@
|
||||
bia: null,
|
||||
user_bankslip_path: null,
|
||||
},
|
||||
supplier_booking:{
|
||||
},
|
||||
supplier: null,
|
||||
supplier_options: null,
|
||||
|
||||
exampleContent: "This is TEXT"
|
||||
|
||||
}
|
||||
},
|
||||
@@ -279,43 +284,239 @@
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
axios
|
||||
.get('/api/supplier-booking/' + this.$route.params.id)
|
||||
.then((response) => {
|
||||
loading.close()
|
||||
this.supplier_booking = response.data
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
loading.close()
|
||||
this.$router.push({
|
||||
name: 'notfound'
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
completeReport(){
|
||||
downloadReport(){
|
||||
let canvas = document.getElementById('myCanvas')
|
||||
var dataString = canvas.toDataURL("image/png");
|
||||
console.log(dataString)
|
||||
var link = document.createElement("a");
|
||||
link.download = 'image';
|
||||
link.href = dataString;
|
||||
link.click();
|
||||
},
|
||||
goToSupplierBooking(){
|
||||
this.$router.push({
|
||||
name: 'booking.admin.supplier',
|
||||
params: this.$route.params.id
|
||||
})
|
||||
},
|
||||
completeReport() {
|
||||
// TODO : send request to change status
|
||||
this.loading_btn = true
|
||||
axios
|
||||
.post('/api/booking/' + this.$route.params.id + '/confirm-supplier')
|
||||
.then((response) => {
|
||||
this.loading_btn = false
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Success, please comeback after getting china bankslip',
|
||||
type: 'success',
|
||||
duration: 5000
|
||||
.post('/api/booking/' + this.$route.params.id + '/confirm-supplier')
|
||||
.then((response) => {
|
||||
this.loading_btn = false
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Success, please comeback after getting china bankslip',
|
||||
type: 'success',
|
||||
duration: 5000
|
||||
})
|
||||
this.$router.push({
|
||||
name: 'home'
|
||||
})
|
||||
//this.booking_details = response.data
|
||||
}).catch((error) => {
|
||||
this.loading_btn = false
|
||||
console.log(error)
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Suceess',
|
||||
type: 'success',
|
||||
duration: 5000
|
||||
})
|
||||
})
|
||||
this.$router.push({
|
||||
name: 'home'
|
||||
})
|
||||
//this.booking_details = response.data
|
||||
}).catch((error) => {
|
||||
this.loading_btn = false
|
||||
console.log(error)
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Suceess',
|
||||
type: 'success',
|
||||
duration: 5000
|
||||
})
|
||||
})
|
||||
this.$router.push({
|
||||
this.$router.push({
|
||||
name: 'booking.admin.cnslip',
|
||||
params: {id: this.$route.params.id }
|
||||
params: {
|
||||
id: this.$route.params.id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
directives: {
|
||||
insertMessage: function (canvasElement, binding) {
|
||||
////////////////// variable //////////////////////////
|
||||
var canvasWidth = 450;
|
||||
var rowHeight = [20, 40, 60, 80, 100, 120, 140, 170, 190, 210, 230, 250, 270, 290, 310, 330, 350, 390, 410,
|
||||
470, 490, 510, 610, 630
|
||||
]
|
||||
const canvasHeight = rowHeight[rowHeight.length - 1];
|
||||
|
||||
var column1X = 220;
|
||||
var column2X = 320;
|
||||
var column3X = 420;
|
||||
|
||||
///////////////////Canvast Init////////////////////
|
||||
var canvas = document.getElementById("myCanvas");
|
||||
canvas.width = canvasWidth;
|
||||
canvas.height = canvasHeight;
|
||||
// Get canvas context
|
||||
var ctx = canvasElement.getContext("2d");
|
||||
// Clear the canvas
|
||||
ctx.clearRect(0, 0, 300, 150);
|
||||
|
||||
ctx.fillStyle = "#FFFFFF";
|
||||
ctx.fillRect(0, 0, canvasWidth, rowHeight[0]);
|
||||
for (var i = 1; i < rowHeight.length; i++) {
|
||||
if (i % 2 == 1)
|
||||
ctx.fillStyle = "#A9D08E";
|
||||
else
|
||||
ctx.fillStyle = "#FFFFFF";
|
||||
ctx.fillRect(0, rowHeight[i - 1], canvasWidth, rowHeight[i]);
|
||||
}
|
||||
///////////// fillup with text////////////////
|
||||
//// config canvas
|
||||
ctx.fillStyle = "#000000";
|
||||
ctx.font = "13px Arial";
|
||||
ctx.textAlign = "right";
|
||||
//// Row 1
|
||||
ctx.fillText("Payment Voucher :", column1X, rowHeight[1] - 5);
|
||||
ctx.fillText(binding.value.id, column3X, rowHeight[1] - 5);
|
||||
//// Row 2
|
||||
ctx.fillText("Date :", column1X, rowHeight[2] - 5);
|
||||
ctx.fillText(binding.value.date, column3X, rowHeight[2] - 5);
|
||||
//// Row 3
|
||||
ctx.fillText("Marking :", column1X, rowHeight[3] - 5);
|
||||
ctx.font = "bold 14px Arial";
|
||||
ctx.fillStyle = "#0070D5";
|
||||
ctx.fillText("CIEF/605HOS", column3X, rowHeight[3] - 5);
|
||||
ctx.fillStyle = "#000000";
|
||||
ctx.font = "13px Arial";
|
||||
//// Row 4
|
||||
ctx.fillText("Payment For(Order No.) :", column1X, rowHeight[4] - 5);
|
||||
ctx.fillText(binding.value.id, column3X, rowHeight[4] - 5);
|
||||
//// Row 4
|
||||
ctx.fillText("Payment For :", column1X, rowHeight[5] - 5);
|
||||
ctx.fillText("Full Payment", column3X, rowHeight[5] - 5);
|
||||
//// Row 5
|
||||
ctx.fillText("Payment Method :", column1X, rowHeight[6] - 5);
|
||||
ctx.fillText(binding.value.payment_method, column3X, rowHeight[6] - 5);
|
||||
//// Row 6
|
||||
ctx.fillText("Remark :", column1X, rowHeight[7] - 10);
|
||||
//// Row 7
|
||||
// Empty
|
||||
//// Row 8
|
||||
ctx.fillText("MYR/RM :", column1X, rowHeight[9] - 5);
|
||||
ctx.fillText("MYR", column2X, rowHeight[9] - 5);
|
||||
ctx.font = "bold 14px Arial";
|
||||
ctx.fillText(binding.value.transfer_amount, column3X, rowHeight[9] - 5);
|
||||
ctx.font = "13px Arial";
|
||||
//// Row 8
|
||||
ctx.fillText("* RATE :", column1X, rowHeight[10] - 5);
|
||||
ctx.fillText(binding.value.rate, column3X, rowHeight[10] - 5);
|
||||
//// Row 9
|
||||
// Empty
|
||||
//// Row 10
|
||||
ctx.font = "bold 14px Arial";
|
||||
ctx.fillText("CNY", column2X, rowHeight[12] - 5);
|
||||
ctx.fillText(binding.value.amountInRMB, column3X, rowHeight[12] - 5);
|
||||
ctx.font = "13px Arial";
|
||||
//line
|
||||
ctx.beginPath();
|
||||
ctx.lineWidth = 1;
|
||||
ctx.moveTo(column1X + 30, rowHeight[11]);
|
||||
ctx.lineTo(column3X + 20, rowHeight[11]);
|
||||
ctx.stroke();
|
||||
ctx.beginPath();
|
||||
ctx.lineWidth = 2;
|
||||
ctx.moveTo(column1X + 30, rowHeight[12]);
|
||||
ctx.lineTo(column3X + 20, rowHeight[12]);
|
||||
ctx.stroke();
|
||||
//// Row 11
|
||||
ctx.fillText("MYR/RM :", column1X, rowHeight[14] - 5);
|
||||
ctx.fillText("MYR", column2X, rowHeight[14] - 5);
|
||||
ctx.fillText("4830.68", column3X, rowHeight[14] - 5);
|
||||
//// Row 12
|
||||
ctx.fillText("Billing(1.0%) :", column1X, rowHeight[15] - 5);
|
||||
ctx.fillText("MYR", column2X, rowHeight[15] - 5);
|
||||
ctx.fillText(binding.value.billing_amount, column3X, rowHeight[15] - 5);
|
||||
//// Row 13
|
||||
ctx.fillText("+ SALES TAX (10%) :", column1X, rowHeight[16] - 5);
|
||||
ctx.fillText("MYR", column2X, rowHeight[16] - 5);
|
||||
ctx.fillText(binding.value.salestax_amount, column3X, rowHeight[16] - 5);
|
||||
//// Row 14
|
||||
ctx.fillText("+ GST 6% :", column1X, rowHeight[17] - 15);
|
||||
ctx.fillText("MYR", column2X, rowHeight[17] - 15);
|
||||
ctx.fillText("289.84", column3X, rowHeight[17] - 15);
|
||||
//// Row 15
|
||||
ctx.font = "bold 14px Arial";
|
||||
ctx.fillText("Customer Bank In Amount :", column1X, rowHeight[18] - 5);
|
||||
ctx.fillStyle = "#0070D5";
|
||||
ctx.fillText("MYR", column2X, rowHeight[18] - 5);
|
||||
ctx.fillText(binding.value.amountInRMB, column3X, rowHeight[18] - 5);
|
||||
ctx.fillStyle = "#000000";
|
||||
ctx.font = "13px Arial";
|
||||
//line
|
||||
ctx.lineWidth = 1;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(column1X + 30, rowHeight[17]);
|
||||
ctx.lineTo(column3X + 20, rowHeight[17]);
|
||||
ctx.stroke();
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(column1X + 30, rowHeight[18] + 1);
|
||||
ctx.lineTo(column3X + 20, rowHeight[18] + 1);
|
||||
ctx.stroke();
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(column1X + 30, rowHeight[18] - 2);
|
||||
ctx.lineTo(column3X + 20, rowHeight[18] - 2);
|
||||
ctx.stroke();
|
||||
//// Row 16
|
||||
ctx.fillText("Rebate :", column1X, rowHeight[19] - 25);
|
||||
ctx.fillText("CNY", column2X, rowHeight[19] - 25);
|
||||
ctx.fillText("224.68", column3X, rowHeight[19] - 25);
|
||||
//// Row 16
|
||||
ctx.font = "bold 14px Arial";
|
||||
ctx.fillText("Bank In to Account Below :", column1X, rowHeight[20] - 5);
|
||||
ctx.font = "bold italic 15px Arial";
|
||||
ctx.fillStyle = "#0070D5";
|
||||
ctx.fillText("CNY", column2X, rowHeight[20] - 5);
|
||||
ctx.fillText("7692.17", column3X - 20, rowHeight[20] - 5);
|
||||
ctx.fillStyle = "#000000";
|
||||
ctx.font = "13px Arial";
|
||||
//// Row 17
|
||||
//// Row 18
|
||||
//// Row 19
|
||||
var img = new Image();
|
||||
img.src = "/banklogo.png";
|
||||
img.crossOrigin = "anonymous";
|
||||
var maxwidth = 70;
|
||||
var ratio = maxwidth / img.width;
|
||||
var offset = ((rowHeight[22] - rowHeight[21]) / 2) - (img.height * ratio / 2);
|
||||
var y = rowHeight[21] + offset; // to make it always center
|
||||
|
||||
img.onload=function(){
|
||||
ctx.drawImage(img, 50, 530, 80, 50);
|
||||
};
|
||||
|
||||
// text
|
||||
ctx.font = "bold 14px Arial";
|
||||
ctx.textAlign = "center";
|
||||
ctx.fillText("China beneficiary Account", column2X - 40, rowHeight[22] - 80);
|
||||
ctx.fillText("户名 : 奕继椿", column2X - 40, rowHeight[22] - 60);
|
||||
ctx.fillText("6226 1906 8014 3314", column2X - 40, rowHeight[22] - 40);
|
||||
ctx.fillText("民生银行 深川红荔支行", column2X - 40, rowHeight[22] - 20);
|
||||
ctx.font = "13px Arial";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -358,23 +358,26 @@
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
this.loading = false
|
||||
console.log(error)
|
||||
this.loading_btn = false
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Please upload your bankin slip first.',
|
||||
type: 'warning',
|
||||
duration: 10000
|
||||
})
|
||||
console.log(error)
|
||||
this.loading_btn = false
|
||||
})
|
||||
|
||||
} else {
|
||||
this.loading_btn = false
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Please upload your bankin slip first.',
|
||||
type: 'warning',
|
||||
duration: 10000
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
console.log(file, fileList);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div align="center">
|
||||
<h4 style="margin-top:5%;"></h4>
|
||||
<br>
|
||||
<div v-if="booking_details.user_po_path !== null">
|
||||
<div v-if="booking_details.user_po_path">
|
||||
<h4>Upload Invoice</h4>
|
||||
</div>
|
||||
<div v-else>
|
||||
@@ -181,7 +181,7 @@
|
||||
</el-row>
|
||||
<br>
|
||||
|
||||
<el-row v-if="booking_details.user_po_path !== null" :gutter="12" justify="center" align="center">
|
||||
<el-row v-if="booking_details.user_po_path" :gutter="12" justify="center" align="center">
|
||||
<el-col :span="12">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
@@ -250,7 +250,6 @@
|
||||
amount: null,
|
||||
bia: null,
|
||||
user_bankslip_path: null,
|
||||
user_po_path: null,
|
||||
},
|
||||
supplier: null,
|
||||
supplier_options: null,
|
||||
@@ -316,6 +315,7 @@
|
||||
.then((response) => {
|
||||
loading.close()
|
||||
this.booking_details = response.data
|
||||
console.log(this.booking_details)
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
loading.close()
|
||||
@@ -356,6 +356,9 @@
|
||||
},
|
||||
handlePreview(file) {
|
||||
console.log(file);
|
||||
},
|
||||
handleExceed(file){
|
||||
console.log(file)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div align="right">
|
||||
<el-button icon="el-icon-refresh" type="primary" size="mini" @click="RefreshBooking()">Refresh</el-button></div>
|
||||
<!-- Booking Table -->
|
||||
<el-row :gutter="20">
|
||||
<div>
|
||||
@@ -41,6 +44,7 @@
|
||||
</div>
|
||||
</el-row>
|
||||
<!-- Booking Table-end -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -52,26 +56,20 @@ export default {
|
||||
return {
|
||||
status: null,
|
||||
bookingTable: [
|
||||
]
|
||||
],
|
||||
url: 'api/admin/booking',
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
axios
|
||||
.get('/api/admin/booking')
|
||||
.then((response) => {
|
||||
console.log(response.data)
|
||||
this.bookingTable = response.data
|
||||
|
||||
// loading.close()
|
||||
}).catch((error) => {
|
||||
// console.log(error)
|
||||
// loading.close()
|
||||
// this.$router.push({
|
||||
// name: 'notfound'
|
||||
// })
|
||||
})
|
||||
this.RefreshBooking()
|
||||
},
|
||||
methods: {
|
||||
RefreshBooking() {
|
||||
let $this = this
|
||||
axios.get(this.url).then(response => {
|
||||
this.bookingTable = response.data
|
||||
})
|
||||
},
|
||||
filterTag (value, row) {
|
||||
return row.tag === value
|
||||
},
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
<el-row justify="center" align="center">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>BankinSlip</span>
|
||||
<span>Banking Slip</span>
|
||||
<!-- <el-button style="float: right; padding: 3px 0" type="text">Operation button</el-button> -->
|
||||
</div>
|
||||
<el-row :gutter="12">
|
||||
|
||||
@@ -32,6 +32,15 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table-responsive el-table" style="display:table; width:50%; margin: 0 auto;" align="center">
|
||||
<tr>
|
||||
<td align="center">TC Global Trade (M) Sdn Bhd (1190583-A) <br> GST : 001408413696 <br> HLB : 2200 0010 531 <br> MBB : 5148 4233 6341</td>
|
||||
|
||||
</tr>
|
||||
<!-- <tr><td align="center">GST : 001408413696</td></tr>
|
||||
<tr><td align="center">HLB : 2200 0010 531</td></tr>
|
||||
<tr><td align="center">MBB : 5148 4233 6341</td></tr> -->
|
||||
</table>
|
||||
</el-row>
|
||||
<br>
|
||||
|
||||
|
||||
@@ -57,13 +57,13 @@
|
||||
<div class="grid-content bg-purple" align="left">X1 :</div>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<div class="grid-content bg-purple" align="center">1.70</div>
|
||||
<div class="grid-content bg-purple" align="center">{{ rate.x1_cash }}</div>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<div class="grid-content bg-purple" align="center">1.64</div>
|
||||
<div class="grid-content bg-purple" align="center">{{ rate.x1_cheque }}</div>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<div class="grid-content bg-purple" align="center">1.62</div>
|
||||
<div class="grid-content bg-purple" align="center">{{ rate.x1_ba }}</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
@@ -104,13 +104,13 @@
|
||||
<div class="grid-content bg-purple" align="left">X2 :</div>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<div class="grid-content bg-purple" align="center">1.56</div>
|
||||
<div class="grid-content bg-purple" align="center">{{ rate.x2_cash }}</div>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<div class="grid-content bg-purple" align="center">1.64</div>
|
||||
<div class="grid-content bg-purple" align="center">{{ rate.x2_cheque }}</div>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<div class="grid-content bg-purple" align="center">1.62</div>
|
||||
<div class="grid-content bg-purple" align="center">{{ rate.x2_ba }}</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
@@ -230,12 +230,13 @@
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- Booking_confirmation_popup -->
|
||||
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<hr>
|
||||
|
||||
<!-- Booking Table -->
|
||||
<div align="right">
|
||||
<el-button icon="el-icon-refresh" type="primary" size="mini" @click="RefreshBooking()">Refresh</el-button></div>
|
||||
<!-- Booking Table -->
|
||||
<el-row :gutter="20">
|
||||
<div>
|
||||
<el-table :data="bookingTable">
|
||||
@@ -275,9 +276,17 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-row>
|
||||
</el-row><br><br>
|
||||
<div align="right">
|
||||
<el-button type="primary" size="mini" @click="fetchPaginateBooking(pagination.prev_page_url)" :disabled="!pagination.prev_page_url">
|
||||
Previous
|
||||
</el-button>
|
||||
<span>Page {{pagination.current_page}} of {{pagination.last_page}}</span>
|
||||
<el-button type="primary" size="mini" @click="fetchPaginateBooking(pagination.next_page_url)" :disabled="!pagination.next_page_url">
|
||||
Next
|
||||
</el-button>
|
||||
</div>
|
||||
<!-- Booking Table-end -->
|
||||
|
||||
</el-main>
|
||||
</template>
|
||||
<style>
|
||||
@@ -300,6 +309,14 @@ export default {
|
||||
term: '',
|
||||
amount: ''
|
||||
}),
|
||||
rate: {
|
||||
x1_ba: null,
|
||||
x1_cheque: null,
|
||||
x1_cash: null,
|
||||
x2_ba: null,
|
||||
x2_cash: null,
|
||||
x2_cheque: null,
|
||||
},
|
||||
loading: false,
|
||||
status: '',
|
||||
booking: {
|
||||
@@ -355,6 +372,8 @@ export default {
|
||||
formLabelWidth: '0px',
|
||||
bookingTable: [
|
||||
],
|
||||
url: 'api/booking',
|
||||
pagination: [],
|
||||
bookingConfirmTable: {
|
||||
date: 'undefined',
|
||||
marking: 'undefined',
|
||||
@@ -369,20 +388,45 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
axios
|
||||
.get('/api/booking/')
|
||||
.then((response) => {
|
||||
console.log(response)
|
||||
this.bookingTable = response.data.data
|
||||
// loading.close()
|
||||
}).catch((error) => {
|
||||
// loading.close()
|
||||
// this.$router.push({
|
||||
// name: 'notfound'
|
||||
// })
|
||||
})
|
||||
this.getBooking()
|
||||
this.RefreshBooking()
|
||||
this.getRate()
|
||||
},
|
||||
methods: {
|
||||
getRate(){
|
||||
let $this = this
|
||||
axios.get(this.url).then(response => {
|
||||
this.bookingTable = response.data.data
|
||||
|
||||
$this.makePagination(response.data)
|
||||
})
|
||||
},
|
||||
getBooking() {
|
||||
let $this = this
|
||||
axios.get('api/rate').then(response => {
|
||||
this.rate = response.data
|
||||
console.log(this.rate)
|
||||
})
|
||||
},
|
||||
RefreshBooking() {
|
||||
let $this = this
|
||||
axios.get(this.url).then(response => {
|
||||
this.bookingTable = response.data.data
|
||||
})
|
||||
},
|
||||
makePagination(data){
|
||||
let pagination = {
|
||||
current_page: data.current_page,
|
||||
last_page: data.last_page,
|
||||
next_page_url: data.next_page_url,
|
||||
prev_page_url: data.prev_page_url
|
||||
}
|
||||
this.pagination = pagination
|
||||
},
|
||||
fetchPaginateBooking(url) {
|
||||
this.url = url
|
||||
this.getBooking()
|
||||
},
|
||||
// TODO fetch booking data on load
|
||||
formatter (row, column) {
|
||||
return row.address
|
||||
@@ -405,13 +449,6 @@ export default {
|
||||
this.dialogFormVisible = true
|
||||
this.term = newterm
|
||||
},
|
||||
BookingList () {
|
||||
axios.get('api/booking')
|
||||
.then((response) => {
|
||||
console.log(response)
|
||||
this.list = response.data
|
||||
})
|
||||
},
|
||||
// Get calculation before submitting booking
|
||||
getCalculationValue (formName) {
|
||||
this.loading = true
|
||||
@@ -437,42 +474,61 @@ export default {
|
||||
this.dialogFormVisible1 = true
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: error.response.data.message,
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
});
|
||||
this.loading = false
|
||||
console.log(error)
|
||||
})
|
||||
} else {
|
||||
|
||||
this.loading = false
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Please fill the booking form in full.',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
createBooking: function () {
|
||||
this.loading = true,
|
||||
this.dialogFormVisible1 = true
|
||||
let newBooking = {
|
||||
account_name: this.bookingForm.account_name,
|
||||
account_num: this.bookingForm.account_num,
|
||||
bank_name: this.bookingForm.bank_name,
|
||||
bank_branch: this.bookingForm.bank_branch,
|
||||
amount: this.booking.amount,
|
||||
term: this.term
|
||||
}
|
||||
|
||||
let newBooking = {
|
||||
account_name: this.bookingForm.account_name,
|
||||
account_num: this.bookingForm.account_num,
|
||||
bank_name: this.bookingForm.bank_name,
|
||||
bank_branch: this.bookingForm.bank_branch,
|
||||
amount: this.booking.amount,
|
||||
term: this.term
|
||||
}
|
||||
console.log(newBooking)
|
||||
axios.post('api/booking', newBooking)
|
||||
.then((response) => {
|
||||
this.loading = false
|
||||
// push with return id
|
||||
this.$router.push({
|
||||
name: 'booking.user.upload',
|
||||
params: {id: response.data.id }
|
||||
})
|
||||
|
||||
console.log(newBooking)
|
||||
axios.post('api/booking', newBooking)
|
||||
.then((response) => {
|
||||
this.loading = false
|
||||
// push with return id
|
||||
this.$router.push({
|
||||
name: 'booking.user.upload',
|
||||
params: {id: response.data.id }
|
||||
})
|
||||
|
||||
// pass variable to another router
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
// pass variable to another router
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
this.loading = false
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Internal server issues. Please contact support',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
})
|
||||
|
||||
})
|
||||
},
|
||||
BookingStatus (status, booking_id) {
|
||||
console.log(status)
|
||||
|
||||
@@ -39,7 +39,7 @@ const TransactionHistory = () => import('~/pages/admin/transaction-history').the
|
||||
const UploadSupplierBankSlip = () => import('~/pages/admin/upload-supplier-bank-slip').then(m => m.default || m)
|
||||
|
||||
export default [
|
||||
{ path: '/', name: 'welcome', component: Welcome },
|
||||
{ path: '/', name: 'welcome', component: Login },
|
||||
{ path: '/login', name: 'login', component: Login },
|
||||
{ path: '/register', name: 'register', component: Register },
|
||||
{ path: '/password/reset', name: 'password.request', component: PasswordEmail },
|
||||
|
||||
+2
-6
@@ -21,7 +21,7 @@ Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
|
||||
|
||||
Route::get('rate', 'RateController@show');
|
||||
//Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
// return $request->user();
|
||||
//});
|
||||
@@ -44,7 +44,6 @@ Route::group(['middleware' => 'auth:api'], function () {
|
||||
Route::post('booking/{book_id}/cancel', 'BookingController@cancel');
|
||||
Route::get('/booking', 'BookingController@index');
|
||||
Route::get('/user', 'UserController@show');
|
||||
|
||||
Route::patch('settings/profile', 'Settings\ProfileController@update');
|
||||
Route::patch('settings/password', 'Settings\PasswordController@update');
|
||||
});
|
||||
@@ -56,7 +55,6 @@ Route::group(['middleware' => 'guest:api'], function () {
|
||||
Route::post('register', 'Auth\RegisterController@create');
|
||||
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
|
||||
Route::post('password/reset', 'Auth\ResetPasswordController@reset');
|
||||
|
||||
Route::post('oauth/{driver}', 'Auth\OAuthController@redirectToProvider');
|
||||
Route::get('oauth/{driver}/callback', 'Auth\OAuthController@handleProviderCallback')->name('oauth.callback');
|
||||
});
|
||||
@@ -64,14 +62,12 @@ Route::group(['middleware' => 'guest:api'], function () {
|
||||
Route::group(['middleware' => ['role:admin']], function() {
|
||||
Route::get('admin/booking/', 'BookingController@adminIndex');
|
||||
Route::get('admin/booking/{id}', 'BookingController@adminShow');
|
||||
|
||||
Route::post('update-rate', 'RateController@store');
|
||||
Route::put('update-rate/{rate}', 'RateController@update');
|
||||
Route::delete('update-rate/{rate}', 'RateController@delete');
|
||||
Route::get('update-rate', 'RateController@index');
|
||||
|
||||
//show current rate
|
||||
Route::get('rate', 'RateController@show');
|
||||
|
||||
|
||||
Route::get('setting-credit', 'SettingCreditController@index');
|
||||
Route::get('setting-credit/{credit}', 'SettingCreditController@show');
|
||||
|
||||
Reference in New Issue
Block a user