mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
Added marking to admin home page
Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/exchange into fix/marking # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\SettingActiveBank;
|
||||
|
||||
class SettingActiveBankController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$active_bank_setting = SettingActiveBank::latest()->first();
|
||||
return response()->json($active_bank_setting, 201);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
if($active_bank_setting = SettingActiveBank::latest()->first())
|
||||
$active_bank_setting->update($request->all());
|
||||
else
|
||||
$active_bank_setting = SettingActiveBank::create($request->all());
|
||||
|
||||
return response()->json($active_bank_setting, 200);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SettingActiveBank extends Model
|
||||
{
|
||||
protected $fillable = ['x1_bank_id','x2_bank_id','beneficiary_id'];
|
||||
}
|
||||
+1
-1
@@ -29,7 +29,7 @@ class User extends Authenticatable implements JWTSubject
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password', 'remember_token', 'roles'
|
||||
'password', 'remember_token'
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(Model::class, function (Faker $faker) {
|
||||
return [
|
||||
//
|
||||
];
|
||||
});
|
||||
@@ -21,5 +21,6 @@ $factory->define(App\User::class, function (Faker $faker) {
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'password' => $password ?: $password = bcrypt('secret'),
|
||||
'remember_token' => str_random(10),
|
||||
'marking' => $faker->name,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -17,7 +17,7 @@ class CreateSettingBeneficiariesTable extends Migration
|
||||
$table->increments('id');
|
||||
$table->string('company_name');
|
||||
$table->string('bank_name');
|
||||
$table->string('acc_no');
|
||||
$table->string('acc_no')->unique();
|
||||
$table->string('bank_address');
|
||||
$table->string('swift');
|
||||
$table->string('cnap');
|
||||
|
||||
@@ -17,7 +17,7 @@ class CreateSettingMalaysiaBankTable extends Migration
|
||||
$table->increments('id');
|
||||
$table->string('company_name');
|
||||
$table->string('bank_name');
|
||||
$table->string('acc_no');
|
||||
$table->string('acc_no')->unique();
|
||||
$table->string('bank_address');
|
||||
$table->string('swift');
|
||||
$table->string('cnap');
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingActiveBankTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('setting_active_banks', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('x1_bank_id')->unique();
|
||||
$table->string('x2_bank_id')->unique();
|
||||
$table->string('beneficiary_id')->unique();
|
||||
$table->foreign('x1_bank_id')
|
||||
->references('acc_no')->on('setting_malaysia_banks')
|
||||
->onDelete('cascade');
|
||||
$table->foreign('x2_bank_id')
|
||||
->references('acc_no')->on('setting_malaysia_banks')
|
||||
->onDelete('cascade');
|
||||
$table->foreign('beneficiary_id')
|
||||
->references('acc_no')->on('setting_beneficiaries')
|
||||
->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('setting_active_banks');
|
||||
}
|
||||
}
|
||||
@@ -21,5 +21,7 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call(SuppliersTableSeeder::class);
|
||||
$this->call(MarkingSeeder::class);
|
||||
$this->call(SettingMalaysiaBankSeeder::class);
|
||||
$this->call(SettingBeneficiaresSeeder::class);
|
||||
$this->call(SettingActiveBankSeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SettingActiveBankSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('setting_active_banks')->insert([
|
||||
'x1_bank_id' => 'malaysiaacc01',
|
||||
'x2_bank_id' => 'malaysiaacc02',
|
||||
'beneficiary_id' => '123456789'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SettingBeneficiaresSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('setting_beneficiaries')->insert([
|
||||
'company_name' => 'CIEF2',
|
||||
'bank_name' => 'Mayban222k',
|
||||
'acc_no' => '5555555',
|
||||
'bank_address' => 'Jalan putrajaya',
|
||||
'swift' => 'ABC122223',
|
||||
'cnap' => 'CED232224',
|
||||
'bank_branch' => 'Putra'
|
||||
]);
|
||||
DB::table('setting_beneficiaries')->insert([
|
||||
'company_name' => 'Bota',
|
||||
'bank_name' => 'CIMB',
|
||||
'acc_no' => '123456789',
|
||||
'bank_address' => 'Jalan cyberjaya',
|
||||
'swift' => 'AB3333',
|
||||
'cnap' => 'CADSeed',
|
||||
'bank_branch' => 'cyberjaa
|
||||
'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -15,11 +15,20 @@ class SettingMalaysiaBankSeeder extends Seeder
|
||||
DB::table('setting_malaysia_banks')->insert([
|
||||
'company_name' => 'CIEF',
|
||||
'bank_name' => 'Maybank',
|
||||
'acc_no' => '131313131313',
|
||||
'acc_no' => 'malaysiaacc01',
|
||||
'bank_address' => 'Jalan putrajaya',
|
||||
'swift' => 'ABC123',
|
||||
'cnap' => 'CED234',
|
||||
'bank_branch' => 'Putra'
|
||||
]);
|
||||
DB::table('setting_malaysia_banks')->insert([
|
||||
'company_name' => 'CIEF',
|
||||
'bank_name' => 'Maybank',
|
||||
'acc_no' => 'malaysiaacc02',
|
||||
'bank_address' => 'Jalan putrajaya',
|
||||
'swift' => 'ABC123',
|
||||
'cnap' => 'CED234',
|
||||
'bank_branch' => 'Putra'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false">
|
||||
stopOnFailure="true">
|
||||
<testsuites>
|
||||
<testsuite name="Feature">
|
||||
<directory suffix="Test.php">./tests/Feature</directory>
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
<el-button slot-scope="scope" type="text" @click="(event) => { BookingStatus(scope.row.admin_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 :filters="[{text: 'X1', value: 'X1'}, {text: 'X2', value: 'X2'}]" :filter-method="filterHandler" label="Term" prop="term" width="100"/> -->
|
||||
<el-table-column label="Marking" width="120" prop="marking" />
|
||||
<el-table-column :filters="[{text: 'X1', value: 'X1'}, {text: 'X2', value: 'X2'}]" :filter-method="filterHandler" label="Term" prop="term" width="100"/>
|
||||
<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"
|
||||
|
||||
@@ -3,30 +3,157 @@
|
||||
<span align="center"><h4>Bank Setting</h4></span><br>
|
||||
<el-form :inline="true">
|
||||
<el-form-item>
|
||||
Active CIEF bank account for today :
|
||||
X1 : <el-select size="mini">
|
||||
<el-option>Maybank</el-option>
|
||||
<el-option>Affinbank</el-option>
|
||||
<el-option>Bank Islam</el-option>
|
||||
</el-select>
|
||||
X2 : <el-select size="mini">
|
||||
<el-option>Maybank</el-option>
|
||||
<el-option>Affinbank</el-option>
|
||||
<el-option>Bank Islam</el-option>
|
||||
Active CIEF bank account for today :
|
||||
X1 :
|
||||
<el-select v-model="active_bank_setting.x1_bank_id" size="mini">
|
||||
<el-option
|
||||
v-for="item in options_CIEF"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button type="primary" size="mini">Update</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :inline="true">
|
||||
<el-form-item>
|
||||
Active CIEF China Beneficiary Account for Today :
|
||||
<el-select size="mini">
|
||||
<el-option>Bank of China</el-option>
|
||||
<el-option>China Bank</el-option>
|
||||
<el-option>Bank</el-option>
|
||||
X2 :
|
||||
<el-select v-model="active_bank_setting.x2_bank_id" size="mini">
|
||||
<el-option
|
||||
v-for="item in options_CIEF"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button type="primary" size="mini">Update</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
Active CIEF China Beneficiary Account for Today :
|
||||
<el-select v-model="active_bank_setting.beneficiary_id" size="mini">
|
||||
<el-option
|
||||
v-for="item in options_china_bank"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="mini" :loading="loading_btn" @click="EditActiveBankSetting">Update</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script type="text/javascript">
|
||||
var axios = require('axios');
|
||||
var client = axios.create({
|
||||
baseURL: 'http://localhost:8000'
|
||||
});
|
||||
|
||||
export default {
|
||||
// TODO : update credit limit and timeout
|
||||
data() {
|
||||
return {
|
||||
options_CIEF: [],
|
||||
options_china_bank: [],
|
||||
active_bank_setting : {
|
||||
x1_bank_id: null,
|
||||
x2_bank_id: null,
|
||||
beneficiary_id: null
|
||||
},
|
||||
loading_btn: false
|
||||
};
|
||||
},
|
||||
beforeMount(){
|
||||
this.UpdateMalaysiaBankOption();
|
||||
this.UpdateChinaBankOption();
|
||||
this.UpdateActiveBankSetting();
|
||||
},
|
||||
methods :{
|
||||
UpdateMalaysiaBankOption : function(){
|
||||
var malaysiaBankData;
|
||||
client.get('api/setting-malaysia-bank')
|
||||
.then((response) => {
|
||||
malaysiaBankData = response.data;
|
||||
this.options_CIEF = malaysiaBankData.map(function(item){
|
||||
return {
|
||||
value : item.acc_no,
|
||||
label : item.acc_no,
|
||||
};
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Fetch data fail',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
});
|
||||
});
|
||||
},
|
||||
UpdateChinaBankOption : function(){
|
||||
var chinaBankData;
|
||||
client.get('api/setting-beneficiary')
|
||||
.then((response) => {
|
||||
chinaBankData = response.data;
|
||||
this.options_china_bank = chinaBankData.map(function(item){
|
||||
return {
|
||||
value : item.acc_no,
|
||||
label : item.acc_no,
|
||||
};
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Fetch data fail',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
});
|
||||
});
|
||||
},
|
||||
UpdateActiveBankSetting : function(){
|
||||
client.get('api/setting-active-bank')
|
||||
.then((response) => {
|
||||
this.active_bank_setting = response.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Fetch data fail',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
});
|
||||
});
|
||||
},
|
||||
EditActiveBankSetting : function(){
|
||||
this.loading_btn = true;
|
||||
client.put('/api/setting-active-bank', this.active_bank_setting)
|
||||
.then((response) => {
|
||||
this.loading_btn = false;
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Success',
|
||||
type: 'success',
|
||||
duration: 5000
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
this.loading_btn = false;
|
||||
console.log(error);
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Update failed, please contact support',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
});
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@@ -17,7 +17,6 @@
|
||||
<el-form-item align="center">
|
||||
<el-button type="primary" align="center" :loading="loading_btn" size="primary" @click="updateCreditSetting">Update</el-button>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
@@ -38,7 +37,7 @@
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getCreditSetting()
|
||||
this.getCreditSetting();
|
||||
},
|
||||
methods: {
|
||||
getCreditSetting() {
|
||||
|
||||
@@ -70,6 +70,9 @@ Route::group(['middleware' => ['role:admin']], function() {
|
||||
Route::get('setting-credit', 'SettingCreditController@index');
|
||||
Route::put('setting-credit', 'SettingCreditController@update');
|
||||
|
||||
Route::get('setting-active-bank', 'SettingActiveBankController@index');
|
||||
Route::put('setting-active-bank', 'SettingActiveBankController@update');
|
||||
|
||||
Route::get('setting-supplier', 'SettingSupplierController@index');
|
||||
Route::get('setting-supplier/{supplier}', 'SettingSupplierController@show');
|
||||
Route::post('setting-supplier', 'SettingSupplierController@store');
|
||||
|
||||
@@ -13,8 +13,8 @@ class LoginTest extends TestCase
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->user = factory(User::class)->create();
|
||||
$this->withoutExceptionHandling();
|
||||
}
|
||||
|
||||
/** @test */
|
||||
@@ -35,7 +35,7 @@ class LoginTest extends TestCase
|
||||
$this->actingAs($this->user)
|
||||
->getJson('/api/user')
|
||||
->assertSuccessful()
|
||||
->assertJsonStructure(['id', 'name', 'email']);
|
||||
->assertJsonStructure(['id', 'name', 'email', 'marking']);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
|
||||
Reference in New Issue
Block a user