import{d as w,aa as N,w as x,i as y,j as t,aC as S,t as s,C as k,c as m,g as $,J as d,B as c,P as B,am as V,Q as D,e as M,aI as q}from"./index-DOFLUERq.js";import{L as I}from"./LinkField-CPzmuCgV.js";import{_ as L}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./iconify-p99pbjf9.js";const P={class:"dialog-content"},U={class:"form-field"},j={class:"field-label"},A=w({__name:"NumberCardDialog",props:{show:{type:Boolean},values:{}},emits:["update:show","submit"],setup(b,{emit:p}){const _=M(),l=b,i=p,v=N(),o=m({get:()=>l.show,set:a=>i("update:show",a)}),u=m(()=>!!l.values?.name),e=D({number_card_name:"",label:"",name:""});function f(){return{query:"jingrow.desk.pagetype.number_card.number_card.get_cards_for_user"}}x(()=>l.show,a=>{a&&(l.values?(e.number_card_name=l.values.number_card_name||"",e.label=l.values.label||"",e.name=l.values.name||""):(e.number_card_name="",e.label="",e.name=""))},{immediate:!0});function g(){if(!e.number_card_name)return v.error(s("Please select a number card")),!1;const a={...e,label:e.label||e.number_card_name};return!u.value&&!a.name&&(a.name=`number_card-${a.label}-${Math.random().toString(36).substring(2,12)}`),i("submit",a),o.value=!1,!0}function C(){o.value=!1}function h(){o.value=!1;const a=q("Number Card"),r=Math.random().toString(36).substring(2,12),n=`new-${a}-${r}`;_.push(`/app/${a}/${n}`)}return(a,r)=>($(),y(t(S),{show:o.value,"onUpdate:show":r[2]||(r[2]=n=>o.value=n),preset:"dialog",title:u.value?t(s)("Edit Number Card"):t(s)("Add Number Card"),"positive-text":u.value?t(s)("Save"):t(s)("Add"),"negative-text":t(s)("Cancel"),onPositiveClick:g,onNegativeClick:C,style:{width:"500px"}},{default:k(()=>[d("div",P,[c(I,{modelValue:e.number_card_name,"onUpdate:modelValue":r[0]||(r[0]=n=>e.number_card_name=n),options:"Number Card",label:t(s)("Number Card"),required:!0,placeholder:"","enable-create":!0,onCreate:h,"get-query":f},null,8,["modelValue","label"]),d("div",U,[d("label",j,B(t(s)("Label")),1),c(t(V),{value:e.label,"onUpdate:value":r[1]||(r[1]=n=>e.label=n),placeholder:""},null,8,["value"])])])]),_:1},8,["show","title","positive-text","negative-text"]))}}),J=L(A,[["__scopeId","data-v-9f26058a"]]);export{J as default};
