[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: PageListComponent.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.pages") }}</h3> <div class="db-card-filter"> <TableLimitComponent :method="list" :search="props.search" :page="paginationPage" /> <PageCreateComponent :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.title") }} </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="pages.length > 0"> <tr class="db-table-body-tr" v-for="page in pages" :key="page"> <td class="db-table-body-td"> {{ textShortener(page.title) }} </td> <td class="db-table-body-td"> <span :class="statusClass(page.status)"> {{ enums.statusEnumArray[page.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"> <SmViewComponent :link="'admin.settings.page.show'" :id="page.id" /> <SmModalEditComponent @click="edit(page)" /> <SmDeleteComponent @click="destroy(page.id)" /> </div> </td> </tr> </tbody> <tbody class="db-table-body" v-else> <tr class="db-table-body-tr"> <td class="db-table-body-td text-center" colspan="3"> <div class="p-4"> <div class="max-w-[300px] mx-auto mt-2"> <img class="w-full h-full" :src="ENV.API_URL+'/images/default/not-found/not_found.png'" alt="Not Found"> </div> <span class="d-block mt-3 text-lg">{{ $t('message.no_data_found') }}</span> </div> </td> </tr> </tbody> </table> </div> <div class="flex items-center justify-between border-t border-gray-200 bg-white px-4 py-6" v-if="pages.length > 0"> <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 PageCreateComponent from "./PageCreateComponent"; 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 statusEnum from "../../../../enums/modules/statusEnum"; import TableLimitComponent from "../../components/TableLimitComponent"; import SmDeleteComponent from "../../components/buttons/SmDeleteComponent"; import SmModalEditComponent from "../../components/buttons/SmModalEditComponent"; import SmViewComponent from "../../components/buttons/SmViewComponent"; import ENV from "../../../../config/env"; export default { name: "PageListComponent", components: { TableLimitComponent, PaginationSMBox, PaginationBox, PaginationTextComponent, PageCreateComponent, LoadingComponent, SmDeleteComponent, SmModalEditComponent, SmViewComponent, }, data() { return { loading: { isActive: false, }, enums: { statusEnum: statusEnum, statusEnumArray: { [statusEnum.ACTIVE]: this.$t("label.active"), [statusEnum.INACTIVE]: this.$t("label.inactive"), }, }, props: { form: { title: "", description: "", menu_section_id: null, menu_template_id: null, status: statusEnum.ACTIVE, }, search: { paginate: 1, page: 1, per_page: 10, order_column: "id", order_type: "desc", }, }, ENV:ENV }; }, mounted() { this.list(); this.$store.dispatch("menuSection/lists"); this.$store.dispatch("menuTemplate/lists"); }, computed: { pages: function () { return this.$store.getters["page/lists"]; }, pagination: function () { return this.$store.getters["page/pagination"]; }, paginationPage: function () { return this.$store.getters["page/page"]; }, menuSections: function () { return this.$store.getters["menuSection/lists"]; }, menuTemplates: function () { return this.$store.getters["menuTemplate/lists"]; }, }, methods: { statusClass: function (status) { return appService.statusClass(status); }, textShortener: function (text, number = 30) { return appService.textShortener(text, number); }, list: function (page = 1) { this.loading.isActive = true; this.props.search.page = page; this.$store.dispatch("page/lists", this.props.search).then((res) => { this.loading.isActive = false; }).catch((err) => { this.loading.isActive = false; }); }, edit: function (page) { appService.modalShow(); this.loading.isActive = true; this.$store.dispatch("page/edit", page.id); this.props.form = { title: page.title, status: page.status, description: page.description, menu_section_id: page.menu_section_id, menu_template_id: page.menu_template_id === 0 || page.menu_template_id === "" || page.menu_template_id === null ? null : page.menu_template_id, }; this.loading.isActive = false; }, destroy: function (id) { appService.destroyConfirmation().then((res) => { try { this.loading.isActive = true; this.$store.dispatch("page/destroy", { id: id, search: this.props.search, }).then((res) => { this.loading.isActive = false; alertService.successFlip( null, this.$t("menu.pages") ); }).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 Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.85 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285