diff --git a/app/Http/Controllers/BookingController.php b/app/Http/Controllers/BookingController.php index 4c2ed0e1..b9b81f2e 100644 --- a/app/Http/Controllers/BookingController.php +++ b/app/Http/Controllers/BookingController.php @@ -97,7 +97,15 @@ class BookingController extends Controller // TODO : transfer_amount change name to bia $booking->transfer_amount = $booking->bia; - $booking->track_status = "(". $booking->admin_status ."/7)"; + $term = $booking->term; + if($term == "x1_ba" || $term == "x2_cheque"){ + $status = $booking->admin_status > 2 ? $booking->admin_status - 2 : $booking->admin_status; + $booking->track_status = "(". $status ."/5)"; + } + else{ + $booking->track_status = "(". $booking->admin_status ."/7)"; + } + switch ($booking->admin_status) { case 1: $status_desc = "Waiting customer upload bank slip"; @@ -106,11 +114,15 @@ class BookingController extends Controller $status_desc = "Verify user bank slip"; break; case 3: - $status_desc = "Generate supplier booking report"; - break; + if($term !== "x1_ba" || $term !== "x2_cheque"){ + $status_desc = "Generate supplier booking report"; + break; + } case 4: - $status_desc = "Supplier booking report. Please confirm with your booking."; - break; + if($term !== "x1_ba" || $term !== "x2_cheque"){ + $status_desc = "Supplier booking report. Please confirm with your booking."; + break; + } case 5: $status_desc = "Please, upload China Bankslip"; break; @@ -619,7 +631,10 @@ class BookingController extends Controller // update booking status $booking->status = 4; - $booking->admin_status = 3; + if($booking->term !== "x1_ba" || $booking->term !== "x2_cheque") + $booking->admin_status = 3; + else + $booking->admin_status = 5; $booking->save(); return response()->json(['message'=>'Success'],200); diff --git a/database/migrations/2018_07_11_150423_update_accno_to_id_setting_active_table.php b/database/migrations/2018_07_11_150423_update_accno_to_id_setting_active_table.php new file mode 100644 index 00000000..148134b9 --- /dev/null +++ b/database/migrations/2018_07_11_150423_update_accno_to_id_setting_active_table.php @@ -0,0 +1,51 @@ +dropForeign('setting_active_banks_x1_bank_id_foreign'); + $table->dropForeign('setting_active_banks_x2_bank_id_foreign'); + $table->dropForeign('setting_active_banks_beneficiary_id_foreign'); + $table->dropColumn('x1_bank_id'); + $table->dropColumn('x2_bank_id'); + $table->dropColumn('beneficiary_id'); + }); + + Schema::table('setting_active_banks', function(Blueprint $table) + { + $table->unsignedInteger('x1_bank_id')->unique(); + $table->foreign('x1_bank_id') + ->references('id')->on('setting_malaysia_banks'); + + $table->unsignedInteger('x2_bank_id')->unique(); + $table->foreign('x2_bank_id') + ->references('id')->on('setting_malaysia_banks'); + + $table->unsignedInteger('beneficiary_id')->unique(); + $table->foreign('beneficiary_id') + ->references('id')->on('setting_beneficiaries'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 32544630..2c2e3c17 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -24,7 +24,7 @@ class DatabaseSeeder extends Seeder $this->call(MarkingSeeder::class); DB::statement('SET FOREIGN_KEY_CHECKS=0;'); $this->call(SettingMalaysiaBankSeeder::class); - $this->call(SettingBeneficiaresSeeder::class); + $this->call(SettingBeneficiarySeeder::class); $this->call(SettingActiveBankSeeder::class); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); } diff --git a/database/seeds/SettingActiveBankSeeder.php b/database/seeds/SettingActiveBankSeeder.php index feed9792..59ed5afd 100644 --- a/database/seeds/SettingActiveBankSeeder.php +++ b/database/seeds/SettingActiveBankSeeder.php @@ -1,6 +1,8 @@ first(); + $bankx2 = SettingMalaysiaBank::where('acc_no', "=",'malaysiaacc02')->first(); + $chinabank = SettingBeneficiary::where('acc_no', "=" ,'123456789')->first(); + DB::table('setting_active_banks')->truncate(); DB::table('setting_active_banks')->insert([ - 'x1_bank_id' => 'malaysiaacc01', - 'x2_bank_id' => 'malaysiaacc02', - 'beneficiary_id' => '123456789' + 'x1_bank_id' => $bankx1->id, + 'x2_bank_id' => $bankx2->id, + 'beneficiary_id' => $chinabank->id ]); } } diff --git a/database/seeds/SettingBeneficiaresSeeder.php b/database/seeds/SettingBeneficiarySeeder.php similarity index 91% rename from database/seeds/SettingBeneficiaresSeeder.php rename to database/seeds/SettingBeneficiarySeeder.php index c7da261c..ff34fbc4 100644 --- a/database/seeds/SettingBeneficiaresSeeder.php +++ b/database/seeds/SettingBeneficiarySeeder.php @@ -1,8 +1,9 @@ - + - - + + @@ -40,7 +40,6 @@ export default { props: ['value'], data: () => ({ - status: 1 }) } diff --git a/resources/assets/js/components/Navbar.vue b/resources/assets/js/components/Navbar.vue index 71c3aace..d71585cd 100644 --- a/resources/assets/js/components/Navbar.vue +++ b/resources/assets/js/components/Navbar.vue @@ -19,7 +19,25 @@