update-admin-ui

This commit is contained in:
hayatie
2024-04-21 12:30:02 +08:00
parent 325b797fc0
commit 842f4a2386
8 changed files with 28 additions and 20 deletions
@@ -11,7 +11,7 @@ class DeleteController extends Controller
{
public function __invoke ($id)
{
$nominee = Nominee::find($id);
$nominee = Nominee::findOrFail($id);
Util::deleteImage($nominee->image);
$nominee->delete();
@@ -56,7 +56,7 @@ export default{
.catch(error=>{
$.notifyClose();
vm.loading = false;
vm.util.showResult(error, 'error')
vm.util.showResult(error.response, 'error');
})
}
}
@@ -16,9 +16,9 @@
<ul class="nav navbar-nav">
<!-- {{ users }} -->
<router-link :to="{name: 'Admin Home'}" tag="li" exact><a href="#">Laman Utama </a></router-link>
<router-link :to="{name: 'Admin Home'}" tag="li" exact><a href="#">LAMAN UTAMA </a></router-link>
<router-link :to="{name: 'Kemaskini Jawatan'}" v-if="data.user.role==1" tag="li">
<a href="#">Jawatan</a>
<a href="#">JAWATAN</a>
</router-link>
<!-- <router-link :to="{name: 'Manage Partylist'}" v-if="data.user.role==1" tag="li">
@@ -26,15 +26,15 @@
</router-link> -->
<router-link :to="{name: 'Manage Voter'}" v-if="data.user.role==1" tag="li">
<a href="#">Anggota Koperasi</a>
<a href="#">ANGGOTA KOPERASI</a>
</router-link>
<router-link :to="{name: 'Maklumat Calon'}" v-if="data.user.role==1" tag="li">
<a href="#">Calon</a>
<a href="#">CALON ALK</a>
</router-link>
<router-link :to="{name: 'Kehadiran Calon'}" v-if="data.user.role==1" tag="li">
<a href="#">Kehadiran</a>
<a href="#">KEHADIRAN</a>
</router-link>
</ul>
@@ -85,7 +85,7 @@ export default{
// }),
created: function () {
this.util.setTitle('Voting System - Administrator');
this.util.setTitle('MyKoPKB - Administrator');
var vm = this;
if (this.util.isLogin()) {
this.util.setAuthorization();
@@ -62,7 +62,7 @@
</div>
<div class="form-group pull-right">
<input type="submit" value="Submit" class="btn btn-info">
<input type="submit" value="Simpan" class="btn btn-info">
<router-link
:to="{name:'Maklumat Calon'}"
class="btn btn-default">
@@ -125,7 +125,7 @@ export default{
if (this.loading) return;
var vm = this;
this.loading = true;
this.util.notify('Updating nominee', 'progress', 0);
this.util.notify('Kemaskini undian', 'progress', 0);
$('#edit_form').ajaxSubmit({
success: function (response) {
$.notifyClose();
@@ -139,7 +139,7 @@ export default{
vm.util.showResult(error, 'error', 'ajax');
},
uploadProgress: function (a, b, c, progress) {
this.util.notify('Updating nominee', 'progress', progress);
this.util.notify('Kemaskini undian', 'progress', progress);
}
})
}
@@ -51,7 +51,7 @@
<router-link :to="{ name: 'Edit Nominee', params: { id: nominee.id } }"
class="btn btn-primary">
<i class="fa fa-edit"></i> Edit
<i class="fa fa-edit"></i> Set semula
</router-link>
<button class="btn btn-danger" @click="util.showModal(nominee.id)" id=nominee.id>
<i class="fa fa-trash"></i> Padam
@@ -72,7 +72,7 @@
<h3>Are you sure to delete this nominee?</h3>
</modal-body>
<modal-footer>
<button class="btn btn-danger" @click="deleteNominee()">Delete</button>
<button class="btn btn-danger" @click="deleteNominee()">Padam</button>
<button class="btn btn-default" @click="util.hideModal('#delete-nominee-modal')">
Kembali
</button>
@@ -105,8 +105,16 @@ export default {
axios.delete(config.API + 'nominee/' + nomineeId) // Make DELETE request
.then(response => {
$.notifyClose(); // Close notification
if (this.util.showResult(response, 'success')) { // Show success notification
// if (this.util.showResult(response, 'success')) {
if (response.data && response.data.status === 'success') {
this.util.notify('Nominee deleted successfully', 'success');
// Show success notification
this.refreshNominee(); // Refresh the list of nominees
} else {
this.util.notify('Failed to delete nominee', 'error'); // Show error notification
}
})
.catch(error => {
@@ -22,7 +22,7 @@
<th>Unit</th>
<th>Saham</th>
<th>Yuran</th>
<th>Action</th>
<th>Tindakan</th>
</tr>
</thead>
<tbody>
@@ -35,12 +35,12 @@
<td>{{ voter.yuran }}</td>
<td>
<button class="btn btn-info" @click="edit(i)">
<i class="fa fa-edit"></i> Edit
<i class="fa fa-edit"></i> Set semula
</button>
<button
class="btn btn-danger"
@click="util.showModal('#delete-voter-modal');id=voter.id">
<i class="fa fa-trash"></i> Delete
<i class="fa fa-trash"></i> Padam
</button>
</td>
</tr>
@@ -77,8 +77,8 @@ export default {
.centered-image {
/* Styles for the image */
max-width: 30%; /* Ensure the image does not exceed container width */
max-height: 30%; /* Ensure the image does not exceed container height */
max-width: 20%; /* Ensure the image does not exceed container width */
max-height: 20%; /* Ensure the image does not exceed container height */
position: relative;
/* top: 50%; */
left: 50%;
@@ -37,7 +37,7 @@ document.addEventListener('DOMContentLoaded', function () {
// Select the image element by its ID
var logoImage = document.getElementById('logo');
// Set the source of the image dynamically
logoImage.src = 'https://i.ibb.co/txhx2N0/My-Ko-PKB-logo-removebg-preview.png'; // Replace this URL with your desired image URL
logoImage.src = 'https://i.ibb.co/txhx2N0/My-Ko-PKB-logo-removebg-preview.png?' + new Date().getTime(); // Replace this URL with your desired image URL
// Add error handling
logoImage.onerror = function() {