mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-28 08:44:16 +00:00
Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/exchange into admin_Completed_Order
This commit is contained in:
@@ -13,11 +13,6 @@ DB_DATABASE=default
|
||||
DB_USERNAME=default
|
||||
DB_PASSWORD=secret
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
QUEUE_DRIVER=sync
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use App\Rate;
|
||||
|
||||
class RateUpdated implements ShouldBroadcast
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $rate;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Rate $rate)
|
||||
{
|
||||
$this->rate = $rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return \Illuminate\Broadcasting\Channel|array
|
||||
*/
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new Channel('rate-updated');
|
||||
//return new PrivateChannel('rate-updated');
|
||||
}
|
||||
|
||||
public function broadcastWith() {
|
||||
return [
|
||||
'rate' => $this->rate,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,11 +25,13 @@ class BookingController extends Controller
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('user_id', 'id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->where('user_id', Auth::user()->id)
|
||||
->where('status', '=', '6')
|
||||
->orwhere('status', '=', '4')
|
||||
->orwhere('status', '=', '3')
|
||||
->orwhere('status', '=', '2')
|
||||
->orwhere('status', '=', '1')
|
||||
->where(function ($query) {
|
||||
$query->where('status', '=', '6')
|
||||
->orwhere('status', '=', '4')
|
||||
->orwhere('status', '=', '3')
|
||||
->orwhere('status', '=', '2')
|
||||
->orwhere('status', '=', '1');
|
||||
})
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
|
||||
@@ -159,14 +161,13 @@ class BookingController extends Controller
|
||||
public function adminIndex(){
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('user_id', 'id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
|
||||
->where('admin_status', '=', '5')
|
||||
->orwhere('admin_status', '=', '4')
|
||||
->orwhere('admin_status', '=', '3')
|
||||
->orwhere('admin_status', '=', '2')
|
||||
->orwhere('admin_status', '=', '1')
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
->where('admin_status', '=', '5')
|
||||
->orwhere('admin_status', '=', '4')
|
||||
->orwhere('admin_status', '=', '3')
|
||||
->orwhere('admin_status', '=', '2')
|
||||
->orwhere('admin_status', '=', '1')
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
|
||||
// reformat to fit frontend structure
|
||||
foreach ($bookings as $booking) {
|
||||
@@ -469,7 +470,8 @@ class BookingController extends Controller
|
||||
if ($amount >= 10000 && ($term == 'x2_cash' || $term == 'x2_cheque' || $term == 'x2_ba')) {
|
||||
$svcharge = 0;
|
||||
} else {
|
||||
$svcharge = 20.00;
|
||||
//$svcharge = 20.00;
|
||||
$svcharge = 0; // UPDATE ON : 15-8-2018 from PM
|
||||
}
|
||||
|
||||
$subtotal = round(($amount + $svcharge) / $rate, 2);
|
||||
@@ -638,16 +640,9 @@ class BookingController extends Controller
|
||||
$booking->admin_status = 2;
|
||||
$booking->save();
|
||||
|
||||
// Add notification message to admin
|
||||
$adminNotification = new Notification;
|
||||
$adminNotification->detail = "A bankslip is uploaded for booking " . $booking->id;
|
||||
$adminNotification->link = "/booking/" . $booking->id . "/verification";
|
||||
$adminNotification->user_id = User::withRole('admin')->first()->id;
|
||||
$adminNotification->save();
|
||||
|
||||
$user_bankslip->transfer_amount = $request->input('transfer_amount');
|
||||
$user_bankslip->save();
|
||||
return response()->json($adminNotification,200);
|
||||
return response()->json(["success"=>true],200);
|
||||
}
|
||||
|
||||
public function uploadPurchaseOrder(Request $request, $id)
|
||||
@@ -796,7 +791,8 @@ class BookingController extends Controller
|
||||
if ($amount >= 10000 && ($term == 'x2_cash' || $term == 'x2_cheque' || $term == 'x2_ba')) {
|
||||
$svcharge = 0;
|
||||
} else {
|
||||
$svcharge = 20.00;
|
||||
//$svcharge = 20.00;
|
||||
$svcharge = 0; // UPDATE ON : 15-8-2018 from PM
|
||||
}
|
||||
|
||||
$subtotal = round(($amount + $svcharge) / $rate,2);
|
||||
@@ -868,21 +864,13 @@ class BookingController extends Controller
|
||||
$booking->status = 4;
|
||||
if($booking->term !== "x1_ba" || $booking->term !== "x2_cheque"){
|
||||
$booking->admin_status = 3;
|
||||
// Add notification message to user
|
||||
$userNotification = new Notification;
|
||||
$userNotification->detail = "Your bankslip for booking " . $booking->id . " is approved.";
|
||||
$userNotification->link = "/booking/" . $booking->id . "/transfer";
|
||||
$userNotification->user_id = $booking->user_id;
|
||||
$userNotification->save();
|
||||
// TODO : Add notification message to user
|
||||
|
||||
}
|
||||
else{
|
||||
$booking->admin_status = 5;
|
||||
// Add notification message to user
|
||||
$userNotification = new Notification;
|
||||
$userNotification->detail = "Your bankslip for booking " . $booking->id . " is approved.";
|
||||
$userNotification->link = "/booking/" . $booking->id . "/supplier";
|
||||
$userNotification->user_id = $booking->user_id;
|
||||
$userNotification->save();
|
||||
// TODO : Add notification message to user
|
||||
|
||||
}
|
||||
$booking->save();
|
||||
|
||||
@@ -981,11 +969,11 @@ class BookingController extends Controller
|
||||
$booking->admin_status = 5; // upload china bankslip
|
||||
|
||||
if($booking->save()){
|
||||
$userNotification = new Notification;
|
||||
$userNotification->detail = "Supplier booking report for booking " . $booking->id . " is completed.";
|
||||
$userNotification->link = "/booking/" . $booking->id . "/transfer";
|
||||
$userNotification->user_id = $booking->user_id;
|
||||
$userNotification->save();
|
||||
// $userNotification = new Notification;
|
||||
// $userNotification->detail = "Supplier booking report for booking " . $booking->id . " is completed.";
|
||||
// $userNotification->link = "/booking/" . $booking->id . "/transfer";
|
||||
// $userNotification->user_id = $booking->user_id;
|
||||
// $userNotification->save();
|
||||
return response()->json(['message'=>"Success"],200);
|
||||
}
|
||||
}
|
||||
@@ -1002,12 +990,6 @@ class BookingController extends Controller
|
||||
$booking->admin_status = 6; // upload invoice
|
||||
$booking->save();
|
||||
|
||||
$adminNotification = new Notification;
|
||||
$adminNotification->detail = "Purchase Order for booking " . $booking->id . " is uploaded.";
|
||||
$adminNotification->link = "/booking/" . $booking->id . "/upload-invoice";
|
||||
$adminNotification->user_id = User::withRole('admin')->first()->id;
|
||||
$adminNotification->save();
|
||||
|
||||
return response()->json($purchase_order,200);
|
||||
}
|
||||
|
||||
@@ -1025,11 +1007,6 @@ class BookingController extends Controller
|
||||
$booking->admin_status = 7; // completed
|
||||
|
||||
if($booking->save()){
|
||||
$adminNotification = new Notification;
|
||||
$adminNotification->detail = "Invoice for booking " . $booking->id . " is uploaded.";
|
||||
$adminNotification->link = "/booking/" . $booking->id . "/complete";
|
||||
$adminNotification->user_id = $booking->user_id;
|
||||
$adminNotification->save();
|
||||
return response()->json(['message'=>"Success"],200);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace App\Http\Controllers;
|
||||
use App\ChinaBankSlip;
|
||||
use App\Booking;
|
||||
use App\User;
|
||||
use App\Notification;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Validator;
|
||||
@@ -82,13 +81,6 @@ class ChinaBankSlipController extends Controller
|
||||
$booking->admin_status = 6;
|
||||
$booking->save();
|
||||
|
||||
$userNotification = new Notification;
|
||||
$userNotification->detail = "Your china bankslip for booking " . $booking->id . " is uploaded.";
|
||||
$userNotification->link = "/booking/" . $booking->id . "/upload-po";
|
||||
$userNotification->user_id = $booking->user_id;
|
||||
$userNotification->save();
|
||||
|
||||
|
||||
return response()->json(["message"=> "Success"],200);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Rate;
|
||||
use App\User;
|
||||
use App\Events\RateUpdated;
|
||||
|
||||
class RateObserver
|
||||
{
|
||||
/**
|
||||
* Handle the rate "created" event.
|
||||
*
|
||||
* @param \App\Rate $rate
|
||||
* @return void
|
||||
*/
|
||||
public function created(Rate $rate)
|
||||
{
|
||||
event(new RateUpdated($rate));
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ namespace App\Providers;
|
||||
use Laravel\Dusk\DuskServiceProvider;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Observers\RateObserver;
|
||||
use App\Rate;
|
||||
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
@@ -21,6 +23,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
Schema::defaultStringLength(191);
|
||||
}
|
||||
*/
|
||||
Rate::observe(RateObserver::class);
|
||||
Schema::defaultStringLength(191);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ class BroadcastServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
//Broadcast::routes();
|
||||
Broadcast::routes(["middleware" => ["auth:api"]]);
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
https://exchange-staging.izyim.com {
|
||||
proxy /phpmyadmin 127.0.0.1:8090
|
||||
root /var/www/public
|
||||
|
||||
fastcgi / 127.0.0.1:9000 php {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"laravel/socialite": "^3.0",
|
||||
"laravel/tinker": "~1.0",
|
||||
"laravelcollective/html": "^5.6",
|
||||
"pusher/pusher-php-server": "~3.0",
|
||||
"tymon/jwt-auth": "^1.0.0-rc.2",
|
||||
"zizaco/entrust": "dev-master"
|
||||
},
|
||||
|
||||
+1
-1
@@ -165,7 +165,7 @@ return [
|
||||
*/
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
|
||||
@@ -36,7 +36,8 @@ return [
|
||||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
//
|
||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||
'encrypted' => true,
|
||||
],
|
||||
],
|
||||
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveForeightFromSettingActiveBanksTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('setting_active_banks', function (Blueprint $table) {
|
||||
$table->dropForeign('setting_active_banks_beneficiary_id_foreign');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('setting_active_banks', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class DropNotificationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateNotificationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('type');
|
||||
$table->morphs('notifiable');
|
||||
$table->text('data');
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call(SettingActiveBankSeeder::class);
|
||||
$this->call(SettingTaxRateSeeder::class);
|
||||
$this->call(SettingBillingChargeSeeder::class);
|
||||
$this->call(NotificationSeeder::class);
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class NotificationSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$user = User::where("email", "user@example.com")->first();
|
||||
$admin = User::where("email", "admin@example.com")->first();
|
||||
|
||||
DB::table('notifications')->insert([
|
||||
'detail' => 'This is an user seeder notification',
|
||||
'user_id' => $user->id,
|
||||
'link' => '/',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
]);
|
||||
|
||||
DB::table('notifications')->insert([
|
||||
'detail' => 'This is an admin seeder notification',
|
||||
'user_id' => $admin->id,
|
||||
'link' => '/',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,10 @@
|
||||
"element-ui": "^2.4.4",
|
||||
"jquery": "^3.3.1",
|
||||
"js-cookie": "^2.2.0",
|
||||
"laravel-echo": "^1.4.0",
|
||||
"npm": "^6.0.1",
|
||||
"popper.js": "^1.14.1",
|
||||
"pusher-js": "^4.3.0",
|
||||
"sweetalert2": "^7.15.1",
|
||||
"vform": "^1.0.0",
|
||||
"vue": "^2.5.16",
|
||||
|
||||
@@ -210,6 +210,7 @@ export default {
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</router-link>
|
||||
|
||||
<template v-if="user">
|
||||
<el-dropdown trigger="click" align="right">
|
||||
<!-- <el-dropdown trigger="click" align="right">
|
||||
<el-badge :value="bellBadge > 0 ? bellBadge : ''" class="item">
|
||||
<el-button icon="el-icon-bell" circle @click="refreshNoti()"></el-button>
|
||||
</el-badge>
|
||||
@@ -32,7 +32,7 @@
|
||||
<el-button v-if="pagination.next_page_url != null" id="notification-load-more" v-on:click='fetchPaginateBooking(pagination.next_page_url)'>Load more</el-button>
|
||||
<div v-else id="notification-load-more"></div>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-dropdown> -->
|
||||
</template>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false">
|
||||
@@ -98,8 +98,8 @@ export default {
|
||||
|
||||
data: () => ({
|
||||
appName: window.config.appName,
|
||||
notification:[],
|
||||
loadingNotification:false,
|
||||
//notification:[],
|
||||
//loadingNotification:false,
|
||||
bellBadge : 0,
|
||||
unread_message_length:0,
|
||||
url: '/api/notification/user',
|
||||
@@ -108,11 +108,6 @@ export default {
|
||||
computed: mapGetters({
|
||||
user: 'auth/user'
|
||||
}),
|
||||
mounted(){
|
||||
if(this.user){
|
||||
this.getNotification(this.url)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async logout(){
|
||||
// Log out the user.
|
||||
@@ -121,33 +116,33 @@ export default {
|
||||
// Redirect to login.
|
||||
this.$router.push({ name: 'login' });
|
||||
},
|
||||
refreshNoti() {
|
||||
axios.get(this.url).then(response => {
|
||||
this.bookingTable = response.data.data
|
||||
this.notification = response.data.message.data;
|
||||
this.bellBadge = response.data.unread_message.length;
|
||||
this.makePagination(response.data.message);
|
||||
console.log(response.data);
|
||||
})
|
||||
},
|
||||
getNotification(url){
|
||||
this.notification = [];
|
||||
this.loadingNotification=true;
|
||||
axios
|
||||
.get(url)
|
||||
.then((response) => {
|
||||
this.loadingNotification=false;
|
||||
this.notification = response.data.message.data;
|
||||
this.bellBadge = response.data.unread_message.length;
|
||||
this.makePagination(response.data.message);
|
||||
console.log(response.data);
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
this.$router.push({
|
||||
name: 'notfound'
|
||||
})
|
||||
})
|
||||
},
|
||||
// refreshNoti() {
|
||||
// axios.get(this.url).then(response => {
|
||||
// this.bookingTable = response.data.data
|
||||
// this.notification = response.data.message.data;
|
||||
// this.bellBadge = response.data.unread_message.length;
|
||||
// this.makePagination(response.data.message);
|
||||
// console.log(response.data);
|
||||
// })
|
||||
// },
|
||||
// getNotification(url){
|
||||
// this.notification = [];
|
||||
// this.loadingNotification=true;
|
||||
// axios
|
||||
// .get(url)
|
||||
// .then((response) => {
|
||||
// this.loadingNotification=false;
|
||||
// this.notification = response.data.message.data;
|
||||
// this.bellBadge = response.data.unread_message.length;
|
||||
// this.makePagination(response.data.message);
|
||||
// console.log(response.data);
|
||||
// }).catch((error) => {
|
||||
// console.log(error)
|
||||
// this.$router.push({
|
||||
// name: 'notfound'
|
||||
// })
|
||||
// })
|
||||
// },
|
||||
makePagination(data){
|
||||
let pagination ={
|
||||
current_page: data.current_page,
|
||||
@@ -159,7 +154,7 @@ export default {
|
||||
},
|
||||
fetchPaginateBooking(url) {
|
||||
this.url = url;
|
||||
this.loadingNotification=true;
|
||||
//this.loadingNotification=true;
|
||||
if(this.url !== null){
|
||||
axios
|
||||
.get(url)
|
||||
@@ -177,21 +172,21 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
readNotification(notification_id){
|
||||
axios
|
||||
.post('/api/notification/read-notification/'+notification_id)
|
||||
.then((response) => {
|
||||
this.getNotification(this.url);
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
this.$router.push({
|
||||
name: 'notfound'
|
||||
})
|
||||
})
|
||||
},
|
||||
// readNotification(notification_id){
|
||||
// axios
|
||||
// .post('/api/notification/read-notification/'+notification_id)
|
||||
// .then((response) => {
|
||||
// this.getNotification(this.url);
|
||||
// }).catch((error) => {
|
||||
// console.log(error)
|
||||
// this.$router.push({
|
||||
// name: 'notfound'
|
||||
// })
|
||||
// })
|
||||
// },
|
||||
navigateTo(nav) {
|
||||
window.location.href = nav;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import store from '~/store'
|
||||
|
||||
export default (to, from, next) => {
|
||||
console.log(store.getters['auth/role'])
|
||||
if (store.getters['auth/role'] !== 'admin') {
|
||||
next({ name: 'home' })
|
||||
} else {
|
||||
|
||||
@@ -402,6 +402,8 @@ import Form from 'vform'
|
||||
import LoginWithGithub from '~/components/LoginWithGithub'
|
||||
import store from '~/store'
|
||||
import axios from 'axios'
|
||||
import Echo from "laravel-echo"
|
||||
import Pusher from "pusher-js"
|
||||
|
||||
export default {
|
||||
middleware: ['auth'],
|
||||
@@ -526,8 +528,39 @@ export default {
|
||||
this.initBooking();
|
||||
this.getRate();
|
||||
this.getCompleteBooking();
|
||||
this.listen();
|
||||
},
|
||||
methods: {
|
||||
// listen to update rate changes
|
||||
listen(){
|
||||
window.Echo = new Echo({
|
||||
broadcaster: 'pusher',
|
||||
key: window.config.pusherUrl,
|
||||
cluster: 'ap1',
|
||||
encrypted: true,
|
||||
auth: {
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + localStorage.getItem("token")
|
||||
},
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
window.Echo.channel('rate-updated')
|
||||
.listen('RateUpdated', response => {
|
||||
if (! ('Notification' in window)) {
|
||||
alert('Web Notification is not supported');
|
||||
return;
|
||||
}
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'New rate updated at ' + response.rate.created_at,
|
||||
duration: 20000
|
||||
});
|
||||
this.rate = response.rate
|
||||
});
|
||||
|
||||
},
|
||||
getBooking(){
|
||||
let $this = this
|
||||
axios.get(this.url).then(response => {
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
<span align="center"><h4>Bank Setting</h4></span><br>
|
||||
<el-form :inline="true">
|
||||
<el-form-item>
|
||||
Active CIEF bank account for today :
|
||||
X1 :
|
||||
Active Bank Account for X1:
|
||||
<el-select v-model="active_bank_setting.x1_bank_id" size="mini">
|
||||
<el-option
|
||||
v-for="item in options_CIEF"
|
||||
@@ -14,8 +13,9 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<br>
|
||||
<el-form-item>
|
||||
X2 :
|
||||
Active Bank Account for X2 :
|
||||
<el-select v-model="active_bank_setting.x2_bank_id" size="mini">
|
||||
<el-option
|
||||
v-for="item in options_CIEF"
|
||||
@@ -26,7 +26,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
Active CIEF China Beneficiary Account for Today :
|
||||
Active China Beneficiary Account:
|
||||
<el-select v-model="active_bank_setting.beneficiary_id" size="mini">
|
||||
<el-option
|
||||
v-for="item in options_china_bank"
|
||||
@@ -36,6 +36,7 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<br>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="mini" :loading="loading_btn" @click="EditActiveBankSetting">Update</el-button>
|
||||
</el-form-item>
|
||||
@@ -74,7 +75,7 @@ export default {
|
||||
this.options_CIEF = malaysiaBankData.map(function(item){
|
||||
return {
|
||||
value : item.id,
|
||||
label : item.acc_no,
|
||||
label : item.company_name + " - " + item.acc_no,
|
||||
};
|
||||
});
|
||||
})
|
||||
@@ -96,7 +97,7 @@ export default {
|
||||
this.options_china_bank = chinaBankData.map(function(item){
|
||||
return {
|
||||
value : item.id,
|
||||
label : item.acc_no,
|
||||
label : item.company_name + " - " + item.acc_no,
|
||||
};
|
||||
});
|
||||
this.options_china_bank.unshift({
|
||||
|
||||
@@ -23,41 +23,38 @@
|
||||
<el-dialog title="Add New Data" align="center" :visible.sync="AddDatadialogVisible" width="40%">
|
||||
<el-form label-width="150px">
|
||||
<el-form-item label="Company Name">
|
||||
<el-input v-model="beneficiariesForm.company_name" v-validate="'required|max:191'" name="company_name"></el-input>
|
||||
<el-input v-model="beneficiariesForm.company_name" name="company_name"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Name">
|
||||
<el-input v-model="beneficiariesForm.bank_name" v-validate="'required|max:191'" name="bank_name"></el-input>
|
||||
<el-input v-model="beneficiariesForm.bank_name" name="bank_name"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Account No">
|
||||
<el-input v-model="beneficiariesForm.acc_no" v-validate="'required|max:191'" name="acc_no"></el-input>
|
||||
<el-input v-model="beneficiariesForm.acc_no" name="acc_no"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Address">
|
||||
<el-input v-model="beneficiariesForm.bank_address" v-validate="'required|max:191'" name="bank_address"></el-input>
|
||||
<el-input v-model="beneficiariesForm.bank_address" name="bank_address"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="SWIFT Code">
|
||||
<el-input v-model="beneficiariesForm.swift" v-validate="'required|max:191'" name="swift"></el-input>
|
||||
<el-input v-model="beneficiariesForm.swift" name="swift"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="CNAP">
|
||||
<el-input v-model="beneficiariesForm.cnap" v-validate="'required|max:191'" name="cnap" ></el-input>
|
||||
<el-input v-model="beneficiariesForm.cnap" name="cnap" ></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Branch">
|
||||
<el-input v-model="beneficiariesForm.bank_branch" v-validate="'required|max:191'" name="bank_branch"></el-input>
|
||||
<el-input v-model="beneficiariesForm.bank_branch" name="bank_branch"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div align="center">
|
||||
<el-button @click="AddDatadialogVisible = false">Cancel</el-button>
|
||||
<el-button type="primary" :loading="loading_btn" @click="CreateBeneficiaries" :disabled="beneficiariesForm.company_name=='' || beneficiariesForm.bank_name=='' || beneficiariesForm.acc_no=='' || beneficiariesForm.bank_address=='' || beneficiariesForm.swift =='' || beneficiariesForm.cnap=='' || beneficiariesForm.bank_branch=='' ? true : false">OK</el-button>
|
||||
<el-button type="primary" :loading="loading_btn" @click="CreateBeneficiaries" :disabled="beneficiariesForm.company_name=='' || beneficiariesForm.bank_name=='' || beneficiariesForm.acc_no=='' ? true : false">OK</el-button>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
* Please key in the data in Chinese
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog align="center" :visible.sync="DoneAddDatadialogVisible" width="30%">
|
||||
<span>Data Added Successfully</span><br><br>
|
||||
@@ -70,35 +67,35 @@
|
||||
<el-dialog title="Edit Data" align="center" :visible.sync="EditDatadialogVisible" width="40%">
|
||||
<el-form label-width="150px">
|
||||
<el-form-item label="Company Name">
|
||||
<el-input v-model="beneficiariesForm.company_name" v-validate="'required|max:191'" name="company_name"></el-input>
|
||||
<el-input v-model="beneficiariesForm.company_name" name="company_name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Name">
|
||||
<el-input v-model="beneficiariesForm.bank_name" v-validate="'required|max:191'" name="bank_name"></el-input>
|
||||
<el-input v-model="beneficiariesForm.bank_name" name="bank_name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Account No">
|
||||
<el-input v-model="beneficiariesForm.acc_no" v-validate="'required|max:191'" name="acc_no"></el-input>
|
||||
<el-input v-model="beneficiariesForm.acc_no" name="acc_no"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Address">
|
||||
<el-input v-model="beneficiariesForm.bank_address" v-validate="'required|max:191'" name="bank_address"></el-input>
|
||||
<el-input v-model="beneficiariesForm.bank_address" name="bank_address"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="SWIFT Code">
|
||||
<el-input v-model="beneficiariesForm.swift" v-validate="'required|max:191'" name="swift"></el-input>
|
||||
<el-input v-model="beneficiariesForm.swift" name="swift"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="CNAP">
|
||||
<el-input v-model="beneficiariesForm.cnap" v-validate="'required|max:191'" name="cnap" ></el-input>
|
||||
<el-input v-model="beneficiariesForm.cnap" name="cnap" ></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Branch">
|
||||
<el-input v-model="beneficiariesForm.bank_branch" v-validate="'required|max:191'" name="bank_branch"></el-input>
|
||||
<el-input v-model="beneficiariesForm.bank_branch" name="bank_branch"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div align="center">
|
||||
<el-button @click="EditDatadialogVisible = false">Cancel</el-button>
|
||||
<el-button type="primary" :loading="loading_btn" @click="EditBeneficiaries" :disabled="beneficiariesForm.company_name=='' || beneficiariesForm.bank_name=='' || beneficiariesForm.acc_no=='' || beneficiariesForm.bank_address=='' || beneficiariesForm.swift =='' || beneficiariesForm.cnap=='' || beneficiariesForm.bank_branch=='' ? true : false">Submit</el-button>
|
||||
<el-button type="primary" :loading="loading_btn" @click="EditBeneficiaries" :disabled="beneficiariesForm.company_name=='' || beneficiariesForm.bank_name=='' || beneficiariesForm.acc_no=='' ? true : false">Submit</el-button>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
* Please key in the data in Chinese
|
||||
|
||||
@@ -23,41 +23,38 @@
|
||||
<el-dialog title="Add New Data" align="center" :visible.sync="AddDatadialogVisible" width="40%">
|
||||
<el-form label-width="150px">
|
||||
<el-form-item label="Company Name">
|
||||
<el-input v-model="malaysiaBankForm.company_name" v-validate="'required|max:191'" name="company_name"></el-input>
|
||||
<el-input v-model="malaysiaBankForm.company_name" name="company_name"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Name">
|
||||
<el-input v-model="malaysiaBankForm.bank_name" v-validate="'required|max:191'" name="bank_name"></el-input>
|
||||
<el-input v-model="malaysiaBankForm.bank_name" name="bank_name"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Account No">
|
||||
<el-input v-model="malaysiaBankForm.acc_no" v-validate="'required|max:191'" name="acc_no"></el-input>
|
||||
<el-input v-model="malaysiaBankForm.acc_no" name="acc_no"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Address">
|
||||
<el-input v-model="malaysiaBankForm.bank_address" v-validate="'required|max:191'" name="bank_address"></el-input>
|
||||
<el-input v-model="malaysiaBankForm.bank_address" name="bank_address"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="SWIFT Code">
|
||||
<el-input v-model="malaysiaBankForm.swift" v-validate="'required|max:191'" name="swift"></el-input>
|
||||
<el-input v-model="malaysiaBankForm.swift" name="swift"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="CNAP">
|
||||
<el-input v-model="malaysiaBankForm.cnap" v-validate="'required|max:191'" name="cnap" ></el-input>
|
||||
<el-input v-model="malaysiaBankForm.cnap" name="cnap" ></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Branch">
|
||||
<el-input v-model="malaysiaBankForm.bank_branch" v-validate="'required|max:191'" name="bank_branch"></el-input>
|
||||
<el-input v-model="malaysiaBankForm.bank_branch" name="bank_branch"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div align="center">
|
||||
<el-button @click="AddDatadialogVisible = false">Cancel</el-button>
|
||||
<el-button type="primary" :loading="loading_btn" @click="CreateMalaysiaBank" :disabled="malaysiaBankForm.company_name=='' || malaysiaBankForm.bank_name=='' || malaysiaBankForm.acc_no=='' || malaysiaBankForm.bank_address=='' || malaysiaBankForm.swift =='' || malaysiaBankForm.cnap=='' || malaysiaBankForm.bank_branch=='' ? true : false">OK</el-button>
|
||||
<el-button type="primary" :loading="loading_btn" @click="CreateMalaysiaBank" :disabled="malaysiaBankForm.company_name=='' || malaysiaBankForm.bank_name=='' || malaysiaBankForm.acc_no=='' ? true : false">OK</el-button>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
* Please key in the data in Chinese
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog align="center" :visible.sync="DoneAddDatadialogVisible" width="30%">
|
||||
<span>Data Added Successfully</span><br><br>
|
||||
@@ -70,41 +67,38 @@
|
||||
<el-dialog title="Edit Data" align="center" :visible.sync="EditDatadialogVisible" width="40%">
|
||||
<el-form label-width="150px">
|
||||
<el-form-item label="Company Name">
|
||||
<el-input v-model="malaysiaBankForm.company_name" v-validate="'required|max:191'" name="company_name"></el-input>
|
||||
<el-input v-model="malaysiaBankForm.company_name" name="company_name"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Name">
|
||||
<el-input v-model="malaysiaBankForm.bank_name" v-validate="'required|max:191'" name="bank_name"></el-input>
|
||||
<el-input v-model="malaysiaBankForm.bank_name" name="bank_name"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Account No">
|
||||
<el-input v-model="malaysiaBankForm.acc_no" v-validate="'required|max:191'" name="acc_no"></el-input>
|
||||
<el-input v-model="malaysiaBankForm.acc_no" name="acc_no"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Address">
|
||||
<el-input v-model="malaysiaBankForm.bank_address" v-validate="'required|max:191'" name="bank_address"></el-input>
|
||||
<el-input v-model="malaysiaBankForm.bank_address" name="bank_address"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="SWIFT Code">
|
||||
<el-input v-model="malaysiaBankForm.swift" v-validate="'required|max:191'" name="swift"></el-input>
|
||||
<el-input v-model="malaysiaBankForm.swift" name="swift"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="CNAP">
|
||||
<el-input v-model="malaysiaBankForm.cnap" v-validate="'required|max:191'" name="cnap" ></el-input>
|
||||
<el-input v-model="malaysiaBankForm.cnap" name="cnap" ></el-input>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="Bank Branch">
|
||||
<el-input v-model="malaysiaBankForm.bank_branch" v-validate="'required|max:191'" name="bank_branch"></el-input>
|
||||
<el-input v-model="malaysiaBankForm.bank_branch" name="bank_branch"></el-input>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div align="center">
|
||||
<el-button @click="EditDatadialogVisible = false">Cancel</el-button>
|
||||
<el-button type="primary" :loading="loading_btn" @click="EditMalaysiaBank" :disabled="malaysiaBankForm.company_name=='' || malaysiaBankForm.bank_name=='' || malaysiaBankForm.acc_no=='' || malaysiaBankForm.bank_address=='' || malaysiaBankForm.swift =='' || malaysiaBankForm.cnap=='' || malaysiaBankForm.bank_branch=='' ? true : false">Submit</el-button>
|
||||
<el-button type="primary" :loading="loading_btn" @click="EditMalaysiaBank" :disabled="malaysiaBankForm.company_name=='' || malaysiaBankForm.bank_name=='' || malaysiaBankForm.acc_no=='' ? true : false">Submit</el-button>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
* Please key in the data in Chinese
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog align="center" :visible.sync="DoneUpdateDatadialogVisible" width="30%">
|
||||
<span>Data Updated Successfully</span><br><br>
|
||||
|
||||
@@ -4,6 +4,7 @@ $config = [
|
||||
'locale' => $locale = app()->getLocale(),
|
||||
'locales' => config('app.locales'),
|
||||
'githubAuth' => config('services.github.client_id'),
|
||||
'pusherUrl' => env('PUSHER_APP_KEY'),
|
||||
];
|
||||
|
||||
$polyfills = [
|
||||
@@ -36,7 +37,6 @@ $polyfills = [
|
||||
|
||||
{{-- Global configuration object --}}
|
||||
<script>window.config = @json($config);</script>
|
||||
|
||||
{{-- Polyfill JS features via polyfill.io --}}
|
||||
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features={{ implode(',', $polyfills) }}"></script>
|
||||
|
||||
|
||||
+7
-7
@@ -49,8 +49,8 @@ Route::group(['middleware' => 'auth:api'], function () {
|
||||
Route::patch('settings/profile', 'Settings\ProfileController@update');
|
||||
Route::patch('settings/password', 'Settings\PasswordController@update');
|
||||
|
||||
Route::get('notification/user', 'NotificationController@getUserMessage');
|
||||
Route::post('notification/read-notification/{notification_id}', 'NotificationController@readNotification');
|
||||
//Route::get('notification/user', 'NotificationController@getUserMessage');
|
||||
//Route::post('notification/read-notification/{notification_id}', 'NotificationController@readNotification');
|
||||
|
||||
// for both user and admin
|
||||
Route::get('active-bank', 'SettingActiveBankController@index');
|
||||
@@ -115,11 +115,11 @@ Route::group(['middleware' => ['role:admin']], function() {
|
||||
Route::put('supplier-booking/{id}', 'BookingSupplierController@update');
|
||||
Route::post('booking/{id}/confirm-supplier', 'BookingController@confirmSupplier');
|
||||
|
||||
Route::get('notification', 'NotificationController@index');
|
||||
Route::get('notification/{notification}', 'NotificationController@show');
|
||||
Route::post('notification', 'NotificationController@store');
|
||||
Route::put('notification/{notification}', 'NotificationController@update');
|
||||
Route::delete('notification/{notification}', 'NotificationController@delete');
|
||||
// Route::get('notification', 'NotificationController@index');
|
||||
// Route::get('notification/{notification}', 'NotificationController@show');
|
||||
// Route::post('notification', 'NotificationController@store');
|
||||
// Route::put('notification/{notification}', 'NotificationController@update');
|
||||
// Route::delete('notification/{notification}', 'NotificationController@delete');
|
||||
|
||||
Route::post('booking/{id}/upload-china-bankslip','ChinaBankSlipController@store');
|
||||
Route::patch('booking/{id}/update-china-bankslip','ChinaBankSlipController@update');
|
||||
|
||||
+1
-1
@@ -12,5 +12,5 @@
|
||||
*/
|
||||
|
||||
Broadcast::channel('App.User.{id}', function ($user, $id) {
|
||||
return (int) $user->id === (int) $id;
|
||||
return true;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user