mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
Add setting for taxrate and billingcharge
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\SettingBillingCharge;
|
||||
|
||||
class SettingBillingChargeController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$billing_charge_setting = SettingBillingCharge::latest()->first();
|
||||
return response()->json($billing_charge_setting, 201);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
if($billing_charge_setting = SettingBillingCharge::latest()->first())
|
||||
$billing_charge_setting->update($request->all());
|
||||
else
|
||||
$billing_charge_setting = SettingBillingCharge::create($request->all());
|
||||
|
||||
return response()->json($billing_charge_setting, 200);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\SettingTaxRate;
|
||||
|
||||
class SettingTaxRateController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$setting_tax = SettingTaxRate::latest()->first();
|
||||
return response()->json($setting_tax, 201);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
if($setting_tax = SettingTaxRate::latest()->first())
|
||||
$setting_tax->update($request->all());
|
||||
else
|
||||
$setting_tax = SettingTaxRate::create($request->all());
|
||||
|
||||
return response()->json($setting_tax, 200);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SettingBillingCharge extends Model
|
||||
{
|
||||
protected $fillable = ['billing_charge_rate'];
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SettingTaxRate extends Model
|
||||
{
|
||||
protected $fillable = ['tax_rate'];
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingBillingChargeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('setting_billing_charges', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->double('billing_charge_rate',8,2);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('setting_billing_charges');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingTaxRateTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('setting_tax_rates', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->double('tax_rate',8,2);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('setting_tax_rates');
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call(SettingMalaysiaBankSeeder::class);
|
||||
$this->call(SettingBeneficiarySeeder::class);
|
||||
$this->call(SettingActiveBankSeeder::class);
|
||||
$this->call(SettingTaxRateSeeder::class);
|
||||
$this->call(SettingBillingChargeSeeder::class);
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SettingBillingChargeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('setting_billing_charges')->insert([
|
||||
'billing_charge_rate' => '1.2',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SettingTaxRateSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('setting_tax_rates')->insert([
|
||||
'tax_rate' => '1.1',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<div>
|
||||
<span align="center">
|
||||
<h4>Billing Charge Setting</h4>
|
||||
</span>
|
||||
<br>
|
||||
<el-form>
|
||||
<el-form-item align="center">
|
||||
Billing Charge Rate :
|
||||
<el-input size="mini" v-model="billing_charge_setting.billing_charge_rate" style=width:20%></el-input> %
|
||||
</el-form-item>
|
||||
<el-form-item align="center">
|
||||
<el-button type="primary" align="center" :loading="loading_btn" size="primary" @click="updateBillingChargeSetting">Update</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
export default {
|
||||
// TODO : update credit limit and timeout
|
||||
data() {
|
||||
return {
|
||||
loading_btn: false,
|
||||
billing_charge_setting: {
|
||||
billing_charge_rate : null
|
||||
},
|
||||
};
|
||||
},
|
||||
beforeMount() {
|
||||
this.getBillingChargeSetting();
|
||||
},
|
||||
methods: {
|
||||
getBillingChargeSetting() {
|
||||
axios.get('/api/setting-billing-charge').then(response => {
|
||||
this.billing_charge_setting = response.data
|
||||
})
|
||||
},
|
||||
updateBillingChargeSetting (){
|
||||
this.loading_btn = true
|
||||
axios.put('/api/setting-billing-charge', this.billing_charge_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>
|
||||
@@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<div>
|
||||
<span align="center">
|
||||
<h4>Tax Setting</h4>
|
||||
</span>
|
||||
<br>
|
||||
<el-form>
|
||||
<el-form-item align="center">
|
||||
Tax :
|
||||
<el-input size="mini" v-model="tax_setting.tax_rate" style=width:20%></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item align="center">
|
||||
<el-button type="primary" align="center" :loading="loading_btn" size="primary" @click="updateTaxSetting">Update</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading_btn: false,
|
||||
tax_setting: {
|
||||
tax_rate : null
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getTaxSetting();
|
||||
},
|
||||
methods: {
|
||||
getTaxSetting() {
|
||||
axios.get('/api/setting-tax').then(response => {
|
||||
this.tax_setting = response.data;
|
||||
console.log(this.tax_setting);
|
||||
})
|
||||
},
|
||||
updateTaxSetting (){
|
||||
this.loading_btn = true
|
||||
console.log(this.tax_setting);
|
||||
axios.put('/api/setting-tax', this.tax_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>
|
||||
@@ -80,6 +80,18 @@
|
||||
route: 'settings.admin-marking-setting',
|
||||
role: 'admin'
|
||||
},
|
||||
{
|
||||
icon: 'building',
|
||||
name: this.$t('Tax Setting'),
|
||||
route: 'settings.admin-tax-setting',
|
||||
role: 'admin'
|
||||
},
|
||||
{
|
||||
icon: 'building',
|
||||
name: this.$t('Billing Charge Setting'),
|
||||
route: 'settings.admin-billing-charge-setting',
|
||||
role: 'admin'
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ const SettingsAdminChinaBank = () => import('~/pages/settings/admin-china-bank')
|
||||
const SettingsAdminMalaysiaBank = () => import('~/pages/settings/admin-malaysia-bank').then(m => m.default || m)
|
||||
const SettingsAdminBankSetting = () => import('~/pages/settings/admin-bank-setting').then(m => m.default || m)
|
||||
const SettingsAdminMarkingSetting = () => import('~/pages/settings/admin-marking-setting').then(m => m.default || m)
|
||||
const SettingsAdminTaxSetting = () => import('~/pages/settings/admin-tax-setting').then(m => m.default || m)
|
||||
const SettingsAdminBillingChargeSetting = () => import('~/pages/settings/admin-billing-charge-setting').then(m => m.default || m)
|
||||
|
||||
// Booking
|
||||
const Upload = () => import('~/pages/booking/uploadUserBankSlip').then(m => m.default || m)
|
||||
@@ -60,7 +62,9 @@ export default [
|
||||
{ path: 'admin-china-bank', name: 'settings.admin-china-bank', component: SettingsAdminChinaBank },
|
||||
{ path: 'admin-malaysia-bank', name: 'settings.admin-malaysia-bank', component: SettingsAdminMalaysiaBank },
|
||||
{ path: 'admin-bank-setting', name: 'settings.admin-bank-setting', component: SettingsAdminBankSetting },
|
||||
{ path: 'admin-marking-setting', name: 'settings.admin-marking-setting', component: SettingsAdminMarkingSetting }
|
||||
{ path: 'admin-marking-setting', name: 'settings.admin-marking-setting', component: SettingsAdminMarkingSetting },
|
||||
{ path: 'admin-tax-setting', name: 'settings.admin-tax-setting', component: SettingsAdminTaxSetting },
|
||||
{ path: 'admin-billing-charge-setting', name: 'settings.admin-billing-charge-setting', component: SettingsAdminBillingChargeSetting },
|
||||
] },
|
||||
|
||||
// Booking
|
||||
|
||||
@@ -49,6 +49,8 @@ Route::group(['middleware' => 'auth:api'], function () {
|
||||
|
||||
// for both user and admin
|
||||
Route::get('active-bank', 'SettingActiveBankController@index');
|
||||
Route::put('setting-tax', 'SettingActiveBankController@index');
|
||||
Route::put('setting-billing-charge', 'SettingBillingChargeController@index');
|
||||
Route::get('malaysia-bank/{malaysiaBank}', 'SettingMalaysiaBankController@show');
|
||||
});
|
||||
|
||||
@@ -74,6 +76,10 @@ Route::group(['middleware' => ['role:admin']], function() {
|
||||
|
||||
Route::put('setting-active-bank', 'SettingActiveBankController@update');
|
||||
|
||||
Route::put('setting-tax', 'SettingTaxRateController@update');
|
||||
|
||||
Route::put('setting-billing-charge', 'SettingBillingChargeController@update');
|
||||
|
||||
Route::get('setting-supplier', 'SettingSupplierController@index');
|
||||
Route::get('setting-supplier/{supplier}', 'SettingSupplierController@show');
|
||||
Route::post('setting-supplier', 'SettingSupplierController@store');
|
||||
@@ -111,6 +117,8 @@ Route::group(['middleware' => ['role:admin']], function() {
|
||||
|
||||
// for both user and admin
|
||||
Route::get('setting-active-bank', 'SettingActiveBankController@index');
|
||||
Route::get('setting-tax', 'SettingTaxRateController@index');
|
||||
Route::get('setting-billing-charge', 'SettingBillingChargeController@index');
|
||||
Route::get('setting-malaysia-bank/{malaysiaBank}', 'SettingMalaysiaBankController@show');
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user