import{n as e,r as t}from"./chunk-qMK8H_w0.js";import{An as n,D as r,F as i,Ht as a,L as o,Nn as s,Rt as c,Zt as l,_n as u,an as d,en as f,jn as p,k as m,kt as h,on as g,pt as _,st as v,tn as y,wn as b}from"./app-4kCgdoJR.js";var x=e({default:()=>F}),S=t(_()),C={class:`relative border-b border-gray-200 p-4 sm:px-6 dark:border-gray-700`},w={class:`absolute end-0 top-0 flex items-center gap-x-4 pe-4 pt-4`},T={class:`sr-only`},E={class:`text-base leading-6 font-semibold text-gray-900 dark:text-gray-100`},D={class:`mt-1 text-sm`},O={class:`bg-gray-100 dark:bg-gray-800`},k={class:`grid grid-cols-1 gap-6 p-6 md:grid-cols-6`},A={class:`col-span-6 sm:col-span-3`},j={class:`col-span-6 sm:col-span-3`},M={class:`col-span-6 sm:col-span-3`},N={class:`col-span-6 sm:col-span-3`},P={class:`flex items-center justify-end border-t border-gray-200 px-6 py-4 dark:border-gray-700`},F={__name:`AddGiftCard`,props:[`show`],emits:[`close`],setup(e,{emit:t}){let{t:_}=c({}),x=t,F=a({number:null,amount:null,customer_id:null,expiry_date:(0,S.default)().add(2,`year`).format(`YYYY-MM-DD`)});async function I(){if(F.errors={},F.number||(F.errors.number=_(`The gift card number is required.`)),F.amount||(F.errors.amount=_(`The gift card amount is required.`)),!Object.keys(F.errors).length){let e={taxes:null,quantity:1,type:`Gift Card`,name:_(`Gift Card`),code:F.number,price:F.amount,net_price:F.amount,unit_price:F.amount,customer_id:F.customer_id,expiry_date:F.expiry_date};F.reset(),x(`close`,e)}}return(t,a)=>(u(),y(n(h),{show:e.show,maxWidth:`xl`,closeable:!0,overflow:!0,round:t.$page.props.settings?.pos_design==`Modern`},{default:b(()=>[f(`div`,{class:p([`transition-all`,t.$page.props.settings?.pos_design==`Modern`?`rounded-2xl`:`rounded-lg`])},[f(`div`,C,[f(`div`,w,[f(`button`,{type:`button`,onClick:a[0]||=e=>x(`close`),class:`rounded-md text-gray-400 hover:text-gray-500 focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 focus:outline-hidden`},[f(`span`,T,s(t.$t(`Close`)),1),a[6]||=f(`svg`,{class:`h-6 w-6`,fill:`none`,viewBox:`0 0 24 24`,"stroke-width":`1.5`,stroke:`currentColor`,"aria-hidden":`true`},[f(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,d:`M6 18L18 6M6 6l12 12`})],-1)])]),f(`div`,null,[f(`h3`,E,s(t.$t(`Sell Gift Card`)),1),f(`p`,D,s(t.$t(`Please add card details below.`)),1)])]),f(`form`,{onSubmit:l(I,[`prevent`]),autocomplete:`off`},[f(`div`,O,[f(`div`,k,[f(`div`,A,[g(n(r),{keyboard:``,autofocus:``,label:n(_)(`Number`),"action-text":`Generate`,modelValue:n(F).number,"onUpdate:modelValue":a[1]||=e=>n(F).number=e,error:n(F).errors.number,action:()=>n(F).number=n(v)(1e11,0x2386f26fc10000)},null,8,[`label`,`modelValue`,`error`,`action`])]),f(`div`,j,[g(n(r),{keyboard:``,type:`number`,label:n(_)(`Amount Value`),modelValue:n(F).amount,"onUpdate:modelValue":a[2]||=e=>n(F).amount=e,error:n(F).errors.amount},null,8,[`label`,`modelValue`,`error`])]),f(`div`,M,[g(n(o),{keyboard:``,json:!0,valueKey:`id`,labelKey:`company`,onChange:t.saveForm,searchable:!0,id:`gc_customer_id`,label:n(_)(`Customer`),modelValue:n(F).customer_id,"onUpdate:modelValue":a[3]||=e=>n(F).customer_id=e,suggestions:t.route(`search.customers`),error:n(F).errors.customer_id},null,8,[`onChange`,`label`,`modelValue`,`suggestions`,`error`])]),f(`div`,N,[g(n(m),{label:t.$t(`Expiry Date`),modelValue:n(F).expiry_date,"onUpdate:modelValue":a[4]||=e=>n(F).expiry_date=e,error:n(F).errors.expiry_date},null,8,[`label`,`modelValue`,`error`])])])]),f(`div`,P,[f(`button`,{type:`button`,onClick:a[5]||=e=>x(`close`),class:`link me-4`},s(t.$t(`Cancel`)),1),g(n(i),{class:`justify-center`,disabled:n(F).processing,loading:n(F).processing},{default:b(()=>[d(s(t.$t(`Add to Order`)),1)]),_:1},8,[`disabled`,`loading`])])],32)],2)]),_:1},8,[`show`,`round`]))}};export{F as n,x as t};