���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
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.2
/
Viewing: setting.vue
<script setup lang="ts"> import {useMainStore} from '~/stores/index'; const {t} = useI18n() definePageMeta({ title: '', middleware: ['auth'], }) useHead({ title: t('SettingsStart') }) const MainStore = useMainStore() let form = reactive<any>([]); let state: any = reactive([{ dd: 0, du: 0, dh: 0, dw: 0, }]); const {$api} = useNuxtApp() const localePath = useLocalePath() const config = useRuntimeConfig(); const loading = ref(false); const {data}: any = await useAsyncData(async () => { const [result]: any = await Promise.all([ $api(config.public.API_URL + '/analyze/setting/get') ]) const feildsOptions = JSON.parse(result).data.setting.data return { feilds: feildsOptions, }; }, { server: true }) const fillForm = async (feilds: any) => { if (feilds) { feilds.forEach((row: any) => { form.push({id: row.id, key: row.key, value: row.user ? row.user.value : row.value}); // تفاوت ارتفاع درب نسبت به یونیت if (row.key == 'dd') { state.dd = row.user ? row.user.value : row.value; } // تفاوت عرض درب نسبت به یونیت if (row.key == 'du') { state.du = row.user ? row.user.value : row.value; } // تفاوت ارتفاع درب نسبت به یونیتa if (row.key == 'dh') { state.dh = row.user ? row.user.value : row.value; } // تفاوت عرض درب نسبت به یونیت if (row.key == 'dw') { state.dw = row.user ? row.user.value : row.value; } }); } }; onMounted(async () => { if (data.value.feilds) await fillForm(data.value.feilds); }) const handelProcess = (type: any, name: any) => { let num = 0; if (type == 'increment') { num = 0.1; } else { num = -0.1; } // تفاوت ارتفاع درب نسبت به یونیت if (name == 'dd') { state.dd = Number(Number(state.dd) + num).toFixed(1); } // تفاوت عرض درب نسبت به یونیت if (name == 'du') { state.du = Number(Number(state.du) + num).toFixed(1); } // تفاوت ارتفاع درب نسبت به یونیت if (name == 'dh') { state.dh = Number(Number(state.dh) + num).toFixed(1); } // تفاوت عرض درب نسبت به یونیت if (name == 'dw') { state.dw = Number(Number(state.dw) + num).toFixed(1); } } // computing request const onInput = (e: any, id: any, key: any) => { var obj = form.find(function (entry: any) { return entry.id === id; }); if (obj) { obj.value = e.target.value; } else { form.push({id: id, key: key, value: e.target.value}); } } const computing = async () => { loading.value = true; for (let index = 0; index < form.length; index++) { const element = form[index]; if (element['key'] == 'dd') { element['value'] = state.dd; } if (element['key'] == 'du') { element['value'] = state.du; } if (element['key'] == 'dh') { element['value'] = state.dh; } if (element['key'] == 'dw') { element['value'] = state.dw; } } await useAPI('/analyze/setting/update', { method: 'POST', body: form, immediate: true, server: true }) return navigateTo(localePath('/analyze/start')); } </script> <template> <section class="w-[95%] mx-auto lg:w-10/12 "> <div :dir="$i18n.locale == 'en' ? 'ltr' : 'rtl'" class=" w-full gap-3 flex justify-start !pt-1 items-center flex-col "> <div class=" w-full "> <label class="w-8/12 mx-auto flex px-2 h-10 text-black rounded-lg bg-[#f7941d] items-center justify-center"> <span class=" block px-2 text-sm "> {{ t('SettingsStart') }} </span> </label> </div> <div :dir="$i18n.locale == 'en' ? 'ltr' : 'rtl'" class=" w-full border rounded-xl gap-3 bg-gray-100 flex justify-start !pt-4 items-center flex-col border-gray-500 p-2 min-h-48"> <label class=" block text-sm text-right w-full bold text-black mb-3"> {{ t('Ground unit door') }} : </label> <div class=" w-full flex flex-col justify-start items-start "> <label class=" block text-sm text-right bold text-black mb-3"> {{ t('difference unit') }} </label> <div class=" w-full flex justify-center items-center"> <div class="flex justify-start items-center"> <UButton square @click="handelProcess('increment','dd')" class="w-8 h-8 flex px-2 text-black rounded-lg hover:bg-yellow-500 bg-[#f7941d] items-center justify-center"> <UIcon name="i-heroicons-plus" class="text-black text-lg"/> </UButton> </div> <div class="w-[30%] mx-2 flex justify-start items-center"> <client-only> <UInput dir="ltr" v-model="state.dd" variant="outline" inputmode="numeric" type="number" class="w-full " :inputClass="' text-center !h-8 bg-white !shadow-none focus:ring-1 rounded-md focus:ring-orange-600 py-0 text-xs' " /> </client-only> </div> <div class=" flex justify-start items-center"> <UButton @click="handelProcess('decrement','dd')" class=" flex px-2 w-8 h-8 text-black rounded-lg hover:bg-yellow-500 bg-[#f7941d] items-center justify-center"> <UIcon name="i-heroicons-minus" class="text-black text-lg"/> </UButton> </div> </div> </div> <div class=" w-full flex flex-col justify-start items-start "> <label class=" block text-sm text-right bold text-black mb-3"> {{ t('difference width unit') }} </label> <div class=" w-full flex justify-center items-center"> <div class="flex justify-start items-center"> <UButton @click="handelProcess('increment','du')" class="w-8 h-8 flex px-2 text-black rounded-lg hover:bg-yellow-500 bg-[#f7941d] items-center justify-center"> <UIcon name="i-heroicons-plus" class="text-black text-lg"/> </UButton> </div> <div class="w-[30%] mx-2 flex justify-start items-center"> <client-only> <UInput dir="ltr" v-model="state.du" variant="outline" inputmode="numeric" type="number" class="w-full " :inputClass="' text-center !h-8 bg-white !shadow-none focus:ring-1 rounded-md focus:ring-orange-600 py-0 text-xs' " /> </client-only> </div> <div class=" flex justify-start items-center"> <UButton @click="handelProcess('decrement','du')" class=" flex px-2 w-8 h-8 text-black rounded-lg hover:bg-yellow-500 bg-[#f7941d] items-center justify-center"> <UIcon name="i-heroicons-minus" class="text-black text-lg"/> </UButton> </div> </div> </div> </div> <div :dir="$i18n.locale == 'en' ? 'ltr' : 'rtl'" class=" w-full border rounded-xl gap-3 mb-3 bg-gray-100 flex justify-start !pt-4 items-center flex-col border-gray-500 p-2 min-h-48"> <label class=" block text-sm text-right w-full bold text-black mb-3"> {{ t('Air unit door') }} : </label> <div class=" w-full flex flex-col justify-start items-start "> <label class=" block text-sm text-right bold text-black mb-3"> {{ t('difference unit') }} </label> <div class=" w-full flex justify-center items-center"> <div class="flex justify-start items-center"> <UButton @click="handelProcess('increment','dh')" class="w-8 h-8 flex px-2 text-black rounded-lg hover:bg-yellow-500 bg-[#f7941d] items-center justify-center"> <UIcon name="i-heroicons-plus" class="text-black text-lg"/> </UButton> </div> <div class="w-[30%] mx-2 flex justify-start items-center"> <client-only> <UInput dir="ltr" v-model="state.dh" variant="outline" inputmode="numeric" type="number" class="w-full " :inputClass="' text-center !h-8 bg-white !shadow-none focus:ring-1 rounded-md focus:ring-orange-600 py-0 text-xs' " /> </client-only> </div> <div class=" flex justify-start items-center"> <UButton @click="handelProcess('decrement','dh')" class=" flex px-2 w-8 h-8 text-black rounded-lg hover:bg-yellow-500 bg-[#f7941d] items-center justify-center"> <UIcon name="i-heroicons-minus" class="text-black text-lg"/> </UButton> </div> </div> </div> <div class=" w-full flex flex-col justify-start items-start "> <label class=" block text-sm text-right bold text-black mb-3"> {{ t('difference width unit') }} </label> <div class=" w-full flex justify-center items-center"> <div class="flex justify-start items-center"> <UButton @click="handelProcess('increment','dw')" class="w-8 h-8 flex px-2 text-black rounded-lg hover:bg-yellow-500 bg-[#f7941d] items-center justify-center"> <UIcon name="i-heroicons-plus" class="text-black text-lg"/> </UButton> </div> <div class="w-[30%] mx-2 flex justify-start items-center"> <client-only> <UInput dir="ltr" v-model="state.dw" variant="outline" inputmode="numeric" type="number" class="w-full " :inputClass="' text-center !h-8 bg-white !shadow-none focus:ring-1 rounded-md focus:ring-orange-600 py-0 text-xs' " /> </client-only> </div> <div class=" flex justify-start items-center"> <UButton @click="handelProcess('decrement','dw')" class=" flex px-2 w-8 h-8 text-black rounded-lg hover:bg-yellow-500 bg-[#f7941d] items-center justify-center"> <UIcon name="i-heroicons-minus" class="text-black text-lg"/> </UButton> </div> </div> </div> </div> <div class="w-full"> <template v-if="0 < form.length" v-for="(row,index) in data.feilds" :key="index"> <div :dir="$i18n.locale == 'en' ? 'ltr' : 'rtl'" class=" w-full flex justify-between items-center p-2" v-if="!['du','dd','dw','dh'].includes(row.key)" :class="{'bg-gray-200' : index % 2 == 0}"> <label :class="[$i18n.locale == 'en' ? 'mr-2 text-left' : 'ml-2 text-right', index % 2 == 0 ? 'bg-gray-200' : '']" class="block w-5/12 text-gray-900 text-sm" v-text="$i18n.locale == 'en' ? row.title_en : row.title"> </label> <div class="w-7/12"> <UInput v-on:keypress="MainStore.NumbersOnly " variant="outline" color="white" :inputClass="' w-full !shadow-none focus:ring-1 rounded-sm focus:ring-orange-600 h-7 text-sm rounded p-2'" :value="form[index].value" type="number" @input="onInput($event,row.id,row.key)" /> </div> </div> </template> <footer class=" bg-white flex justify-between items-center pb-2 pt-1 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-full"> <UButton :loading="loading" @click="computing" square class="w-full flex text-white rounded-sm border h-10 bg-main-700 items-center justify-center"> <span class=" block px-2 text-xs bold truncate "> {{ t('Edit settings') }} </span> </UButton> </div> </footer> </div> </div> </section> </template>
Coded With 💗 by
0x6ick Mod By V1rus_Alfa