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

This commit is contained in:
sengweitoo
2018-06-22 21:26:09 +08:00
9 changed files with 155 additions and 9217 deletions
+1
View File
@@ -9,6 +9,7 @@
/.vscode
/.vagrant
/data
vendor/composer
Homestead.json
Homestead.yaml
npm-debug.log
+23 -11
View File
@@ -18,7 +18,7 @@ class BookingController extends Controller
{
public function index(){
$bookings = Booking::select('id', 'created_at', 'status', 'rate', 'amount', 'bia', 'verification_status')
$bookings = Booking::select('id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
->where('user_id',Auth::user()->id)
->get();
@@ -39,23 +39,29 @@ class BookingController extends Controller
$booking->transfer_amount = $booking->bia;
$booking->track_status = "(". $booking->status ."/6)";
switch ($booking->status) {
case 1:
$booking->status_desc = "Order in progress";
$status_desc = "Order in progress";
break;
case 2:
$booking->status_desc = "Waiting for payment";
$status_desc = "Waiting for payment";
break;
case 3:
$booking->status_desc = "Waiting verification";
$status_desc = "Waiting verification";
break;
case 4:
$booking->status_desc = "Processing transfer";
$status_desc = "Processing transfer";
break;
case 5:
$booking->status_desc = "Transfer Complete, please upload your PO";
$status_desc = "Transfer Complete, please upload your PO";
break;
case 6:
$booking->status_desc = "Processing invoice";
$status_desc = "Processing invoice";
break;
default:
$booking->status_desc = "";
$biastatus_desc = "";
}
$booking->status_desc = $status_desc;
}
return $bookings;
@@ -289,11 +295,17 @@ class BookingController extends Controller
$user_po = new PurchaseOrder;
$user_po->image_path = $unique_image_path;
$user_po->book_id = $booking->id;
$user_po->amount = $request->input('amount');
$user_po->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 = 5;
$booking->save();
return response()->json(['message'=>'Success'],200);
}
public function delete(Booking $book_id)
{
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveAmountcolumnFromPoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('purchase_orders', function (Blueprint $table) {
$table->dropColumn('amount');
// $table->dropColumn('reject_reason');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('purchase_orders', function (Blueprint $table) {
$table->double('amount');
// $table->dropColumn('reject_reason');
});
}
}
+45 -12
View File
@@ -19,19 +19,22 @@
</div>
<!-- upload image -->
<el-upload class="upload-demo" drag action="https://jsonplaceholder.typicode.com/posts/" :on-preview="handlePreview" :on-remove="handleRemove"
:file-list="fileList" multiple>
<el-upload class="upload-demo" drag v-bind:action="'/api/booking/' + booking_id + '/upload-po'"
:on-exceed="handleExceed"
:on-preview="handlePreview"
:on-remove="handleRemove"
multiple>
<i class="el-icon-upload"></i>
<div class="el-upload__text">Drop file here or
<em>click to upload</em>
</div>
<div class="el-upload__tip" slot="tip">jpg/png files with a size less than 500kb</div>
<div class="el-upload__tip" slot="tip">jpg/png/pdf files with a size less than 3mb</div>
</el-upload>
<br>
<div class="bottom clearfix" style="text-align:right;">
<el-button @click="uploadPo" type="primary">Submit</el-button>
<el-button @click="uploadPo" :loading="loading" type="primary">Submit</el-button>
</div>
<!-- upload image end -->
@@ -103,6 +106,7 @@
<script>
import VueCountdown from '@dmaksimovic/vue-countdown'
import ProgressTrack from '~/components/ProgressTrack'
import axios from 'axios'
export default {
components: {
@@ -110,7 +114,9 @@
},
data() {
return {
booking_id: this.$route.params.id,
status: 5,
loading: false,
bookingConfirmTable: [{
data1: 'Order Number :',
data2: '001'
@@ -156,15 +162,42 @@
},
methods: {
uploadPo(){
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 = true
axios
.post('/api/booking/' + this.$route.params.id + '/confirm-po')
.then((response) => {
console.log(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 = false
}).catch((error) => {
console.log(error)
loading.close()
this.$router.push({
name: 'notfound'
})
this.loading = false
})
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
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 }`);
}
}
}
@@ -32,7 +32,7 @@
<div align="center">
<vue-countdown :time="booking.timeout">
<vue-countdown :countdownend="handleCoutdownend" :time="booking.timeout">
<template slot-scope="props">Time Remaining<br>{{ props.days }} days, {{ props.hours }} hours, {{ props.minutes }} minutes, {{ props.seconds }} seconds.</template>
</vue-countdown>
<!-- <button v-on:click="startTimer">Start timer</button> -->
@@ -140,6 +140,19 @@
this.booking.timeout = response.data.timeout * 1000
this.start = true;
loading.close()
if(this.booking.timeout < 0 ){
this.$message({
showClose: true,
message: 'Booking timeout, please make another booking.',
type: 'error',
duration: 30000,
});
this.$router.push({
name: 'home'
})
}
}).catch((error) => {
console.log(error)
loading.close()
@@ -150,6 +163,17 @@
},
methods: {
handleCoutdownend(){
this.$message({
showClose: true,
message: 'Booking timeout, please make another booking.',
type: 'error',
duration: 30000,
});
this.$router.push({
name: 'home'
})
},
handleRemove(file, fileList) {
console.log(file, fileList)
},
+25 -94
View File
@@ -239,17 +239,17 @@
<el-row :gutter="20">
<div>
<el-table :data="bookingTable">
<el-table-column label="No." width="50">
<el-table-column label="No." width="100">
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">Update</el-button>
<el-button type="text" slot-scope="scope" @click="(event) => { BookingStatus(scope.row.status, scope.row.id) }"> {{scope.row.id}}</el-button>
</el-table-column>
<el-table-column label="DateTime" prop="created_at" width="180" sortable/>
<!-- <el-table-column label="Term" :filters="[{text: 'X1', value: 'X1'}, {text: 'X2', value: 'X2'}]" :filter-method="filterHandler">
<el-table-column label="Term" prop="term" :filters="[{text: 'X1', value: 'X1'}, {text: 'X2', value: 'X2'}]" width="100" :filter-method="filterHandler">
</el-table-column> -->
<el-table-column label="Rate" width="74" prop="rate" />
<el-table-column label="Amount" prop="amount" justify="center" width="110" />
<el-table-column :filters="[{text: 'RMB', value: 'RMB'}, {text: 'USD', value: 'USD'}]" :filter-method="filterHandler" label="Transfer Amount"
prop="transfer_amount" width="150" />
prop="transfer_amount" width="170" />
<!-- <el-table-column label="ETA" sortable width="100"/> -->
<!-- <el-table-column label="Payment Method" :filters="[{text: 'Cash', value: 'Cash'}, {text: 'Cheque', value: 'Cheque'}, {text: 'BA', value: 'BA'}]" :filter-method="filterHandler">
</el-table-column> -->
@@ -265,13 +265,14 @@
</template>
</el-table-column>
<!-- <el-table-column label="Balance" prop="transfer_amount" sortable width="100"/> -->
<el-table-column prop="timeout" label="Bankin Timeout" />
<!-- <el-table-column prop="timeout" label="Bankin Timeout" /> -->
<el-table-column :filters="[{ text: 'Success', value: 'Success' }, { text: 'Pending', value: 'Pending' }]" :filter-method="filterTag"
label="" width="180" filter-placement="bottom-end">
<template slot-scope="scope">
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">Update</el-button>
<el-button type="text" slot-scope="scope" @click="(event) => { BookingStatus(scope.row.status, scope.row.id) }"> View Status </el-button>
<!-- <template slot-scope="scope">
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">View Status</el-button>
<el-button size="mini" type="danger" @click="BookingStatus(scope.$index, scope.row)">Cancel</el-button>
</template>
</template> -->
</el-table-column>
</el-table>
</div>
@@ -353,72 +354,7 @@
dialogFormVisible: false,
dialogFormVisible1: false,
formLabelWidth: '0px',
bookingTable: [{
created_at: '12/1/2018',
id: '12',
rate: '1.23',
amount: 'RM 1000',
transfer_amount: 'RMB 10000',
track_status: '(1/6)',
status_desc: 'Waiting for payment',
timeout: '56:00:00',
status: 2
},
{
created_at: '12/1/2018',
id: '13',
rate: '1.23',
amount: 'RM 1000',
transfer_amount: 'RMB 10000',
track_status: '(2/6)',
status_desc: 'Waiting verification',
timeout: '56:00:00',
status: 3
},
{
created_at: '12/1/2018',
id: '14',
rate: '1.23',
amount: 'RM 1000',
transfer_amount: 'RMB 10000',
track_status: '(3/6)',
status_desc: 'Processing transfer',
timeout: '56:00:00',
status: 4
},
{
created_at: '12/1/2018',
id: '15',
rate: '1.23',
amount: 'RM 1000',
transfer_amount: 'RMB 10000',
track_status: '(4/6)',
status_desc: 'Transfer Complete, please upload your PO',
timeout: '56:00:00',
status: 5
},
{
created_at: '12/1/2018',
id: '16',
rate: '1.23',
amount: 'RM 1000',
transfer_amount: 'RMB 10000',
track_status: '(5/6)',
status_desc: 'Processing invoice',
timeout: '56:00:00',
status: 6
},
{
created_at: '12/1/2018',
id: '17',
rate: '1.23',
amount: 'RM 1000',
transfer_amount: 'RMB 10000',
track_status: '(6/6)',
status_desc: 'Order Completed',
timeout: '56:00:00',
status: 6
}
bookingTable: [
],
bookingConfirmTable: {
date: 'undefined',
@@ -439,11 +375,7 @@
.then((response) => {
console.log(response)
this.bookingTable = response.data
// this.booking.amount = response.data.amount
// this.booking.bankin_amount = response.data.bia
// this.booking.timeout = response.data.timeout * 1000
// this.start = true;
//loading.close()
}).catch((error) => {
// console.log(error)
@@ -548,7 +480,7 @@
return
})
},
BookingStatus(status, row) {
BookingStatus(status, booking_id) {
console.log(status)
// TODO : Get booking status from server
this.status = status
@@ -557,46 +489,45 @@
case 1:
this.$router.push({
name: 'booking.user.upload',
params: {id: "12" }
params: {id: booking_id }
})
case 2:
this.$router.push({
name: 'booking.user.upload',
params: {id: "12" }
this.$router.push({
name: 'booking.confirmation',
params: {id: booking_id }
})
break;
case 3:
this.$router.push({
name: 'booking.confirmation',
params: {id: "1" }
this.$router.push({
name: 'booking.transfer',
params: {id: booking_id }
})
break;
case 4:
this.$router.push({
name: 'booking.transfer',
params: {id: "1" }
this.$router.push({
name: 'booking.user.uploadpo',
params: {id: booking_id }
})
break;
case 5:
this.$router.push({
name: 'booking.user.uploadpo',
params: {id: "1" }
name: 'booking.user.pocomplete',
params: {id: booking_id }
})
break;
case 6:
this.$router.push({
name: 'booking.complete',
params: {id: "1" }
params: {id: booking_id }
})
break;
default:
break
}
}
}
},
}
</script>
+2 -1
View File
@@ -36,7 +36,8 @@ Route::group(['middleware' => 'auth:api'], function () {
Route::post('/booking/calculation', 'BookingController@calculation');
Route::post('/booking/{book_id}/cancel', 'BookingController@cancel');
Route::post('/booking/{id}/upload-user-bankslip', 'BookingController@uploadbankslip');
Route::post('/booking/{id}/upload-po', 'BookingController@uploadPurchaseOrder');
Route::post('/booking/{id}/upload-po', 'BookingController@uploadPurchaseOrder');
Route::post('/booking/{id}/confirm-po', 'BookingController@confirmPurchaseOrder');
Route::patch('/booking/{id}/bankslip-amount', 'BookingController@updateBankSlipAmount');
Route::post('booking/{book_id}/reject-bank-slip','BookingController@rejectBankSlip');
Route::post('booking/{book_id}/approve-bank-slip','BookingController@approveBankSlip');
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff