fix : delete confirm modal and style

This commit is contained in:
Ashrafi
2025-04-12 14:30:59 +03:30
parent 47d81a2aa6
commit 90b0e0dc65
25 changed files with 782 additions and 12074 deletions
+21 -20
View File
@@ -2,7 +2,7 @@
<div class>
<v-container fluid>
<material-card class color="black" title="All Items" text>
<v-layout align-center wrap class="my-3 px-5">
<v-layout align-center wrap class="my-3 px-3">
<v-flex xs12 sm4 md4 lg2 xl2 class="WM-FlexCenter">
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
<v-text-field class="py-3 pr-3" v-model="filter.item_id" label="Item ID"
@@ -43,10 +43,10 @@
</router-link>
</v-flex>
</v-layout>
<v-layout class="px-4 my-3">
<v-layout class="px-3 my-3">
<v-divider/>
</v-layout>
<v-layout align-center wrap class="my-3 px-5">
<v-layout align-center wrap class="my-3 px-3">
<v-flex md12>
<v-data-table :headers="headers" :items="items" hide-actions>
<template slot="headerCell" slot-scope="{ header }">
@@ -109,7 +109,7 @@
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn v-bind="attrs" v-on="on" color="pink" class="WM-ActionButton mr-2"
@click="remove(item.id)"
@click="removeModal(item.id)"
v-if="$hasRole('Admin|Supervisor') ||( item.user_id == $store.state.user.id && !['approved', 'rejected'].includes(item.status))">
<v-icon class="white--text mr-2 caption">fas fa-trash</v-icon>
<span>Remove</span>
@@ -137,7 +137,7 @@
<v-pagination color="black" v-model="currentPage" :length="lastPage"
:total-visible="6"/>
</div>
<v-layout row wrap align-center justify-center class="mt-3">
<v-layout row wrap align-center justify-center class="mt-3 px-3">
<router-link to="/dashboard">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black ml-5">
<v-icon class="black--text mr-2 caption">fas fa-chevron-left</v-icon>
@@ -200,9 +200,7 @@ export default {
}
}
filter += (page) ? `page=${page}` : `page=1`;
const result = await ApiService.get(
urls.listItem(filter)
);
const result = await ApiService.get(urls.listItem(filter));
if (result && result.status == 200) {
this.items = result.data.data;
this.currentPage = result.data.meta.current_page;
@@ -219,10 +217,8 @@ export default {
});
}
},
async show(testResultId) {
const result = await ApiService.get(
urls.showItem(testResultId)
);
async show(id) {
const result = await ApiService.get(urls.showItem(id));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-item-show",
@@ -230,16 +226,21 @@ export default {
});
}
},
async remove(testResultId) {
const result = await ApiService.delete(
urls.removeItem(testResultId)
);
removeModal(id) {
this.changeCurrentModal({
modal: "modal-delete-delete",
properties: {
success: () => {
this.remove(id);
},
}
});
},
async remove(id) {
const result = await ApiService.delete(urls.removeItem(id));
if (result && result.status == 200) {
for (const key in this.items) {
if (
this.items.hasOwnProperty(key) &&
this.items[key].id == testResultId
) {
if (this.items.hasOwnProperty(key) && this.items[key].id == id) {
this.items.splice(key, 1);
}
}