fix/Admin/Settings

This commit is contained in:
lonetrinity
2018-07-26 17:55:55 +08:00
parent 7e49714be6
commit 4f3d225084
4 changed files with 81 additions and 15 deletions
@@ -57,7 +57,6 @@
</div>
</li>
</template>
</li>
<!-- Guest -->
<template v-else>
<li class="nav-item">
@@ -53,7 +53,7 @@
</el-form>
<div align="center">
<el-button @click="AddDatadialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="CreateBeneficiaries" :disabled="errors.any() || 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="errors.any() || beneficiariesForm.company_name=='' || beneficiariesForm.bank_name=='' || beneficiariesForm.acc_no=='' || beneficiariesForm.bank_address=='' || beneficiariesForm.swift =='' || beneficiariesForm.cnap=='' || beneficiariesForm.bank_branch=='' ? true : false">OK</el-button>
</div>
<span slot="footer" class="dialog-footer">
* Please key in the data in Chinese
@@ -62,7 +62,7 @@
<el-dialog align="center" :visible.sync="DoneAddDatadialogVisible" width="30%">
<span>Data Added Successfully</span><br><br>
<div align="center">
<el-button type="primary" @click="DoneAddDatadialogVisible = false">OK</el-button>
<el-button type="primary" :loading="loading_btn" @click="DoneAddDatadialogVisible = false">OK</el-button>
</div>
</el-dialog>
<!-- popup add new data end -->
@@ -100,7 +100,7 @@
</el-form>
<div align="center">
<el-button @click="EditDatadialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="EditBeneficiaries" :disabled="errors.any() || 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="errors.any() || beneficiariesForm.company_name=='' || beneficiariesForm.bank_name=='' || beneficiariesForm.acc_no=='' || beneficiariesForm.bank_address=='' || beneficiariesForm.swift =='' || beneficiariesForm.cnap=='' || beneficiariesForm.bank_branch=='' ? true : false">Submit</el-button>
</div>
<span slot="footer" class="dialog-footer">
* Please key in the data in Chinese
@@ -109,7 +109,7 @@
<el-dialog align="center" :visible.sync="DoneUpdateDatadialogVisible" width="30%">
<span>Data Updated Successfully</span><br><br>
<div align="center">
<el-button type="primary" @click="DoneUpdateDatadialogVisible = false">OK</el-button>
<el-button type="primary" :loading="loading_btn" @click="DoneUpdateDatadialogVisible = false">OK</el-button>
</div>
</el-dialog>
<!-- popup edit data end -->
@@ -117,7 +117,7 @@
<el-dialog align="center" :visible.sync="DeleteAdddialogVisible" width="30%">
<span>Data Deleted</span><br><br>
<div align="center">
<el-button type="primary" @click="DeleteAdddialogVisible = false">OK</el-button>
<el-button type="primary" :loading="loading_btn" @click="DeleteAdddialogVisible = false">OK</el-button>
</div>
</el-dialog>
<!-- popup delete end -->
@@ -130,6 +130,7 @@
export default {
data() {
return {
loading_btn: false,
tableData: [],
beneficiariesForm : {
company_name : '',
@@ -153,14 +154,17 @@
},
methods: {
CreateBeneficiaries : function(){
this.loading_btn = true
this.AddDatadialogVisible = false;
axios.post('/api/setting-beneficiary', this.beneficiariesForm)
.then((response) => {
this.loading_btn = false
this.DoneAddDatadialogVisible = true;
this.ClearBeneficiariesForm();
this.UpdateTableData();
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
@@ -172,11 +176,17 @@
});
},
UpdateTableData : function(){
this.loading_btn = true
axios.get('/api/setting-beneficiary', this.beneficiariesForm)
.then((response) => {
this.loading_btn = false
this.tableData = response.data;
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
@@ -187,12 +197,21 @@
})
},
DeleteBeneficiaries : function(beneficiaries_id){
this.loading_btn = true
this.DeleteAdddialogVisible = true;
axios.delete('/api/setting-beneficiary/' + beneficiaries_id)
.then((response) => {
this.loading_btn = false
this.UpdateTableData();
this.$message({
showClose: true,
message: 'Data Deleted Successfully',
type: 'success',
duration: 5000
});
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
@@ -203,14 +222,24 @@
});
},
EditBeneficiaries : function(){
this.loading_btn = true
this.EditDatadialogVisible = false;
this.DoneUpdateDatadialogVisible = true;
axios.put('/api/setting-beneficiary/' + this.currentEdit, this.beneficiariesForm)
.then((response) => {
this.loading_btn = false
this.UpdateTableData();
this.$message({
showClose: true,
message: 'Data Updated Succesfully',
type: 'success',
duration: 5000
});
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
@@ -62,7 +62,7 @@
this.loading_btn = false
this.$message({
showClose: true,
message: 'Success',
message: 'Time Limit and Credit Limit Updated Successfully',
type: 'success',
duration: 5000
});
@@ -11,8 +11,8 @@
<el-table-column prop="bank_branch" label="Bank Branch"></el-table-column>
<el-table-column label="Action">
<template slot-scope="scope">
<el-button type="text" size="small" @click="PopOutEditMalaysiaBank(scope.$index)">Edit</el-button>
<el-button type="text" size="small" @click="DeleteMalaysiaBank(tableData[scope.$index].id)">Delete</el-button>
<el-button type="text" size="small" :loading="loading_btn" @click="PopOutEditMalaysiaBank(scope.$index)">Edit</el-button>
<el-button type="text" size="small" :loading="loading_btn" @click="DeleteMalaysiaBank(tableData[scope.$index].id)">Delete</el-button>
</template>
</el-table-column>
</el-table><br>
@@ -53,7 +53,7 @@
</el-form>
<div align="center">
<el-button @click="AddDatadialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="CreateMalaysiaBank" :disabled="errors.any() || 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="errors.any() || malaysiaBankForm.company_name=='' || malaysiaBankForm.bank_name=='' || malaysiaBankForm.acc_no=='' || malaysiaBankForm.bank_address=='' || malaysiaBankForm.swift =='' || malaysiaBankForm.cnap=='' || malaysiaBankForm.bank_branch=='' ? true : false">OK</el-button>
</div>
<span slot="footer" class="dialog-footer">
* Please key in the data in Chinese
@@ -62,7 +62,7 @@
<el-dialog align="center" :visible.sync="DoneAddDatadialogVisible" width="30%">
<span>Data Added Successfully</span><br><br>
<div align="center">
<el-button type="primary" @click="DoneAddDatadialogVisible = false">OK</el-button>
<el-button type="primary" :loading="loading_btn" @click="DoneAddDatadialogVisible = false">OK</el-button>
</div>
</el-dialog>
<!-- popup add new data end -->
@@ -100,7 +100,7 @@
</el-form>
<div align="center">
<el-button @click="EditDatadialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="EditMalaysiaBank" :disabled="errors.any() || 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="errors.any() || malaysiaBankForm.company_name=='' || malaysiaBankForm.bank_name=='' || malaysiaBankForm.acc_no=='' || malaysiaBankForm.bank_address=='' || malaysiaBankForm.swift =='' || malaysiaBankForm.cnap=='' || malaysiaBankForm.bank_branch=='' ? true : false">Submit</el-button>
</div>
<span slot="footer" class="dialog-footer">
* Please key in the data in Chinese
@@ -109,7 +109,7 @@
<el-dialog align="center" :visible.sync="DoneUpdateDatadialogVisible" width="30%">
<span>Data Updated Successfully</span><br><br>
<div align="center">
<el-button type="primary" @click="DoneUpdateDatadialogVisible = false">OK</el-button>
<el-button type="primary" :loading="loading_btn" @click="DoneUpdateDatadialogVisible = false">OK</el-button>
</div>
</el-dialog>
<!-- popup edit data end -->
@@ -117,7 +117,7 @@
<el-dialog align="center" :visible.sync="DeleteAdddialogVisible" width="30%">
<span>Data Deleted</span><br><br>
<div align="center">
<el-button type="primary" @click="DeleteAdddialogVisible = false">OK</el-button>
<el-button type="primary" :loading="loading_btn" @click="DeleteAdddialogVisible = false">OK</el-button>
</div>
</el-dialog>
<!-- popup delete end -->
@@ -130,6 +130,7 @@
export default {
data() {
return {
loading_btn: false,
tableData: [],
malaysiaBankForm : {
company_name : '',
@@ -153,14 +154,23 @@
},
methods: {
CreateMalaysiaBank : function(){
this.loading_btn = true
this.AddDatadialogVisible = false;
axios.post('/api/setting-malaysia-bank', this.malaysiaBankForm)
.then((response) => {
this.loading_btn = false
this.DoneAddDatadialogVisible = true;
this.ClearMalaysiaBankForm();
this.UpdateTableData();
})
this.$message({
showClose: true,
message: 'Success',
type: 'success',
duration: 5000
});
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
@@ -172,11 +182,21 @@
});
},
UpdateTableData : function(){
this.loading_btn = true
axios.get('/api/setting-malaysia-bank', this.malaysiaBankForm)
.then((response) => {
this.loading_btn = false;
this.tableData = response.data;
this.$message({
showClose: true,
message: 'Data Updated Successfully',
type: 'success',
duration: 5000
});
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
@@ -187,12 +207,21 @@
})
},
DeleteMalaysiaBank : function(malaysiaBank_id){
this.loading_btn = true;
this.DeleteAdddialogVisible = true;
axios.delete('/api/setting-malaysia-bank/' + malaysiaBank_id)
.then((response) => {
this.UpdateTableData();
this.$message({
showClose: true,
message: 'Data Deleted Successfully',
type: 'success',
duration: 5000
});
})
.catch((error) => {
this.loading_btn = false;
console.log(error);
this.$message({
showClose: true,
@@ -203,11 +232,20 @@
});
},
EditMalaysiaBank : function(){
this.loading_btn = true;
this.EditDatadialogVisible = false;
this.DoneUpdateDatadialogVisible = true;
axios.put('/api/setting-malaysia-bank/' + this.currentEdit, this.malaysiaBankForm)
.then((response) => {
this.loading_btn = false;
this.UpdateTableData();
this.$message({
showClose: true,
message: 'Updated Successfully',
type: 'success',
duration: 5000
});
})
.catch((error) => {
console.log(error);