fix/removeDeleteandAddBankStatus

This commit is contained in:
lonetrinity
2018-09-25 15:04:03 +08:00
parent bcf83b167c
commit 6022a8fccd
9 changed files with 49 additions and 37 deletions
@@ -37,4 +37,10 @@ class SettingMalaysiaBankController extends Controller
return response()->json(null, 204);
}
public function updateStatus(string $id, SettingMalaysiaBank $malaysiaBank){
$currentRecord = SettingMalaysiaBank::where('id', $id)->first();
SettingMalaysiaBank::where('id', $id)->update(['active' => $currentRecord->active === 1 ? 0 : 1]);
return response()->json(SettingMalaysiaBank::all(), 200);
}
}
+1 -1
View File
@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
class SettingMalaysiaBank extends Model
{
protected $fillable = ['company_name','bank_name','acc_no','bank_address','swift','cnap','bank_branch'];
protected $fillable = ['company_name','bank_name','acc_no','bank_address','swift','cnap','bank_branch', 'active'];
}
@@ -21,6 +21,7 @@ class AddNullableSettingMalaysiaBankTable extends Migration
$table->string('swift')->nullable()->change();
$table->string('cnap')->nullable()->change();
$table->string('bank_branch')->nullable()->change();
$table->integer('active')->default(1);
});
}
+1 -1
View File
@@ -29,7 +29,7 @@ class SettingBeneficiarySeeder extends Seeder
'bank_address' => 'Jalan cyberjaya',
'swift' => 'AB3333',
'cnap' => 'CADSeed',
'bank_branch' => 'cyberjaa
'bank_branch' => 'cyberjaya
'
]);
}
+1
View File
@@ -34,6 +34,7 @@
"vue-axios": "^2.1.1",
"vue-button-spinner": "^2.2.0",
"vue-i18n": "^7.6.0",
"vue-js-toggle-button": "^1.3.0",
"vue-loader": "^14.2.2",
"vue-loading-spinner": "^1.0.11",
"vue-meta": "^1.4.4",
+2
View File
@@ -6,6 +6,8 @@ import App from '~/components/App'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en'
import ToggleButton from 'vue-js-toggle-button'
Vue.use(ToggleButton)
import '~/plugins'
import '~/components'
@@ -9,7 +9,8 @@
v-for="item in options_CIEF"
:key="item.value"
:label="item.label"
:value="item.value">
:value="item.value"
:disabled="item.disabled === 0">
</el-option>
</el-select>
</el-form-item>
@@ -21,7 +22,8 @@
v-for="item in options_CIEF"
:key="item.value"
:label="item.label"
:value="item.value">
:value="item.value"
:disabled="item.disabled === 0">
</el-option>
</el-select>
</el-form-item>
@@ -76,6 +78,7 @@ export default {
return {
value : item.id,
label : item.company_name + " : " + item.bank_name + " : " + item.acc_no,
disabled : item.active
};
});
})
@@ -4,15 +4,19 @@
<el-table :data="tableData" border style="width: 100%">
<el-table-column prop="company_name" label="Company Name" width="90px"></el-table-column>
<el-table-column prop="bank_name" label="Bank Name"></el-table-column>
<el-table-column prop="acc_no" label="Bank Account No" width="115px"></el-table-column>
<el-table-column prop="bank_address" label="Bank Address" width="111px"></el-table-column>
<el-table-column prop="swift" label="SWIFT Code"></el-table-column>
<el-table-column prop="acc_no" label="Bank Account No" width="125px"></el-table-column>
<el-table-column prop="bank_address" label="Bank Address" width="121px"></el-table-column>
<el-table-column prop="swift" label="SWIFT Code" width="101px"></el-table-column>
<el-table-column prop="cnap" label="CNAP" width="80px"></el-table-column>
<el-table-column prop="bank_branch" label="Bank Branch"></el-table-column>
<el-table-column prop="bank_branch" label="Bank Branch" width="111px"></el-table-column>
<el-table-column label="Action">
<template slot-scope="scope">
<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>
<div id="mobile-toggle" v-bind:class="{ active: showMobileMenu }" v-on:click="showMobileMenu = !showMobileMenu"><toggle-button :value="scope.row.active === 1 ? true : false"
color="#82C7EB"
:sync="true"
@change="UpdateBankStatus(scope.row.id)"
:labels="{checked: 'Active', unchecked: 'Inactive'}" :width="70"/></div>
<el-button type="text" size="small" :loading="loading_btn" @click="PopOutEditMalaysiaBank(scope.$index)">Edit Information</el-button>
</template>
</el-table-column>
</el-table><br>
@@ -134,14 +138,15 @@
swift : '',
cnap : '',
bank_branch : '',
},
EditDatadialogVisible: false,
DeleteAdddialogVisible: false,
AddDatadialogVisible: false,
DoneAddDatadialogVisible: false,
DoneUpdateDatadialogVisible: false,
currentEdit : -1,
}
}
},
mounted(){
this.UpdateTableData();
@@ -175,6 +180,24 @@
this.ClearMalaysiaBankForm();
});
},
UpdateBankStatus : function(id){
this.loading_btn = true
axios.put('/api/setting-malaysia-bank/status/'+ id)
.then((response) => {
this.loading_btn = false;
this.tableData = response.data;
})
.catch((error) => {
this.loading_btn = false
console.log(error);
this.$message({
showClose: true,
message: 'Update Status fail',
type: 'error',
duration: 10000
});
})
},
UpdateTableData : function(){
this.loading_btn = true
axios.get('/api/setting-malaysia-bank', this.malaysiaBankForm)
@@ -195,31 +218,6 @@
});
})
},
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,
message: 'Delete data fail',
type: 'error',
duration: 10000
});
});
},
EditMalaysiaBank : function(){
this.loading_btn = true;
this.EditDatadialogVisible = false;
+1
View File
@@ -101,6 +101,7 @@ Route::group(['middleware' => ['role:admin']], function() {
Route::post('setting-malaysia-bank', 'SettingMalaysiaBankController@store');
Route::put('setting-malaysia-bank/{malaysiaBank}', 'SettingMalaysiaBankController@update');
Route::delete('setting-malaysia-bank/{malaysiaBank}', 'SettingMalaysiaBankController@delete');
Route::put('setting-malaysia-bank/status/{id}', 'SettingMalaysiaBankController@updateStatus');
Route::get('setting-marking', 'MarkingController@index');
Route::post('setting-marking', 'MarkingController@store');