Explorer
home
/
zoteqbgb
/
public_html
/
resources
/
js
/
components
/
admin
/
settings
/
Unit
Location:
/home/zoteqbgb/public_html/resources/js/components/admin/settings/Unit
Root path:
/home/zoteqbgb/public_html/config/676626
Editing: UnitListComponent.vue
<template> <LoadingComponent :props="loading" /> <div class="db-card db-tab-div active"> <div class="db-card-header border-none"> <h3 class="db-card-title">{{ $t("menu.units") }}</h3> <div class="db-card-filter"> <TableLimitComponent :method="list" :search="props.search" :page="paginationPage" /> <UnitCreateComponent :props="props" /> </div> </div> <div class="db-table-responsive"> <table class="db-table stripe"> <thead class="db-table-head"> <tr class="db-table-head-tr"> <th class="db-table-head-th">{{ $t("label.name") }}</th> <th class="db-table-head-th">{{ $t("label.code") }}</th> <th class="db-table-head-th"> {{ $t("label.status") }} </th> <th class="db-table-head-th"> {{ $t("label.action") }} </th> </tr> </thead> <tbody class="db-table-body" v-if="units.length > 0"> <tr class="db-table-body-tr" v-for="unit in units" :key="unit"> <td class="db-table-body-td"> {{ unit.name }} </td> <td class="db-table-body-td"> {{ unit.code }} </td> <td class="db-table-body-td"> <span :class="statusClass(unit.status)"> {{ enums.statusEnumArray[unit.status] }} </span> </td> <td class="db-table-body-td"> <div class="flex justify-start items-center sm:items-start sm:justify-start gap-1.5"> <SmModalEditComponent @click="edit(unit)" /> <SmDeleteComponent @click="destroy(unit.id)" /> </div> </td> </tr> </tbody> </table> </div> <div class="flex items-center justify-between border-t border-gray-200 bg-white px-4 py-6"> <PaginationSMBox :pagination="pagination" :method="list" /> <div class="hidden sm:flex sm:flex-1 sm:items-center sm:justify-between"> <PaginationTextComponent :props="{ page: paginationPage }" /> <PaginationBox :pagination="pagination" :method="list" /> </div> </div> </div> </template> <script> import LoadingComponent from "../../components/LoadingComponent"; import UnitCreateComponent from "./UnitCreateComponent"; import alertService from "../../../../services/alertService"; import PaginationTextComponent from "../../components/pagination/PaginationTextComponent"; import PaginationBox from "../../components/pagination/PaginationBox"; import PaginationSMBox from "../../components/pagination/PaginationSMBox"; import appService from "../../../../services/appService"; import TableLimitComponent from "../../components/TableLimitComponent"; import SmDeleteComponent from "../../components/buttons/SmDeleteComponent"; import SmModalEditComponent from "../../components/buttons/SmModalEditComponent"; import statusEnum from "../../../../enums/modules/statusEnum"; export default { name: "UnitListComponent", components: { TableLimitComponent, PaginationSMBox, PaginationBox, PaginationTextComponent, UnitCreateComponent, LoadingComponent, SmDeleteComponent, SmModalEditComponent, }, data() { return { loading: { isActive: false, }, enums: { statusEnum: statusEnum, statusEnumArray: { [statusEnum.ACTIVE]: this.$t("label.active"), [statusEnum.INACTIVE]: this.$t("label.inactive"), }, }, props: { form: { name: "", code: "", status: statusEnum.ACTIVE, }, search: { paginate: 1, page: 1, per_page: 10, order_column: "id", order_type: "desc", }, }, }; }, mounted() { this.list(); }, computed: { units: function () { return this.$store.getters["unit/lists"]; }, pagination: function () { return this.$store.getters["unit/pagination"]; }, paginationPage: function () { return this.$store.getters["unit/page"]; }, }, methods: { statusClass: function (status) { return appService.statusClass(status); }, list: function (page = 1) { this.loading.isActive = true; this.props.search.page = page; this.$store.dispatch("unit/lists", this.props.search).then((res) => { this.loading.isActive = false; }).catch((err) => { this.loading.isActive = false; }); }, edit: function (unit) { appService.modalShow(); this.loading.isActive = true; this.$store.dispatch("unit/edit", unit.id); this.props.form = { name: unit.name, code: unit.code, status: unit.status, }; this.loading.isActive = false; }, destroy: function (id) { appService.destroyConfirmation().then((res) => { try { this.loading.isActive = true; this.$store.dispatch("unit/destroy", { id: id, search: this.props.search, }).then((res) => { this.loading.isActive = false; alertService.successFlip( null, this.$t("menu.units") ); }).catch((err) => { this.loading.isActive = false; alertService.error(err.response.data.message); }); } catch (err) { this.loading.isActive = false; alertService.error(err.response.data.message); } }).catch((err) => { this.loading.isActive = false; }); }, }, }; </script>
Save maftirs
Upload
Start Upload
New File
Create File
New Folder
Create Folder
Directory Contents
Name
Size
Perms
Modified
Actions
UnitComponent.vue
157 bytes
0644
2025-04-25 02:11
âï¸
ðï¸
Rename
UnitCreateComponent.vue
6,925 bytes
0644
2025-04-25 02:11
âï¸
ðï¸
Rename
UnitListComponent.vue
7,037 bytes
0644
2025-04-25 02:11
âï¸
ðï¸
Rename
Chang
Apply