import{n as e}from"./chunk-qMK8H_w0.js";import{An as n,D as r,F as i,Lt as a,Nn as o,On as s,Pn as c,Ut as l,Zt as u,_n as d,an as f,bn as p,en as m,jn as h,kt as g,nn as _,on as v,rn as y,tn as b,wn as x,zt as S}from"./app-4kCgdoJR.js";var C=e({default:()=>M}),w={key:0,class:`p-6`},T={class:`text-base leading-6 font-semibold text-gray-900 dark:text-gray-100`},E={class:`mt-1 text-sm`},D={class:`mt-6 flex justify-between gap-4`},O={key:1},k={class:`relative border-b border-gray-200 p-4 sm:px-6 dark:border-gray-700`},A={class:`text-base leading-6 font-semibold text-gray-900 dark:text-gray-100`},j={class:`mt-1 text-sm`},M={__name:`OpenRegister`,props:[`show`],emits:[`close`],setup(e,{emit:C}){let M=l(),N=C,P=s(!1),F=s(0);async function I(){P.value=!0,await c.post(a(`pos.register`),{cash_in_hand:F.value},{onSuccess:()=>{N(`close`)},onFinish:()=>P.value=!1})}function L(){c.visit(a(`stores.select`,{store:M.props.opened_register.store_id}),{method:`post`,onSuccess:e=>{e.props.opened_register&&e.props.opened_register.store_id!=e.props.selected_store&&(S({group:`main`,type:`success`,title:`Success!`,text:t(`The store has been selected!`)}),M.props.select_store=!1,N(`close`))}})}return(s,c)=>{let l=p(`Link`);return d(),b(n(g),{show:e.show,maxWidth:`sm`,closeable:!1,round:s.$page.props.settings?.pos_design==`Modern`},{default:x(()=>[n(M).props.opened_register?(d(),y(`div`,w,[m(`div`,null,[m(`h3`,T,o(s.$t(`Register already opened!`)),1),m(`p`,E,o(s.$t(`You already have opened register at {x}.`,{x:n(M).props.opened_register.store.name})),1)]),m(`div`,D,[v(l,{href:n(a)(`dashboard`),class:`link`},{default:x(()=>[f(o(s.$t(`Go to {x}`,{x:s.$t(`Dashboard`)})),1)]),_:1},8,[`href`]),!n(M).props.auth.user.store_id&&!n(M).props.order?(d(),y(`button`,{key:0,type:`button`,onClick:L,class:`link`},o(s.$t(`Select {x}`,{x:n(M).props.opened_register.store.name})),1)):_(``,!0),n(M).props.order?(d(),b(l,{key:1,href:n(a)(`orders.index`),class:`link`},{default:x(()=>[f(o(s.$t(`Go to {x}`,{x:s.$t(`Orders`)})),1)]),_:1},8,[`href`])):_(``,!0)])])):(d(),y(`div`,O,[m(`div`,k,[m(`h3`,A,o(s.$t(`Open Register`)),1),m(`p`,j,o(s.$t(`Please type the cash in hand to open register.`)),1)]),m(`div`,{class:h([`bg-gray-100 p-6 dark:bg-gray-800`,s.$page.props.settings?.pos_design==`Modern`?`rounded-b-2xl`:`rounded-b-lg`])},[m(`form`,{onSubmit:u(I,[`prevent`]),autocomplete:`off`,class:`flex flex-col items-stretch gap-4`},[v(n(r),{keyboard:``,placeholder:s.$t(`Cash in hand`),type:`number`,step:`1`,modelValue:F.value,"onUpdate:modelValue":c[0]||=e=>F.value=e,id:`register-cash-in-hand`},null,8,[`placeholder`,`modelValue`]),v(n(i),{class:`justify-center`,loading:P.value},{default:x(()=>[f(o(s.$t(`Open`)),1)]),_:1},8,[`loading`]),v(l,{href:n(a)(`dashboard`),class:`link`},{default:x(()=>[f(o(s.$t(`Go to {x}`,{x:s.$t(`Dashboard`)})),1)]),_:1},8,[`href`])],32)],2)]))]),_:1},8,[`show`,`round`])}}};export{M as n,C as t};