Removing gitignore mess

This commit is contained in:
Mouhamed Lamine
2018-07-04 15:14:55 +08:00
25 changed files with 22806 additions and 12005 deletions
+1
View File
@@ -15,4 +15,5 @@ Homestead.yaml
npm-debug.log
yarn-error.log
.env
vendor/composer/autoload_static.php
package-lock.json
+13 -1
View File
@@ -22,6 +22,7 @@ class BookingController extends Controller
$user = Auth::user();
$bookings = Booking::select('id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
->where('user_id', $user->id)
->orderby('updated_at','desc')
->paginate(10);
@@ -77,7 +78,8 @@ class BookingController extends Controller
public function adminIndex(){
$user = Auth::user();
$bookings = Booking::select('id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
->get();
->orderby('updated_at','desc')
->get();
// reformat to fit frontend structure
foreach ($bookings as $booking) {
@@ -524,6 +526,16 @@ class BookingController extends Controller
$term = $request->input('term');
$china_beneficiary = $request->input('china_beneficiary');
$rates = Rate::orderby('updated_at','desc')->first();
$creditLimit = SettingCredit::orderby('updated_at','desc')->first();
if (!$creditLimit){
return response()->json("Credit limit not set, please contact admin", 405);
}
if($amount > $creditLimit->rmb_credit_limit){
return response()->json(["message" => "Exceed credit limit, please contact our sales team for larger quantitiy"], 400);
}
// TODO : get marking
$marking = "123X";
@@ -47,7 +47,6 @@ class BookingSupplierController extends Controller
// 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");
+1 -1
View File
@@ -35,7 +35,7 @@ class RateController extends Controller
public function show()
{
$rate = DB::table('rates')->latest()->first();
$rate = Rate::latest()->first();
return response()->json($rate, 200);
}
+1
View File
@@ -7,4 +7,5 @@ use Illuminate\Database\Eloquent\Model;
class Rate extends Model
{
protected $fillable = ['x1_cash','x1_cheque','x1_ba','x2_cash','x2_cheque','x2_ba'];
protected $hidden = ['id'];
}
-2
View File
@@ -1,2 +0,0 @@
*.sqlite
package-lock.json
@@ -29,7 +29,7 @@ class CreateUsersTable extends Migration
* @return void
*/
public function down()
{
{
Schema::drop('users');
}
}
@@ -32,6 +32,6 @@ class CreateRatesTable extends Migration
*/
public function down()
{
Schema::dropIfExists('rates');
}
}
@@ -41,8 +41,14 @@ class CreateBookingsTable extends Migration
* @return void
*/
public function down()
{
{
Schema::table('bookings', function(Blueprint $table)
{
$table->dropForeign('bookings_rate_id_foreign');
$table->dropColumn('rate_id');
});
Schema::dropIfExists('bookings');
}
}
@@ -29,6 +29,10 @@ class ChangeUserIdInBookingsTable extends Migration
*/
public function down()
{
Schema::table('bookings', function(Blueprint $table)
{
$table->dropForeign('bookings_user_id_foreign');
$table->dropColumn('user_id');
});
}
}
@@ -28,11 +28,7 @@ class AddBookingsTable extends Migration
$table->string('usd_book_swift_code')->default(' ');
$table->string('usd_book_cnap')->default(' ');
$table->string('usd_book_bank_branch')->default(' ');
$table->boolean('verification_status')->default('1'); // Results in a default value of 1.
// $table->foreign('status_id')
// ->references('id')->on('status')
// ->onDelete('cascade');
$table->boolean('verification_status')->default('1');
});
}
@@ -43,8 +39,6 @@ class AddBookingsTable extends Migration
*/
public function down()
{
Schema::table('bookings', function (Blueprint $table) {
//
});
}
}
@@ -28,11 +28,7 @@ class MakeNullableFieldBookingsTable extends Migration
$table->string('usd_book_swift_code')->nullable()->change();
$table->string('usd_book_cnap')->nullable()->change();
$table->string('usd_book_bank_branch')->nullable()->change();
$table->boolean('verification_status')->nullable()->change(); // Results in a default value of 1.
// $table->foreign('status_id')
// ->references('id')->on('status')
// ->onDelete('cascade');
$table->boolean('verification_status')->nullable()->change();
});
}
@@ -34,6 +34,11 @@ class CreateUserBankSlipsTable extends Migration
*/
public function down()
{
Schema::table('user_bank_slips', function(Blueprint $table)
{
$table->dropForeign('user_bank_slips_book_id_foreign');
});
Schema::dropIfExists('user_bank_slips');
}
}
@@ -30,6 +30,11 @@ class CreatePurchaseOrdersTable extends Migration
*/
public function down()
{
Schema::table('purchase_orders', function(Blueprint $table)
{
$table->dropForeign('purchase_orders_booking_id_foreign');
$table->dropColumn('booking_id');
});
Schema::dropIfExists('purchase_orders');
}
}
@@ -28,6 +28,6 @@ class CreateMarkingTable extends Migration
*/
public function down()
{
Schema::dropIfExists('marking');
Schema::dropIfExists('markings');
}
}
@@ -30,6 +30,12 @@ class CreateInvoiceTable extends Migration
*/
public function down()
{
Schema::table('invoices', function(Blueprint $table)
{
$table->dropForeign('invoices_booking_id_foreign');
$table->dropColumn('booking_id');
});
Schema::dropIfExists('invoices');
}
}
@@ -27,6 +27,10 @@ class AddBookingidForeignkeyToChinabankslipTable extends Migration
*/
public function down()
{
//
Schema::table('china_bank_slips', function(Blueprint $table)
{
$table->dropForeign('china_bank_slips_booking_id_foreign');
$table->dropColumn('booking_id');
});
}
}
+22642
View File
File diff suppressed because it is too large Load Diff
@@ -1,7 +1,7 @@
<template>
<div>
<ul class="nav navbar-nav">
<li class="nav-item dropdown">
<!-- <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ locales[locale] }}
@@ -12,7 +12,7 @@
{{ value }}
</a>
</div>
</li>
</li> -->
<ul class="navbar-nav mr-auto">
<li v-if="(user && role == 'admin')" class="nav-item">
<el-popover placement="top" width="300" v-model="UpdateRatePopoverVisible">
@@ -27,9 +27,9 @@
<a class="nav-link" href="#" role="button" slot="reference">Update Rate</a>
</el-popover>
</li></ul>
<li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.complete' }" class="nav-link">{{ $t('Complete Order') }}</router-link></li>
<!-- <li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.complete' }" class="nav-link">{{ $t('Complete Order') }}</router-link></li> -->
<li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.transaction-history' }" class="nav-link">{{ $t('Transaction History') }}</router-link></li>
<li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.upload-supplier-bank-slip' }" class="nav-link">{{ $t('Upload Supplier Bank Slip to System') }}</router-link></li>
<!-- <li v-if="(user && role == 'admin')" class="nav-item"><router-link :to="{ name: 'admin.upload-supplier-bank-slip' }" class="nav-link">{{ $t('Upload Supplier Bank Slip to System') }}</router-link></li> -->
</ul>
@@ -353,11 +353,16 @@
console.log(error)
// TODO : Show error message
})
} else {
this.loading_btn = false
this.$message({
showClose: true,
message: 'Please fill the supplier form',
type: 'error',
duration: 10000
})
}
})
@@ -358,23 +358,26 @@
})
})
.catch((error) => {
this.loading = false
console.log(error)
this.loading_btn = false
this.$message({
showClose: true,
message: 'Please upload your bankin slip first.',
type: 'warning',
duration: 10000
})
console.log(error)
this.loading_btn = false
})
} else {
this.loading_btn = false
this.$message({
showClose: true,
message: 'Please upload your bankin slip first.',
type: 'warning',
duration: 10000
})
}
})
},
handleRemove(file, fileList) {
console.log(file, fileList);
+13 -15
View File
@@ -1,4 +1,7 @@
<template>
<div>
<div align="right">
<el-button icon="el-icon-refresh" type="primary" size="mini" @click="RefreshBooking()">Refresh</el-button></div>
<!-- Booking Table -->
<el-row :gutter="20">
<div>
@@ -41,6 +44,7 @@
</div>
</el-row>
<!-- Booking Table-end -->
</div>
</template>
<script>
@@ -52,26 +56,20 @@ export default {
return {
status: null,
bookingTable: [
]
],
url: 'api/admin/booking',
}
},
mounted () {
axios
.get('/api/admin/booking')
.then((response) => {
console.log(response.data)
this.bookingTable = response.data
// loading.close()
}).catch((error) => {
// console.log(error)
// loading.close()
// this.$router.push({
// name: 'notfound'
// })
})
this.RefreshBooking()
},
methods: {
RefreshBooking() {
let $this = this
axios.get(this.url).then(response => {
this.bookingTable = response.data
})
},
filterTag (value, row) {
return row.tag === value
},
+75 -38
View File
@@ -57,13 +57,13 @@
<div class="grid-content bg-purple" align="left">X1 :</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">1.70</div>
<div class="grid-content bg-purple" align="center">{{ rate.x1_cash }}</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">1.64</div>
<div class="grid-content bg-purple" align="center">{{ rate.x1_cheque }}</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">1.62</div>
<div class="grid-content bg-purple" align="center">{{ rate.x1_ba }}</div>
</el-col>
</el-row>
@@ -104,13 +104,13 @@
<div class="grid-content bg-purple" align="left">X2 :</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">1.56</div>
<div class="grid-content bg-purple" align="center">{{ rate.x2_cash }}</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">1.64</div>
<div class="grid-content bg-purple" align="center">{{ rate.x2_cheque }}</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">1.62</div>
<div class="grid-content bg-purple" align="center">{{ rate.x2_ba }}</div>
</el-col>
</el-row>
@@ -234,6 +234,8 @@
<br>
<br>
<hr>
<div align="right">
<el-button icon="el-icon-refresh" type="primary" size="mini" @click="RefreshBooking()">Refresh</el-button></div>
<!-- Booking Table -->
<el-row :gutter="20">
<div>
@@ -307,6 +309,14 @@ export default {
term: '',
amount: ''
}),
rate: {
x1_ba: null,
x1_cheque: null,
x1_cash: null,
x2_ba: null,
x2_cash: null,
x2_cheque: null,
},
loading: false,
status: '',
booking: {
@@ -379,9 +389,11 @@ export default {
},
mounted () {
this.getBooking()
this.RefreshBooking()
this.getRate()
},
methods: {
getBooking() {
getRate(){
let $this = this
axios.get(this.url).then(response => {
this.bookingTable = response.data.data
@@ -389,6 +401,19 @@ export default {
$this.makePagination(response.data)
})
},
getBooking() {
let $this = this
axios.get('api/rate').then(response => {
this.rate = response.data
console.log(this.rate)
})
},
RefreshBooking() {
let $this = this
axios.get(this.url).then(response => {
this.bookingTable = response.data.data
})
},
makePagination(data){
let pagination = {
current_page: data.current_page,
@@ -449,49 +474,61 @@ export default {
this.dialogFormVisible1 = true
})
.catch((error) => {
this.$message({
showClose: true,
message: error.response.data.message,
type: 'error',
duration: 10000
});
this.loading = false
console.log(error)
})
} else {
this.loading = false
this.$message({
showClose: true,
message: 'Please fill the booking form in full.',
type: 'error',
duration: 10000
})
}
})
},
createBooking: function () {
this.loading = true,
this.dialogFormVisible1 = true
let newBooking = {
account_name: this.bookingForm.account_name,
account_num: this.bookingForm.account_num,
bank_name: this.bookingForm.bank_name,
bank_branch: this.bookingForm.bank_branch,
amount: this.booking.amount,
term: this.term
}
let newBooking = {
account_name: this.bookingForm.account_name,
account_num: this.bookingForm.account_num,
bank_name: this.bookingForm.bank_name,
bank_branch: this.bookingForm.bank_branch,
amount: this.booking.amount,
term: this.term
}
console.log(newBooking)
axios.post('api/booking', newBooking)
.then((response) => {
this.loading = false
// push with return id
this.$router.push({
name: 'booking.user.upload',
params: {id: response.data.id }
})
console.log(newBooking)
axios.post('api/booking', newBooking)
.then((response) => {
this.loading = false
// push with return id
this.$router.push({
name: 'booking.user.upload',
params: {id: response.data.id }
})
// pass variable to another router
})
.catch((error) => {
this.loading = false
this.$message({
showClose: true,
message: 'Internal server issues. Please contact support',
type: 'error',
duration: 10000
})
console.log(error)
})
// pass variable to another router
})
.catch((error) => {
console.log(error)
this.loading = false
this.$message({
showClose: true,
message: 'Internal server issues. Please contact support',
type: 'error',
duration: 10000
})
})
},
BookingStatus (status, booking_id) {
console.log(status)
+2 -6
View File
@@ -21,7 +21,7 @@ Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::get('rate', 'RateController@show');
//Route::middleware('auth:api')->get('/user', function (Request $request) {
// return $request->user();
//});
@@ -44,7 +44,6 @@ Route::group(['middleware' => 'auth:api'], function () {
Route::post('booking/{book_id}/cancel', 'BookingController@cancel');
Route::get('/booking', 'BookingController@index');
Route::get('/user', 'UserController@show');
Route::patch('settings/profile', 'Settings\ProfileController@update');
Route::patch('settings/password', 'Settings\PasswordController@update');
});
@@ -56,7 +55,6 @@ Route::group(['middleware' => 'guest:api'], function () {
Route::post('register', 'Auth\RegisterController@create');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
Route::post('password/reset', 'Auth\ResetPasswordController@reset');
Route::post('oauth/{driver}', 'Auth\OAuthController@redirectToProvider');
Route::get('oauth/{driver}/callback', 'Auth\OAuthController@handleProviderCallback')->name('oauth.callback');
});
@@ -64,14 +62,12 @@ Route::group(['middleware' => 'guest:api'], function () {
Route::group(['middleware' => ['role:admin']], function() {
Route::get('admin/booking/', 'BookingController@adminIndex');
Route::get('admin/booking/{id}', 'BookingController@adminShow');
Route::post('update-rate', 'RateController@store');
Route::put('update-rate/{rate}', 'RateController@update');
Route::delete('update-rate/{rate}', 'RateController@delete');
Route::get('update-rate', 'RateController@index');
//show current rate
Route::get('rate', 'RateController@show');
Route::get('setting-credit', 'SettingCreditController@index');
Route::get('setting-credit/{credit}', 'SettingCreditController@show');
-11911
View File
File diff suppressed because it is too large Load Diff