Merge conflicts fixed

This commit is contained in:
Mouhamed Lamine
2018-07-27 16:15:03 +08:00
38 changed files with 1128 additions and 420 deletions
+80
View File
@@ -0,0 +1,80 @@
APP_NAME=IZYIM
APP_ENV=production
APP_KEY=base64:Fu2YulXExzm9HJ5LgVmZUmcbRkchHkc82q02MorN5GQ=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
APP_NAME=exchange
APP_ENV=local
APP_KEY=base64:Fu2YulXExzm9HJ5LgVmZUmcbRkchHkc82q02MorN5GQ=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
JWT_SECRET=FwYZ3SPFgjpEDqAwcaSIV6eEmQiMtGWt
+3 -1
View File
@@ -13,5 +13,7 @@ RUN php artisan clear-compiled
COPY wait.sh /usr/local/bin/wait.sh
RUN chmod +x /usr/local/bin/wait.sh
CMD /usr/local/bin/wait.sh && composer update --no-scripts && composer dumpautoload && php artisan storage:link && php artisan migrate && php artisan serve --host=0.0.0.0 --port=8000
RUN php artisan storage:link
CMD /usr/local/bin/wait.sh && composer update --no-scripts && composer dumpautoload && php artisan migrate && php artisan serve --host=0.0.0.0 --port=8000
EXPOSE 8000
+137 -62
View File
@@ -13,6 +13,7 @@ use App\Invoice;
use App\SettingCredit;
use App\SettingTaxRate;
use App\SettingBillingCharge;
use App\Notification;
use Auth;
use Validator;
use DateTime;
@@ -70,6 +71,7 @@ class BookingController extends Controller
default:
$status_desc = "";
}
$booking->status_desc = $status_desc;
$booking->marking = $booking->user->marking;
}
@@ -248,7 +250,9 @@ class BookingController extends Controller
$term = $request->input('term');
$amount = $request->input("amount"); // in RMB
$rates = Rate::orderby('updated_at','desc')->first();
$creditLimit = SettingCredit::orderby('updated_at','desc')->first();
$creditLimit = SettingCredit::orderby('updated_at','desc')->first();
$taxrate = SettingTaxRate::latest()->first()->tax_rate;
$billingChargeRate = SettingBillingCharge::latest()->first()->billing_charge_rate;
if (!$creditLimit){
return response()->json("Credit limit not set, please contact admin", 405);
@@ -290,27 +294,31 @@ class BookingController extends Controller
}
// Service charge (RMB) : if amount higher than 10,000, no service charge. if amount lower than 10,000, 20.00 service charge
if ($amount >= 10000 && ($term == 'x2_cash' || $term = 'x2_cheque' || $term = 'x2_ba')) {
if ($amount >= 10000 && ($term == 'x2_cash' || $term == 'x2_cheque' || $term == 'x2_ba')) {
$svcharge = 0;
} else {
$svcharge = 20.00;
}
// initial rmb to myr amount
$RMBinMYR = (($amount + $svcharge) / $rate);
// TODO : Should be remove this ?
// gst 0%
$gst = 0 * $RMBinMYR;
// Sales tax : 10 %
$sales_tax = 0.10 * $RMBinMYR;
// Billing fees : 1.5%
$billing = 0.015 * $RMBinMYR;
// Bank in amount
$bia = round($RMBinMYR + $gst + $sales_tax + $billing, 2);
$subtotal = round(($amount + $svcharge) / $rate,2);
// TODO : refactor
if ($taxrate !=0){
$taxAmount = round($subtotal * $taxrate - $subtotal,2);
}
else{
$taxAmount = 0;
}
if ($billingChargeRate !=0){
$billingChargeAmount = round(($amount + $svcharge) * $billingChargeRate - ($amount + $svcharge), 2);
}
else{
$billingChargeAmount = 0;
}
$billingChargeAmount = round((($amount / $rate) * $billingChargeRate) - ($amount / $rate), 2);
$bankin_amount = round($subtotal + $taxAmount + $billingChargeAmount , 2);
$booking = new Booking();
$booking->account_name = $request->input('account_name');
@@ -318,12 +326,14 @@ class BookingController extends Controller
$booking->bank_name = $request->input('bank_name');
$booking->bank_branch = $request->input('bank_branch');
$booking->amount = $request->input('amount');
$booking->order_no = $request->input('order_no');
$booking->payment_for = $request->input('payment_for');
$booking->term = $term;
$booking->rate_id = $rates->id;
$booking->rate = $rate;
$booking->rmb_book_amount = $request->input('amount');
$booking->rmb_book_amount = $request->input('amount'); // BIG TODO : amount change variable name to rmb_book_amount
$booking->status = 2;
$booking->bia = $bia;
$booking->bia = $bankin_amount; // BID TODO : change bia viariable name
// $booking->user_id = $user->id;
$booking->user()->associate($user);
@@ -350,8 +360,9 @@ class BookingController extends Controller
// $booking->usd_book_cnap = $request->input('usd_book_cnap');
// $booking->usd_book_bank_branch = $request->input('usd_book_bank_branch');
// $booking->verification_status = $request->input('verification_status');
// return response()->json($booking, 201);
$booking->save();
//return response()->json('error', 400);
// return response()->json('error', 400);
return response()->json($booking, 201);
}
@@ -415,19 +426,26 @@ class BookingController extends Controller
'user_bankslip', $bankslip_file, $unique_image_path
);
$user_bankslip = $booking->userBankSlip()->first();
if($upload_path){
$user_bankslip = $booking->userBankSlip()->first();
// if user bankslip not exist, create new one
if(!$user_bankslip){
$user_bankslip = new UserBankSlip;
// if user bankslip not exist, create new one
if(!$user_bankslip){
$user_bankslip = new UserBankSlip;
}
$user_bankslip->booking_id = $booking->id;
$user_bankslip->bankslip_path = $upload_path;
$user_bankslip->transfer_amount = $request->input('transfer_amount');
$user_bankslip->save();
return response()->json(['message'=>"Success"],200);
}
else{
return response()->json(['message' => 'File not uploaded. Please contact support'], 400);
}
$user_bankslip->booking_id = $booking->id;
$user_bankslip->bankslip_path = $upload_path;
$user_bankslip->transfer_amount = $request->input('transfer_amount');
$user_bankslip->save();
return response()->json(['message'=>"Success"],200);
}
else {
return response()->json(['message' => 'No file detected'], 400);
@@ -447,9 +465,16 @@ class BookingController extends Controller
$booking->admin_status = 2;
$booking->save();
// Add notification message to admin
$adminNotification = new Notification;
$adminNotification->detail = "A bankslip is uploaded for booking " . $booking->id;
$adminNotification->link = "/booking/" . $booking->id . "/verification";
$adminNotification->user_id = User::withRole('admin')->first()->id;
$adminNotification->save();
$user_bankslip->transfer_amount = $request->input('transfer_amount');
$user_bankslip->save();
return response()->json(["message"=> "Success"],200);
return response()->json($adminNotification,200);
}
public function uploadPurchaseOrder(Request $request, $id)
@@ -545,6 +570,8 @@ class BookingController extends Controller
$amount = $request->input('amount');
$term = $request->input('term');
$china_beneficiary = $request->input('china_beneficiary');
$order_no = $request->input('order_no');
$payment_for = $request->input('payment_for');
$rates = Rate::orderby('updated_at','desc')->first();
$marking = $user = Auth::user()->marking;
$taxrate = SettingTaxRate::latest()->first()->tax_rate;
@@ -559,16 +586,15 @@ class BookingController extends Controller
if($amount > $creditLimit->rmb_credit_limit){
return response()->json(["message" => "Exceed credit limit, please contact our sales team for larger quantitiy"], 400);
}
switch ($term) {
case "x1_cash":
$rate = $rates->x1_cash;
$payment_method = "cash";
$payment_method = "CASH";
break;
case "x1_cheque":
$rate = $rates->x1_cheque;
$payment_method = "Cheque";
$payment_method = "CHEQUE";
break;
case "x1_ba":
$rate = $rates->x1_ba;
@@ -576,11 +602,11 @@ class BookingController extends Controller
break;
case "x2_cash":
$rate = $rates->x2_cash;
$payment_method = "Cash";
$payment_method = "CASH";
break;
case "x2_cheque":
$rate = $rates->x2_cheque;
$payment_method = "Cheque";
$payment_method = "CHEQUE";
break;
case "x2_ba":
$rate = $rates->x2_ba;
@@ -594,19 +620,36 @@ class BookingController extends Controller
break;
}
if ($amount >= 10000 && ($term == 'x2_cash' || $term = 'x2_cheque' || $term = 'x2_ba')) {
if ($amount >= 10000 && ($term == 'x2_cash' || $term == 'x2_cheque' || $term == 'x2_ba')) {
$svcharge = 0;
} else {
$svcharge = 20.00;
}
$subtotal = round($amount + $svcharge / $rate,2);
$taxAmount = round($subtotal * $taxrate,2);
$billingChargeAmount = round(($amount + $svcharge) * $billingChargeRate, 2);
$subtotal = round(($amount + $svcharge) / $rate,2);
// TODO : refactor
if ($taxrate !=0){
$taxAmount = round($subtotal * $taxrate - $subtotal,2);
}
else{
$taxAmount = 0;
}
if ($billingChargeRate !=0){
$billingChargeAmount = round(($amount + $svcharge) * $billingChargeRate - ($amount + $svcharge), 2);
}
else{
$billingChargeAmount = 0;
}
$billingChargeAmount = round((($amount / $rate) * $billingChargeRate) - ($amount / $rate), 2);
$bankin_amount = round($subtotal + $taxAmount + $billingChargeAmount , 2);
return response()->json([
'date' => date('Y-m-d'),
'order_no' => $order_no,
'payment_for' => $payment_for,
'marking' => $marking,
'payment_method' => $payment_method,
'china_beneficary' => $china_beneficiary,
@@ -617,6 +660,8 @@ class BookingController extends Controller
'taxAmount' => $taxAmount,
'billingChargeAmount' => $billingChargeAmount,
'bankin_amount' => $bankin_amount,
'acc_name' => $request->input('acc_name'),
'acc_no' => $request->input('acc_no')
], 200);
}
@@ -647,11 +692,26 @@ class BookingController extends Controller
// update booking status
$booking->status = 4;
if($booking->term !== "x1_ba" || $booking->term !== "x2_cheque")
if($booking->term !== "x1_ba" || $booking->term !== "x2_cheque"){
$booking->admin_status = 3;
else
// Add notification message to user
$userNotification = new Notification;
$userNotification->detail = "Your bankslip for booking " . $booking->id . " is approved.";
$userNotification->link = "/booking/" . $booking->id . "/transfer";
$userNotification->user_id = $booking->user_id;
$userNotification->save();
}
else{
$booking->admin_status = 5;
// Add notification message to user
$userNotification = new Notification;
$userNotification->detail = "Your bankslip for booking " . $booking->id . " is approved.";
$userNotification->link = "/booking/" . $booking->id . "/supplier";
$userNotification->user_id = $booking->user_id;
$userNotification->save();
}
$booking->save();
return response()->json(['message'=>'Success'],200);
}
@@ -747,6 +807,11 @@ class BookingController extends Controller
$booking->admin_status = 5; // upload china bankslip
if($booking->save()){
$userNotification = new Notification;
$userNotification->detail = "Supplier booking report for booking " . $booking->id . " is completed.";
$userNotification->link = "/booking/" . $booking->id . "/transfer";
$userNotification->user_id = $booking->user_id;
$userNotification->save();
return response()->json(['message'=>"Success"],200);
}
}
@@ -755,16 +820,21 @@ class BookingController extends Controller
$booking = Booking::where('user_id',Auth::user()->id)->where('id',$id)->first();
$purchase_order = $booking->purchaseOrder()->first();
return($purchase_order);
if(!$purchase_order){
return response()->json(["message"=> "Please upload your purchase order"],400);
}
$booking->status = 6; // wait invoice
$booking->admin_status = 6; // upload invoice
$booking->save();
return response()->json(['message'=>'Success'],200);
$adminNotification = new Notification;
$adminNotification->detail = "Purchase Order for booking " . $booking->id . " is uploaded.";
$adminNotification->link = "/booking/" . $booking->id . "/upload-invoice";
$adminNotification->user_id = User::withRole('admin')->first()->id;
$adminNotification->save();
return response()->json($purchase_order,200);
}
public function confirmInvoice(Request $request, $id)
@@ -781,27 +851,32 @@ class BookingController extends Controller
$booking->admin_status = 7; // completed
if($booking->save()){
$adminNotification = new Notification;
$adminNotification->detail = "Invoice for booking " . $booking->id . " is uploaded.";
$adminNotification->link = "/booking/" . $booking->id . "/complete";
$adminNotification->user_id = $booking->user_id;
$adminNotification->save();
return response()->json(['message'=>"Success"],200);
}
}
// public function adminShowCompletedOrders()
// {
// $bookings = Booking::select('id','created_at','user_id','rate','amount', 'bia', 'admin_status')
// ->where('admin_status', 7)
// ->orderBy('id', 'desc')
// ->get();
public function adminShowCompletedOrders()
{
$bookings = Booking::select('id','created_at','user_id','rate','amount', 'bia', 'admin_status')
->where('admin_status', 7)
->orderBy('id', 'desc')
->get();
// foreach ($bookings as $booking) {
// $booking->id;
// $booking->created_at;
// $booking->marking = $booking->user->marking;
// $booking->rate;
// $booking->amount;
// $booking->bia;
// $booking->admin_status = "(". $booking->admin_status ."/7)";;
// }
// return $bookings;
// }
foreach ($bookings as $booking) {
$booking->id;
$booking->created_at;
$booking->marking = $booking->user->marking;
$booking->rate;
$booking->amount;
$booking->bia;
$booking->admin_status = "(". $booking->admin_status ."/7)";;
}
return $bookings;
}
}
@@ -11,6 +11,8 @@ use App\UserBankSlip;
use App\SettingBeneficiary;
use App\SupplierBookingItem;
use App\SettingSupplier;
use App\SettingTaxRate;
use App\SettingActiveBank;
use Illuminate\Http\Request;
class BookingSupplierController extends Controller
@@ -30,15 +32,66 @@ class BookingSupplierController extends Controller
public function show($id)
{
$booking = Booking::where('id', $id)->first();
$bankin_amount = round($booking->amount / $booking->rate, 2);
if (!$booking){
return response()->json(['message' => 'Booking not found'], 404);
}
switch ($booking->term) {
case "x1_cash":
$payment_method = "CASH";
break;
case "x1_cheque":
$payment_method = "CHEQUE";
break;
case "x1_ba":
$payment_method = "BA";
break;
case "x2_cash":
$payment_method = "CASH";
break;
case "x2_cheque":
$payment_method = "CHEQUE";
break;
case "x2_ba":
$payment_method = "BA";
break;
default:
return response()->json([
'success' => false,
'message' => 'Invalid input',
], 422);
break;
}
$supplier_booking = $booking->supplierBooking()->first();
$dt = new \DateTime($supplier_booking->created_at);
$supplier_booking->date = $dt->format('j F Y');
$supplier_booking->marking = $booking->user->marking;
$supplier_booking->payment_for = $booking->payment_for;
$supplier_booking->order_no = $booking->order_no;
$supplier_booking->payment_method = $payment_method;
$active_bank = SettingActiveBank::first();
// if setting is set to use customer's beneficiary
if ($active_bank->beneficiary_id == 0){
$supplier_booking->acc_name = $booking->account_name;
$supplier_booking->acc_no = $booking->account_num; // TODO : standardize acc_no
$supplier_booking->bank_name = $booking->bank_name;
}
else{
$beneficiary = SettingBeneficiary::find($active_bank->beneficiary_id);
$supplier_booking->acc_name = $beneficiary->company_name;
$supplier_booking->acc_no = $beneficiary->acc_no;
$supplier_booking->bank_name = $beneficiary->bank_name;
}
return response()->json($supplier_booking ,200);
}
@@ -47,41 +100,58 @@ class BookingSupplierController extends Controller
// TODO : Multiple booking
public function store(Request $request)
{
$transfer_amount = $request->input("transfer_amount");
//$transfer_amount = $request->input("transfer_amount");
$supplier_id = $request->input("supplier_id");
$booking_id = $request->input("booking_id");
$rate = $request->input('rate');
$rate = $request->input('rate'); // costing rate
$rebate = $request->input('rebate');
// Calculation
$amountInRMB = $transfer_amount * $rate;
$billing = 0.015 * $transfer_amount;
$sales_tax = 0.10 * $transfer_amount;
$gst = 0 * $transfer_amount; // do we still need this ?
$customerBankInAmount = round($transfer_amount + $gst + $sales_tax + $billing,2);
$rmbBankAmount = $customerBankInAmount + $rebate;
$user = Auth::user();
$supplier = SettingSupplier::find($supplier_id);
$booking = Booking::find($booking_id);
// Calculation (backup)
// $amountInRMB = $transfer_amount * $rate;
// $billing = 0.015 * $transfer_amount;
// $sales_tax = 0.0 * $transfer_amount;
// $gst = 0 * $transfer_amount; // do we still need this ?
// $customerBankInAmount = round($transfer_amount + $gst + $sales_tax + $billing,2);
// $rmbBankAmount = round($customerBankInAmount + $rebate, 2);
// Update: changes in 1.1 according to new supplier booking report
$transfer_amount = $booking->amount;
$amount_in_myr = round($transfer_amount / $rate, 2);
$amountInRMB = $transfer_amount;
$tax_rate = SettingTaxRate::latest()->first()->tax_rate;
$sales_tax = round($tax_rate * $amount_in_myr - $amount_in_myr, 2);
$amount_after_tax = round($amount_in_myr * $tax_rate,2);
//$billing = 0.015 * $transfer_amount;
//
//$gst = 0 * $transfer_amount; // do we still need this ?
//$customerBankInAmount = round($transfer_amount + $gst + $sales_tax + $billing,2);
//$rmbBankAmount = round($customerBankInAmount + $rebate, 2);
// update existing booking supplier if exist
$bookingsupplier = SupplierBooking::where('booking_id', $booking_id)->first();
if (!$bookingsupplier){
$bookingsupplier = new SupplierBooking();
}
$bookingsupplier->supplier_id = $supplier->id;
$bookingsupplier->payment_method = $request->input('payment_method');
$bookingsupplier->transfer_amount = $transfer_amount;
$bookingsupplier->amountInRMB = $amountInRMB; // TODO : rename to underscore
$bookingsupplier->amount_in_myr = $amount_in_myr;
$bookingsupplier->tax_rate = $tax_rate;
$bookingsupplier->amount_after_tax = $amount_after_tax;
$bookingsupplier->rate = $rate;
$bookingsupplier->billing_amount = $billing;
$bookingsupplier->salestax_amount = $sales_tax;
$bookingsupplier->rebate = $rebate;
$bookingsupplier->amountInRMB = $amountInRMB;
$bookingsupplier->rmbBankAmount = $rmbBankAmount;
$bookingsupplier->rebate = $rebate;
$bookingsupplier->salestax_amount = $sales_tax;
//$bookingsupplier->payment_method = $request->input('payment_method'); // TODO : remove from db
//$bookingsupplier->transfer_amount = $transfer_amount; // TODO : remove from db
//$bookingsupplier->billing_amount = $billing; // TODO : remove from db
//$bookingsupplier->rmbBankAmount = $rmbBankAmount; // TODO : remove from db
$bookingsupplier->booking_id = $booking->id;
$bookingsupplier->save();
@@ -89,47 +159,12 @@ class BookingSupplierController extends Controller
$booking->status = 4;
$booking->admin_status = 4;
$booking->save();
return response()->json($bookingsupplier, 201);
}
public function update(Request $request, $id)
{
$bookingsupplier = SupplierBooking::find($id);
$bookingsupplier->payment_method = $request->input('payment_method');
$bookingsupplier->transfer_amount = $request->input('transfer_amount');
$bookingsupplier->rate = $request->input('rate');
$bookingsupplier->rebate = $request->input('rebate');
// calculation
$amountInRMB = $amount * $rate;
$billing = 0.015 * $amount;
$sales_tax = 0.10 * $amount;
$gst = 0 * $amount;
$customerBankInAmount = round($amount + $gst + $sales_tax + $billing,2);
$rmbBankAmount = $customerBankInAmount + $rebate;
// save amount in rmb
$bookingsupplier->amountInRMB = $amountInRMB;
// save rmb bank amount
$bookingsupplier->rmbBankAmount = $rmbBankAmount;
$bookingsupplier->save();
/* For multiple booking */
// $supplierbookingitems = $request->input("supplierbookingitem");
// foreach ($bookings as $booking)
// {
// $update_supplierbookingitem = SupplierBookingItem::where('supplierbooking_id', $id)->first();
// $update_supplierbookingitem->china_bankslip_url = $booking['china_bankslip_url'];
// $update_supplierbookingitem->bank_in_amount = $booking['bank_in_amount'];
// $update_supplierbookingitem->date = $booking['date'];
// $update_supplierbookingitem->details = $booking['details'];
// $update_supplierbookingitem->save();
// }
return response()->json(['book_id'=>$book_id],201);
}
public function report(Request $request, $id)
{
$supplier_booking = Booking::firstOrFail($id)->supplierBooking()->firstOrFail();
@@ -4,6 +4,8 @@ namespace App\Http\Controllers;
use App\ChinaBankSlip;
use App\Booking;
use App\User;
use App\Notification;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Validator;
@@ -80,6 +82,13 @@ class ChinaBankSlipController extends Controller
$booking->admin_status = 6;
$booking->save();
$userNotification = new Notification;
$userNotification->detail = "Your china bankslip for booking " . $booking->id . " is uploaded.";
$userNotification->link = "/booking/" . $booking->id . "/upload-po";
$userNotification->user_id = $booking->user_id;
$userNotification->save();
return response()->json(["message"=> "Success"],200);
}
@@ -0,0 +1,66 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Notification;
use Illuminate\Support\Facades\DB;
use Auth;
class NotificationController extends Controller
{
public function index()
{
return Notification::all()->orderby('updated_at','desc');
}
public function show(Notification $notification)
{
return $notification;
}
public function store(Request $request)
{
$notification = Notification::create($request->all());
return response()->json($notification, 201);
}
public function update(Request $request, Notification $notification)
{
$notification->update($request->all());
return response()->json($notification, 200);
}
public function delete(Notification $notification)
{
$notification->delete();
return response()->json(null, 204);
}
public function getUserMessage()
{
$user_all_notification = Notification::Where("user_id",Auth::user()->id)
->orderby('updated_at','desc')
->paginate(5);
$user_unread_notification = Notification::Where([["user_id",Auth::user()->id],["is_read",0]])
->orderby('updated_at','desc')
->get();
return response()->json([
"message" =>$user_all_notification,
"unread_message" =>$user_unread_notification
],200);
}
public function readNotification($notification_id){
$affected = DB::table('notifications')
->Where('id', $notification_id)
->update(array('is_read' => 1));
return response()->json("Read message", 200);
}
}
@@ -12,8 +12,12 @@ class SettingBeneficiaryController extends Controller
return SettingBeneficiary::all();
}
public function show(SettingBeneficiary $beneficiary)
public function show($beneficiary)
{
if ($beneficiary == 0){
response()->json(["company_name"=>"123", "account_number"=>"123"] , 201);
}
$beneficiary = SettingBeneficiary::find($beneficiary);
return $beneficiary;
}
+77
View File
@@ -0,0 +1,77 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Notification extends Model
{
protected $fillable = ['detail','user_id','is_read'];
protected $appends = ['time_interval'];
public function getTimeIntervalAttribute()
{
$created_time = $this->created_at;
date_default_timezone_set('Asia/Kuala_Lumpur'); //Change as per your default time
$str = strtotime($created_time);
$today = strtotime(date('Y-m-d H:i:s'));
// It returns the time difference in Seconds...
$time_differnce = $today-$str;
// To Calculate the time difference in Years...
$years = 60*60*24*365;
// To Calculate the time difference in Months...
$months = 60*60*24*30;
// To Calculate the time difference in Days...
$days = 60*60*24;
// To Calculate the time difference in Hours...
$hours = 60*60;
// To Calculate the time difference in Minutes...
$minutes = 60;
if(intval($time_differnce/$years) > 1)
{
return intval($time_differnce/$years)." years ago";
}else if(intval($time_differnce/$years) > 0)
{
return intval($time_differnce/$years)." year ago";
}else if(intval($time_differnce/$months) > 1)
{
return intval($time_differnce/$months)." months ago";
}else if(intval(($time_differnce/$months)) > 0)
{
return intval(($time_differnce/$months))." month ago";
}else if(intval(($time_differnce/$days)) > 1)
{
return intval(($time_differnce/$days))." days ago";
}else if (intval(($time_differnce/$days)) > 0)
{
return intval(($time_differnce/$days))." day ago";
}else if (intval(($time_differnce/$hours)) > 1)
{
return intval(($time_differnce/$hours))." hours ago";
}else if (intval(($time_differnce/$hours)) > 0)
{
return intval(($time_differnce/$hours))." hour ago";
}else if (intval(($time_differnce/$minutes)) > 1)
{
return intval(($time_differnce/$minutes))." minutes ago";
}else if (intval(($time_differnce/$minutes)) > 0)
{
return intval(($time_differnce/$minutes))." minute ago";
}else if (intval(($time_differnce)) > 1)
{
return intval(($time_differnce))." seconds ago";
}else
{
return "few seconds ago";
}
}
}
+10 -4
View File
@@ -1,6 +1,5 @@
# Docs: https://caddyserver.com/docs/caddyfile
https://exchange-staging.izyim.com {
root /var/www/public
root /app/public
fastcgi / 127.0.0.1:9000 php {
index index.php
}
@@ -9,10 +8,17 @@ https://exchange-staging.izyim.com {
# ext / .html
rewrite {
to {path} {path}/ /index.php?{query}
r .*
ext /
to /index.php?{query}
}
header / {
Cache-Control no-cache
}
gzip
browse
# browse
log stdout
errors stdout
on startup php-fpm --nodaemonize
+2 -1
View File
@@ -10,8 +10,9 @@ RUN curl --silent --show-error --fail --location \
&& /usr/bin/caddy -version \
&& docker-php-ext-install mbstring pdo pdo_mysql
ADD . /var/www
COPY Caddyfile /etc/Caddyfile
WORKDIR /var/www/public
WORKDIR /var/www
CMD ["/usr/bin/caddy", "--conf", "/etc/Caddyfile", "--log", "stdout"]
+1 -1
View File
@@ -100,7 +100,7 @@ return [
|
*/
'ttl' => env('JWT_TTL', 60),
'ttl' => env('JWT_TTL', 60 * 12),
/*
|--------------------------------------------------------------------------
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeChinaBeneficiaryAccNulabbleInBeneficiarysettingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_active_banks', function (Blueprint $table) {
$table->dropForeign('setting_active_banks_beneficiary_id_foreign');
$table->integer('beneficiary_id')->nullable()->unsigned()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('beneficiarysetting', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddOrdernoNPaymentforFieldToBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->string('order_no')->nullable();
$table->string('payment_for');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('bookings', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,39 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNotificationTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->increments('id');
$table->string('detail');
$table->string('link');
$table->unsignedInteger('user_id');
$table->boolean('is_read')->default(0);
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddFieldsIntoSupplierBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function (Blueprint $table) {
$table->string('amount_in_myr')->nullable();
$table->string('tax_rate')->nullable();
$table->string('amount_after_tax')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
+4 -2
View File
@@ -18,8 +18,8 @@ class BookTableSeeder extends Seeder
$rate = Rate::all()->last();
DB::table('bookings')->insert([
'account_name' => 'milah',
'account_num' => '99898',
'account_name' => 'EXCHANGE SDN BHD',
'account_num' => '99898239298123',
'bank_name' => 'maybank',
'bank_branch' => 'rembau',
'company_name' => 'ICEF',
@@ -36,6 +36,8 @@ class BookTableSeeder extends Seeder
'user_id' => $user->id,
'status' => 2,
'admin_status' => 2,
'order_no' => '001',
'payment_for' => 'FULL PAYMENT',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
]);
+1
View File
@@ -28,6 +28,7 @@ class DatabaseSeeder extends Seeder
$this->call(SettingActiveBankSeeder::class);
$this->call(SettingTaxRateSeeder::class);
$this->call(SettingBillingChargeSeeder::class);
$this->call(NotificationSeeder::class);
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Seeder;
use App\User;
use Carbon\Carbon;
class NotificationSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$user = User::where("email", "user@example.com")->first();
$admin = User::where("email", "admin@example.com")->first();
DB::table('notifications')->insert([
'detail' => 'This is an user seeder notification',
'user_id' => $user->id,
'link' => 'http://www.google.com',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
]);
DB::table('notifications')->insert([
'detail' => 'This is an admin seeder notification',
'user_id' => $admin->id,
'link' => 'http://www.google.com',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
]);
}
}
+2 -2
View File
@@ -13,8 +13,8 @@ class SettingActiveBankSeeder extends Seeder
*/
public function run()
{
$bankx1 = SettingMalaysiaBank::where('acc_no', "=" ,'malaysiaacc01')->first();
$bankx2 = SettingMalaysiaBank::where('acc_no', "=",'malaysiaacc02')->first();
$bankx1 = SettingMalaysiaBank::find(1);
$bankx2 = SettingMalaysiaBank::find(2);
$chinabank = SettingBeneficiary::where('acc_no', "=" ,'123456789')->first();
DB::table('setting_active_banks')->truncate();
+4 -4
View File
@@ -15,8 +15,8 @@ class SettingMalaysiaBankSeeder extends Seeder
DB::table('setting_malaysia_banks')->truncate();
DB::table('setting_malaysia_banks')->insert([
'company_name' => 'CIEF',
'bank_name' => 'Maybank',
'acc_no' => 'malaysiaacc01',
'bank_name' => 'MAYBANK',
'acc_no' => '75930284783',
'bank_address' => 'Jalan putrajaya',
'swift' => 'ABC123',
'cnap' => 'CED234',
@@ -24,8 +24,8 @@ class SettingMalaysiaBankSeeder extends Seeder
]);
DB::table('setting_malaysia_banks')->insert([
'company_name' => 'CIEF',
'bank_name' => 'Maybank',
'acc_no' => 'malaysiaacc02',
'bank_name' => 'MAYBANK',
'acc_no' => '85839298348',
'bank_address' => 'Jalan putrajaya',
'swift' => 'ABC123',
'cnap' => 'CED234',
+1 -2
View File
@@ -16,7 +16,7 @@
"@fortawesome/fontawesome-free-brands": "^5.0.8",
"@fortawesome/fontawesome-free-regular": "^5.0.8",
"@fortawesome/fontawesome-free-solid": "^5.0.8",
"@fortawesome/vue-fontawesome": "^0.0.22",
"@fortawesome/vue-fontawesome": "0.0.22",
"@xkeshi/vue-countdown": "^0.6.0",
"axios": "^0.18.0",
"bootstrap": "^4.0.0",
@@ -27,7 +27,6 @@
"npm": "^6.0.1",
"popper.js": "^1.14.1",
"sweetalert2": "^7.15.1",
"vee-validate": "^2.1.0-beta.5",
"vform": "^1.0.0",
"vue": "^2.5.16",
"vue-axios": "^2.1.1",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

-2
View File
@@ -10,7 +10,6 @@ import locale from 'element-ui/lib/locale/lang/en'
import '~/plugins'
import '~/components'
import VeeValidate from 'vee-validate';
const config = {
errorBagName: 'errors', // change if property conflicts.
fieldsBagName: 'fields',
@@ -29,7 +28,6 @@ const config = {
events: 'blur',
inject: true
};
Vue.use(VeeValidate, config);
Vue.config.productionTip = false
@@ -132,7 +132,7 @@ export default {
this.rate = response.data
})
},
createRate: function () {
createRate: function () { // TODO : we do not have create rate, only update rate. Delete this ?
this.loading = true,
this.dialogFormVisible1 = true
let newRate = {
+100 -13
View File
@@ -68,11 +68,37 @@
height: 2rem;
margin: -.375rem 0;
}
.el-dropdown-menu{
height: 50%;
}
#notification{
overflow-y: scroll;
overflow-x: hidden;
max-height: 100%;
}
#notification-load-more{
position: absolute;
width: 100%;
min-height: 20px;
background: white;
border: 1px solid #dcdfe6;
}
.el-dropdown-menu__item {
line-height: 26px;
}
.opacity80{
opacity: 0.8 ;
}
::-webkit-scrollbar {
width: 0px;
background: transparent; /* make scrollbar transparent */
}
</style>
<script>
import { mapGetters } from 'vuex'
import LocaleDropdown from './LocaleDropdown'
import axios from 'axios'
export default {
components: {
@@ -81,29 +107,90 @@ export default {
data: () => ({
appName: window.config.appName,
notification:[{
message : "You have an unread message",
link : "http://www.google.com"
},
{
message : "There are 10 booking for your approval",
link : "http://www.yahoo.com"
}]
notification:[],
loadingNotification:false,
bellBadge : 0,
unread_message_length:0,
url: '/api/notification/user',
pagination: [],
}),
computed: mapGetters({
user: 'auth/user',
role: 'auth/role'
}),
mounted(){
this.getNotification(this.url);
},
methods: {
async logout () {
async logout(){
// Log out the user.
await this.$store.dispatch('auth/logout')
await this.$store.dispatch('auth/logout');
// Redirect to login.
this.$router.push({ name: 'login' })
this.$router.push({ name: 'login' });
},
getNotification(url){
this.notification = [];
this.loadingNotification=true;
axios
.get(url)
.then((response) => {
this.loadingNotification=false;
this.notification = response.data.message.data;
this.bellBadge = response.data.unread_message.length;
this.makePagination(response.data.message);
console.log(response.data);
}).catch((error) => {
console.log(error)
this.$router.push({
name: 'notfound'
})
})
},
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.loadingNotification=true;
if(this.url !== null){
axios
.get(url)
.then((response) => {
this.loadingNotification=false;
this.notification = this.notification.concat(response.data.message.data);
this.bellBadge = response.data.unread_message.length;
this.makePagination(response.data.message);
console.log(this.notification);
}).catch((error) => {
console.log(error)
this.$router.push({
name: 'notfound'
})
})
}
},
readNotification(notification_id){
axios
.post('/api/notification/read-notification/'+notification_id)
.then((response) => {
this.getNotification(this.url);
}).catch((error) => {
console.log(error)
this.$router.push({
name: 'notfound'
})
})
},
navigateTo(nav) {
window.location.href = nav;
}
}
}
@@ -83,9 +83,9 @@
<el-form-item prop="rebate">
<el-input v-model="supplierBookingForm.rebate" type="text" placeholder="Rebate" style="width: 80%" />
</el-form-item>
<el-form-item prop="transfer_amount">
<!-- <el-form-item prop="transfer_amount">
<el-input v-model="supplierBookingForm.transfer_amount" type="text" placeholder="Payment Amount" style="width: 80%" />
</el-form-item>
</el-form-item> -->
<el-form-item>
<el-button :loading="loading_btn" type="primary" @click="generateReport('supplierBookingForm')">Generate Report</el-button>
</el-form-item>
@@ -142,7 +142,6 @@
supplier_options: null,
supplierBookingForm: {
supplier: null,
amount: null,
rebate: null,
rate: null,
transfer_amount: null,
@@ -215,10 +214,9 @@
let newReport = {
booking_id: this.$route.params.id,
supplier_id: this.supplierBookingForm.supplier,
amount: this.supplierBookingForm.amount,
rebate: this.supplierBookingForm.rebate,
rate: this.supplierBookingForm.rate,
transfer_amount: this.supplierBookingForm.transfer_amount,
//transfer_amount: this.supplierBookingForm.transfer_amount,
}
axios.post('/api/supplier-booking', newReport)
@@ -80,7 +80,6 @@
<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>
@@ -202,43 +201,14 @@
axios.get('/api/supplier-booking/' + this.$route.params.id)
.then((response) => {
this.supplier_booking = response.data
loading.close()
}).catch((error) => {
console.log(error)
this.$router.push({
name: 'notfound'
})
loading.close()
})
axios.get('/api/active-bank')
.then((response) => {
axios.get('/api/setting-beneficiary/' + response.data.beneficiary_id)
.then((response) => {
loading.close();
this.supplier_booking.china_bank_name = response.data.bank_name;
this.supplier_booking.china_company_name = response.data.company_name;
this.supplier_booking.china_acc_no = response.data.acc_no;
})
.catch((error) => {
loading.close();
console.log(error);
this.$message({
showClose: true,
message: 'Fetch data fail',
type: 'error',
duration: 10000
});
});
})
.catch((error) => {
loading.close();
console.log(error);
this.$message({
showClose: true,
message: 'Fetch data fail',
type: 'error',
duration: 10000
});
});
},
methods: {
downloadReport(){
@@ -340,8 +310,8 @@
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);
ctx.fillText("Ref No. :", column1X, rowHeight[1] - 5);
ctx.fillText(binding.value.booking_id, column3X, rowHeight[1] - 5);
//// Row 2
ctx.fillText("Date :", column1X, rowHeight[2] - 5);
ctx.fillText(binding.value.date, column3X, rowHeight[2] - 5);
@@ -349,15 +319,15 @@
ctx.fillText("Marking :", column1X, rowHeight[3] - 5);
ctx.font = "bold 14px Arial";
ctx.fillStyle = "#0070D5";
ctx.fillText("CIEF/605HOS", column3X, rowHeight[3] - 5);
ctx.fillText(binding.value.marking, 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);
ctx.fillText(binding.value.order_no, column3X, rowHeight[4] - 5);
//// Row 4
ctx.fillText("Payment For :", column1X, rowHeight[5] - 5);
ctx.fillText("Full Payment", column3X, rowHeight[5] - 5);
ctx.fillText(binding.value.payment_for, column3X, rowHeight[5] - 5);
//// Row 5
ctx.fillText("Payment Method :", column1X, rowHeight[6] - 5);
ctx.fillText(binding.value.payment_method, column3X, rowHeight[6] - 5);
@@ -369,13 +339,17 @@
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.fillText(binding.value.amount_in_myr, 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
ctx.fillText("REBATE :", column1X, rowHeight[11] - 5);
ctx.fillText("MYR", column2X, rowHeight[11] - 5);
ctx.font = "14px Arial";
ctx.fillText(binding.value.rebate, column3X, rowHeight[11] - 5);
ctx.font = "13px Arial";
//// Row 10
ctx.font = "bold 14px Arial";
ctx.fillText("CNY", column2X, rowHeight[12] - 5);
@@ -395,25 +369,26 @@
//// 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);
ctx.fillText(binding.value.amount_in_myr, 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);
// 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("+ TAX "+ (Math.round((binding.value.tax_rate * 100 - 100) * 100) / 100) + "% :", column1X, rowHeight[16] - 5); // TODO : Change to percentage
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 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.fillText("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.fillText(binding.value.amount_after_tax, column3X, rowHeight[18] - 5);
ctx.fillStyle = "#000000";
ctx.font = "13px Arial";
//line
@@ -431,40 +406,40 @@
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);
// 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.fillText(binding.value.amountInRMB, 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
// 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);
};
// 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("户名 : " + binding.value.china_company_name, column2X - 40, rowHeight[22] - 60);
ctx.fillText(binding.value.china_acc_no, column2X - 40, rowHeight[22] - 40);
ctx.fillText(binding.value.china_bank_name , column2X - 40, rowHeight[22] - 20);
ctx.fillText("户名 : " + binding.value.acc_name, column2X - 40, rowHeight[22] - 60);
ctx.fillText(binding.value.acc_no, column2X - 40, rowHeight[22] - 40);
ctx.fillText(binding.value.bank_name , column2X - 40, rowHeight[22] - 20);
ctx.font = "13px Arial";
}, 1000,canvasElement,binding);
+2 -4
View File
@@ -66,9 +66,8 @@ export default {
getBooking(){
let $this = this
axios.get(this.url).then(response => {
this.bookingTable = response.data.data
$this.makePagination(response.data)
console.log(response)
this.bookingTable = response.data.data;
$this.makePagination(this.bookingTable);
})
},
RefreshBooking() {
@@ -93,7 +92,6 @@ export default {
prev_page_url: data.prev_page_url
}
this.pagination = pagination
console.log(this.pagination)
},
fetchPaginateBooking(url) {
this.url = url
@@ -83,8 +83,6 @@ import Form from 'vform'
import LoginWithGithub from '~/components/LoginWithGithub'
import store from '~/store'
import Vue from 'vue'
import VeeValidate from 'vee-validate';
Vue.use(VeeValidate);
export default {
middleware: 'guest',
+163 -162
View File
@@ -1,64 +1,56 @@
<template>
<el-main>
<progress-track v-model="status"/>
<h1>Transfer Completed</h1>
<h2> Please upload your purchase order </h2>
<!-- upload card -->
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">Upload PO</div>
<!-- upload image -->
<div class="card-body">
<el-upload :action="'/api/booking/' + booking_id + '/upload-po'" :on-exceed="handleExceed" :on-preview="handlePreview"
:on-remove="handleRemove"
:on-error="uploadError"
class="upload-demo uploadAreaOne"
accept=".jpeg, .jpg, .png, .bmp, .doc, .docx, .xls, .xlsx, .pdf"
drag
multiple>
<i class="el-icon-upload"/>
<div class="el-upload__text">Drop file here or
<em>click to upload</em>
</div>
<div slot="tip" class="el-upload__tip">bmp/jpeg/jpg/png/pdf/xls/xlxs/doc/docx files with a size less than 3MB</div>
</el-upload>
<el-upload
class="upload-demo uploadAreaTwo"
:action="'/api/booking/' + booking_id + '/upload-po'"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
multiple
:file-list="fileList">
<el-button size="small" type="primary">Click to upload</el-button>
<div slot="tip" class="el-upload__tip">jpg/png files with a size less than 500kb</div>
</el-upload>
<div class="bottom clearfix" style="text-align:right;">
<el-button :loading="loading_btn" type="primary" @click="uploadPo">Submit</el-button>
<el-main>
<progress-track v-model="status" />
<h1>Transfer Completed</h1>
<h2> Please upload your purchase order </h2>
<!-- upload card -->
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">Upload PO
<a href="/po-format.xls" target="_blank">(Download Po Format)</a>
</div>
<!-- upload image -->
<div class="card-body">
<el-upload :action="'/api/booking/' + booking_id + '/upload-po'" :on-exceed="handleExceed" :on-preview="handlePreview" :on-remove="handleRemove"
:on-error="uploadError" class="upload-demo uploadAreaOne" accept=".jpeg, .jpg, .png, .bmp, .doc, .docx, .xls, .xlsx, .pdf"
drag multiple>
<i class="el-icon-upload" />
<div class="el-upload__text">Drop file here or
<em>click to upload</em>
</div>
<div slot="tip" class="el-upload__tip">bmp/jpeg/jpg/png/pdf/xls/xlxs/doc/docx files with a size less than 3MB</div>
</el-upload>
<el-upload class="upload-demo uploadAreaTwo" :action="'/api/booking/' + booking_id + '/upload-po'" :on-preview="handlePreview"
:on-remove="handleRemove" :before-remove="beforeRemove" multiple :file-list="fileList">
<el-button size="small" type="primary">Click to upload</el-button>
<div slot="tip" class="el-upload__tip">jpg/png files with a size less than 500kb</div>
</el-upload>
<div class="bottom clearfix" style="text-align:right;">
<el-button :loading="loading_btn" type="primary" @click="uploadPo">Submit</el-button>
</div>
<!-- upload image end -->
</div>
</div>
</div>
<div class="col">
<div class="card">
<div class="card-header">China Bank Slip</div>
<div class="card-body">
<a target="_blank" :href="getURL(booking_details.china_bankslip_path)">
<img v-if="isImage(booking_details.china_bankslip_path)" v-bind:src="booking_details.china_bankslip_path" class="image">
<p v-else>Download</p>
</a>
</div>
<!-- upload image end -->
</div>
</div>
</div>
<div class="col">
<div class="card">
<div class="card-header">China Bank Slip</div>
<div class="card-body">
<a target="_blank" :href="getURL(booking_details.china_bankslip_path)">
<img v-if="isImage(booking_details.china_bankslip_path)" v-bind:src="booking_details.china_bankslip_path" class="image">
<p v-else>Download</p>
</a>
</div>
</div>
</div>
</div>
<!-- order details -->
<div class="card">
<div class="card-header">Order Details</div>
<div class="card-body">
<!-- order details -->
<div class="card">
<div class="card-header">Order Details</div>
<div class="card-body">
<div class="row">
<div class="col">
<table class="table table-striped">
@@ -69,11 +61,11 @@
</tr>
<tr>
<td>Date :</td>
<td>{{ booking_details.created_at }}</td>
<td>{{ booking_details.created_at }}</td>
</tr>
<tr>
<td>Customer Marking :</td>
<td>{{ booking_details.marking }}</td>
<td>{{ booking_details.marking }}</td>
</tr>
<tr>
<td>Term: </td>
@@ -95,15 +87,17 @@
</tr>
<tr>
<td>+ Service Charge :</td>
<td>CNY {{ booking_details.service_charge }}</td>
<td>CNY {{ booking_details.service_charge }}</td>
</tr>
<tr>
<td>RATE :</td>
<td>{{ booking_details.rate }}</td>
<td>{{ booking_details.rate }}</td>
</tr>
<tr>
<td></td>
<td><b>MYR {{ booking_details.bia }}</b></td>
<td>
<b>MYR {{ booking_details.bia }}</b>
</td>
</tr>
<tr>
<td>Beneficiary Account Number : </td>
@@ -120,9 +114,9 @@
<div class="row">
<div class="card-body">
<a target="_blank" :href="getURL(booking_details.user_bankslip_path)">
<img v-if="isImage(booking_details.user_bankslip_path)" v-bind:src="booking_details.user_bankslip_path" class="image">
<p v-else>Download</p>
</a>
<img v-if="isImage(booking_details.user_bankslip_path)" v-bind:src="booking_details.user_bankslip_path" class="image">
<p v-else>Download</p>
</a>
</div>
</div>
</div>
@@ -132,15 +126,17 @@
* {
box-sizing: border-box;
}
h1 {
margin-top:5%;
font-size:3vw;
text-align:center;
margin-top: 5%;
font-size: 3vw;
text-align: center;
}
h2 {
font-size:2vw;
text-align:center;
margin-bottom:3%;
font-size: 2vw;
text-align: center;
margin-bottom: 3%;
}
.image {
border: 1px solid #ddd;
@@ -153,23 +149,26 @@
.image:hover {
box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
}
.uploadAreaTwo {
display: none;
}
.card {
margin-bottom: 3%;
}
@media only screen and (max-width : 767px) {
@media only screen and (max-width: 767px) {
.uploadAreaOne {
display: none;
}
.uploadAreaTwo {
display: unset;
}
.table {
font-size: 3.5vmin;
}
h1 {
.table {
font-size: 3.5vmin;
}
h1 {
font-size: 1em;
}
h2 {
@@ -178,104 +177,106 @@
}
</style>
<script>
import VueCountdown from '@dmaksimovic/vue-countdown'
import ProgressTrack from '~/components/ProgressTrack'
import axios from 'axios'
import VueCountdown from '@dmaksimovic/vue-countdown'
import ProgressTrack from '~/components/ProgressTrack'
import axios from 'axios'
export default {
components: {
'progress-track': ProgressTrack
},
data () {
return {
booking_id: this.$route.params.id,
status: 5,
loading_btn: false,
booking_details:{
id: null,
amount: null,
bia: null,
user_bankslip_path: null,
china_bankslip_path: null,
export default {
components: {
'progress-track': ProgressTrack
},
data() {
return {
booking_id: this.$route.params.id,
status: 5,
loading_btn: false,
booking_details: {
id: null,
amount: null,
bia: null,
user_bankslip_path: null,
china_bankslip_path: null,
}
}
}
},
beforeCreate () {
const loading = this.$loading({
lock: true,
text: 'Please wait..',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
axios
.get('/api/booking/' + this.$route.params.id)
.then((response) => {
this.booking_details = response.data
loading.close()
}).catch((error) => {
console.log(error)
loading.close()
this.$router.push({
name: 'notfound'
})
},
beforeCreate() {
const loading = this.$loading({
lock: true,
text: 'Please wait..',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
},
methods: {
uploadPo () {
this.loading_btn = true
axios
.post('/api/booking/' + this.$route.params.id + '/confirm-po')
.get('/api/booking/' + this.$route.params.id)
.then((response) => {
this.$message({
showClose: true,
message: 'Your PO has been uploaded. We are processing the Invoice.',
type: 'success',
duration: 5000
})
this.$router.push({
name: 'home'
})
this.loading_btn = false
this.booking_details = response.data
loading.close()
}).catch((error) => {
console.log(error)
loading.close()
this.$router.push({
name: 'notfound'
})
})
},
methods: {
uploadPo() {
this.loading_btn = true
axios
.post('/api/booking/' + this.$route.params.id + '/confirm-po')
.then((response) => {
this.$message({
showClose: true,
message: 'Your PO has been uploaded. We are processing the Invoice.',
type: 'success',
duration: 5000
})
this.$router.push({
name: 'home'
})
this.loading_btn = false
}).catch((error) => {
this.$message({
showClose: true,
message: "Please upload your purchase order",
type: 'error',
duration: 30000
})
this.loading_btn = false
})
},
handleRemove (file, fileList) {
console.log(file, fileList)
// Should send some reqeust to controller to delete the file
},
handlePreview (file) {
console.log(file)
},
handleExceed (files, fileList) {
this.$message.warning(`The limit is 3, you selected ${files.length} files this time, add up to ${files.length + fileList.length} totally`)
},
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`)
},
uploadError(file,fileList){
this.$message.warning(`Incorrect file format or file size too big.`)
},
getExtension(path){
return path.slice(-3);
},
isImage(path){
var ext = this.getExtension(path);
return ext === 'jpg' || ext === 'jpeg' || ext === 'bmp' || ext === 'png';
},
getURL(path){
var getUrl = window.location;
var baseUrl = getUrl.protocol + "//" + getUrl.host;
return baseUrl + path;
this.loading_btn = false
})
},
handleRemove(file, fileList) {
console.log(file, fileList)
// Should send some reqeust to controller to delete the file
},
handlePreview(file) {
console.log(file)
},
handleExceed(files, fileList) {
this.$message.warning(
`The limit is 3, you selected ${files.length} files this time, add up to ${files.length + fileList.length} totally`
)
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`)
},
uploadError(file, fileList) {
this.$message.warning(`Incorrect file format or file size too big.`)
},
getExtension(path) {
return path.slice(-3);
},
isImage(path) {
var ext = this.getExtension(path);
return ext === 'jpg' || ext === 'jpeg' || ext === 'bmp' || ext === 'png';
},
getURL(path) {
var getUrl = window.location;
var baseUrl = getUrl.protocol + "//" + getUrl.host;
return baseUrl + path;
}
}
}
}
</script>
</script>
@@ -222,7 +222,7 @@ export default {
console.log(error);
this.$message({
showClose: true,
message: 'Fetch data fail',
message: 'Fetch bank details fail',
type: 'error',
duration: 10000
});
@@ -265,8 +265,10 @@ export default {
let newUserSlip = {
transfer_amount: this.user_slip_form.transfer_amount
}
axios.patch('/api/booking/' + this.booking_id + '/bankslip-amount', newUserSlip)
axios.patch('/api/booking/' + this.booking_id + '/bankslip-amount/', newUserSlip)
.then((response) => {
console.log(response);
this.$message({
showClose: true,
message: 'Your bankinslip has been submitted, please wait admin to approve.',
@@ -277,6 +279,7 @@ export default {
this.$router.push({
name: 'home'
})
})
.catch((error) => {
this.loading = false
+50 -11
View File
@@ -22,7 +22,7 @@
<!-- Input-Amount-end -->
<div align="right">
<el-button icon="el-icon-refresh" type="primary" size="mini" @click="refreshRate()">Refresh Rate</el-button></div>
<el-button type="primary" :loading="loading_btn" size="mini" @click="refreshRate()">Refresh Rate</el-button></div>
<hr>
<!-- Rate-Display -->
@@ -142,7 +142,15 @@
<!-- Form_popup -->
<el-dialog :visible.sync="dialogFormVisible" :fullscreen="true" title="Booking" center>
<el-form ref="bookingForm" :model="bookingForm" :rules="rules">
<div align="center">
<div align="center">
<el-form-item prop="payment_for"> <!-- TODO : this should be payment for order number -->
<el-select v-model="bookingForm.payment_for" placeholder="Payment For" style="width: 80%" required="true">
<el-option v-for="item in options3" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item prop="order_no">
<el-input v-model="bookingForm.order_no" placeholder="Order No." style="width: 80%" required="true" />
</el-form-item>
<el-form-item prop="account_name">
<el-input v-model="bookingForm.account_name" placeholder="China Beneficiary Account" style="width: 80%" required="true" />
</el-form-item>
@@ -299,6 +307,7 @@
</el-button>
</div>
<!-- Booking Table-end -->
</el-main>
</template>
<style>
@@ -317,6 +326,7 @@ export default {
data () {
return {
loading_btn: false,
confirmForm: new Form({
term: '',
amount: ''
@@ -336,13 +346,23 @@ export default {
amount: '',
rate: ''
},
bookingForm: [{
bookingForm: {
account_name: '',
bank_name: '',
bank_branch: '',
account_num: ''
}],
},
rules: {
order_no: [{
required: true,
message: 'Please input order number',
trigger: 'change'
}],
payment_for: [{
required: true,
message: 'Please input payment for',
trigger: 'change'
}],
amount: [{
required: true,
message: 'Please input amount',
@@ -378,6 +398,22 @@ export default {
value2: 'MYR',
label2: 'MYR'
}],
options3: [{
value: 'Full Payment',
label: 'Full Payment'
},
{
value: 'Deposit',
label: 'Deposit'
},
{
value: 'Balance',
label: 'Balance'
},
{
value: 'Others',
label: 'Others'
}],
value: 'RMB',
dialogFormVisible: false,
dialogFormVisible1: false,
@@ -410,7 +446,6 @@ export default {
axios.get(this.url).then(response => {
this.bookingTable = response.data.data
$this.makePagination(response.data)
console.log(response)
})
},
getRate() {
@@ -421,7 +456,9 @@ export default {
},
refreshRate() {
let $this = this
this.loading_btn = true
axios.get('api/rate').then(response => {
this.loading_btn = false
this.rate = response.data
this.$message({
showClose: true,
@@ -459,7 +496,6 @@ export default {
prev_page_url: data.prev_page_url
}
this.pagination = pagination
console.log(this.pagination)
},
fetchPaginateBooking(url) {
this.url = url
@@ -494,16 +530,16 @@ export default {
if (valid) {
let newConfirmation = {
amount: this.booking.amount,
term: this.term
term: this.term,
order_no: this.bookingForm.order_no,
payment_for: this.bookingForm.payment_for,
acc_name: this.bookingForm.account_name,
acc_no: this.bookingForm.account_num
}
axios.post('api/booking/calculation', newConfirmation)
.then((response) => {
this.loading = false
console.log(response)
this.bookingConfirmTable = response.data;
this.bookingConfirmTable.payment_for = 'Full Payment';//For future purpose
this.bookingConfirmTable.remark = '';//For future purpose
this.bookingConfirmTable.payment_order = '';//For future purpose
this.dialogFormVisible = false
this.dialogFormVisible1 = true
})
@@ -532,6 +568,8 @@ export default {
this.loading = true,
this.dialogFormVisible1 = true
let newBooking = {
order_no: this.bookingForm.order_no,
payment_for: this.bookingForm.payment_for,
account_name: this.bookingForm.account_name,
account_num: this.bookingForm.account_num,
bank_name: this.bookingForm.bank_name,
@@ -541,6 +579,7 @@ export default {
}
axios.post('api/booking', newBooking)
.then((response) => {
console.log(response);
this.loading = false
// push with return id
this.$router.push({
@@ -114,6 +114,10 @@ export default {
label : item.acc_no,
};
});
this.options_china_bank.unshift({
value : 0,
label : "Use Customer's Beneficiary"
});
})
.catch((error) => {
console.log(error);
@@ -101,7 +101,7 @@
</el-form>
<div align="center">
<el-button @click="EditDatadialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="EditBeneficiaries" :disabled="errors.any() || beneficiariesForm.company_name=='' || beneficiariesForm.bank_name=='' || beneficiariesForm.acc_no=='' || beneficiariesForm.bank_address=='' || beneficiariesForm.swift =='' || beneficiariesForm.cnap=='' || beneficiariesForm.bank_branch=='' ? true : false">Submit</el-button>
<el-button type="primary" :loading="loading_btn" @click="EditBeneficiaries" :disabled="errors.any() || beneficiariesForm.company_name=='' || beneficiariesForm.bank_name=='' || beneficiariesForm.acc_no=='' || beneficiariesForm.bank_address=='' || beneficiariesForm.swift =='' || beneficiariesForm.cnap=='' || beneficiariesForm.bank_branch=='' ? true : false">Submit</el-button>
</div>
<span slot="footer" class="dialog-footer">
* Please key in the data in Chinese
@@ -110,7 +110,7 @@
<el-dialog align="center" :visible.sync="DoneUpdateDatadialogVisible">
<span>Data Updated Successfully</span><br><br>
<div align="center">
<el-button type="primary" @click="DoneUpdateDatadialogVisible = false">OK</el-button>
<el-button type="primary" :loading="loading_btn" @click="DoneUpdateDatadialogVisible = false">OK</el-button>
</div>
</el-dialog>
<!-- popup edit data end -->
@@ -118,7 +118,7 @@
<el-dialog align="center" :visible.sync="DeleteAdddialogVisible" width="30%">
<span>Data Deleted</span><br><br>
<div align="center">
<el-button type="primary" @click="DeleteAdddialogVisible = false">OK</el-button>
<el-button type="primary" :loading="loading_btn" @click="DeleteAdddialogVisible = false">OK</el-button>
</div>
</el-dialog>
<!-- popup delete end -->
@@ -167,6 +167,7 @@
export default {
data() {
return {
loading_btn: false,
tableData: [],
beneficiariesForm : {
company_name : '',
@@ -190,14 +191,17 @@
},
methods: {
CreateBeneficiaries : function(){
this.loading_btn = true
this.AddDatadialogVisible = false;
axios.post('/api/setting-beneficiary', this.beneficiariesForm)
.then((response) => {
this.loading_btn = false
this.DoneAddDatadialogVisible = true;
this.ClearBeneficiariesForm();
this.UpdateTableData();
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
@@ -209,11 +213,17 @@
});
},
UpdateTableData : function(){
this.loading_btn = true
axios.get('/api/setting-beneficiary', this.beneficiariesForm)
.then((response) => {
this.loading_btn = false
this.tableData = response.data;
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
@@ -224,12 +234,21 @@
})
},
DeleteBeneficiaries : function(beneficiaries_id){
this.loading_btn = true
this.DeleteAdddialogVisible = true;
axios.delete('/api/setting-beneficiary/' + beneficiaries_id)
.then((response) => {
this.loading_btn = false
this.UpdateTableData();
this.$message({
showClose: true,
message: 'Data Deleted Successfully',
type: 'success',
duration: 5000
});
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
@@ -240,14 +259,24 @@
});
},
EditBeneficiaries : function(){
this.loading_btn = true
this.EditDatadialogVisible = false;
this.DoneUpdateDatadialogVisible = true;
axios.put('/api/setting-beneficiary/' + this.currentEdit, this.beneficiariesForm)
.then((response) => {
this.loading_btn = false
this.UpdateTableData();
this.$message({
showClose: true,
message: 'Data Updated Succesfully',
type: 'success',
duration: 5000
});
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
@@ -81,7 +81,7 @@
this.loading_btn = false
this.$message({
showClose: true,
message: 'Success',
message: 'Time Limit and Credit Limit Updated Successfully',
type: 'success',
duration: 5000
});
@@ -11,8 +11,8 @@
<el-table-column prop="bank_branch" label="Bank Branch"></el-table-column>
<el-table-column label="Action">
<template slot-scope="scope">
<el-button type="text" size="small" @click="PopOutEditMalaysiaBank(scope.$index)">Edit</el-button>
<el-button type="text" size="small" @click="DeleteMalaysiaBank(tableData[scope.$index].id)">Delete</el-button>
<el-button type="text" size="small" :loading="loading_btn" @click="PopOutEditMalaysiaBank(scope.$index)">Edit</el-button>
<el-button type="text" size="small" :loading="loading_btn" @click="DeleteMalaysiaBank(tableData[scope.$index].id)">Delete</el-button>
</template>
</el-table-column>
</el-table>
@@ -54,7 +54,7 @@
</el-form>
<div align="center">
<el-button @click="AddDatadialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="CreateMalaysiaBank" :disabled="errors.any() || malaysiaBankForm.company_name=='' || malaysiaBankForm.bank_name=='' || malaysiaBankForm.acc_no=='' || malaysiaBankForm.bank_address=='' || malaysiaBankForm.swift =='' || malaysiaBankForm.cnap=='' || malaysiaBankForm.bank_branch=='' ? true : false">OK</el-button>
<el-button type="primary" :loading="loading_btn" @click="CreateMalaysiaBank" :disabled="errors.any() || malaysiaBankForm.company_name=='' || malaysiaBankForm.bank_name=='' || malaysiaBankForm.acc_no=='' || malaysiaBankForm.bank_address=='' || malaysiaBankForm.swift =='' || malaysiaBankForm.cnap=='' || malaysiaBankForm.bank_branch=='' ? true : false">OK</el-button>
</div>
<span slot="footer" class="dialog-footer">
* Please key in the data in Chinese
@@ -63,7 +63,7 @@
<el-dialog align="center" :visible.sync="DoneAddDatadialogVisible" width="30%">
<span>Data Added Successfully</span><br><br>
<div align="center">
<el-button type="primary" @click="DoneAddDatadialogVisible = false">OK</el-button>
<el-button type="primary" :loading="loading_btn" @click="DoneAddDatadialogVisible = false">OK</el-button>
</div>
</el-dialog>
<!-- popup add new data end -->
@@ -101,7 +101,7 @@
</el-form>
<div align="center">
<el-button @click="EditDatadialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="EditMalaysiaBank" :disabled="errors.any() || malaysiaBankForm.company_name=='' || malaysiaBankForm.bank_name=='' || malaysiaBankForm.acc_no=='' || malaysiaBankForm.bank_address=='' || malaysiaBankForm.swift =='' || malaysiaBankForm.cnap=='' || malaysiaBankForm.bank_branch=='' ? true : false">Submit</el-button>
<el-button type="primary" :loading="loading_btn" @click="EditMalaysiaBank" :disabled="errors.any() || malaysiaBankForm.company_name=='' || malaysiaBankForm.bank_name=='' || malaysiaBankForm.acc_no=='' || malaysiaBankForm.bank_address=='' || malaysiaBankForm.swift =='' || malaysiaBankForm.cnap=='' || malaysiaBankForm.bank_branch=='' ? true : false">Submit</el-button>
</div>
<span slot="footer" class="dialog-footer">
* Please key in the data in Chinese
@@ -110,7 +110,7 @@
<el-dialog align="center" :visible.sync="DoneUpdateDatadialogVisible" width="30%">
<span>Data Updated Successfully</span><br><br>
<div align="center">
<el-button type="primary" @click="DoneUpdateDatadialogVisible = false">OK</el-button>
<el-button type="primary" :loading="loading_btn" @click="DoneUpdateDatadialogVisible = false">OK</el-button>
</div>
</el-dialog>
<!-- popup edit data end -->
@@ -118,7 +118,7 @@
<el-dialog align="center" :visible.sync="DeleteAdddialogVisible" width="30%">
<span>Data Deleted</span><br><br>
<div align="center">
<el-button type="primary" @click="DeleteAdddialogVisible = false">OK</el-button>
<el-button type="primary" :loading="loading_btn" @click="DeleteAdddialogVisible = false">OK</el-button>
</div>
</el-dialog>
<!-- popup delete end -->
@@ -167,6 +167,7 @@
export default {
data() {
return {
loading_btn: false,
tableData: [],
malaysiaBankForm : {
company_name : '',
@@ -190,14 +191,23 @@
},
methods: {
CreateMalaysiaBank : function(){
this.loading_btn = true
this.AddDatadialogVisible = false;
axios.post('/api/setting-malaysia-bank', this.malaysiaBankForm)
.then((response) => {
this.loading_btn = false
this.DoneAddDatadialogVisible = true;
this.ClearMalaysiaBankForm();
this.UpdateTableData();
})
this.$message({
showClose: true,
message: 'Success',
type: 'success',
duration: 5000
});
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
@@ -209,11 +219,21 @@
});
},
UpdateTableData : function(){
this.loading_btn = true
axios.get('/api/setting-malaysia-bank', this.malaysiaBankForm)
.then((response) => {
this.loading_btn = false;
this.tableData = response.data;
this.$message({
showClose: true,
message: 'Data Updated Successfully',
type: 'success',
duration: 5000
});
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
@@ -224,12 +244,21 @@
})
},
DeleteMalaysiaBank : function(malaysiaBank_id){
this.loading_btn = true;
this.DeleteAdddialogVisible = true;
axios.delete('/api/setting-malaysia-bank/' + malaysiaBank_id)
.then((response) => {
this.UpdateTableData();
this.$message({
showClose: true,
message: 'Data Deleted Successfully',
type: 'success',
duration: 5000
});
})
.catch((error) => {
this.loading_btn = false;
console.log(error);
this.$message({
showClose: true,
@@ -240,11 +269,20 @@
});
},
EditMalaysiaBank : function(){
this.loading_btn = true;
this.EditDatadialogVisible = false;
this.DoneUpdateDatadialogVisible = true;
axios.put('/api/setting-malaysia-bank/' + this.currentEdit, this.malaysiaBankForm)
.then((response) => {
this.loading_btn = false;
this.UpdateTableData();
this.$message({
showClose: true,
message: 'Updated Successfully',
type: 'success',
duration: 5000
});
})
.catch((error) => {
console.log(error);
@@ -32,6 +32,7 @@
<el-button type="primary" icon="el-icon-plus" @click="CreateMarking('markingForm')" class="addButtonNormal">Add New Data</el-button>
<el-button type="primary" icon="el-icon-plus" @click="CreateMarking('markingForm')" class="addButtonSmall" size="mini">Add New Data</el-button>
</div>
</el-dialog>
<el-dialog align="center" :visible.sync="DoneAddDatadialogVisible">
<span>Data Added Successfully</span><br><br>
@@ -149,6 +150,7 @@
},
methods: {
CreateMarking : function(formName){
this.loading_btn = true
this.AddDatadialogVisible = false;
this.$refs[formName].validate((valid) => {
if (valid) {
+10 -1
View File
@@ -42,11 +42,14 @@ Route::group(['middleware' => 'auth:api'], function () {
Route::post('booking/{book_id}/reject-bank-slip','BookingController@rejectBankSlip');
Route::post('booking/{book_id}/approve-bank-slip','BookingController@approveBankSlip');
Route::post('booking/{book_id}/cancel', 'BookingController@cancel');
Route::get('/booking', 'BookingController@index');
Route::get('booking', 'BookingController@index');
Route::get('user', 'UserController@show');
Route::patch('settings/profile', 'Settings\ProfileController@update');
Route::patch('settings/password', 'Settings\PasswordController@update');
Route::get('notification/user', 'NotificationController@getUserMessage');
Route::post('notification/read-notification/{notification_id}', 'NotificationController@readNotification');
// for both user and admin
Route::get('active-bank', 'SettingActiveBankController@index');
Route::put('setting-tax', 'SettingActiveBankController@index');
@@ -109,6 +112,12 @@ Route::group(['middleware' => ['role:admin']], function() {
Route::put('supplier-booking/{id}', 'BookingSupplierController@update');
Route::post('booking/{id}/confirm-supplier', 'BookingController@confirmSupplier');
Route::get('notification', 'NotificationController@index');
Route::get('notification/{notification}', 'NotificationController@show');
Route::post('notification', 'NotificationController@store');
Route::put('notification/{notification}', 'NotificationController@update');
Route::delete('notification/{notification}', 'NotificationController@delete');
Route::post('booking/{id}/upload-china-bankslip','ChinaBankSlipController@store');
Route::patch('booking/{id}/update-china-bankslip','ChinaBankSlipController@update');
Route::get('booking/{id}/po', 'BookingController@showPurchaseOrder');