diff --git a/Dockerfile b/Dockerfile index 5eb8b990..9efcd1c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,5 +9,5 @@ RUN composer install COPY wait.sh /usr/local/bin/wait.sh RUN chmod +x /usr/local/bin/wait.sh -CMD /usr/local/bin/wait.sh && composer dumpautoload && php artisan migrate && php artisan db:seed && php artisan serve --host=0.0.0.0 --port=8000 +CMD /usr/local/bin/wait.sh && composer dumpautoload && php artisan storage:link && php artisan migrate && php artisan db:seed && php artisan serve --host=0.0.0.0 --port=8000 EXPOSE 8000 diff --git a/app/Booking.php b/app/Booking.php index cffe157c..6daa1d89 100644 --- a/app/Booking.php +++ b/app/Booking.php @@ -27,13 +27,25 @@ class Booking extends Model 'bank_branch', 'company_name']; public $timestamps = true; - + public function user(){ return $this->belongsTo('app\User'); } + public function bookingSupplier(){ + return $this->belongsTo('app\BookingSupplier '); + } + + public function chinaBankSlip(){ + return $this->hasOne(ChinaBankSlip::class); + } + public function userBankSlip(){ return $this->hasOne(UserBankSlip::class); } + + public function purchaseOrder(){ + return $this->hasOne(PurchaseOrder::class); + } } diff --git a/app/ChinaBankSlip.php b/app/ChinaBankSlip.php index d7354956..47e2fe4d 100644 --- a/app/ChinaBankSlip.php +++ b/app/ChinaBankSlip.php @@ -7,4 +7,9 @@ use Illuminate\Database\Eloquent\Model; class ChinaBankSlip extends Model { protected $fillable = ['actual_transfer_amount','date','details','china_bank_slip_path']; + + public function booking() + { + return $this->belongsTo(Booking::class); + } } diff --git a/app/Http/Controllers/BookingController.php b/app/Http/Controllers/BookingController.php index ebf2f580..ebd88930 100644 --- a/app/Http/Controllers/BookingController.php +++ b/app/Http/Controllers/BookingController.php @@ -31,8 +31,7 @@ class BookingController extends Controller // set timeout $date1 = new DateTime($booking->created_at); $date2 = new DateTime(); - $time_in_seconds = SettingCredit::orderby('updated_at','desc')->first()->time_limit; - $difference_in_seconds = ($date1->format('U') + $time_in_seconds) - ($date2->format('U')); + $difference_in_seconds = ($date1->format('U') + 600) - ($date2->format('U')); $booking->timeout = $difference_in_seconds; // TODO : you can make it better @@ -94,7 +93,7 @@ class BookingController extends Controller // TODO : transfer_amount change name to bia $booking->transfer_amount = $booking->bia; - $booking->track_status = "(". $booking->admin_status ."/6)"; + $booking->track_status = "(". $booking->admin_status ."/7)"; switch ($booking->admin_status) { case 0: $status_desc = "Waiting user to upload bankin slip"; @@ -112,10 +111,13 @@ class BookingController extends Controller $status_desc = "Please update supplier booking status."; break; case 5: - $status_desc = "Customer has uploaded the invoice, please upload purchase order"; + $status_desc = "Upload China Bankslip"; break; case 6: - $status_desc = "Booking completed"; + $status_desc = "Customer has uploaded the invoice, please upload purchase order"; + break; + case 7: + $status_desc = "Booking Completed"; break; default: $status_desc = ""; @@ -148,7 +150,8 @@ class BookingController extends Controller public function adminShow($id) { $booking = Booking::where('id', $id)->first(); - return $booking->userBankSlip()->get(); + $user_bankslip_path = $booking->userBankSlip()->first()->bankslip_path; + $booking->user_bankslip_path = Storage::url($user_bankslip_path); if($booking){ $date1 = new DateTime($booking->created_at); @@ -166,10 +169,15 @@ class BookingController extends Controller public function store(Request $request) { - $rates = Rate::orderby('updated_at','desc')->first(); $term = $request->input('term'); $amount = $request->input("amount"); // in RMB - $creditLimit = SettingCredit::orderby('updated_at','desc')->first(); + $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("Exceed credit limit, need approved from admin", 401); } @@ -315,29 +323,33 @@ class BookingController extends Controller return response()->json(['message'=>'Image too large, upload files up to 3 MB'], 400); } - if(!$bankslip_file = $request->file('file')) + if($bankslip_file = $request->file('file')) { + /* End Validation */ + $filename = $bankslip_file->getClientOriginalName(); + $ext = $bankslip_file->getClientOriginalExtension(); + + + $unique_name = 'bank_slip_' . md5($filename. time()); // probably not a good idea + $unique_image_path = $unique_name. '.' .$ext; + + $upload_path = Storage::disk('public')->putFileAs( + 'user_bankslip', $bankslip_file, $unique_image_path + ); + + $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' => 'No file detected'], 400); } - /* End Validation */ - $filename = $bankslip_file->getClientOriginalName(); - $ext = $bankslip_file->getClientOriginalExtension(); - $input['file'] = $filename; - - $unique_name = 'bank_slip_' . md5($filename. time()); // probably not a good idea - $unique_image_path = $unique_name. '.' .$ext; - Storage::putFileAs( - 'user_bankslip', $bankslip_file, $unique_image_path - ); - - $user_bankslip = new UserBankSlip; - $user_bankslip->booking_id = $booking->id; - $user_bankslip->bankslip_path = $unique_image_path; - $user_bankslip->transfer_amount = $request->input('transfer_amount'); - $user_bankslip->save(); - - - return response()->json(['message'=>"Success"],200); + } public function updateBankSlipAmount(Request $request, $id){ @@ -346,7 +358,13 @@ class BookingController extends Controller if(!$user_bankslip){ return response()->json(["message"=> "not found"],400); - } + } + + // update booking status + $booking->status = 3; + $booking->admin_status = 2; + $booking->save(); + $user_bankslip->transfer_amount = $request->input('transfer_amount'); $user_bankslip->save(); return response()->json(["message"=> "Success"],200); @@ -392,12 +410,12 @@ class BookingController extends Controller $input['file'] = $filename; $unique_name = 'purchase_order_' . md5($filename. time()); $unique_image_path = $unique_name. '.' .$ext; - Storage::putFileAs( - 'purchase_order',/*folder name*/ $user_input_file, $unique_image_path + $upload_path = Storage::disk('public')->putFileAs( + 'purchase_order',/*folder name*/ $user_input_file, $unique_image_path, 'public' ); $user_po = new PurchaseOrder; - $user_po->image_path = $unique_image_path; + $user_po->image_path = $upload_path; $user_po->book_id = $booking->id; $user_po->save(); @@ -406,11 +424,18 @@ class BookingController extends Controller public function confirmPurchaseOrder($id){ $booking = Booking::where('user_id',Auth::user()->id)->where('id',$id)->first(); - $booking->status = 5; + $booking->status = 6; $booking->save(); return response()->json(['message'=>'Success'],200); } + public function showPurchaseOrder($id){ + $booking = Booking::where('id',$id)->first(); + $user_po = $booking->purchaseOrder()->first(); + + return response()->json(['po_path'=> $user_po],200); + } + public function delete(Booking $book_id) { $booking = Booking::where('user_id', Auth::user())->where('id', $book_id)->firstOrFail(); @@ -496,14 +521,16 @@ class BookingController extends Controller public function approveBankSlip(Request $request, $book_id) { - if (!$booking = Booking::where('user_id',Auth::user()->id)->where('id',$book_id)->first()) + $booking = Booking::where('id',$book_id)->first(); + + if (!$booking) { - return response()->json(['message'=>'Access denied'], 200); + return response()->json(['message'=>'Booking not found'], 400); } if(!$userBankSlip = UserBankSlip::where('booking_id',$booking->id)->first()) { - return response()->json(['message'=>'Access denied'], 200); + return response()->json(['message'=>'User bankslip not found'], 400); } // Rejected bankslip cannot be approve again @@ -515,12 +542,19 @@ class BookingController extends Controller $userBankSlip->is_approve = 1; $userBankSlip->estimated_arrival_time = $request->input('estimated_arrival_time'); $userBankSlip->save(); + + // update booking status + $booking->status = 4; + $booking->admin_status = 3; + $booking->save(); + return response()->json(['message'=>'Success'],200); } public function rejectBankSlip(Request $request, $book_id) { - if (!$booking = Booking::where('user_id',Auth::user()->id)->where('id',$book_id)->first()) + $booking = Booking::where('id',$book_id)->first(); + if (!$booking) { return response()->json(['message'=>'Access denied'], 200); } @@ -540,6 +574,12 @@ class BookingController extends Controller $userBankSlip->reject_reason = $request->reject_reason; $userBankSlip->save(); + // TODO : reject user bankinslip + // update booking status + $booking->status = 0; + $booking->admin_status = 0; + $booking->save(); + return response()->json(['message'=>'Success'],200); } //upload @@ -583,12 +623,12 @@ class BookingController extends Controller $input['invoice_path'] = $filename; $unique_name = 'invoice' . md5($filename. time()); $unique_file_url = $unique_name. '.' .$ext; - Storage::putFileAs( - 'invoice',/*folder name*/ $input_file, $unique_file_url + $upload_path = Storage::disk('public')->putFileAs( + 'invoice',/*folder name*/ $input_file, $unique_file_url, 'public' ); $invoice = new Invoice; - $invoice->invoice_path = $unique_file_url; + $invoice->invoice_path = $upload_path; $invoice->amount = $request->input('amount'); $invoice->booking_id = $booking->id; $invoice->save(); diff --git a/app/Http/Controllers/BookingSupplierController.php b/app/Http/Controllers/BookingSupplierController.php new file mode 100644 index 00000000..8a358a6e --- /dev/null +++ b/app/Http/Controllers/BookingSupplierController.php @@ -0,0 +1,134 @@ + $bookingsupplier + ]; + + return response()->json($response, 200); + } + + public function show($id) + { + $bookingsupplier = SupplierBooking::has('supplier-booking')->findOrFail($id); + + $response = [ + 'supplier-booking' => $bookingsupplier + ]; + + return response()->json($response, 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"); + $rate = $request->input('rate'); + $rebate = $request->input('rebate'); + + if ($supplierbooking = SupplierBooking::where('book_id', $booking_id)->first()){ + return response()->json(['success'=>false, 'message'=>'Bad request, please contact support'], 400); + } + + + // 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); + + $bookingsupplier = new SupplierBooking(); + $bookingsupplier->supplier_id = $supplier->id; + $bookingsupplier->payment_method = $request->input('payment_method'); + $bookingsupplier->transfer_amount = $transfer_amount; + $bookingsupplier->rate = $rate; + $bookingsupplier->rebate = $rebate; + $bookingsupplier->amountInRMB = $amountInRMB; + $bookingsupplier->rmbBankAmount = $rmbBankAmount; + $bookingsupplier->book_id = $booking->id; + $bookingsupplier->save(); + + // update booking status + $booking->status = 5; + $booking->admin_status = 4; + $booking->save(); + + // TODO : generate a jpg version of report and save the path + + return response()->json($bookingsupplier, 201); + } + + + public function update(Request $request, $id) + { + $bookingsupplier = BSupplierBooking::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(); + + // $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(); + + return response()->json($supplier_booking ,200); + } + + +} diff --git a/app/Http/Controllers/ChinaBankSlipController.php b/app/Http/Controllers/ChinaBankSlipController.php index 7e860d62..f691725c 100644 --- a/app/Http/Controllers/ChinaBankSlipController.php +++ b/app/Http/Controllers/ChinaBankSlipController.php @@ -3,118 +3,85 @@ namespace App\Http\Controllers; use App\ChinaBankSlip; +use App\Booking; use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; use Validator; class ChinaBankSlipController extends Controller { - /** - * Display a listing of the resource. - * - * @return \Illuminate\Http\Response - */ - public function index() - { - // - } - /** - * Show the form for creating a new resource. - * - * @return \Illuminate\Http\Response - */ - public function create() - { - // - } + public function store(Request $request, $id) + { + $booking = Booking::where('id',$id)->firstOrFail(); + + // TODO : put this after check file exist + // validate file format + $validator = Validator::make($request->all(), [ + 'file' => 'image|mimes:jpg,jpeg,bmp,png' + ]); - /** - * Store a newly created resource in storage. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function store(Request $request) - { - // Handle File Upload - if($request->hasFile('china_bank_slips')){ - // Get filename with the extension - $filenameWithExt = $request->file('china_bank_slips')->getClientOriginalName(); - // Get just filename - $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME); - // Get just ext - $extension = $request->file('china_bank_slips')->getClientOriginalExtension(); - // Filename to store - $fileNameToStore= $filename.'_'.time().'.'.$extension; - - // File size checking - $validator = Validator::make($request->all(), [ - 'china_bank_slips' => 'max:3072' - ]); - - if($validator->fails()) - { - return response()->json(['message'=>'Image too large, upload files up to 3 MB'], 400); - } - // Upload Image - $path = $request->file('china_bank_slips')->storeAs('public/bankslip', $fileNameToStore); - } else { - $fileNameToStore = 'hello.jpg'; + if($validator->fails()) + { + return response()->json(['message'=>'Incorrect format'],200); } - // Create Post - $post = new ChinaBankSlip; - $post->actual_transfer_amount = $request->input('actual_transfer_amount'); - $post->date = $request->input('date'); - $post->details = $request->input('details'); - $post->china_bank_slip_path = $fileNameToStore; - $post->save(); - return response()->json(['message'=>$post], 200); - } - /** - * Display the specified resource. - * - * @param \App\ChinaBankSlip $chinaBankSlip - * @return \Illuminate\Http\Response - */ - public function show(ChinaBankSlip $chinaBankSlip) - { - // + $validator = Validator::make($request->all(), [ + 'china_bank_slips' => 'max:3072' + ]); + + if($validator->fails()) + { + return response()->json(['message'=>'Image too large, upload files up to 3 MB'], 400); + } + + + if($bankslip_file = $request->file('file')){ + + $filename = $bankslip_file->getClientOriginalName(); + $ext = $bankslip_file->getClientOriginalExtension(); + $unique_name = 'cnbank_slip_' . md5($filename. time()); // probably not a good idea + $unique_image_path = $unique_name. '.' .$ext; + + // Upload Image + $upload_path = Storage::disk('public')->putFileAs( + 'china_bank_slip', $bankslip_file, $unique_image_path + ); + + + } else { + return response()->json(['message'=>'file not found'],200); + } + + $china_bankslip = new ChinaBankSlip; + $china_bankslip->booking_id = $booking->id; + $china_bankslip->china_bank_slip_path = $upload_path; + $china_bankslip->save(); + + return response()->json(['message'=>'success'], 201); } - /** - * Show the form for editing the specified resource. - * - * @param \App\ChinaBankSlip $chinaBankSlip - * @return \Illuminate\Http\Response - */ - public function edit(ChinaBankSlip $chinaBankSlip) - { - // + public function update(Request $request, $id){ + $booking = Booking::where('id',$id)->first(); + $china_bankslip = $booking->chinaBankSlip()->first(); + + // TODO: first or fail + if(!$china_bankslip){ + return response()->json(["message"=> "not found"],400); + } + + $china_bankslip->actual_transfer_amount = $request->input('actual_transfer_amount'); + $china_bankslip->date = $request->input('date'); + $china_bankslip->details = $request->input('details'); + $china_bankslip->save(); + + // update booking status + $booking->status = 5; + $booking->admin_status = 6; + $booking->save(); + + return response()->json(["message"=> "Success"],200); } - /** - * Update the specified resource in storage. - * - * @param \Illuminate\Http\Request $request - * @param \App\ChinaBankSlip $chinaBankSlip - * @return \Illuminate\Http\Response - */ - public function update(Request $request, ChinaBankSlip $chinaBankSlip) - { - // - } - - /** - * Remove the specified resource from storage. - * - * @param \App\ChinaBankSlip $chinaBankSlip - * @return \Illuminate\Http\Response - */ - public function destroy(ChinaBankSlip $chinaBankSlip) - { - // - } } diff --git a/app/Http/Controllers/SettingSupplierController.php b/app/Http/Controllers/SettingSupplierController.php index 96f0a861..d6bf1eda 100644 --- a/app/Http/Controllers/SettingSupplierController.php +++ b/app/Http/Controllers/SettingSupplierController.php @@ -9,7 +9,13 @@ class SettingSupplierController extends Controller { public function index() { - return SettingSupplier::all(); + $suppliers = SettingSupplier::all(); + + foreach ($suppliers as $supplier) { + $supplier->value = $supplier->id; + $supplier->label = $supplier->company_name; + } + return $suppliers; } public function show(SettingSupplier $supplier) diff --git a/app/PurchaseOrder.php b/app/PurchaseOrder.php index 72345a6f..71227d02 100644 --- a/app/PurchaseOrder.php +++ b/app/PurchaseOrder.php @@ -7,4 +7,9 @@ use Illuminate\Database\Eloquent\Model; class PurchaseOrder extends Model { protected $fillable = ['image_url','amount','booking_id']; + + public function booking() + { + return $this->belongsTo(Booking::class); + } } diff --git a/app/SupplierBooking.php b/app/SupplierBooking.php new file mode 100644 index 00000000..9f660105 --- /dev/null +++ b/app/SupplierBooking.php @@ -0,0 +1,27 @@ +belongsTo('app\User'); + } + + public function booking(){ + return $this->hasOne('App\Booking'); + } + + public function supplierBookingTtem() + { + return $this->hasMany('App\SupplierBookingItem'); + } + +} diff --git a/app/SupplierBookingItem.php b/app/SupplierBookingItem.php new file mode 100644 index 00000000..c0073d18 --- /dev/null +++ b/app/SupplierBookingItem.php @@ -0,0 +1,25 @@ +belongsTo('App\BookingSupplier'); + } + + +} diff --git a/artisan b/artisan old mode 100755 new mode 100644 diff --git a/database/factories/SupplierBookingItemFactory.php b/database/factories/SupplierBookingItemFactory.php new file mode 100644 index 00000000..514eae24 --- /dev/null +++ b/database/factories/SupplierBookingItemFactory.php @@ -0,0 +1,9 @@ +define(App\SupplierBookingItem::class, function (Faker $faker) { + return [ + // + ]; +}); diff --git a/database/migrations/2018_06_21_025734_supplier_booking_table.php b/database/migrations/2018_06_21_025734_supplier_booking_table.php new file mode 100644 index 00000000..2369cf24 --- /dev/null +++ b/database/migrations/2018_06_21_025734_supplier_booking_table.php @@ -0,0 +1,44 @@ +increments('id'); + $table->string('payment_method'); + $table->double('transfer_amount'); + $table->double('rate'); + $table->double('rebate'); + $table->double('amountInRMB'); + $table->double('rmbBankAmount'); + + $table->integer('book_id')->unsigned(); + $table->foreign('book_id')->references('id')->on('bookings'); + + $table->integer('supplier_id')->unsigned(); + $table->foreign('supplier_id')->references('id')->on('setting_suppliers'); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('supplier_bookings'); + } +} diff --git a/database/migrations/2018_06_21_034658_supplierbooking_customerbooking_table.php b/database/migrations/2018_06_21_034658_supplierbooking_customerbooking_table.php new file mode 100644 index 00000000..bf18bb6a --- /dev/null +++ b/database/migrations/2018_06_21_034658_supplierbooking_customerbooking_table.php @@ -0,0 +1,34 @@ +integer('supplierbooking_id')->unsigned(); + $table->integer('booking_id')->unsigned(); + + $table->foreign('supplierbooking_id')->references('id')->on('supplier_bookings'); + $table->foreign('booking_id')->references('id')->on('bookings'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('supplierbooking_customerbooking'); + } +} diff --git a/database/migrations/2018_06_25_120731_create_supplier_booking_items_table.php b/database/migrations/2018_06_25_120731_create_supplier_booking_items_table.php new file mode 100644 index 00000000..fad1a1c3 --- /dev/null +++ b/database/migrations/2018_06_25_120731_create_supplier_booking_items_table.php @@ -0,0 +1,37 @@ +increments('id'); + $table->string('china_bankslip_url'); + $table->integer('book_id')->unsigned(); + $table->foreign('book_id')->references('id')->on('bookings'); + $table->double('bank_in_amount'); + $table->integer('supplierbooking_id')->unsigned(); + $table->foreign('supplierbooking_id')->references('id')->on('supplier_bookings'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('supplier_booking_items'); + } +} diff --git a/database/migrations/2018_06_27_035705_make_paymentmethod_nulltable_in_supplierbooking_table.php b/database/migrations/2018_06_27_035705_make_paymentmethod_nulltable_in_supplierbooking_table.php new file mode 100644 index 00000000..8baebdac --- /dev/null +++ b/database/migrations/2018_06_27_035705_make_paymentmethod_nulltable_in_supplierbooking_table.php @@ -0,0 +1,31 @@ +string('payment_method')->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/migrations/2018_06_27_081455_add_bookingid_foreignkey_to_chinabankslip_table.php b/database/migrations/2018_06_27_081455_add_bookingid_foreignkey_to_chinabankslip_table.php new file mode 100644 index 00000000..5a184094 --- /dev/null +++ b/database/migrations/2018_06_27_081455_add_bookingid_foreignkey_to_chinabankslip_table.php @@ -0,0 +1,32 @@ +integer('booking_id')->unsigned(); + $table->foreign('booking_id')->references('id')->on('bookings'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/migrations/2018_06_28_011717_rename_booking_foreignkey_in_po_table.php b/database/migrations/2018_06_28_011717_rename_booking_foreignkey_in_po_table.php new file mode 100644 index 00000000..27f8b18a --- /dev/null +++ b/database/migrations/2018_06_28_011717_rename_booking_foreignkey_in_po_table.php @@ -0,0 +1,33 @@ +dropForeign('book_id'); + $table->integer('booking_id')->unsigned(); + $table->foreign('booking_id')->references('id')->on('bookings'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index d40a4e4b..0834c81d 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -17,6 +17,6 @@ class DatabaseSeeder extends Seeder $this->call(UserRoleSeeder::class); $this->call(RateTableSeeder::class); $this->call(BookTableSeeder::class); - $this->call(SettingCreditSeeder::class); + $this->call(CreditTableSeeder::class); } } diff --git a/public/bankslip/hello.jpg b/public/bankslip/hello.jpg old mode 100755 new mode 100644 diff --git a/resources/assets/js/components/AdminProgressTrack.vue b/resources/assets/js/components/AdminProgressTrack.vue index dfae9647..3cff63df 100644 --- a/resources/assets/js/components/AdminProgressTrack.vue +++ b/resources/assets/js/components/AdminProgressTrack.vue @@ -6,6 +6,7 @@ + diff --git a/resources/assets/js/components/LocaleDropdown.vue b/resources/assets/js/components/LocaleDropdown.vue index f4b0d5c3..a10a05fb 100644 --- a/resources/assets/js/components/LocaleDropdown.vue +++ b/resources/assets/js/components/LocaleDropdown.vue @@ -13,11 +13,59 @@ -
  • Update Rate
  • -
  • Complete Order
  • -
  • Transaction History
  • -
  • Upload Supplier Bank Slip to System
  • + + + + + + + + + + X1 : + Cash : + Cheque : + BA : + + + + X2 : + Cash : + Cheque : + BA : + + +
    + Cancel + Save +
    +
    + + + + Rate Successfully Updated

    +
    + OK +
    +
    + @@ -26,9 +74,24 @@ import { mapGetters } from 'vuex' import { loadMessages } from '~/plugins/i18n' export default { + data() { + return { + UpdateRatePopoverVisible: false, + UpdateRateDialogVisible: false, + DoneUpdateRateDialogVisible: false, + x1_cash: '1.56', + x1_cheque: '1.63', + x1_ba: '1.66', + x2_cash: '1.61', + x2_cheque: '1.70', + x2_ba: '1.72', + }; + }, computed: mapGetters({ locale: 'lang/locale', - locales: 'lang/locales' + locales: 'lang/locales', + user: 'auth/user', + role: 'auth/role' }), methods: { diff --git a/resources/assets/js/components/ProgressTrack.vue b/resources/assets/js/components/ProgressTrack.vue index 00c85c5d..0161e8b0 100644 --- a/resources/assets/js/components/ProgressTrack.vue +++ b/resources/assets/js/components/ProgressTrack.vue @@ -6,6 +6,7 @@ + diff --git a/resources/assets/js/pages/admin/booking/completed.vue b/resources/assets/js/pages/admin/booking/completed.vue new file mode 100644 index 00000000..42585d3c --- /dev/null +++ b/resources/assets/js/pages/admin/booking/completed.vue @@ -0,0 +1,165 @@ + + + diff --git a/resources/assets/js/pages/admin/booking/supplierBooking.vue b/resources/assets/js/pages/admin/booking/supplierBooking.vue index 37196cb3..14ccd189 100644 --- a/resources/assets/js/pages/admin/booking/supplierBooking.vue +++ b/resources/assets/js/pages/admin/booking/supplierBooking.vue @@ -1,13 +1,13 @@