���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
/
unit
/
make
/
update
/
Viewing: [id].vue
<script setup lang="ts"> const { t } = useI18n() definePageMeta({ title: '', middleware: ['auth'], }) useHead ({ title: t('makeUnit') }) const toast = useToast(); const loading = ref(false); const { $api } = useNuxtApp(); const config = useRuntimeConfig(); const localePath = useLocalePath(); const { id } = useRoute().params let form = reactive({ list_id: 0, material_id: 1, panel_description: '', rotate_status: false, num_slice: 1, slice:[ { 'length':'', 'width':'', 'count':'', 'length_one':0, 'length_two':0, 'width_one':0, 'width_two':0, 'rotate_status':false, 'description':'' } ] }) const { data }:any = await useAsyncData(`user:${id}`,async () => { const [result]:any = await Promise.all([ $api(config.public.API_URL+'/analyze/list/single',{ query: { unit_id: id } }) ]) const feildsOptions =JSON.parse(result).data.materials const unit_res= JSON.parse(result).data.list return { feilds:feildsOptions , unit:unit_res }; },{ server:true , }) const fillForm = async (res:any) => { if (res) { form.list_id=res.id; form.material_id=res.attach[0].material_id; form.panel_description=res.name; form.rotate_status=false; form.num_slice=res.attach.length; form.list_id=res.id; form.slice=[]; res.attach.forEach((element:any) => { form.slice.push({ 'length':element.length, 'width':element.width, 'count':element.count, 'length_one':element.length_one, 'length_two':element.length_two, 'width_one':element.width_one, 'width_two':element.width_two, 'rotate_status':element.rotate_status ? true : false, 'description':element.label, }) }); } }; onMounted(async() => { if (data.value.unit) await fillForm(data.value.unit); }) const handelSlice = (type:string) =>{ if(type == 'increment'){ form.num_slice=form.num_slice+1; form.slice.push({ 'length':'', 'width':'', 'count':'1', 'length_one':0, 'length_two':0, 'width_one':0, 'width_two':0, 'rotate_status':false, 'description':'' }); }else if(1 < form.num_slice){ form.num_slice=form.num_slice-1; form.slice.splice(form.num_slice, 1); } handelRotateStatus() } const removeSliceRow = (i:number) =>{ form.slice.splice(i, 1); form.num_slice=form.num_slice-1; } const handelRotateStatus = () =>{ for (let index = 0; index < form.slice.length; index++) { form.slice[index].rotate_status = form.rotate_status; } } const handelClick = async ()=>{ loading.value=true; for (let index = 0; index < form.slice.length; index++) { const element = form.slice[index]; if(!element.width){ return toast.add({ title: t("Section ")+(index+1)+' '+t("Width_Alert"),color:"orange"}),loading.value=false; } if(!element.length){ return toast.add({ title: t("Section ")+(index+1)+' '+t("Length_Alert"),color:"orange"}),loading.value=false; } if(!element.count){ return toast.add({ title: t("Section ")+(index+1)+' '+t("Number_Alert"),color:"orange"}),loading.value=false; } } await useAPI( '/analyze/custom-list/edit', { method: 'POST', body: form , immediate: true, server: true, onResponse({ request, response, options }) { if(response.status != 422){ return navigateTo(localePath('/analyze/list')); } } }) } </script> <template> <div class="w-[95%] mx-auto " > <div :dir="$i18n.locale == 'en' ? 'ltr' : 'rtl'" class="mb-2 " > <div class=" bg-[#f7941d] text-black block w-full rounded-t-md overflow-hidden " > <div class="flex items-center justify-between px-2 py-2 "> <span class="w-4/12 text-base font-bold text-right text-white"> </span> <div class="flex items-start justify-center w-4/12 "> <span id="title_group_1" class="block text-sm font-bold"> <ClientOnly> {{ t('Edit piece') }} </ClientOnly> </span> </div> <span class="w-4/12 block"> </span> </div> </div> <div class=" pt-2 border-b border-l border-r border-gray-400 min-h-[90vh] !rounded-t-none rounded-md overflow-hidden"> <div class="flex flex-wrap w-full mx-auto "> <div class="flex items-start justify-start flex-wrap w-full mb-4"> <div class="w-full mb-2"> <div class="mx-auto w-[98%]"> <select v-model="form.material_id" class="block w-full h-9 py-0 !px-3 text-sm bg-white text-gray-900 border border-gray-300 rounded focus:ring-main-700 focus:border-main-700"> <option v-for="(row,i) in data.feilds" :value="row.id"> {{ $i18n.locale == 'en' ? row.title_en : row.title }} </option> </select> </div> </div> <div class="w-full mb-2"> <div class="mx-auto w-[98%]"> <textarea v-model="form.panel_description" rows="1" class="block w-full h-9 py-1 !px-3 text-xs bg-white text-gray-900 border border-gray-300 rounded 3xl:h-9 focus:ring-main-700 focus:border-main-700 placeholder-slate-400" type="text" :placeholder="t('Sheet name and code')"></textarea> </div> </div> <div class="w-full "> <div class="mx-auto w-[98%] flex justify-start items-center"> <input type="checkbox" @change="handelRotateStatus" v-model="form.rotate_status" class="w-5 h-5 text-red-900 border-2 border-red-900 cursor-pointer focus:border-red-900 focus:ring-red-900"> <span class="mr-5 text-sm text-black"> {{ t('Total rotation of parts') }} </span> </div> </div> </div> </div> <section class="flex separator items-center justify-between w-full pb-5"> <div class="flex items-center justify-center flex-row px-2 "> <button @click="handelSlice('increment')" type="button" :class="$i18n.locale == 'en' ? 'mr-2 pr-2' : 'ml-2 pl-2'" class=" mb-0 w-auto h-7 text-xs bold flex justify-center items-center bg-gray-50 border-green-500 hover:bg-green-50 border rounded cursor-pointer "> <i class='mx-1 text-xl bx bx-plus text-green-500' ></i> <span class="flex w-full justify-center items-center"> {{ t('Add row') }} </span> </button> <button @click="handelSlice('decrement')" type="button" :class="$i18n.locale == 'en' ? ' pr-2' : ' pl-2'" class=" mb-0 :w-auto h-7 text-xs bold flex justify-center items-center bg-gray-50 border-red-500 hover:bg-red-50 border rounded cursor-pointer "> <i class='mx-1 text-xl bx bx-minus text-red-500' ></i> <span class="flex w-full justify-center items-center"> {{ t('Reduce line') }} </span> </button> </div> </section> <div class="w-full" > <div class=" w-full flex justify-start items-start mb-2 pb-0 border-b border-dashed border-main-700 " :key="i" v-for="(row,i) in form.num_slice" > <div class="w-[12%] mr-[.1rem] "> <span class=" w-full py-0 !pr-0 text-xs text-gray-900 h-7 3xl:h-9 flex items-center rounded justify-center text-center bold border-2 border-red-700 border-dashed focus:!ring-0" > <UIcon v-if="1 < (i+1)" @click="removeSliceRow(i)" name="i-heroicons-x-circle" class="text-xl text-red-600 cursor-pointer ml-1" /> {{i+1}} </span> <div class="w-full flex flex-col items-center justify-end my-[.3rem]"> <input type="checkbox" v-model="form.slice[i].rotate_status" class="text-red-900 border-2 border-red-900 cursor-pointer focus:border-red-900 focus:ring-red-900"> <span class=" text-xs text-black"> {{ t('rotation') }} </span> </div> </div> <div class=" w-[88%] flex flex-wrap justify-start items-center "> <div class="w-[24%] mr-[.1rem] mb-[.1rem]"> <input :placeholder="t('count')" v-model="form.slice[i].count" class="{{(i+1)%2 == 0 ? 'bg-main-400' : 'bg-white'}} block w-full py-0 !px-3 text-xs bg-white text-gray-900 border border-gray-300 text-center bold rounded h-7 3xl:h-9 focus:ring-main-700 focus:border-main-700" > </div> <div class="w-[24%] mr-[.1rem] mb-[.1rem]"> <input :placeholder="t('Width')" v-model="form.slice[i].width" class="{{(i+1)%2 == 0 ? 'bg-main-400' : 'bg-white'}} block w-full py-0 !px-3 text-xs bg-white text-gray-900 border border-gray-300 text-center bold rounded h-7 3xl:h-9 focus:ring-main-700 focus:border-main-700" > </div> <div class="w-[24%] mr-[.1rem] mb-[.1rem]"> <input v-model="form.slice[i].length" :placeholder="t('Length')" class="{{(i+1)%2 == 0 ? 'bg-main-400' : 'bg-white'}} block w-full py-0 !px-3 text-xs bg-white text-gray-900 border border-gray-300 text-center bold rounded h-7 3xl:h-9 focus:ring-main-700 focus:border-main-700" > </div> <div class="w-[24%] mb-[.1rem] mr-[.1rem] "> <textarea v-model="form.slice[i].description" rows="1" class="{{(i+1)%2 == 0 ? 'bg-main-400' : 'bg-white'}} block w-full py-1 !px-3 text-xs bg-white text-gray-900 border border-gray-300 rounded description h-7 3xl:h-9 focus:ring-main-700 focus:border-main-700 placeholder-slate-400" :placeholder="t('Description')" ></textarea> </div> <div class="w-[24%] mr-[.1rem]"> <select v-model="form.slice[i].width_two" class="{{(i+1)%2 == 0 ? 'bg-main-400' : 'bg-white'}} block w-full py-0 !px-3 text-xs bg-white text-gray-900 border border-gray-300 rounded h-7 3xl:h-9 focus:ring-main-700 focus:border-main-700"> <option value="0">{{ t('width two') }}</option> <option value="1">{{ t('Strip') }}</option> <option value="2">{{ t('Farsi') }}</option> <option value="3">{{ t('Groove') }}</option> <option value="0">{{ t('none') }}</option> </select> </div> <div class="w-[24%] mr-[.1rem]"> <select v-model="form.slice[i].width_one" class="{{(i+1)%2 == 0 ? 'bg-main-400' : 'bg-white'}} block w-full py-0 !px-3 text-xs bg-white text-gray-900 border border-gray-300 rounded h-7 3xl:h-9 focus:ring-main-700 focus:border-main-700"> <option value="0">{{ t('width one') }}</option> <option value="1">{{ t('Strip') }}</option> <option value="2">{{ t('Farsi') }}</option> <option value="3">{{ t('Groove') }}</option> <option value="0">{{ t('none') }}</option> </select> </div> <div class="w-[24%] mr-[.1rem]"> <select v-model="form.slice[i].length_two" class="{{(i+1)%2 == 0 ? 'bg-main-400' : 'bg-white'}} block w-full py-0 !px-3 text-xs bg-white text-gray-900 border border-gray-300 rounded h-7 3xl:h-9 focus:ring-main-700 focus:border-main-700"> <option value="0">{{ t('length two') }}</option> <option value="1">{{ t('Strip') }}</option> <option value="2">{{ t('Farsi') }}</option> <option value="3">{{ t('Groove') }}</option> <option value="0">{{ t('none') }}</option> </select> </div> <div class="w-[24%] mr-[.1rem]"> <select v-model="form.slice[i].length_one" class="{{(i+1)%2 == 0 ? 'bg-main-400' : 'bg-white'}} block w-full py-0 !px-3 text-xs bg-white text-gray-900 border border-gray-300 rounded h-7 3xl:h-9 focus:ring-main-700 focus:border-main-700"> <option value="0">{{ t('length one') }}</option> <option value="1">{{ t('Strip') }}</option> <option value="2">{{ t('Farsi') }}</option> <option value="3">{{ t('Groove') }}</option> <option value="0">{{ t('none') }}</option> </select> </div> </div> </div> </div> </div> </div> <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 @click="handelClick" :loading="loading" 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('registration') }} </span> </UButton> </div> </footer> </div> </template>
Coded With 💗 by
0x6ick Mod By V1rus_Alfa