fix bug for validation. Remove nullable for malaysia bank table

This commit is contained in:
weiweitoo
2018-07-11 01:39:35 +08:00
parent 97453bb084
commit edbd8887c5
8 changed files with 81 additions and 21 deletions
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNotNullableSettingMalaysiaBankTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_malaysia_banks', function(Blueprint $table) {
$table->string('company_name')->nullable(false)->change();
$table->string('bank_name')->nullable(false)->change();
$table->string('acc_no')->nullable()->change(); // reference key at select active bank
$table->string('bank_address')->nullable(false)->change();
$table->string('swift')->nullable(false)->change();
$table->string('cnap')->nullable(false)->change();
$table->string('bank_branch')->nullable(false)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
+19 -1
View File
@@ -11,7 +11,25 @@ import '~/plugins'
import '~/components'
import VeeValidate from 'vee-validate';
Vue.use(VeeValidate);
const config = {
errorBagName: 'errors', // change if property conflicts.
fieldsBagName: 'fields',
delay: 0,
// locale: 'zh_CN',
strict: true,
enableAutoClasses: false,
classNames: {
touched: 'touched', // the control has been blurred
untouched: 'untouched', // the control hasn't been blurred
valid: 'valid', // model is valid
invalid: 'invalid', // model is invalid
pristine: 'pristine', // control has not been interacted with
dirty: 'dirty' // control has been interacted with
},
events: 'blur',
inject: true
};
Vue.use(VeeValidate, config);
Vue.config.productionTip = false
+1 -4
View File
@@ -59,8 +59,6 @@
</div>
</div>
<div class="form-group row">
<div class="col-md-7 offset-md-3 d-flex">
<!-- Submit Button -->
@@ -105,7 +103,6 @@ export default {
password_confirmation: ''
}),
email : '',
formError: [],
password_visible : false,
password_confirmation_visible : false
}),
@@ -124,7 +121,7 @@ export default {
.then( (response) => {
data = response.data
this.$message({
message: "Sucess. Logging in..",
message: "Success. Logging in..",
type: 'success'
})
})
@@ -53,7 +53,7 @@
</el-form>
<div align="center">
<el-button @click="AddDatadialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="CreateBeneficiaries">OK</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>
</div>
<span slot="footer" class="dialog-footer">
* Please key in the data in Chinese
@@ -100,7 +100,7 @@
</el-form>
<div align="center">
<el-button @click="EditDatadialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="EditBeneficiaries">Submit</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>
</div>
<span slot="footer" class="dialog-footer">
* Please key in the data in Chinese
@@ -157,7 +157,6 @@
methods: {
CreateBeneficiaries : function(){
this.AddDatadialogVisible = false;
console.log(this.beneficiariesForm);
client.post('api/setting-beneficiary', this.beneficiariesForm)
.then((response) => {
this.DoneAddDatadialogVisible = true;
@@ -40,12 +40,22 @@
this.getCreditSetting();
},
methods: {
ValidateAll : function(){
var working;
this.$validator.validateAll().then((result) => {
working = result;
}).catch(() => {
});
},
getCreditSetting() {
axios.get('/api/setting-credit').then(response => {
this.credit_setting = response.data
})
},
updateCreditSetting (){
if(this.ValidateAll())
return;
this.loading_btn = true
axios.put('/api/setting-credit', this.credit_setting)
.then((response) => {
@@ -53,7 +53,7 @@
</el-form>
<div align="center">
<el-button @click="AddDatadialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="CreateMalaysiaBank">OK</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>
</div>
<span slot="footer" class="dialog-footer">
* Please key in the data in Chinese
@@ -100,7 +100,7 @@
</el-form>
<div align="center">
<el-button @click="EditDatadialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="EditMalaysiaBank">Submit</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>
</div>
<span slot="footer" class="dialog-footer">
* Please key in the data in Chinese
@@ -151,12 +151,12 @@
currentEdit : -1,
}
},
beforeMount(){
this.UpdateTableData();
},
mounted(){
this.UpdateTableData();
},
methods: {
CreateMalaysiaBank : function(){
this.AddDatadialogVisible = false;
this.AddDatadialogVisible = false;
client.post('api/setting-malaysia-bank', this.malaysiaBankForm)
.then((response) => {
this.DoneAddDatadialogVisible = true;
@@ -190,7 +190,6 @@
})
},
DeleteMalaysiaBank : function(malaysiaBank_id){
console.log('delete'+malaysiaBank_id);
this.DeleteAdddialogVisible = true;
client.delete('api/setting-malaysia-bank/' + malaysiaBank_id)
.then((response) => {
@@ -209,7 +208,6 @@
EditMalaysiaBank : function(){
this.EditDatadialogVisible = false;
this.DoneUpdateDatadialogVisible = true;
client.put('api/setting-malaysia-bank/' + this.currentEdit, this.malaysiaBankForm)
.then((response) => {
this.UpdateTableData();
@@ -227,6 +225,8 @@
PopOutAddMalaysiaBank : function(){
this.AddDatadialogVisible = true;
this.ClearMalaysiaBankForm();
this.$validator.validateAll();
console.log(this.errors.count());
},
PopOutEditMalaysiaBank : function(tableDataRow){
this.EditDatadialogVisible = true;
@@ -12,7 +12,7 @@
</el-form-item>
</el-form>
<div align="right">
<el-button type="primary" icon="el-icon-plus" @click="CreateMarking">Add New Data</el-button>
<el-button type="primary" icon="el-icon-plus" @click="CreateMarking" :disabled="errors.any() || markingForm.email=='' || markingForm.marking=='' ? true : false">Add New Data</el-button>
</div>
</div>
</template>
@@ -61,7 +61,7 @@
ClearMarkingForm : function(){
this.markingForm.marking = '';
this.markingForm.email = '';
}
},
}
}
</script>
@@ -43,7 +43,7 @@
</el-form>
<div align="center">
<el-button @click="AddNewSupplierdialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="CreateSupplier">OK</el-button>
<el-button type="primary" @click="CreateSupplier" :disabled="errors.any() || supplierForm.company_name=='' || supplierForm.supplier_reg_no=='' || supplierForm.gst_no=='' || supplierForm.bank_name=='' || supplierForm.acc_no =='' ? true : false">OK</el-button>
</div>
</el-dialog>
<el-dialog align="center" :visible.sync="DoneAddSupplierdialogVisible" width="30%">
@@ -79,13 +79,13 @@
</el-form>
<div align="center">
<el-button @click="EditSupplierdialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="EditSupplier">OK</el-button>
<el-button type="primary" @click="EditSupplier" :disabled="errors.any() || supplierForm.company_name=='' || supplierForm.supplier_reg_no=='' || supplierForm.gst_no=='' || supplierForm.bank_name=='' || supplierForm.acc_no =='' ? true : false">OK</el-button>
</div>
</el-dialog>
<el-dialog align="center" :visible.sync="DoneUpdateSupplierdialogVisible" width="30%">
<span>Supplier's Details Updated Successfully</span><br><br>
<div align="center">
<el-button type="primary" @click="DoneUpdateSupplierdialogVisible = false">OK</el-button>
<el-button type="primary" @click="DoneUpdateSupplierdialogVisible = false" >OK</el-button>
</div>
</el-dialog>
<!-- popup edit supplier end -->