import{d as T,r as m,C as U,c as p,o as _,a as v,b as e,u as o,m as F,t as n,e as L,g,v as h,s as j,h as z,f,F as C,H as S,E as b}from"./app-DJb_CRLj.js";import{_ as B}from"./MainLayout.vue_vue_type_script_setup_true_lang-BnRI7JXG.js";import{u as w}from"./useToastify-DqLaHt3f.js";import"./simplebar.min-CZ5saGqI.js";import"./debounce-CDPmhVE8.js";/* empty css                             *//* empty css                          *//* empty css            */import"./AdminNavigation.vue_vue_type_script_setup_true_lang-BfIfENbj.js";import"./useHexToRgb-Crf73LpK.js";import"./useRandomStr-7r5tQ8Eq.js";const M={class:"card shadow-1 panel-content"},N={class:"card-body"},x={class:"panel-content--title mb-5 lts-05"},D={class:"row"},E={class:"col-md-6"},I={class:"form-element-row mb-4"},R={class:"label"},H=["placeholder"],O={class:"col-md-6"},q={class:"form-element-row mb-4"},A={class:"label"},G={class:"row"},J={class:"col-12"},K={class:"form-element-row mb-4"},P={class:"label"},Q=["placeholder"],W={class:"col-12"},X={class:"form-element-row form-element-row-file mb-4"},Y={class:"text-center"},Z={class:"fs-6 fw-bold text-dark mb-2"},ee={class:"fs-9 text-muted mb-4"},te={key:0,class:"selected-image"},se=["src"],le={class:"custom-input-file"},oe={for:"attachment",class:"custom-input-file-label"},ae={class:"label"},ie={class:"col-12 text-end"},ne=["disabled"],we=T({layout:B,__name:"Create",props:{priorityList:{}},setup(re){const a=m(),d=m(),r=m(),c=m(),u=()=>{a.value=null,d.value=null,r.value=null,c.value=null,l.attachment=null,$("#attachment").val("")},l=U({title:null,priority:"normal",content:null,attachment:null}),y=()=>{l.post(route("user.tickets.store"),{forceFormData:!0,replace:!0,onSuccess(){u()},onError(){u()}})},k=t=>{a.value=$(t.target).prop("files")[0];let s=a.value.type,i=a.value.size;if(c.value=Math.round(i/1e6*100)/100,c.value>S().props.mediaLibrary.maxUploadSize){w(b("messages.sentence.the_size_of_the_selected_file_is_not_allowed"),"fail"),a.value=null,d.value=null,r.value=null,c.value=null,l.attachment=null;return}switch(s){case"image/jpeg":case"image/jpg":case"image/png":case"image/webp":case"image/gif":case"image/svg+xml":d.value="image",typeof window!==void 0&&(r.value=window.URL.createObjectURL(a.value));break;default:w(b("messages.sentence.the_selected_format_is_not_supported"),"fail"),a.value=null,d.value=null,r.value=null,c.value=null,l.attachment=null;break}l.attachment=a.value},V=()=>{u()};return(t,s)=>(_(),p(C,null,[v(o(F),{title:t.$t("messages.title.create_ticket")},null,8,["title"]),e("div",M,[e("div",N,[e("div",x,n(t.$t("messages.sentence.create_ticket")),1),e("form",{onSubmit:L(y,["prevent"]),class:"add-ticket-form"},[e("div",D,[e("div",E,[e("div",I,[e("label",R,n(t.$t("messages.word.title")),1),g(e("input",{"onUpdate:modelValue":s[0]||(s[0]=i=>o(l).title=i),type:"text",class:"form-control",placeholder:t.$t("messages.sentence.ticket_title")},null,8,H),[[h,o(l).title]])])]),e("div",O,[e("div",q,[e("label",A,n(t.$t("messages.word.priority")),1),v(o(j),{modelValue:o(l).priority,"onUpdate:modelValue":s[1]||(s[1]=i=>o(l).priority=i),options:t.priorityList,optionLabel:"label",optionValue:"id",type:"text",readonly:"",class:"pvc-dropdown"},null,8,["modelValue","options"])])])]),e("div",G,[e("div",J,[e("div",K,[e("label",P,n(t.$t("messages.word.message")),1),g(e("textarea",{"onUpdate:modelValue":s[2]||(s[2]=i=>o(l).content=i),rows:"5",class:"form-control",placeholder:t.$t("messages.sentence.write_your_message")},null,8,Q),[[h,o(l).content]])])]),e("div",W,[e("div",X,[e("div",Y,[e("div",Z,n(t.$t("messages.sentence.upload_your_image_as_attachment_to_ticket")),1),e("div",ee,"("+n(t.$t("messages.sentence.ticket_attachment_hint"))+")",1)]),r.value!=null?(_(),p("div",te,[e("img",{class:"shadow-1",src:r.value},null,8,se),e("i",{onClick:s[3]||(s[3]=i=>V()),class:"ri-close-line shadow-1 remove-image"})])):z("",!0),e("div",le,[e("input",{onInput:k,type:"file",class:"custom-input-file-input",id:"attachment",accept:".png,.jpg,.jpeg,.webp,.svg"},null,32),e("label",oe,[e("span",ae,[s[4]||(s[4]=e("i",{class:"ri-arrow-up-fill me-1"},null,-1)),f(" "+n(t.$t("messages.sentence.select_image")),1)])])])])]),e("div",ie,[e("button",{type:"submit",disabled:o(l).processing,class:"btn btn-primary shadow-1 px-4"},[f(n(t.$t("messages.word.send"))+" ",1),s[5]||(s[5]=e("i",{class:"ri-send-plane-2-line ms-2"},null,-1))],8,ne)])])],32)])])],64))}});export{we as default};
