mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 20:34:08 +00:00
Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/exchange into feature/booking-pagination
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
APP_NAME=EXCHANGE
|
||||
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=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=exchange
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
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=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=homestead
|
||||
DB_USERNAME=homestead
|
||||
DB_PASSWORD=secr
|
||||
|
||||
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}"
|
||||
@@ -47,5 +47,11 @@ class Booking extends Model
|
||||
public function purchaseOrder(){
|
||||
return $this->hasOne(PurchaseOrder::class);
|
||||
}
|
||||
|
||||
public function invoice(){
|
||||
return $this->hasOne(Invoice::class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,12 @@ class BookingController extends Controller
|
||||
{
|
||||
|
||||
public function index(){
|
||||
$user = Auth::user();
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->where('user_id', $user->id)
|
||||
->get();
|
||||
|
||||
->where('user_id', $user->id)
|
||||
->paginate(10);
|
||||
|
||||
|
||||
// reformat to fit frontend structure
|
||||
foreach ($bookings as $booking) {
|
||||
// set timeout
|
||||
@@ -40,7 +41,7 @@ class BookingController extends Controller
|
||||
// TODO : transfer_amount change name to bia
|
||||
$booking->transfer_amount = $booking->bia;
|
||||
|
||||
$booking->track_status = "(". $booking->status ."/6)";
|
||||
$booking->track_status = "(". $booking->status ."/7)";
|
||||
switch ($booking->status) {
|
||||
case 1:
|
||||
$status_desc = "Order in progress";
|
||||
@@ -60,6 +61,9 @@ class BookingController extends Controller
|
||||
case 6:
|
||||
$status_desc = "Processing invoice";
|
||||
break;
|
||||
case 7:
|
||||
$status_desc = "Order Completed";
|
||||
break;
|
||||
default:
|
||||
$status_desc = "";
|
||||
}
|
||||
@@ -91,30 +95,30 @@ class BookingController extends Controller
|
||||
// TODO : transfer_amount change name to bia
|
||||
$booking->transfer_amount = $booking->bia;
|
||||
|
||||
$booking->track_status = "(". $booking->admin_status ."/7)";
|
||||
$booking->track_status = "(". $booking->admin_status ."/8)";
|
||||
switch ($booking->admin_status) {
|
||||
case 0:
|
||||
$status_desc = "Waiting user to upload bankin slip";
|
||||
break;
|
||||
case 1:
|
||||
$status_desc = "Waiting for verification";
|
||||
$status_desc = "Waiting customer upload bank slip";
|
||||
break;
|
||||
case 2:
|
||||
$status_desc = "Bookg with supplier";
|
||||
$status_desc = "Verify user bank slip";
|
||||
break;
|
||||
case 3:
|
||||
$status_desc = "Supplier booking report. Please confirm with your booking.";
|
||||
$status_desc = "Generate supplier booking report";
|
||||
break;
|
||||
case 4:
|
||||
$status_desc = "Please update supplier booking status.";
|
||||
$status_desc = "Supplier booking report. Please confirm with your booking.";
|
||||
break;
|
||||
case 5:
|
||||
$status_desc = "Upload China Bankslip";
|
||||
$status_desc = "Please, upload China Bankslip";
|
||||
break;
|
||||
case 6:
|
||||
$status_desc = "Customer has uploaded the invoice, please upload purchase order";
|
||||
$status_desc = "Waiting customer to upload purchase order";
|
||||
break;
|
||||
case 7:
|
||||
$status_desc = "Customer has uploaded purchase order, please upload invoice";
|
||||
break;
|
||||
case 8:
|
||||
$status_desc = "Booking Completed";
|
||||
break;
|
||||
default:
|
||||
@@ -419,24 +423,26 @@ class BookingController extends Controller
|
||||
|
||||
$user_po = new PurchaseOrder;
|
||||
$user_po->image_path = $upload_path;
|
||||
$user_po->book_id = $booking->id;
|
||||
$user_po->booking_id = $booking->id;
|
||||
$user_po->save();
|
||||
|
||||
$booking->status = 6;
|
||||
$booking->admin_status = 7;
|
||||
$booking->save();
|
||||
|
||||
return response()->json(['message'=>'Success'],200);
|
||||
}
|
||||
|
||||
public function confirmPurchaseOrder($id){
|
||||
$booking = Booking::where('user_id',Auth::user()->id)->where('id',$id)->first();
|
||||
$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);
|
||||
if($user_po){
|
||||
return response()->json(['user_po_path'=> $user_po->image_path ],200);
|
||||
}
|
||||
|
||||
return response()->json(['message'=> 'waiting customer to upload their po'],400);
|
||||
}
|
||||
|
||||
public function delete(Booking $book_id)
|
||||
@@ -588,7 +594,7 @@ class BookingController extends Controller
|
||||
//upload
|
||||
public function uploadInvoice(Request $request, $id)
|
||||
{
|
||||
$booking = Booking::where('user_id',Auth::user()->id)->where('id',$id)->first();
|
||||
$booking = Booking::where('id',$id)->first();
|
||||
|
||||
/* Validation */
|
||||
if (!$booking)
|
||||
@@ -614,7 +620,7 @@ class BookingController extends Controller
|
||||
return response()->json(['message'=>'Image too large, upload files up to 3 MB'], 400);
|
||||
}
|
||||
|
||||
if(!$input_file = $request->file('invoice_path'))
|
||||
if(!$input_file = $request->file('file'))
|
||||
{
|
||||
return response()->json(['message'=>'No file detected'], 400);
|
||||
}
|
||||
@@ -623,20 +629,63 @@ class BookingController extends Controller
|
||||
$filename = $input_file->getClientOriginalName();
|
||||
$ext = $input_file->getClientOriginalExtension();
|
||||
|
||||
$input['invoice_path'] = $filename;
|
||||
$unique_name = 'invoice' . md5($filename. time());
|
||||
$unique_file_url = $unique_name. '.' .$ext;
|
||||
$upload_path = Storage::disk('public')->putFileAs(
|
||||
'invoice',/*folder name*/ $input_file, $unique_file_url, 'public'
|
||||
'invoice', $input_file, $unique_file_url, 'public'
|
||||
);
|
||||
|
||||
$invoice = new Invoice;
|
||||
$invoice->invoice_path = $upload_path;
|
||||
$invoice->amount = $request->input('amount');
|
||||
// TODO : amount
|
||||
$invoice->amount = 0;
|
||||
$invoice->booking_id = $booking->id;
|
||||
$invoice->save();
|
||||
|
||||
return response()->json(['message'=>"Success"],200);
|
||||
}
|
||||
|
||||
public function confirmSupplier(Request $request, $id)
|
||||
{
|
||||
$booking = Booking::where('id', $id)->firstOrFail();
|
||||
$booking->status = 4; // processing transfer
|
||||
$booking->admin_status = 5; // upload china bankslip
|
||||
|
||||
if($booking->save()){
|
||||
return response()->json(['message'=>"Success"],200);
|
||||
}
|
||||
}
|
||||
|
||||
public function confirmPurchaseOrder($id){
|
||||
$booking = Booking::where('user_id',Auth::user()->id)->where('id',$id)->first();
|
||||
|
||||
$purchase_order = $booking->purchaseOrder()->first();
|
||||
|
||||
if(!$purchase_order){
|
||||
return response()->json(["message"=> "Please upload your purchase order"],400);
|
||||
}
|
||||
|
||||
$booking->status = 6;
|
||||
$booking->save();
|
||||
return response()->json(['message'=>'Success'],200);
|
||||
}
|
||||
|
||||
public function confirmInvoice(Request $request, $id)
|
||||
{
|
||||
$booking = Booking::where('id', $id)->firstOrFail();
|
||||
|
||||
$invoice = $booking->invoice()->first();
|
||||
|
||||
if(!$invoice){
|
||||
return response()->json(["message"=> "Please upload your invoice"],400);
|
||||
}
|
||||
|
||||
$booking->status = 7; // completed
|
||||
$booking->admin_status = 7; // completed
|
||||
|
||||
if($booking->save()){
|
||||
return response()->json(['message'=>"Success"],200);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ class BookingSupplierController extends Controller
|
||||
$bookingsupplier->save();
|
||||
|
||||
// update booking status
|
||||
$booking->status = 5;
|
||||
$booking->status = 4;
|
||||
$booking->admin_status = 4;
|
||||
$booking->save();
|
||||
|
||||
@@ -131,4 +131,6 @@ class BookingSupplierController extends Controller
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class ChinaBankSlipController extends Controller
|
||||
|
||||
// TODO: first or fail
|
||||
if(!$china_bankslip){
|
||||
return response()->json(["message"=> "not found"],400);
|
||||
return response()->json(["message"=> "China bankslip not found. Please upload first."],400);
|
||||
}
|
||||
|
||||
$china_bankslip->actual_transfer_amount = $request->input('actual_transfer_amount');
|
||||
|
||||
@@ -7,4 +7,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Invoice extends Model
|
||||
{
|
||||
protected $fillable = ['invoice_url','amount','booking_id'];
|
||||
|
||||
public function booking(){
|
||||
return $this->hasOne('App\Booking');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\SettingSupplier::class, function (Faker $faker) {
|
||||
return [
|
||||
//
|
||||
'company_name' => $faker->name,
|
||||
'gst_no' => $faker->unique()->randomDigit,
|
||||
'supplier_reg_no' => $faker->unique()->randomDigit,
|
||||
'bank_name' => $faker->name,
|
||||
'acc_no' => $faker->unique()->randomDigit
|
||||
];
|
||||
});
|
||||
|
||||
@@ -30,6 +30,6 @@ class CreateUsersTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,6 @@ class CreateRatesTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('rates');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class CreateBookingsTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('bookings');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ class RenameBookingForeignkeyInPoTable extends Migration
|
||||
{
|
||||
Schema::table('purchase_orders', function($table)
|
||||
{
|
||||
$table->dropForeign(['book_id']);
|
||||
$table->dropColumn('book_id');
|
||||
$table->integer('booking_id')->unsigned();
|
||||
$table->foreign('booking_id')->references('id')->on('bookings');
|
||||
});
|
||||
|
||||
@@ -18,5 +18,6 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call(RateTableSeeder::class);
|
||||
$this->call(BookTableSeeder::class);
|
||||
$this->call(SettingCreditSeeder::class);
|
||||
$this->call(SuppliersTableSeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SuppliersTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('setting_suppliers')->insert([
|
||||
'company_name' => 'WongKok PLT',
|
||||
'gst_no' => 'GTS12232123',
|
||||
'bank_name' => 'HSBC',
|
||||
'acc_no' => '86774723848593'
|
||||
]);
|
||||
}
|
||||
}
|
||||
Generated
+599
-645
File diff suppressed because it is too large
Load Diff
+3
-1
@@ -29,10 +29,12 @@
|
||||
"vform": "^1.0.0",
|
||||
"vue": "^2.5.16",
|
||||
"vue-i18n": "^7.6.0",
|
||||
"vue-loader": "14.2.2",
|
||||
"vue-meta": "^1.4.4",
|
||||
"vue-router": "^3.0.1",
|
||||
"vuex": "^3.0.1",
|
||||
"vuex-router-sync": "^5.0.0"
|
||||
"vuex-router-sync": "^5.0.0",
|
||||
"webpack": "^3.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-eslint": "^3.0.0-beta.6",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</div>
|
||||
</li>
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item">
|
||||
<li v-if="(user && role == 'admin')" class="nav-item">
|
||||
<el-popover placement="top" width="300" v-model="UpdateRatePopoverVisible">
|
||||
<div align="center">
|
||||
<p>Today's Rate</p>
|
||||
@@ -27,13 +27,10 @@
|
||||
<a class="nav-link" href="#" role="button" slot="reference">Update Rate</a>
|
||||
</el-popover>
|
||||
</li></ul>
|
||||
<li class="nav-item"><router-link :to="{ name: 'admin.complete-order' }" class="nav-link">{{ $t('Complete Order') }}</router-link></li>
|
||||
<li class="nav-item"><router-link :to="{ name: 'admin.transaction-history' }" class="nav-link">{{ $t('Transaction History') }}</router-link></li>
|
||||
<li class="nav-item"><router-link :to="{ name: 'admin.upload-supplier-bank-slip' }" class="nav-link">{{ $t('Upload Supplier Bank Slip to System') }}</router-link></li>
|
||||
<!-- <li v-if="(user && role == 'admin')"><a class="nav-link" href="#" role="button">Update Rate</a></li>
|
||||
<li v-if="(user && role == 'admin')"><a class="nav-link" href="#" role="button">Complete Order</a></li>
|
||||
<li v-if="(user && role == 'admin')"><a class="nav-link" href="#" role="button">Transaction History</a></li>
|
||||
<li v-if="(user && role == 'admin')"><a class="nav-link" href="#" role="button">Upload Supplier Bank Slip to System</a></li> -->
|
||||
<li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.complete-order' }" class="nav-link">{{ $t('Complete Order') }}</router-link></li>
|
||||
<li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.transaction-history' }" class="nav-link">{{ $t('Transaction History') }}</router-link></li>
|
||||
<li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.upload-supplier-bank-slip' }" class="nav-link">{{ $t('Upload Supplier Bank Slip to System') }}</router-link></li>
|
||||
|
||||
</ul>
|
||||
|
||||
<!-- update rate dialog -->
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
</style>
|
||||
<script>
|
||||
import VueCountdown from '@dmaksimovic/vue-countdown'
|
||||
import ProgressTrack from '~/components/ProgressTrack'
|
||||
import ProgressTrack from '~/components/AdminProgressTrack'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -114,7 +114,7 @@ export default {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
status: 6,
|
||||
status: 8,
|
||||
bookingConfirmTable: [{
|
||||
data1: 'Order Number :',
|
||||
data2: '001'
|
||||
|
||||
@@ -285,6 +285,32 @@
|
||||
methods: {
|
||||
completeReport(){
|
||||
// TODO : send request to change status
|
||||
this.loading_btn = true
|
||||
axios
|
||||
.post('/api/booking/' + this.$route.params.id + '/confirm-supplier')
|
||||
.then((response) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Success, please comeback after getting china bankslip',
|
||||
type: 'success',
|
||||
duration: 5000
|
||||
})
|
||||
this.$router.push({
|
||||
name: 'home'
|
||||
})
|
||||
//this.booking_details = response.data
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Suceess',
|
||||
type: 'success',
|
||||
duration: 5000
|
||||
})
|
||||
})
|
||||
|
||||
this.loading_btn = false
|
||||
|
||||
this.$router.push({
|
||||
name: 'booking.admin.cnslip',
|
||||
params: {id: this.$route.params.id }
|
||||
|
||||
@@ -361,7 +361,7 @@
|
||||
.then((response) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Your bankinslip has been submitted, please wait admin to approve.',
|
||||
message: 'Your bankinslip has been submitted, please wait customer to upload their purchase order.',
|
||||
type: 'success',
|
||||
duration: 5000
|
||||
})
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div align="center">
|
||||
<h4 style="margin-top:5%;"></h4>
|
||||
<br>
|
||||
<div v-if="po_status">
|
||||
<div v-if="user_po_path !== null">
|
||||
<h4>Upload Invoice</h4>
|
||||
</div>
|
||||
<div v-else>
|
||||
@@ -173,42 +173,24 @@
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="el-table__column-resize-proxy" style="display: none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <el-row :gutter="12">
|
||||
<el-col :span="12">
|
||||
<el-table :data="bookingConfirmTable" :show-header="false" align="center">
|
||||
<el-table-column prop="data1" align="right" width="200" />
|
||||
<el-table-column prop="data2" align="left" width="200" />
|
||||
</el-table>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-table :data="bookingConfirmTable2" :show-header="false" align="center">
|
||||
<el-table-column prop="data1" align="right" width="200" />
|
||||
<el-table-column prop="data2" align="left" width="200" />
|
||||
</el-table>
|
||||
</el-col>
|
||||
</el-row> -->
|
||||
</el-card>
|
||||
</el-row>
|
||||
<br>
|
||||
|
||||
<el-row :gutter="12" justify="center" align="center">
|
||||
<el-row v-if="user_po_path !== null" :gutter="12" justify="center" align="center">
|
||||
<el-col :span="12">
|
||||
<el-card class="box-card">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>Upload Invoice</span>
|
||||
<!-- <el-button style="float: right; padding: 3px 0" type="text">Operation button</el-button> -->
|
||||
</div>
|
||||
|
||||
<!-- upload image -->
|
||||
<el-upload :action="'/api/booking/' + booking_id + '/upload-po'" :on-exceed="handleExceed" :on-preview="handlePreview"
|
||||
<el-upload :action="'/api/booking/' + booking_id + '/upload-invoice'" :on-exceed="handleExceed" :on-preview="handlePreview"
|
||||
:on-remove="handleRemove"
|
||||
class="upload-demo"
|
||||
drag
|
||||
@@ -223,7 +205,7 @@
|
||||
<br>
|
||||
|
||||
<div class="bottom clearfix" style="text-align:right;">
|
||||
<el-button :loading="loading" type="primary" @click="uploadPo">Submit</el-button>
|
||||
<el-button :loading="loading_btn" type="primary" @click="confirmInvoice">Submit</el-button>
|
||||
</div>
|
||||
<!-- upload image end -->
|
||||
|
||||
@@ -237,9 +219,8 @@
|
||||
</div>
|
||||
<el-row :gutter="12" type="flex">
|
||||
<el-col :span="12">
|
||||
<a href="https://placeholder.com">
|
||||
<img width="100%" height="100%" src="http://via.placeholder.com/700x800">
|
||||
</a>
|
||||
<img v-bind:src="user_po_path" width="100%" height="100%">
|
||||
<img v-bind:src="booking_details.user_bankslip_path" class="image">
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
@@ -264,8 +245,8 @@
|
||||
return {
|
||||
status: 6,
|
||||
loading_btn: false,
|
||||
po_status: null,
|
||||
booking_id: this.$route.params.id,
|
||||
user_po_path: null,
|
||||
booking_details: {
|
||||
id: null,
|
||||
amount: null,
|
||||
@@ -334,7 +315,6 @@
|
||||
axios
|
||||
.get('/api/admin/booking/' + this.$route.params.id)
|
||||
.then((response) => {
|
||||
loading.close()
|
||||
this.booking_details = response.data
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
@@ -348,7 +328,7 @@
|
||||
.get('/api/booking/'+ this.$route.params.id +'/po')
|
||||
.then((response) => {
|
||||
loading.close()
|
||||
this.supplier_options = response.data
|
||||
this.user_po_path = response.user_po_path
|
||||
}).catch((error) => {
|
||||
loading.close()
|
||||
console.log(error)
|
||||
@@ -359,50 +339,32 @@
|
||||
|
||||
},
|
||||
methods: {
|
||||
uploadPo(formName) {
|
||||
this.loading_btn = true
|
||||
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
let newChinaSlip = {
|
||||
date: this.chinaSlipForm.date,
|
||||
actual_transfer_amount: this.chinaSlipForm.actual_transfer_amount,
|
||||
details: this.chinaSlipForm.details,
|
||||
}
|
||||
|
||||
axios.patch('/api/booking/' + this.booking_id + '/update-china-bankslip', newChinaSlip)
|
||||
.then((response) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Your bankinslip has been submitted, please wait admin to approve.',
|
||||
type: 'success',
|
||||
duration: 5000
|
||||
})
|
||||
|
||||
console.log(response)
|
||||
this.$router.push({
|
||||
name: 'home'
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
this.loading = false
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Please upload your bankin slip first.',
|
||||
type: 'warning',
|
||||
duration: 10000
|
||||
})
|
||||
console.log(error)
|
||||
this.loading_btn = false
|
||||
})
|
||||
|
||||
} else {
|
||||
this.loading_btn = false
|
||||
}
|
||||
confirmInvoice () {
|
||||
this.loading_btn = true
|
||||
axios
|
||||
.post('/api/booking/' + this.$route.params.id + '/confirm-invoice')
|
||||
.then((response) => {
|
||||
console.log(response)
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Your invoice has been uploaded. Order completed !',
|
||||
type: 'success',
|
||||
duration: 5000
|
||||
})
|
||||
this.$router.push({
|
||||
name: 'home'
|
||||
})
|
||||
this.loading_btn = false
|
||||
}).catch((error) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Please upload invoice',
|
||||
type: 'error',
|
||||
duration: 30000
|
||||
})
|
||||
this.loading_btn = false
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
console.log(file, fileList);
|
||||
},
|
||||
|
||||
@@ -124,7 +124,7 @@ export default {
|
||||
|
||||
case 7:
|
||||
this.$router.push({
|
||||
name: 'booking.complete',
|
||||
name: 'booking.admin.complete',
|
||||
params: {id: booking_id }
|
||||
})
|
||||
break
|
||||
|
||||
@@ -63,7 +63,7 @@ export default {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
status: 4,
|
||||
status: 6,
|
||||
bookingConfirmTable: [{
|
||||
data1: 'Order Number :',
|
||||
data2: '001'
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<div align="center">
|
||||
<h4 style="margin-top:5%;">Transfer Completed</h4>
|
||||
<h5> Please upload your PO </h5>
|
||||
<h5> Please upload your purchase order </h5>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<br>
|
||||
|
||||
<div class="bottom clearfix" style="text-align:right;">
|
||||
<el-button :loading="loading" type="primary" @click="uploadPo">Submit</el-button>
|
||||
<el-button :loading="loading_btn" type="primary" @click="uploadPo">Submit</el-button>
|
||||
</div>
|
||||
<!-- upload image end -->
|
||||
|
||||
@@ -116,7 +116,7 @@ export default {
|
||||
return {
|
||||
booking_id: this.$route.params.id,
|
||||
status: 5,
|
||||
loading: false,
|
||||
loading_btn: false,
|
||||
bookingConfirmTable: [{
|
||||
data1: 'Order Number :',
|
||||
data2: '001'
|
||||
@@ -162,7 +162,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
uploadPo () {
|
||||
this.loading = true
|
||||
this.loading_btn = true
|
||||
axios
|
||||
.post('/api/booking/' + this.$route.params.id + '/confirm-po')
|
||||
.then((response) => {
|
||||
@@ -176,14 +176,15 @@ export default {
|
||||
this.$router.push({
|
||||
name: 'home'
|
||||
})
|
||||
this.loading = false
|
||||
this.loading_btn = false
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
loading.close()
|
||||
this.$router.push({
|
||||
name: 'notfound'
|
||||
})
|
||||
this.loading = false
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Please upload purchase order',
|
||||
type: 'error',
|
||||
duration: 30000
|
||||
})
|
||||
this.loading_btn = false
|
||||
})
|
||||
},
|
||||
handleRemove (file, fileList) {
|
||||
|
||||
@@ -376,11 +376,9 @@ export default {
|
||||
.get('/api/booking/')
|
||||
.then((response) => {
|
||||
console.log(response)
|
||||
this.bookingTable = response.data
|
||||
|
||||
this.bookingTable = response.data.data
|
||||
// loading.close()
|
||||
}).catch((error) => {
|
||||
// console.log(error)
|
||||
// loading.close()
|
||||
// this.$router.push({
|
||||
// name: 'notfound'
|
||||
@@ -518,11 +516,19 @@ export default {
|
||||
break
|
||||
|
||||
case 6:
|
||||
this.$router.push({
|
||||
name: 'booking.user.po',
|
||||
params: {id: booking_id }
|
||||
})
|
||||
break
|
||||
|
||||
case 7:
|
||||
this.$router.push({
|
||||
name: 'booking.user.complete',
|
||||
params: {id: booking_id }
|
||||
})
|
||||
break
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<span align="center"><h4>Suppplier Details</h4></span><br>
|
||||
<span align="center"><h4>Supplier Details</h4></span><br>
|
||||
<el-table :data="tableData" border style="width: 100%">
|
||||
<el-table-column prop="comp_name" label="Company Name"></el-table-column>
|
||||
<el-table-column prop="reg_no" label="Registration No"></el-table-column>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
mapGetters
|
||||
} from 'vuex'
|
||||
export default {
|
||||
middleware: 'auth',
|
||||
middleware: 'check-auth',
|
||||
|
||||
computed: {
|
||||
role() {
|
||||
|
||||
@@ -64,8 +64,8 @@ export default [
|
||||
{ path: '/booking/:id/transfer', name: 'booking.user.transfer', component: Transfer },
|
||||
{ path: '/booking/:id/upload-po', name: 'booking.user.uploadpo', component: UploadPo },
|
||||
{ path: '/booking/:id/po-complete', name: 'booking.user.pocomplete', component: PoComplete },
|
||||
{ path: '/booking/:id/po', name: 'booking.complete', component: PurchaseOrder },
|
||||
{ path: '/booking/:id/complete', name: 'booking.complete', component: Completed },
|
||||
{ path: '/booking/:id/po', name: 'booking.user.po', component: PurchaseOrder },
|
||||
{ path: '/booking/:id/complete', name: 'booking.user.complete', component: Completed },
|
||||
|
||||
// Admin booking
|
||||
{ path: '/booking/:id/verification', name: 'booking.admin.verification', component: Verification },
|
||||
|
||||
+5
-3
@@ -42,8 +42,9 @@ 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');
|
||||
});
|
||||
@@ -63,7 +64,6 @@ Route::group(['middleware' => 'guest:api'], function () {
|
||||
Route::group(['middleware' => ['role:admin']], function() {
|
||||
Route::get('admin/booking/', 'BookingController@adminIndex');
|
||||
Route::get('admin/booking/{id}', 'BookingController@adminShow');
|
||||
Route::post('booking/{id}/upload-invoice', 'BookingController@uploadInvoice');
|
||||
|
||||
Route::post('update-rate', 'RateController@store');
|
||||
Route::put('update-rate/{rate}', 'RateController@update');
|
||||
@@ -100,11 +100,13 @@ Route::group(['middleware' => ['role:admin']], function() {
|
||||
Route::get('supplier-booking/{id}', 'BookingSupplierController@show');
|
||||
Route::post('supplier-booking', 'BookingSupplierController@store');
|
||||
Route::put('supplier-booking/{id}', 'BookingSupplierController@update');
|
||||
Route::post('/booking/{id}/confirm-supplier', 'BookingController@confirmSupplier');
|
||||
|
||||
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');
|
||||
Route::post('booking/{id}/upload-invoice', 'BookingController@uploadInvoice');
|
||||
Route::post('booking/{id}/confirm-invoice', 'BookingController@confirmInvoice');
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use App\User;
|
||||
use App\SettingSupplier;
|
||||
use App\Role;
|
||||
use Artisan;
|
||||
|
||||
class SettingSupplierTest extends TestCase
|
||||
{
|
||||
protected $user;
|
||||
protected $settingSupplier;
|
||||
|
||||
public function setUp(){
|
||||
parent::setUp();
|
||||
Artisan::call('db:seed');
|
||||
|
||||
$this->user = factory(User::class)->create();
|
||||
$this->settingSupplier = factory(SettingSupplier::class)->create();
|
||||
$this->user->attachRole(Role::Where('name','admin')->first());
|
||||
}
|
||||
|
||||
public function testStore(){
|
||||
$this->actingAs($this->user)
|
||||
->postJson('api/setting-supplier',[
|
||||
'company_name' => "CompanyABC",
|
||||
'gst_no' => "123321",
|
||||
'supplier_reg_no' => "12332123",
|
||||
'bank_name' => "maybank",
|
||||
'acc_no' => "1231522334"
|
||||
])
|
||||
->assertStatus(201);
|
||||
|
||||
$this->assertDatabaseHas('setting_suppliers', [
|
||||
'acc_no' => '1231522334'
|
||||
]);
|
||||
}
|
||||
|
||||
public function testUpdate(){
|
||||
$this->actingAs($this->user)
|
||||
->json('PUT','api/setting-supplier/' . $this->settingSupplier->id,[
|
||||
'company_name' => "CompanyDDEDED",
|
||||
'gst_no' => "gstgstgstgst",
|
||||
'supplier_reg_no' => "ABC12332123",
|
||||
'bank_name' => "Cimb bank",
|
||||
'acc_no' => "7030303030"
|
||||
])
|
||||
->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testDelete(){
|
||||
$id = $this->settingSupplier->id;
|
||||
$this->actingAs($this->user)
|
||||
->json('DELETE','api/setting-supplier/' . $this->settingSupplier->id,[
|
||||
'id' => $this->settingSupplier->id
|
||||
])
|
||||
->assertStatus(204);
|
||||
|
||||
$this->assertDatabaseMissing('setting_suppliers',[
|
||||
'id' => $id
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -3551,6 +3551,7 @@ return array(
|
||||
'SebastianBergmann\\Timer\\Timer' => $vendorDir . '/phpunit/php-timer/src/Timer.php',
|
||||
'SebastianBergmann\\Version' => $vendorDir . '/sebastian/version/src/Version.php',
|
||||
'SettingCreditSeeder' => $baseDir . '/database/seeds/SettingCreditSeeder.php',
|
||||
'SuppliersTableSeeder' => $baseDir . '/database/seeds/SuppliersTableSeeder.php',
|
||||
'Symfony\\Component\\Console\\Application' => $vendorDir . '/symfony/console/Application.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => $vendorDir . '/symfony/console/CommandLoader/CommandLoaderInterface.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => $vendorDir . '/symfony/console/CommandLoader/ContainerCommandLoader.php',
|
||||
@@ -4145,6 +4146,7 @@ return array(
|
||||
'Tests\\Feature\\RateTest' => $baseDir . '/tests/Feature/RateTest.php',
|
||||
'Tests\\Feature\\RegisterTest' => $baseDir . '/tests/Feature/RegisterTest.php',
|
||||
'Tests\\Feature\\SettingCreditTest' => $baseDir . '/tests/Feature/SettingCreditTest.php',
|
||||
'Tests\\Feature\\SettingSupplierTest' => $baseDir . '/tests/Feature/SettingSupplierTest.php',
|
||||
'Tests\\Feature\\SettingsTest' => $baseDir . '/tests/Feature/SettingsTest.php',
|
||||
'Tests\\TestCase' => $baseDir . '/tests/TestCase.php',
|
||||
'Text_Template' => $vendorDir . '/phpunit/php-text-template/src/Template.php',
|
||||
|
||||
Vendored
+11
-9
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit50cdbea3724e5f1d6267359fe107641a
|
||||
class ComposerStaticInit186bbd0d0f979469b3a193511536d69e
|
||||
{
|
||||
public static $files = array (
|
||||
'6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
|
||||
@@ -12,11 +12,11 @@ class ComposerStaticInit50cdbea3724e5f1d6267359fe107641a
|
||||
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
|
||||
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
|
||||
'2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
|
||||
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
|
||||
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
|
||||
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
|
||||
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
|
||||
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
|
||||
'bd9634f2d41831496de0d3dfe4c94881' => __DIR__ . '/..' . '/symfony/polyfill-php56/bootstrap.php',
|
||||
'f0906e6318348a765ffb6eb24e0d0938' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php',
|
||||
'58571171fd5812e6e447dce228f52f4d' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php',
|
||||
@@ -145,8 +145,8 @@ class ComposerStaticInit50cdbea3724e5f1d6267359fe107641a
|
||||
'phpDocumentor\\Reflection\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/phpdocumentor/reflection-common/src',
|
||||
1 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src',
|
||||
2 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src',
|
||||
1 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src',
|
||||
2 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src',
|
||||
),
|
||||
'Zizaco\\Entrust\\' =>
|
||||
array (
|
||||
@@ -3979,6 +3979,7 @@ class ComposerStaticInit50cdbea3724e5f1d6267359fe107641a
|
||||
'SebastianBergmann\\Timer\\Timer' => __DIR__ . '/..' . '/phpunit/php-timer/src/Timer.php',
|
||||
'SebastianBergmann\\Version' => __DIR__ . '/..' . '/sebastian/version/src/Version.php',
|
||||
'SettingCreditSeeder' => __DIR__ . '/../..' . '/database/seeds/SettingCreditSeeder.php',
|
||||
'SuppliersTableSeeder' => __DIR__ . '/../..' . '/database/seeds/SuppliersTableSeeder.php',
|
||||
'Symfony\\Component\\Console\\Application' => __DIR__ . '/..' . '/symfony/console/Application.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => __DIR__ . '/..' . '/symfony/console/CommandLoader/CommandLoaderInterface.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => __DIR__ . '/..' . '/symfony/console/CommandLoader/ContainerCommandLoader.php',
|
||||
@@ -4573,6 +4574,7 @@ class ComposerStaticInit50cdbea3724e5f1d6267359fe107641a
|
||||
'Tests\\Feature\\RateTest' => __DIR__ . '/../..' . '/tests/Feature/RateTest.php',
|
||||
'Tests\\Feature\\RegisterTest' => __DIR__ . '/../..' . '/tests/Feature/RegisterTest.php',
|
||||
'Tests\\Feature\\SettingCreditTest' => __DIR__ . '/../..' . '/tests/Feature/SettingCreditTest.php',
|
||||
'Tests\\Feature\\SettingSupplierTest' => __DIR__ . '/../..' . '/tests/Feature/SettingSupplierTest.php',
|
||||
'Tests\\Feature\\SettingsTest' => __DIR__ . '/../..' . '/tests/Feature/SettingsTest.php',
|
||||
'Tests\\TestCase' => __DIR__ . '/../..' . '/tests/TestCase.php',
|
||||
'Text_Template' => __DIR__ . '/..' . '/phpunit/php-text-template/src/Template.php',
|
||||
@@ -4765,10 +4767,10 @@ class ComposerStaticInit50cdbea3724e5f1d6267359fe107641a
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit50cdbea3724e5f1d6267359fe107641a::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit50cdbea3724e5f1d6267359fe107641a::$prefixDirsPsr4;
|
||||
$loader->prefixesPsr0 = ComposerStaticInit50cdbea3724e5f1d6267359fe107641a::$prefixesPsr0;
|
||||
$loader->classMap = ComposerStaticInit50cdbea3724e5f1d6267359fe107641a::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit186bbd0d0f979469b3a193511536d69e::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit186bbd0d0f979469b3a193511536d69e::$prefixDirsPsr4;
|
||||
$loader->prefixesPsr0 = ComposerStaticInit186bbd0d0f979469b3a193511536d69e::$prefixesPsr0;
|
||||
$loader->classMap = ComposerStaticInit186bbd0d0f979469b3a193511536d69e::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user