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) public function __invoke ($id)
{ {
$nominee = Nominee::find($id); $nominee = Nominee::findOrFail($id);
Util::deleteImage($nominee->image); Util::deleteImage($nominee->image);
$nominee->delete(); $nominee->delete();
@@ -56,7 +56,7 @@ export default{
.catch(error=>{ .catch(error=>{
$.notifyClose(); $.notifyClose();
vm.loading = false; vm.loading = false;
vm.util.showResult(error, 'error') vm.util.showResult(error.response, 'error');
}) })
} }
} }
@@ -16,9 +16,9 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<!-- {{ users }} --> <!-- {{ 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"> <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>
<!-- <router-link :to="{name: 'Manage Partylist'}" v-if="data.user.role==1" tag="li"> <!-- <router-link :to="{name: 'Manage Partylist'}" v-if="data.user.role==1" tag="li">
@@ -26,15 +26,15 @@
</router-link> --> </router-link> -->
<router-link :to="{name: 'Manage Voter'}" v-if="data.user.role==1" tag="li"> <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>
<router-link :to="{name: 'Maklumat Calon'}" v-if="data.user.role==1" tag="li"> <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>
<router-link :to="{name: 'Kehadiran Calon'}" v-if="data.user.role==1" tag="li"> <router-link :to="{name: 'Kehadiran Calon'}" v-if="data.user.role==1" tag="li">
<a href="#">Kehadiran</a> <a href="#">KEHADIRAN</a>
</router-link> </router-link>
</ul> </ul>
@@ -85,7 +85,7 @@ export default{
// }), // }),
created: function () { created: function () {
this.util.setTitle('Voting System - Administrator'); this.util.setTitle('MyKoPKB - Administrator');
var vm = this; var vm = this;
if (this.util.isLogin()) { if (this.util.isLogin()) {
this.util.setAuthorization(); this.util.setAuthorization();
@@ -62,7 +62,7 @@
</div> </div>
<div class="form-group pull-right"> <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 <router-link
:to="{name:'Maklumat Calon'}" :to="{name:'Maklumat Calon'}"
class="btn btn-default"> class="btn btn-default">
@@ -125,7 +125,7 @@ export default{
if (this.loading) return; if (this.loading) return;
var vm = this; var vm = this;
this.loading = true; this.loading = true;
this.util.notify('Updating nominee', 'progress', 0); this.util.notify('Kemaskini undian', 'progress', 0);
$('#edit_form').ajaxSubmit({ $('#edit_form').ajaxSubmit({
success: function (response) { success: function (response) {
$.notifyClose(); $.notifyClose();
@@ -139,7 +139,7 @@ export default{
vm.util.showResult(error, 'error', 'ajax'); vm.util.showResult(error, 'error', 'ajax');
}, },
uploadProgress: function (a, b, c, progress) { 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 } }" <router-link :to="{ name: 'Edit Nominee', params: { id: nominee.id } }"
class="btn btn-primary"> class="btn btn-primary">
<i class="fa fa-edit"></i> Edit <i class="fa fa-edit"></i> Set semula
</router-link> </router-link>
<button class="btn btn-danger" @click="util.showModal(nominee.id)" id=nominee.id> <button class="btn btn-danger" @click="util.showModal(nominee.id)" id=nominee.id>
<i class="fa fa-trash"></i> Padam <i class="fa fa-trash"></i> Padam
@@ -72,7 +72,7 @@
<h3>Are you sure to delete this nominee?</h3> <h3>Are you sure to delete this nominee?</h3>
</modal-body> </modal-body>
<modal-footer> <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')"> <button class="btn btn-default" @click="util.hideModal('#delete-nominee-modal')">
Kembali Kembali
</button> </button>
@@ -105,8 +105,16 @@ export default {
axios.delete(config.API + 'nominee/' + nomineeId) // Make DELETE request axios.delete(config.API + 'nominee/' + nomineeId) // Make DELETE request
.then(response => { .then(response => {
$.notifyClose(); // Close notification $.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 this.refreshNominee(); // Refresh the list of nominees
} else {
this.util.notify('Failed to delete nominee', 'error'); // Show error notification
} }
}) })
.catch(error => { .catch(error => {
@@ -22,7 +22,7 @@
<th>Unit</th> <th>Unit</th>
<th>Saham</th> <th>Saham</th>
<th>Yuran</th> <th>Yuran</th>
<th>Action</th> <th>Tindakan</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -35,12 +35,12 @@
<td>{{ voter.yuran }}</td> <td>{{ voter.yuran }}</td>
<td> <td>
<button class="btn btn-info" @click="edit(i)"> <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>
<button <button
class="btn btn-danger" class="btn btn-danger"
@click="util.showModal('#delete-voter-modal');id=voter.id"> @click="util.showModal('#delete-voter-modal');id=voter.id">
<i class="fa fa-trash"></i> Delete <i class="fa fa-trash"></i> Padam
</button> </button>
</td> </td>
</tr> </tr>
@@ -77,8 +77,8 @@ export default {
.centered-image { .centered-image {
/* Styles for the image */ /* Styles for the image */
max-width: 30%; /* Ensure the image does not exceed container width */ max-width: 20%; /* Ensure the image does not exceed container width */
max-height: 30%; /* Ensure the image does not exceed container height */ max-height: 20%; /* Ensure the image does not exceed container height */
position: relative; position: relative;
/* top: 50%; */ /* top: 50%; */
left: 50%; left: 50%;
@@ -37,7 +37,7 @@ document.addEventListener('DOMContentLoaded', function () {
// Select the image element by its ID // Select the image element by its ID
var logoImage = document.getElementById('logo'); var logoImage = document.getElementById('logo');
// Set the source of the image dynamically // 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 // Add error handling
logoImage.onerror = function() { logoImage.onerror = function() {