Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/exchange into too/registerpage

# Conflicts:
#	package-lock.json
#	package.json
#	vendor/composer/autoload_static.php
#	yarn.lock
This commit is contained in:
Jack Goh
2018-07-04 11:17:44 +08:00
40 changed files with 545 additions and 19775 deletions
+3
View File
@@ -15,4 +15,7 @@ Homestead.yaml
npm-debug.log
yarn-error.log
.env
package-lock.json
*.lock
vendor/composer/autoload_static.php
+2 -2
View File
@@ -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(){
+13 -1
View File
@@ -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) {
@@ -522,6 +524,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)
// {
+1 -1
View File
@@ -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);
}
+5
View File
@@ -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');
}
}
+1
View File
@@ -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'];
}
+1 -1
View File
@@ -16,7 +16,7 @@ class SupplierBooking extends Model
}
public function booking(){
return $this->hasOne('App\Booking');
return $this->belongTo('App\Booking');
}
public function supplierBookingTtem()
+4
View File
@@ -102,4 +102,8 @@ class User extends Authenticatable implements JWTSubject
return $this->hasMany(Booking::class);
}
public function marking(){
return $this->hasOne(Booking::class);
}
}
Generated
-5352
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -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');
}
}
@@ -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');
});
}
}
@@ -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()
{
//
}
}
-3809
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -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",
@@ -34,7 +35,8 @@
"vue-meta": "^1.4.4",
"vue-router": "^3.0.1",
"vuex": "^3.0.1",
"vuex-router-sync": "^5.0.0"
"vuex-router-sync": "^5.0.0",
"webpack": "^4.14.0"
},
"devDependencies": {
"@vue/cli-plugin-eslint": "^3.0.0-beta.6",
BIN
View File
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,9 +27,9 @@
<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>
@@ -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)
}
}
}
+13 -15
View 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>
+75 -38
View File
@@ -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>
@@ -234,6 +234,8 @@
<br>
<br>
<hr>
<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>
@@ -307,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: {
@@ -379,9 +389,11 @@ export default {
},
mounted () {
this.getBooking()
this.RefreshBooking()
this.getRate()
},
methods: {
getBooking() {
getRate(){
let $this = this
axios.get(this.url).then(response => {
this.bookingTable = response.data.data
@@ -389,6 +401,19 @@ export default {
$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,
@@ -449,49 +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) => {
this.loading = false
this.$message({
showClose: true,
message: 'Internal server issues. Please contact support',
type: 'error',
duration: 10000
})
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)
+1 -1
View File
@@ -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
View File
@@ -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');
-10471
View File
File diff suppressed because it is too large Load Diff