import{d as j,u as k,o as l,a as d,b as u,e as s,h as q,w as L,f as t,t as i,s as V,i as p,F as b,n as _,v as g,x,j as f}from"./app-bWy6VYs1.js";import{a as C,_ as E}from"./AppLayout.vue_vue_type_script_setup_true_lang-BwuDxc8O.js";import{R as y}from"./rotate-ccw-B2w1S6NG.js";import"./index-C32fBP6Q.js";import"./index-CMWG4mbA.js";import"./useForwardExpose-Cx2E44RD.js";import"./VisuallyHidden-0BfmsMPn.js";import"./RovingFocusGroup-D20OvR_w.js";import"./useArrowNavigation-C6Y-ieo6.js";import"./_plugin-vue_export-helper-DmjF0He4.js";const D={class:"p-4"},O={class:"mb-6"},J={class:"mt-1 text-sm text-gray-600"},Q={class:"rounded-lg border border-gray-200 bg-white p-6 shadow-sm"},$={class:"mb-4 flex items-center justify-between"},N={class:"grid gap-4 md:grid-cols-2"},R={class:"mb-1 block text-sm font-medium text-gray-700"},U=["onUpdate:modelValue"],B={key:0,class:"mt-1 text-xs text-red-600"},F={class:"rounded-lg border border-gray-200 bg-white p-6 shadow-sm"},M={class:"mb-4 flex items-center justify-between"},T={class:"grid gap-4 md:grid-cols-2"},z={class:"mb-1 block text-sm font-medium text-gray-700"},A=["onUpdate:modelValue"],G={key:0,class:"mt-1 text-xs text-red-600"},H={class:"flex justify-end"},I=["disabled"],ot=j({__name:"StatusEditor",props:{jobcardStatusOptions:{},quoteStatusOptions:{},defaultJobcardStatusLabels:{},defaultQuoteStatusLabels:{},company:{}},setup(h){const r=h,c=m=>m.reduce((o,e)=>(o[e.value]=e.label,o),{}),a=k({jobcard_status_labels:c(r.jobcardStatusOptions),quote_status_labels:c(r.quoteStatusOptions)}),v=()=>{a.jobcard_status_labels={...r.defaultJobcardStatusLabels}},w=()=>{a.quote_status_labels={...r.defaultQuoteStatusLabels}},S=()=>{a.put("/administration/status-editor")};return(m,o)=>(l(),d(b,null,[u(s(q),{title:"Status Editor"}),u(E,{breadcrumbs:[{title:"Administration",href:s(C).index().url},{title:"Status Editor",href:"#"}]},{default:L(()=>[t("div",D,[t("div",O,[o[0]||(o[0]=t("h1",{class:"text-2xl font-bold text-gray-900"},"Status Editor",-1)),t("p",J," Customize Jobcard and Quote status labels for "+i(r.company.name)+". ",1)]),t("form",{onSubmit:V(S,["prevent"]),class:"space-y-6"},[t("div",Q,[t("div",$,[o[2]||(o[2]=t("div",null,[t("h2",{class:"text-lg font-semibold text-gray-900"},"Jobcard Status Labels"),t("p",{class:"text-sm text-gray-600"},"Edit how each jobcard status is displayed in the app.")],-1)),t("button",{type:"button",onClick:v,class:"inline-flex items-center gap-2 rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50"},[u(s(y),{class:"h-4 w-4"}),o[1]||(o[1]=p(" Reset to Default ",-1))])]),t("div",N,[(l(!0),d(b,null,_(r.jobcardStatusOptions,e=>(l(),d("div",{key:e.value},[t("label",R,i(e.value.replace(/_/g," ")),1),g(t("input",{"onUpdate:modelValue":n=>s(a).jobcard_status_labels[e.value]=n,type:"text",maxlength:"50",class:"w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500"},null,8,U),[[x,s(a).jobcard_status_labels[e.value]]]),s(a).errors[`jobcard_status_labels.${e.value}`]?(l(),d("p",B,i(s(a).errors[`jobcard_status_labels.${e.value}`]),1)):f("",!0)]))),128))])]),t("div",F,[t("div",M,[o[4]||(o[4]=t("div",null,[t("h2",{class:"text-lg font-semibold text-gray-900"},"Quote Status Labels"),t("p",{class:"text-sm text-gray-600"},"Edit how each quote status is displayed in the app.")],-1)),t("button",{type:"button",onClick:w,class:"inline-flex items-center gap-2 rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50"},[u(s(y),{class:"h-4 w-4"}),o[3]||(o[3]=p(" Reset to Default ",-1))])]),t("div",T,[(l(!0),d(b,null,_(r.quoteStatusOptions,e=>(l(),d("div",{key:e.value},[t("label",z,i(e.value.replace(/_/g," ")),1),g(t("input",{"onUpdate:modelValue":n=>s(a).quote_status_labels[e.value]=n,type:"text",maxlength:"50",class:"w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500"},null,8,A),[[x,s(a).quote_status_labels[e.value]]]),s(a).errors[`quote_status_labels.${e.value}`]?(l(),d("p",G,i(s(a).errors[`quote_status_labels.${e.value}`]),1)):f("",!0)]))),128))])]),t("div",H,[t("button",{type:"submit",disabled:s(a).processing,class:"rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:opacity-50"},i(s(a).processing?"Saving...":"Save Status Labels"),9,I)])],32)])]),_:1},8,["breadcrumbs"])],64))}});export{ot as default};
