1import{I as v,u as b,c as w,a as s,P as y,b as n,j as a,K as c,H as V,z as g,J as $,o as x}from"./Bz9xZ2qO.js";import{u as N}from"./B3qUyPGw.js";import{_ as k}from"./CGqGIiY8.js";import"./BNwyYzC4.js";import"./BMOVrsa3.js";import"./Bzmka5Fh.js";import"./nnYrN7zk.js";import"./zjdVGI5d.js";import"./BWpOoIJI.js";const C={class:"edit-page col pa-8"},L={class:"row"},B={class:"rounded col-md-6 mx-auto bg-white pa-4"},q={class:"mt-5"},K={class:"row"},z={class:"col"},J={__name:"add",setup(F){const o=g({name:"",slug:""}),l=g(!1),r=$(),u=v(),f=N();b({title:"New Location"});function _(){o.value.slug=o.value.name.toLowerCase().trim().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}async function m(){l.value=!0;const{error:i}=await f.from("locations").insert({name:o.value.name,slug:o.value.slug});if(i){r.notify({type:"negative",message:`Failed to create location. ${i.message}`,position:"top",timeout:3e3}),l.value=!1;return}r.notify({type:"positive",message:"Location created successfully.",position:"top",timeout:2e3}),l.value=!1,u.push("/manage/locations?page=1")}return(i,e)=>{const p=k,d=V;return x(),w("div",C,[s("div",L,[s("div",B,[e[6]||(e[6]=s("h2",{class:"font-bold text-h5 mr-auto"},"New Location",-1)),s("div",q,[s("form",{onKeydown:e[5]||(e[5]=y(t=>m(),["enter"]))},[s("div",K,[s("div",z,[n(p,{label:"Name",modelValue:a(o).name,"onUpdate:modelValue":e[0]||(e[0]=t=>a(o).name=t),onChange:e[1]||(e[1]=t=>_()),filled:"",class:"mb-3"},null,8,["modelValue"]),n(p,{label:"Slug",modelValue:a(o).slug,"onUpdate:modelValue":e[2]||(e[2]=t=>a(o).slug=t),filled:"",class:"mb-3"},null,8,["modelValue"]),n(d,{color:"primary",onClick:e[3]||(e[3]=c(t=>m(),["prevent"])),loading:a(l),label:"Add Location"},null,8,["loading"]),n(d,{onClick:e[4]||(e[4]=c(t=>a(u).go(-1),["prevent"])),class:"float-right",label:"Back"})])])],32)])])])])}}};export{J as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.