DONE: add accumulated amount display

This commit is contained in:
ISMAIL MASSERAN
2026-05-18 11:52:32 +08:00
parent e8d4f03627
commit fe9223cae1
11 changed files with 482 additions and 242 deletions
@@ -1,49 +1,60 @@
<template>
<div class="panel panel-default">
<div class="panel-body">
<h4><b>Kemaskini Maklumat</b></h4>
<form @submit.prevent="edit()" id="edit-form">
<div class="form-group">
<label for="name">Nama</label>
<input type="text" name="name" class="form-control" :value="data.voter.name" required/>
</div>
<div class="panel panel-default">
<div class="panel-body">
<h4><b>Kemaskini Maklumat</b></h4>
<form @submit.prevent="edit()" id="edit-form">
<div class="form-group">
<label for="name">Nama</label>
<input type="text" name="name" class="form-control" :value="data.voter.name" required />
</div>
<div class="form-group">
<label for="no_kp">No. Kad Pengenalan</label>
<input type="text" name="no_kp" class="form-control" :value="data.voter.no_kp" required/>
</div>
<div class="form-group">
<label for="no_kp">No. Kad Pengenalan</label>
<input type="text" name="no_kp" class="form-control" :value="data.voter.no_kp" required />
</div>
<div class="form-group">
<label for="telefon">No. Telefon</label>
<input type="text" name="telefon" class="form-control" :value="data.voter.telefon" required/>
</div>
<div class="form-group">
<label for="telefon">No. Telefon</label>
<input type="text" name="telefon" class="form-control" :value="data.voter.telefon" required />
</div>
<div class="form-group">
<label for="Unit">Unit</label>
<input type="text" name="unit" class="form-control" :value="data.voter.unit" required/>
</div>
<div class="form-group">
<label for="Unit">Unit</label>
<input type="text" name="unit" class="form-control" :value="data.voter.unit" required />
</div>
<div class="form-group">
<label for="saham">Saham</label>
<input type="text" name="saham" class="form-control" :value="data.voter.saham" required/>
</div>
<div class="form-group">
<label for="saham">Saham</label>
<input type="text" name="saham" class="form-control" :value="data.voter.saham" required />
</div>
<div class="form-group">
<label for="yuran">Yuran</label>
<input type="text" name="yuran" class="form-control" :value="data.voter.yuran" required/>
</div>
<div class="form-group">
<label for="yuran">Yuran</label>
<input type="text" name="yuran" class="form-control" :value="data.voter.yuran" required />
</div>
<div class="form-group">
<input type="submit" value="Hantar" class="btn btn-success"/>
<router-link :to="{name: 'Manage Voter'}" class="btn btn-default">Kembali</router-link>
</div>
</form>
<div class="form-group">
<label for="accumulated_amount">Jumlah Pelaburan (hingga Dis 2025)</label>
<input type="text" name="accumulated_amount" class="form-control"
:value="data.voter.accumulated_amount" required />
</div>
<div class="form-group">
<label for="pelaburan">Dividen Simpanan Khas (Tabung 1) Tahun 2025</label>
<input type="text" name="pelaburan" class="form-control" :value="data.voter.pelaburan" required />
</div>
<div class="form-group">
<input type="submit" value="Hantar" class="btn btn-success" />
<router-link :to="{ name: 'Manage Voter' }" class="btn btn-default">Kembali</router-link>
</div>
</form>
</div>
</div>
</div>
</template>
<script>
export default{
export default {
data: function () {
return {
loading: false
@@ -52,7 +63,7 @@ export default{
created: function () {
if (!this.data.voter.id) {
this.$router.push({name:'Manage Voter'});
this.$router.push({ name: 'Manage Voter' });
}
},
@@ -62,15 +73,15 @@ export default{
this.loading = true;
var vm = this;
this.util.notify('Updating voter', 'loading');
axios.put(config.API+'voter/'+this.data.voter.id, $('#edit-form').serialize())
.then(response=>{
axios.put(config.API + 'voter/' + this.data.voter.id, $('#edit-form').serialize())
.then(response => {
vm.loading = false;
$.notifyClose();
if (vm.util.showResult(response, 'success')) {
vm.$router.push({name:'Manage Voter'});
vm.$router.push({ name: 'Manage Voter' });
}
})
.catch(error=>{
.catch(error => {
$.notifyClose();
vm.loading = false;
vm.util.showResult(error);
@@ -106,6 +106,8 @@ export default {
{ title: 'Unit', key: 'unit', sortable: true },
{ title: 'Saham', key: 'saham', sortable: true },
{ title: 'Yuran', key: 'yuran', sortable: true },
{ title: 'Jumlah Pelaburan (hingga Dis 2025)', key: 'accumulated_amount', sortable: true },
{ title: 'Dividen Simpanan Khas (Tabung 1) Tahun 2025', key: 'pelaburan', sortable: true },
{ title: 'Tindakan', key: 'actions', sortable: false }
]
}
@@ -393,6 +393,7 @@ export default {
{ icon: "fa-building", label: "Unit", value: u.unit || "—" },
{ icon: "fa-line-chart", label: "Saham", value: "RM " + fmt(u.saham) },
{ icon: "fa-money", label: "Yuran", value: "RM " + fmt(u.yuran) },
{ icon: "fa-bank", label: "Simpanan Khas (Tabung 1) - (Sehingga Dis 2025)", value: "RM " + fmt(u.accumulated_amount) },
{ icon: "fa-percent", label: "Dividen Simpanan Khas (Tabung 1) Tahun 2025", value: "RM " + fmt(u.pelaburan) }
];
}