import{c as m,o as p,i as y,b as r,t as n,n as S,u as t,d as W,m as C,T as M,r as N,a,aD as _,x as U,l as x,v as h,w as $,h as j,F as A}from"./app-Do7K7VDV.js";import{s as D}from"./multiselect-D1A7YaZl.js";import{_ as B}from"./SpinnerBtn-C-rqKjUt.js";import{_ as L}from"./BlankLayout-BFAnWCOB.js";import{_ as b}from"./InputFieldError-0BmYlL24.js";import"./ToastrContainer-CtYDvNPN.js";const O={class:"w-full"},T={key:0,class:"label mb-1"},E={key:1,class:"my-1 text-[11px] font-light text-danger-600"},F={__name:"MultiSelect",props:{inputLabel:{type:String,default:"label"},label:{type:String,default:""},mode:{type:String,default:"tags"},modelValue:{type:[Array,Object,String,Number],default:()=>[]},options:{type:[Array,Object],default:()=>[]},validationMessage:{type:[String,Array],default:""},placeholder:{type:String,default:"Select"},customClass:{type:String,default:""},valueProp:{type:String,default:"value"}},emits:["update:modelValue"],setup(e,{emit:o}){const i=o;return(s,u)=>(p(),m("div",O,[e.label?(p(),m("label",T,n(e.label),1)):y("",!0),r(t(D),{class:S(["multiselect-dark",e.validationMessage?"border border-danger-600":""]),modelValue:e.modelValue,"onUpdate:modelValue":u[0]||(u[0]=f=>i("update:modelValue",f)),mode:e.mode,"close-on-select":!1,searchable:!0,"create-option":!0,options:e.options,placeholder:e.placeholder,label:e.inputLabel,"value-prop":e.valueProp},null,8,["modelValue","class","mode","options","placeholder","label","value-prop"]),e.validationMessage?(p(),m("div",E,n(Array.isArray(e.validationMessage)?e.validationMessage[0]:e.validationMessage),1)):y("",!0)]))}},P={class:"container flex h-screen items-center justify-center px-3"},z={class:"card card-body mx-auto max-w-2xl"},Z={class:"font-semibold md:text-xl"},q={class:"mt-3 flex flex-col gap-1"},G={for:"name",class:"label mb-1"},H={for:"description",class:"label mb-1"},I={for:"modules",class:"label mb-1"},J={class:"mt-2 flex flex-wrap justify-between gap-2 sm:whitespace-nowrap"},K=W({layout:L}),se=Object.assign(K,{__name:"Create",props:["modules","workspace"],setup(e){var g,v,k;const o=e,i=C(()=>{var l;return!!((l=o.workspace)!=null&&l.id)}),s=M({name:(g=o.workspace)==null?void 0:g.name,description:(v=o.workspace)==null?void 0:v.description,modules:((k=o.workspace)==null?void 0:k.modules)??[]});console.log(o.modules);const u=()=>{i.value?w():f()},f=()=>{s.post(route("user.workspaces.store"))},w=()=>{s.put(route("user.workspaces.update",o.workspace.id))};return(l,d)=>{const V=N("Link");return p(),m(A,null,[r(t(_),{title:l.trans(i.value?"Update Workspace":"Create New Workspace")},null,8,["title"]),a("div",P,[a("div",z,[a("form",{onSubmit:U(u,["prevent"])},[a("p",Z,n(l.trans(i.value?"Update Workspace":"Create New Workspace")),1),a("div",q,[a("div",null,[a("label",G,n(l.trans("Workspace Name")),1),x(a("input",{type:"text","onUpdate:modelValue":d[0]||(d[0]=c=>t(s).name=c),class:"input",placeholder:"Workspace Name"},null,512),[[h,t(s).name]]),r(b,{message:t(s).errors.name},null,8,["message"])]),a("div",null,[a("label",H,n(l.trans("Workspace Description")),1),x(a("textarea",{"onUpdate:modelValue":d[1]||(d[1]=c=>t(s).description=c),class:"textarea",placeholder:"Workspace Description"},null,512),[[h,t(s).description]]),r(b,{message:t(s).errors.description},null,8,["message"])]),a("div",null,[a("label",I,n(l.trans("Modules")),1),r(F,{modelValue:t(s).modules,"onUpdate:modelValue":d[2]||(d[2]=c=>t(s).modules=c),options:e.modules},null,8,["modelValue","options"]),r(b,{message:t(s).errors.modules},null,8,["message"])]),a("div",J,[r(V,{href:l.route("user.workspaces.index"),class:"btn btn-secondary flex-1 md:flex-initial"},{default:$(()=>[j(n(l.trans("Back to Workspaces")),1)]),_:1},8,["href"]),r(B,{class:"flex-1 md:flex-initial",processing:t(s).processing,"btn-text":l.trans(i.value?"Update Workspace":"Create Workspace")},null,8,["processing","btn-text"])])])],32)])])],64)}}});export{se as default};
