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