���Root Mod By V1rus_Alfa
User / IP
:
216.73.216.158
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
.trash
/
pages
/
unit
/
edit
/
Viewing: [id].vue
<script setup lang="ts"> // import modules import { useMainStore } from '~/stores/index'; const { t } = useI18n() // set Meta definePageMeta({ title:'', layout: 'with-out-footer', middleware: ['auth'], }) // set const global const localePath = useLocalePath() const { locale } = useI18n() const config = useRuntimeConfig(); const { $api } = useNuxtApp() const MainStore = useMainStore() const toast = useToast() const { id } = useRoute().params const loading = ref(false); type res = { label: string, label_en: string, length: string, width: string, var_1: number, var_2: number, count: number, } const state:any = reactive({ y: undefined, x: undefined, z: undefined, s: undefined, unit_id : undefined, list_id : undefined, c: 1, count: 1, }) const computingUnit = ref(null as null | res[]); const colors =ref<any>([]); const route = useRoute() const { data }:any = await useAsyncData(`user:${id}`,async () => { const [feilds,result]:any = await Promise.all([ $api(config.public.API_URL+'/analyze/materials'), $api(config.public.API_URL+'/analyze/list/single',{ query: { unit_id: id } }) ]) const feildsOptions =JSON.parse(feilds).data.materials const list_res= JSON.parse(result).data.list const unit_res= list_res.unit return { feilds:feildsOptions , list:list_res , unit:unit_res }; },{ server:true }) const fillForm = async (feilds:any,list:any) => { if (feilds) { feilds.forEach((row:any) => { colors.value.push( { name: locale.value == 'en' ? row.title_en : row.title , value: row.id }); }); state.unit_id=list.unit.id state.list_id=list.id state.x=list.x state.y=list.y state.z=list.z state.s=list.s state.c=list.attach[0].material_id } }; onMounted( async () => { if (data.value.feilds) await fillForm(data.value.feilds,data.value.list); route.meta.title = t('Edit') +' '+ data.value.unit.title useHead ({ title: data.value.unit.title }) }) async function computing (type:any,title:any,url:any) { if(!state.y){ return toast.add({ title: t('Length field Alert'),color:"orange"})} if(!state.x ){ return toast.add({ title: t('Width field Alert'),color:"orange"})} if(!state.z ){ return toast.add({ title: t('Height field Alert'),color:"orange"})} let state_d = 1; if(state.s){ state_d = state.x - state.s; } loading.value=true; const {data}:any = await useAPI('/analyze/computing-unit', { method: 'POST', immediate: true, server: true, body: { y:state.y, x:state.x, z:state.z, s:state.s, c:state.c, d:state_d, count:state.count, type:type, unit_id: state.unit_id, list_id: state.list_id, unit_title: title } }) computingUnit.value= JSON.parse(data.value).data.result; loading.value=false; if(url){ navigateTo(localePath(url)); } } </script> <template> <div class=" mb-2 pt-3 px-2 mt-1"> <section :dir="$i18n.locale == 'en' ? 'ltr' : 'rtl'" > <div class=" flex justify-between items-start"> <div class=" w-full flex justify-between items-start mb-3"> <div class="w-5/12 "> <div class=" flex justify-between items-center w-full mb-3"> <label class="block w-5/12 text-gray-500 bg-white text-sm "> {{ t('Depth') }} </label> <div class="w-7/12 "> <UInput :loading="false" variant="outline" :inputClass="' w-10/12 sm:w-full !shadow-none focus:ring-1 rounded-sm focus:ring-orange-600 h-7 py-0 text-xs' " v-on:keypress="MainStore.NumbersOnly" v-model="state.y" /> </div> </div> <div class=" flex justify-between items-center w-full mb-3"> <label class="block w-5/12 text-gray-500 bg-white text-sm "> {{ t('Width') }} </label> <div class="w-7/12 "> <UInput :loading="false" variant="outline" :inputClass="' w-10/12 sm:w-full !shadow-none focus:ring-1 rounded-sm focus:ring-orange-600 h-7 py-0 text-xs' " v-on:keypress="MainStore.NumbersOnly" v-model="state.x" /> </div> </div> <div class=" flex justify-between items-center w-full mb-3"> <label class="block w-5/12 text-gray-500 bg-white text-sm "> {{ t('Height') }} </label> <div class="w-7/12 "> <UInput :loading="false" variant="outline" :inputClass="'w-10/12 sm:w-full !shadow-none focus:ring-1 rounded-sm focus:ring-orange-600 h-7 py-0 text-xs' " v-on:keypress="MainStore.NumbersOnly" v-model="state.z" /> </div> </div> <template v-if="data.unit.sabet_status == 'true'"> <div class=" flex justify-between items-center w-full mb-3"> <label class="block w-5/12 text-gray-500 bg-white text-sm "> {{ t('Fixed Width') }} </label> <div class="w-7/12 "> <UInput :loading="false" variant="outline" :inputClass="'w-10/12 sm:w-full !shadow-none focus:ring-1 rounded-sm focus:ring-orange-600 h-7 py-0 text-xs' " v-on:keypress="MainStore.NumbersOnly" v-model="state.s" /> </div> </div> </template> <div class=" flex justify-between items-center w-full mb-3"> <label class="block w-5/12 text-gray-500 bg-white text-sm "> {{ t('Door Color') }} </label> <div class="w-7/12 "> <USelect :options="colors" option-attribute="name" class="w-full" :selectClass="' w-full !shadow-none focus:ring-1 rounded-sm focus:ring-orange-600 h-7 pl-2 py-0 text-xs' " v-model="state.c" /> </div> </div> </div> <div class="h-32 w-[13rem] mb-3" > <template v-if="data.unit.image_2_d"> <img :src="config.public.FILE_URL+data.unit.image_2_d.address" class=" w-full h-full " :alt="t('Add Unit')" > </template> <UButton :loading="false" square @click="computing('computing',data.unit.title,null)" class="w-full flex text-main-700 rounded-sm border border-red-600 h-7 bg-white items-center justify-center"> <span v-text="computingUnit?.length ? t('Recalculate') : t('Computing')" class=" block px-2 text-sm truncate "> </span> </UButton> </div> </div> </div> </section> <section class=" mb-2 "> <div v-if=" loading == true" > <Snipper /> </div> <ul class=" w-full p-0" v-if="computingUnit" :dir="$i18n.locale == 'en' ? 'ltr' : 'rtl'"> <li class=" px-2 flex justify-between items-center w-full mb-2 border-b pb-2" :key="key" v-for="(res, key) in computingUnit"> <label v-text="$i18n.locale == 'en' ? res.label_en : res.label" class="block w-3/12 text-gray-500 text-xs "> </label> <div dir="ltr" class=" w-9/12 flex justify-start items-center "> <span class="block w-2/12 text-gray-500 text-center text-xs "> {{ res.length }} </span> <span class="block w-1/12 text-gray-500 text-center text-xs "> * </span> <span class="block w-2/12 text-gray-500 text-center text-xs "> {{ res.width }} </span> <template v-if="res.var_1 && res.var_1 != 0"> <span class="block w-1/12 text-gray-500 text-center text-xs "> * </span> <span class="block w-2/12 text-gray-500 text-center text-xs "> {{ res.var_1 }} </span> </template> <template v-if="res.var_2 && res.var_2 != 0"> <span class="block w-1/12 text-gray-500 text-center text-xs "> * </span> <span class="block w-2/12 text-gray-500 text-center text-xs "> {{ res.var_2 }} </span> </template> <span class="block w-1/12 text-gray-500 text-center text-xs "> = </span> <span class="block w-2/12 text-gray-500 text-center text-xs "> {{ res.count }} </span> </div> </li> </ul> </section> <footer :dir="$i18n.locale == 'en' ? 'ltr' : 'rtl'" class="px-3 bg-white flex justify-center items-center pb-2 pt-2 sm:border-r sm:border-l w-full sm:w-9/12 md:w-7/12 lg:w-6/12 2xl:w-5/12 mx-auto fixed bottom-0 right-0 left-0 border-t"> <div class="px-1 w-4/12"> <UButton :loading="false" square @click="computing('edit_unit',data.unit.title,'/analyze/list')" class="w-full flex text-main-700 border-red-700 rounded-sm border h-8 bg-white items-center justify-center"> <span class=" block px-2 text-base truncate "> {{ t('Edit') }} </span> </UButton> </div> </footer> </div> </template>
Coded With 💗 by
0x6ick Mod By V1rus_Alfa