Merge branch 'nazri/integrate-frontend-backend-for-update-rate' into 'master'

Nazri/integrate frontend backend for update rate

See merge request CIEFWorldwideSdnBhd/exchange!59
This commit is contained in:
Jack Goh
2018-07-05 05:45:29 +00:00
4 changed files with 170 additions and 41 deletions
+10
View File
@@ -22412,6 +22412,11 @@
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
"dev": true
},
"vee-validate": {
"version": "2.1.0-beta.5",
"resolved": "https://registry.npmjs.org/vee-validate/-/vee-validate-2.1.0-beta.5.tgz",
"integrity": "sha512-XN0FCHBEWKbxKprjzIwIr7ff5U+aFaJZlkoKr1ReuncMwHgG/6iW0hEI4bDuNXx1YKPmm4SyhoXkAOBHIUIwTA=="
},
"vendors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/vendors/-/vendors-1.0.2.tgz",
@@ -22513,6 +22518,11 @@
"resolved": "https://registry.npmjs.org/vue/-/vue-2.5.16.tgz",
"integrity": "sha512-/ffmsiVuPC8PsWcFkZngdpas19ABm5mh2wA7iDqcltyCTwlgZjHGeJYOXkBMo422iPwIcviOtrTCUpSfXmToLQ=="
},
"vue-axios": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/vue-axios/-/vue-axios-2.1.1.tgz",
"integrity": "sha512-Ek1STxe7G8H+ylkru1v1z6sIuUr4UkpYXjNLvDsqQNQIQ1CyrDk17KG2GaCjvhopu1wn7d8iAM9DJ5prn+FnrQ=="
},
"vue-eslint-parser": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-2.0.3.tgz",
+146 -28
View File
@@ -18,8 +18,8 @@
<el-popover placement="top" width="300" v-model="UpdateRatePopoverVisible">
<div align="center">
<p>Today's Rate</p>
<p>X1 : Cash: {{x1_cash}} Cheque: {{x1_cheque}} BA: {{x1_ba}}</p>
<p>X2 : Cash: {{x2_cash}} Cheque: {{x2_cheque}} BA: {{x2_ba}}</p>
<p>X1 : Cash: {{rate.x1_cash}} Cheque: {{rate.x1_cheque}} BA: {{rate.x1_ba}}</p>
<p>X2 : Cash: {{rate.x2_cash}} Cheque: {{rate.x2_cheque}} BA: {{rate.x2_ba}}</p>
</div>
<div style="text-align: center; margin: 0">
<el-button type="primary" size="mini" @click="UpdateRatePopoverVisible = false; UpdateRateDialogVisible = true">Update rate</el-button>
@@ -32,30 +32,26 @@
<!-- <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>
<!-- update rate dialog start -->
<el-dialog align="center" :visible.sync="UpdateRateDialogVisible" width="900px">
<el-form :inline="true" align="center" ref="rateForm" :model="rateForm" :rules="rules">
<!-- update rate dialog -->
<el-dialog align="center" :visible.sync="UpdateRateDialogVisible">
<el-form :inline="true" align="center">
<el-form-item>X1 :
Cash : <el-input style=width:10% ></el-input>
Cheque : <el-input style=width:10%></el-input>
BA : <el-input style=width:10%></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" align="center">
<el-form-item>X2 :
Cash : <el-input style=width:10% ></el-input>
Cheque : <el-input style=width:10%></el-input>
BA : <el-input style=width:10%></el-input>
</el-form-item>
<el-form-item prop="x1_cash" >X1: &nbsp;&nbsp;&nbsp;Cash : <el-input v-model.number="rateForm.x1_cash" style=width:25% ></el-input></el-form-item>
<el-form-item prop="x1_cheque" >Cheque : <el-input v-model.number="rateForm.x1_cheque" style=width:25%></el-input></el-form-item>
<el-form-item prop="x1_ba">BA : <el-input v-model.number="rateForm.x1_ba" style=width:25%></el-input></el-form-item>
<br>
<el-form-item prop="x2_cash" >X2: &nbsp;&nbsp;&nbsp;Cash : <el-input v-model.number="rateForm.x2_cash" style=width:25% ></el-input></el-form-item>
<el-form-item prop="x2_cheque" >Cheque : <el-input v-model.number="rateForm.x2_cheque" style=width:25%></el-input></el-form-item>
<el-form-item prop="x2_ba" >BA : <el-input v-model.number="rateForm.x2_ba" style=width:25%></el-input></el-form-item>
</el-form>
<br>
<div align="center">
<el-button type="text" @click="UpdateRateDialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="UpdateRateDialogVisible = false; DoneUpdateRateDialogVisible = true">Save</el-button>
<el-button type="primary" @click="updateRate('rateForm'); UpdateRateDialogVisible = false; DoneUpdateRateDialogVisible = true" >Save</el-button>
</div>
</el-dialog>
<!-- update rate dialog end -->
</el-dialog>
<!-- update rate dialog done -->
<el-dialog align="center" :visible.sync="DoneUpdateRateDialogVisible" width="30%">
<span>Rate Successfully Updated</span><br><br>
<div align="center">
@@ -69,6 +65,7 @@
<script>
import { mapGetters } from 'vuex'
import { loadMessages } from '~/plugins/i18n'
import axios from 'axios'
export default {
data() {
@@ -76,13 +73,49 @@ export default {
UpdateRatePopoverVisible: false,
UpdateRateDialogVisible: false,
DoneUpdateRateDialogVisible: false,
x1_cash: '1.56',
x1_cheque: '1.63',
x1_ba: '1.66',
x2_cash: '1.61',
x2_cheque: '1.70',
x2_ba: '1.72',
};
rate: {
x1_ba: null,
x1_cheque: null,
x1_cash: null,
x2_ba: null,
x2_cash: null,
x2_cheque: null,
},
rateForm: {
x1_cash: '',
x1_cheque: '',
x1_ba: '',
x1_cash: '',
x1_cheque: '',
x1_ba: '',
},
rules: {
x1_cash: [
{ required: true, message: 'Please input rate for X1 Cash', trigger: 'change'},
{ type: 'number', message: 'Rate must be a number'}
],
x1_cheque: [
{ required: true, message: 'Please input rate for X1 Cheque', trigger: 'change'},
{ type: 'number', message: 'Rate must be a number'}
],
x1_ba: [
{ required: true, message: 'Please input rate for X1 BA', trigger: 'change'},
{ type: 'number', message: 'Rate must be a number'}
],
x2_cash: [
{ required: true, message: 'Please input rate for X2 Cash', trigger: 'change'},
{ type: 'number', message: 'Rate must be a number'}
],
x2_cheque: [
{ required: true, message: 'Please input rate for X2 Cheque', trigger: 'change'},
{ type: 'number', message: 'Rate must be a number'}
],
x2_ba: [
{ required: true, message: 'Please input rate for X2 BA', trigger: 'change'},
{ type: 'number', message: 'Rate must be a number'}
]
}
}
},
computed: mapGetters({
locale: 'lang/locale',
@@ -91,6 +124,10 @@ export default {
role: 'auth/role'
}),
mounted () {
this.getRate()
},
methods: {
setLocale (locale) {
if (this.$i18n.locale !== locale) {
@@ -98,7 +135,88 @@ export default {
this.$store.dispatch('lang/setLocale', { locale })
}
}
},
getRate() {
let $this = this
axios.get('api/rate').then(response => {
this.rate = response.data
console.log(this.rate)
})
},
createRate: function () {
this.loading = true,
this.dialogFormVisible1 = true
let newRate = {
x1_cash: this.rateForm.x1_cash,
x1_cheque: this.rateForm.x1_cheque,
x1_ba: this.rateForm.x1_ba,
x2_cash: this.rateForm.x2_cash,
x2_cheque: this.rateForm.x2_cheque,
x2_ba: this.rateForm.x2_ba
}
console.log(newRate)
axios.post('api/update-rate', newRate)
.then((response) => {
this.loading = false
this.rate = response.data
})
.catch((error) => {
console.log(error)
this.loading = false
this.$message({
showClose: true,
message: 'Error : All rate must be inserted',
type: 'error',
duration: 10000
})
})
},
updateRate(formName) {
this.loading = true
this.$refs[formName].validate((valid) => {
if (valid) {
let newRate = {
x1_cash: this.rateForm.x1_cash,
x1_cheque: this.rateForm.x1_cheque,
x1_ba: this.rateForm.x1_ba,
x2_cash: this.rateForm.x2_cash,
x2_cheque: this.rateForm.x2_cheque,
x2_ba: this.rateForm.x2_ba,
}
axios.post('/api/update-rate', newRate)
.then((response) => {
this.loading = false
this.rate = response.data
})
.catch((error) => {
this.loading = false
this.$message({
showClose: true,
message: 'Error : All rate must be inserted',
type: 'error',
duration: 10000
})
})
} else {
this.loading = false
DoneUpdateRateDialogVisible = false
UpdateRateDialogVisible = true
this.$message({
showClose: true,
message: 'Please fill the form',
type: 'error',
duration: 10000
})
}
})
},
}
}
</script>
@@ -131,7 +131,7 @@ var client = axios.create({
methods:{
CreateSupplier : function(){
this.AddNewSupplierdialogVisible = false;
client.post('api/setting-supplier', this.supplierForm)
axios.post('/api/setting-supplier', this.supplierForm)
.then((response) => {
this.DoneAddSupplierdialogVisible = true;
this.UpdateTableData();
@@ -147,8 +147,9 @@ var client = axios.create({
});
},
UpdateTableData : function(){
client.get('api/setting-supplier', this.supplierForm)
axios.get('/api/setting-supplier', this.supplierForm)
.then((response) => {
console.log(response.data)
this.tableData = response.data;
})
.catch((error) => {
@@ -163,7 +164,7 @@ var client = axios.create({
},
DeleteSupplier : function(supplier_id){
this.DeleteSupplierdialogVisible = true;
client.delete('api/setting-supplier/' + supplier_id)
axios.delete('/api/setting-supplier/' + supplier_id)
.then((response) => {
this.UpdateTableData();
})
@@ -181,7 +182,7 @@ var client = axios.create({
this.EditSupplierdialogVisible = false;
this.DoneUpdateSupplierdialogVisible = true;
client.put('api/setting-supplier/' + this.currentEdit, this.supplierForm)
axios.put('/api/setting-supplier/' + this.currentEdit, this.supplierForm)
.then((response) => {
this.UpdateTableData();
})
+9 -9
View File
@@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit0eb1f3eb0d8144627e65b3e93f0783e4
class ComposerStaticInit8b6a5ffea816e8de5a43df8cf9a88cdd
{
public static $files = array (
'6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
@@ -12,11 +12,11 @@ class ComposerStaticInit0eb1f3eb0d8144627e65b3e93f0783e4
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
'2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'bd9634f2d41831496de0d3dfe4c94881' => __DIR__ . '/..' . '/symfony/polyfill-php56/bootstrap.php',
'f0906e6318348a765ffb6eb24e0d0938' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php',
'58571171fd5812e6e447dce228f52f4d' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php',
@@ -145,8 +145,8 @@ class ComposerStaticInit0eb1f3eb0d8144627e65b3e93f0783e4
'phpDocumentor\\Reflection\\' =>
array (
0 => __DIR__ . '/..' . '/phpdocumentor/reflection-common/src',
1 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src',
2 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src',
1 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src',
2 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src',
),
'Zizaco\\Entrust\\' =>
array (
@@ -4767,10 +4767,10 @@ class ComposerStaticInit0eb1f3eb0d8144627e65b3e93f0783e4
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit0eb1f3eb0d8144627e65b3e93f0783e4::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit0eb1f3eb0d8144627e65b3e93f0783e4::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit0eb1f3eb0d8144627e65b3e93f0783e4::$prefixesPsr0;
$loader->classMap = ComposerStaticInit0eb1f3eb0d8144627e65b3e93f0783e4::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit8b6a5ffea816e8de5a43df8cf9a88cdd::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit8b6a5ffea816e8de5a43df8cf9a88cdd::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit8b6a5ffea816e8de5a43df8cf9a88cdd::$prefixesPsr0;
$loader->classMap = ComposerStaticInit8b6a5ffea816e8de5a43df8cf9a88cdd::$classMap;
}, null, ClassLoader::class);
}