import{S as vt,b as ut,u as Mt,r as b,a_ as ct,aN as Nt,_ as Y,a as mt,o as d,g,j as f,t as r,J as F,ar as zt,Z as xt,bs as Lt,bt as Vt,aq as bt,E as Ct,d as Bt,e as q,f as _,w as e,c as a,i as p,F as w,h as L,b9 as Wt,n as dt,v as it,B as kt,aw as wt,a3 as pt,a1 as St,a0 as jt,a4 as Kt,a8 as Dt,a9 as Qt,a2 as _t,x as Ft,A as Ht,ah as Jt,at as At,bn as Xt,am as Zt,ad as Gt,bo as Yt,ae as $t,ag as te,bu as ee,aF as ae,W as ne,al as oe,be as rt,az as le,bp as de,av as ie,ai as se,m as re,R as ue}from"./app-DGDivIsO.js";import{a as ce}from"./apiAdmin-D4J8O5cP.js";import{s as me}from"./sumBy-BZxLiSvb.js";import{f as pe}from"./filter-_TPdNMe8.js";import{C as _e}from"./CustomerAddButton-DHoGZ3PZ.js";import{I as fe}from"./Invoice-D3OvMgwj.js";import{C as ge}from"./ContainerOutlined-B3xh2RnJ.js";import{S as ye}from"./SaveOutlined-saF8VQQc.js";import{S as he}from"./SettingOutlined-F4vTp2uH.js";import{S as ve}from"./ShoppingCartOutlined-BJIcmyJ0.js";import{U as xe}from"./UnorderedListOutlined-Z74bDpoK.js";import"./index-C2QBqMxH.js";import"./fields-DIa_lWOD.js";import"./Upload-DinpFMlS.js";import"./AddButton-DKGR_30t.js";import"./AddEdit-78MTlGEV.js";import"./AddButton-C3B5OL-2.js";import"./AddEdit-_a1AdlgA.js";import"./BarcodeGenerator-Da4AtV3-.js";import"./PrinterOutlined-zjsA7tiW.js";vt.div`
    border-radius: 10px;
    background-color: #fff;
    position: relative;
	width: 100%;

    @media only screen and (max-width: 767px){
        max-width: 350px;
        margin: 0 auto;
    }
    &.list-view{
        max-width: 100%;
        .product-single-price__offer{
            @media only screen and (max-width: 991px) and (min-width: 768px){
                display: block;
            }
        }
    }
    .product-list{
        background-color: #fff;
        padding: 20px;
        border-radius: 10px;
        figure{
            @media only screen and (max-width: 1199px){
            }
            @media only screen and (max-width: 991px){
                margin: 0 0 20px;
            }
            img{
                border-radius: 10px;
            }
        }
        .product-single-description{
            p{
                font-size: 15px;
            }
        }
        .product-single-title{
            font-size: 18px;
            margin: 25px 0 16px;
            @media only screen and (max-width: 1199px){
                margin: 0 0 16px;
            }
        }
        .product-single-info{
            margin-top: 25px;
            @media only screen and (max-width: 1199px){
                margin-top: 0;
            }
        }
        .product-single-price__new{
            font-size: 16px;
        }
        .product-single-action{
            flex-flow: column;
            align-items: flex-start;
            margin: 28px 0 0 0;
            button{
                min-width: 132px;
                margin: 0;
                padding: 0px 14px;
                height: 38px;
            }
            .btn-cart{
                margin: 0 0 10px;
            }
            .ant-btn-sm{
                height: 38px;
            }
        }
        .btn-heart{
            @media only screen and (max-width: 1599px){
                top: 0;
            }
            @media only screen and (max-width: 1199px){
                top: -4px;
            }
            @media only screen and (max-width: 991){
                top: 0;
            }
        }
    }
    figure{
        margin-bottom: 0;
        img{
            width: 100px;
        }
    }
    figcaption{
        padding: 20px 20px 26px;
    }
    .quantity-box{
        position: absolute;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        height: 15px;
        top: 1px;
        background-color: #fff;
		padding: 0 6px;
		left: 1px;
    }
    .product-single-title{
        margin-bottom: 10px;
        font-size: 15px;
        font-weight: 500;

    }
    .product-single-price{
        margin-bottom: 5px;
        del{
            margin: 0 5px;
        }
    }
    .product-single-price__new{
        font-weight: 600;
    }
    .product-single-price__offer{
        font-weight: 500;
        font-size: 12px;
    }
    .product-single-rating{
        font-size: 12px;
        font-weight: 500;
        display: flex;
        flex-wrap: wrap;
        align-items: center;

        .ant-rate-star{
            div{
                transform: none !important;
            }
        }
        .total-reviews{
            font-weight: 400;
          
        }
        svg{
            width: 13px;
        }
    }
    .product-single-action{
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        margin: 20px -5px -5px -5px;
        button{
            font-size: 12px;
            margin: 5px;
        }


        .ant-btn-sm{
            font-size: 12px;
            padding: 0px 18.065px;
            height: 36px;
        }
    }
`;const be=vt.div`
    max-width: 650px;
    margin: 0 auto;
    .ant-card{
        margin-bottom: 0 !important;
    }

    .ant-form-item{
        margin-bottom: 0;
    }

    .summary-table-title{
        font-size: 18px;
        font-weight: 500;
        margin-bottom: 25px;
      
    }
    .order-summary-inner{
        padding-bottom: 5px;
        @media only screen and (max-width: 1599px){
            max-width: 600px;
            margin: 0 auto;
        }
        .ant-form-item-control{
            line-height: 2.2;
        }
        .ant-form-item-control-wrapper{
            width: 100%;
        }
        .ant-select{
            .ant-select-selection-item{
                font-weight: 500;
            }
        }
        .ant-select-single:not(.ant-select-customize-input) .ant-select-selector{
            height: 30px !important;
        }
    }
    .invoice-summary-inner{
        .summary-list{
            margin: 22px 0;
            li{
                &:not(:last-child){
                    margin-bottom: 12px;
                }
            }
        }
      
    }

    .summary-list{
		padding: 0;
        li{
            display: flex;
            justify-content: space-between;
            &:not(:last-child){
                margin-bottom: 18px;
            }
            span{
                font-weight: 500;
            }
          
        }
    }
    .ant-select-focused.ant-select-single{
        .ant-select-selector{
            box-shadow: 0 0 !important;
        }
    }
    .ant-select-single{
        margin-top: 18px;
        .ant-select-selection-search-input{
            height: fit-content;
        }
        .ant-select-selector{
            padding: 0 !important;
            border: 0 none !important;
            
        }
       
    }
    .promo-apply-form{
        display: flex;
        align-items: flex-end;
        margin: 5px 0 18px;
        @media only screen and (max-width: 479px){
            flex-flow: column;
            align-items: flex-start;
        }
        .ant-form-item{
            margin-bottom: 0;
        }
        .ant-row{
            flex: auto;
            flex-flow: column;
        }
        .ant-form-item-label{
            text-align: 'right';
            line-height: 30px;
            label{
                font-weight: 400;
                margin-bottom: 4px;
                height: fit-content;
                
            }
        }
        .ant-form-item-control-wrapper{
            display: flex;
            width: 100%;
            @media only screen and (max-width: 479px){
                flex-flow: column;
            }
            .ant-form-item-control{
                width: 100%;
            }
            .ant-form-item-children{
                display: block;
                margin: '0 6px 0 0';
                height: auto;
                @media only screen and (max-width: 479px){
                    margin: '0 6px 10px 0';
                }
            }
            input{
                height: 40px;
                @media only screen and (max-width: 479px){
                    width: 100% !important;
                }
            }
            button{
                height: 40px;
            }
        }
    }
    .summary-total{
        display: inline-flex;
        justify-content: space-between;
        width: 100%;
        .summary-total-label{
            font-size: 16px;
            font-weight: 500;
          
        }
        .summary-total-amount{
            font-size: 18px;
            font-weight: 600;
          
        }
    }
    .btn-proceed{
        font-size: 15px;
        font-weight: 500;
        width: 100%;
        height: 50px;
        border-radius: 8px;
        margin-top: 22px;
        @media only screen and (max-width: 575px){
            font-size: 13px;
        }
        a{
            display: flex;
            align-items: center;
        }
        i,
        svg{
            'margin-left' : 6px;
            color: #fff;
        }
    }
`,Ce=()=>{const{t:n}=ut();Mt();const l=b([]);b([]);const h=b([]),t=b([]),M=b([]),V=b([]),c=b({}),m=b(),v=b(),R=b({}),i=b({user_id:void 0,tax_id:void 0,category_id:void 0,brand_id:void 0,tax_id:void 0,tax_rate:0,tax_amount:0,discount_type:"percentage",discount_value:0,discount:0,shipping:0,subtotal:0}),u=[{title:"#",dataIndex:"sn"},{title:n("product.name"),dataIndex:"name"},{title:n("product.quantity"),dataIndex:"unit_quantity"},{title:n("product.subtotal"),dataIndex:"subtotal"},{title:n("common.action"),dataIndex:"action"}],U="customers?limit=10000",W=()=>{const A=axiosAdmin.get("taxes?limit=10000"),P=axiosAdmin.get(U),z=axiosAdmin.get("categories?limit=10000"),S=axiosAdmin.get("brands?limit=10000"),j=axiosAdmin.post("pos/products",{brand_id:i.value.brand_id,category_id:i.value.category_id}),E=axiosAdmin.get("default-walkin-customer");Promise.all([A,P,j,z,S,E]).then(([C,K,x,Q,J,H])=>{l.value=C.data,h.value=K.data,M.value=Q.data,t.value=J.data,V.value=x.data.products;var X=ct(h.value,["xid",H.data.customer.xid]);X&&(c.value=X,i.value={...i.value,user_id:X.xid}),I()})},I=()=>{var A=1;Nt(l.value,P=>{A==1&&(R.value=P,i.value.tax_id=P.xid,v.value=P.rate,m.value=P.xid),A+=1})};return{taxes:l,customers:h,brands:t,categories:M,productLists:V,formData:i,customerUrl:U,orderItemColumns:u,getPreFetchData:W,posDefaultCustomer:c,taxObject:R,fixedTaxRateId:m,fixedTaxRate:v}},ke={props:["product"],setup(n){const{formatAmountCurrency:l}=mt();return{formatAmountCurrency:l}}},we={key:0,class:"product-pos"},Se={class:"product-pos-top"},De={href:"javascript:void(0)"},Fe={key:0,class:"quantity-box",to:"#"},Ae={key:1,class:"quantity-box",to:"#"},Pe=["src"],Oe={class:"product-pos-bottom"},Ie={class:"product-title"},Ee={class:"product-details"},qe={class:"product-price"};function Re(n,l,h,t,M,V){return h.product&&h.product.xid?(d(),g("div",we,[f("div",Se,[f("a",De,[h.product.product_type=="service"?(d(),g("span",Fe,r(n.$t("product.service")),1)):(d(),g("span",Ae,r(h.product.stock_quantity)+" "+r(h.product.unit.short_name),1)),f("img",{src:h.product.image_url,class:"img-fit"},null,8,Pe)])]),f("div",Oe,[f("div",null,[f("h5",Ie,r(h.product.name),1)]),f("div",Ee,[f("div",qe,[f("span",null,r(t.formatAmountCurrency(h.product.subtotal)),1)])])])])):F("",!0)}const Ue=Y(ke,[["render",Re]]),Te={props:["visible","data","selectedProducts"],emits:["closed","success"],components:{CheckOutlined:zt,PlusOutlined:xt,LeftOutlined:Lt,RightOutlined:Vt,DeleteOutlined:bt},setup(n,{emit:l}){const{addEditRequestAdmin:h,loading:t,rules:M}=ce(),{appSetting:V,formatAmountCurrency:c}=mt(),m=b([]),v=b({payment_mode_id:void 0,amount:0,notes:""}),{t:R}=ut(),i=b([]),u=b([{title:R("payments.payment_mode"),dataIndex:"payment_mode"},{title:R("payments.amount"),dataIndex:"amount"},{title:R("common.action"),dataIndex:"action"}]),U=b(!1);Ct(()=>{axiosAdmin.get("payment-modes").then(E=>{m.value=E.data})});const W=()=>{v.value={payment_mode_id:void 0,amount:0,notes:""},i.value=[],l("closed")},I=()=>{h({url:"pos/payment",data:v.value,success:E=>{i.value=[...i.value,{...v.value,id:Math.random().toString(36).slice(2)}],v.value={payment_mode_id:void 0,amount:0,notes:""},U.value=!1}})},A=()=>{const E={all_payments:i.value,product_items:n.selectedProducts,details:n.data};h({url:"pos/save",data:E,successMessage:n.successMessage,success:C=>{v.value={payment_mode_id:void 0,amount:0,notes:""},i.value=[],U.value=!1,l("success",C.order)}})},P=()=>{v.value={payment_mode_id:void 0,amount:0,notes:""},U.value=!1},z=E=>{var C=ct(m.value,["xid",E]);return C?C.name:"-"},S=E=>{var C=pe(i.value,K=>K.id!=E);i.value=C},j=Bt(()=>{var E=me(i.value,C=>parseFloat(C.amount));return E+parseFloat(v.value.amount)});return{loading:t,rules:M,drawerClosed:W,paymentModes:m,formData:v,appSetting:V,formatAmountCurrency:c,onSubmit:I,allPaymentRecords:i,paymentRecordsColumns:u,showAddForm:U,completeOrder:A,goBack:P,getPaymentModeName:z,deletePayment:S,totalEnteredAmount:j,drawerWidth:window.innerWidth<=991?"90%":"50%"}}},Me={style:{color:"#7c8db5 !important"}};function Ne(n,l,h,t,M,V){const c=Wt,m=dt,v=it,R=q("PlusOutlined"),i=kt,u=q("RightOutlined"),U=q("LeftOutlined"),W=q("DeleteOutlined"),I=wt,A=_t,P=pt,z=St,S=jt,j=Kt,E=q("CheckOutlined"),C=Dt,K=Qt;return d(),_(K,{title:n.$t("payments.order_payment"),width:t.drawerWidth,maskClosable:!1,open:h.visible,onClose:t.drawerClosed},{default:e(()=>[a(v,null,{default:e(()=>[a(m,{xs:24,sm:24,md:8,lg:8},{default:e(()=>[a(v,null,{default:e(()=>[a(m,{span:24},{default:e(()=>[a(c,{title:n.$t("stock.total_items"),value:h.selectedProducts.length,style:{"margin-right":"50px"}},null,8,["title","value"])]),_:1}),a(m,{span:24,class:"mt-20"},{default:e(()=>[a(c,{title:n.$t("stock.paying_amount"),value:t.formatAmountCurrency(t.totalEnteredAmount)},null,8,["title","value"])]),_:1}),a(m,{span:24,class:"mt-20"},{default:e(()=>[a(c,{title:n.$t("stock.payable_amount"),value:t.formatAmountCurrency(h.data.subtotal)},null,8,["title","value"])]),_:1}),a(m,{span:24,class:"mt-20"},{default:e(()=>[t.totalEnteredAmount<=h.data.subtotal?(d(),_(c,{key:0,title:n.$t("payments.due_amount"),value:t.formatAmountCurrency(h.data.subtotal-t.totalEnteredAmount)},null,8,["title","value"])):(d(),_(c,{key:1,title:n.$t("stock.change_return"),value:t.formatAmountCurrency(t.totalEnteredAmount-h.data.subtotal)},null,8,["title","value"]))]),_:1})]),_:1})]),_:1}),a(m,{xs:24,sm:24,md:16,lg:16},{default:e(()=>[a(v,{gutter:[24,24]},{default:e(()=>[t.showAddForm?(d(),_(m,{key:1,span:24},{default:e(()=>[a(v,null,{default:e(()=>[a(m,{xs:24,sm:24,md:10,lg:10},{default:e(()=>[a(i,{block:!0,type:"primary",onClick:t.goBack},{default:e(()=>[a(U),p(" "+r(n.$t("common.back")),1)]),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1})):(d(),_(m,{key:0,span:24},{default:e(()=>[a(v,{gutter:[16,8],class:"mt-20"},{default:e(()=>[a(m,{xs:24,sm:24,md:10,lg:10},{default:e(()=>[a(i,{block:!0,type:"primary",onClick:l[0]||(l[0]=()=>t.showAddForm=!0)},{default:e(()=>[a(R),p(" "+r(n.$t("payments.add")),1)]),_:1})]),_:1}),a(m,{xs:24,sm:24,md:10,lg:10},{default:e(()=>[a(i,{loading:t.loading,block:!0,onClick:t.completeOrder},{default:e(()=>[p(r(n.$t("stock.complete_order"))+" ",1),a(u)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1})),t.showAddForm?(d(),_(m,{key:3,span:24},{default:e(()=>[a(C,{layout:"vertical"},{default:e(()=>[a(v,{gutter:16},{default:e(()=>[a(m,{xs:24,sm:24,md:12,lg:12},{default:e(()=>[a(z,{label:n.$t("payments.payment_mode"),name:"payment_mode_id",help:t.rules.payment_mode_id?t.rules.payment_mode_id.message:null,validateStatus:t.rules.payment_mode_id?"error":null},{default:e(()=>[a(P,{value:t.formData.payment_mode_id,"onUpdate:value":l[1]||(l[1]=x=>t.formData.payment_mode_id=x),placeholder:n.$t("common.select_default_text",[n.$t("payments.payment_mode")]),allowClear:!0},{default:e(()=>[(d(!0),g(w,null,L(t.paymentModes,x=>(d(),_(A,{key:x.xid,value:x.xid},{default:e(()=>[p(r(x.name),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1}),a(m,{xs:24,sm:24,md:12,lg:12},{default:e(()=>[a(z,{label:n.$t("stock.paying_amount"),name:"amount",help:t.rules.amount?t.rules.amount.message:null,validateStatus:t.rules.amount?"error":null},{default:e(()=>[a(S,{prefix:t.appSetting.currency.symbol,value:t.formData.amount,"onUpdate:value":l[2]||(l[2]=x=>t.formData.amount=x),placeholder:n.$t("common.placeholder_default_text",[n.$t("stock.payable_amount")])},null,8,["prefix","value","placeholder"]),f("small",Me,[p(r(n.$t("stock.payable_amount"))+" ",1),f("span",null,r(t.formatAmountCurrency(h.data.subtotal)),1)])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),a(v,{gutter:16},{default:e(()=>[a(m,{xs:24,sm:24,md:24,lg:24},{default:e(()=>[a(z,{label:n.$t("payments.notes"),name:"notes",help:t.rules.notes?t.rules.notes.message:null,validateStatus:t.rules.notes?"error":null},{default:e(()=>[a(j,{value:t.formData.notes,"onUpdate:value":l[3]||(l[3]=x=>t.formData.notes=x),placeholder:n.$t("payments.notes"),rows:5},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),a(v,{gutter:16},{default:e(()=>[a(m,{xs:24,sm:24,md:24,lg:24},{default:e(()=>[a(i,{type:"primary",loading:t.loading,onClick:t.onSubmit,block:""},{icon:e(()=>[a(E)]),default:e(()=>[p(" "+r(n.$t("common.add")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1})]),_:1})):(d(),_(m,{key:2,span:24},{default:e(()=>[a(I,{dataSource:t.allPaymentRecords,columns:t.paymentRecordsColumns,pagination:!1},{bodyCell:e(({column:x,record:Q})=>[x.dataIndex==="payment_mode"?(d(),g(w,{key:0},[p(r(t.getPaymentModeName(Q.payment_mode_id)),1)],64)):F("",!0),x.dataIndex==="amount"?(d(),g(w,{key:1},[p(r(t.formatAmountCurrency(Q.amount)),1)],64)):F("",!0),x.dataIndex==="action"?(d(),_(i,{key:2,type:"primary",onClick:J=>t.deletePayment(Q.id),danger:""},{icon:e(()=>[a(W)]),_:2},1032,["onClick"])):F("",!0)]),_:1},8,["dataSource","columns"])]),_:1}))]),_:1})]),_:1})]),_:1})]),_:1},8,["title","width","open","onClose"])}const ze=Y(Te,[["render",Ne]]),Le=Ft({props:["formData","brands","categories"],emits:["changed"],components:{ContainerOutlined:ge},setup(n,{emit:l}){return{reFetchProducts:()=>{l("changed")},getCategoryName:M=>M.length>9?M.substring(0,8)+"..":M}}}),Ve=["onClick"];function Be(n,l,h,t,M,V){const c=q("ContainerOutlined"),m=Ht,v=Jt,R=dt,i=it;return d(),_(i,{gutter:[16,16]},{default:e(()=>[a(R,{xs:24,sm:24,md:24,lg:24,xl:24,class:"pos-style-1-category-scroll"},{default:e(()=>[f("div",{onClick:l[0]||(l[0]=()=>{n.formData.category_id=void 0,n.reFetchProducts()}),class:"pos-style-1-category-box"},[a(m,{shape:"square",size:"large",style:{backgroundColor:"#fff",color:"black",verticalAlign:"middle",marginTop:"5px"}},{icon:e(()=>[a(c)]),_:1}),f("p",null,r(n.$t("common.all")),1)]),(d(!0),g(w,null,L(n.categories,u=>(d(),g("div",{key:u.xid,onClick:()=>{n.formData.category_id=u.xid,n.reFetchProducts()},class:"pos-style-1-category-box"},[a(v,{title:u.name},{default:e(()=>[a(m,{size:"large",src:u.image_url,style:{verticalAlign:"middle",marginTop:"5px"}},null,8,["src"]),f("p",null,r(n.getCategoryName(u.name)),1)]),_:2},1032,["title"])],8,Ve))),128))]),_:1})]),_:1})}const We=Y(Le,[["render",Be]]),je=Ft({props:["formData","brands","categories"],emits:["changed"],setup(n,{emit:l}){return{reFetchProducts:()=>{l("changed")}}}});function Ke(n,l,h,t,M,V){const c=_t,m=pt,v=dt,R=At,i=it;return d(),_(i,{gutter:[16,16]},{default:e(()=>[a(v,{xs:24,sm:24,md:12,lg:12,xl:12},{default:e(()=>[a(m,{value:n.formData.brand_id,"onUpdate:value":l[0]||(l[0]=u=>n.formData.brand_id=u),placeholder:n.$t("common.select_default_text",[n.$t("product.brand")]),allowClear:!0,style:{width:"100%"},optionFilterProp:"title","show-search":"",onChange:n.reFetchProducts},{default:e(()=>[(d(!0),g(w,null,L(n.brands,u=>(d(),_(c,{key:u.xid,title:u.name,value:u.xid},{default:e(()=>[p(r(u.name),1)]),_:2},1032,["title","value"]))),128))]),_:1},8,["value","placeholder","onChange"])]),_:1}),a(v,{xs:24,sm:24,md:12,lg:12,xl:12},{default:e(()=>[a(R,{compact:""},{default:e(()=>[a(m,{value:n.formData.category_id,"onUpdate:value":l[1]||(l[1]=u=>n.formData.category_id=u),placeholder:n.$t("common.select_default_text",[n.$t("product.category")]),allowClear:!0,style:{width:"100%"},optionFilterProp:"title","show-search":"",onChange:n.reFetchProducts},{default:e(()=>[(d(!0),g(w,null,L(n.categories,u=>(d(),_(c,{key:u.xid,title:u.name,value:u.xid},{default:e(()=>[p(r(u.name),1)]),_:2},1032,["title","value"]))),128))]),_:1},8,["value","placeholder","onChange"])]),_:1})]),_:1})]),_:1})}const Qe=Y(je,[["render",Ke]]),He={components:{PlusOutlined:xt,SearchOutlined:Xt,EditOutlined:Zt,DeleteOutlined:bt,SaveOutlined:ye,SettingOutlined:he,ShoppingCartOutlined:ve,UnorderedListOutlined:xe,PosLayout1:We,PosLayout2:Qe,ProductCardNew:Ue,OrderSummary:be,PayNow:ze,CustomerAddButton:_e,InvoiceModal:fe},setup(){const{taxes:n,customers:l,brands:h,categories:t,productLists:M,orderItemColumns:V,formData:c,customerUrl:m,getPreFetchData:v,posDefaultCustomer:R}=Ce(),i=b([]),u=b([]),U=b([]),W=b(1),I=Gt({orderSearchTerm:void 0,productFetching:!1,products:[]}),{formatAmount:A,formatAmountCurrency:P,appSetting:z,taxTypes:S,permsArray:j}=mt(),{t:E}=ut(),C=b(!1),K=b(!1),x=b({}),Q=b([]),J=b(""),H=b(!1),X=b(!1),$=b({}),tt=b(!1);Ct(()=>{v()});const G=()=>{axiosAdmin.post("pos/products",{brand_id:c.value.brand_id,category_id:c.value.category_id}).then(s=>{M.value=s.data.products})},et=Yt(s=>{at(s)},300),at=s=>{I.products=[],s!=""&&(I.productFetching=!0,axiosAdmin.post("search-product",{order_type:"sales",search_term:s}).then(D=>{D.data.length==1?nt("",{product:D.data[0]}):I.products=D.data,I.productFetching=!1}))},st=s=>{te(()=>{s.keyCode==13&&at(s.target.value)})},nt=(s,y)=>{const D=y.product;ot(D)},ot=s=>{if(ee(u.value,s.xid)){const T=ct(i.value,["xid",s.xid]);if(T&&(T.quantity<T.stock_quantity||T.product_type=="service")){const O=[];var D={};i.value.map(B=>{var Z=B.quantity;B.xid==s.xid&&(Z+=1,B.quantity=Z,D=B),O.push(B)}),i.value=O;var y=new Audio(z.value.beep_audio_url);y.play(),I.orderSearchTerm=void 0,I.products=[],k(D)}else I.orderSearchTerm=void 0,I.products=[],ae.error(E("common.out_of_stock"))}else{u.value.push(s.xid),i.value.push({...s,sn:i.value.length+1,unit_price:A(s.unit_price),tax_amount:A(s.tax_amount),subtotal:A(s.subtotal)}),I.orderSearchTerm=void 0,I.products=[],N();var y=new Audio(z.value.beep_audio_url);y.play()}},o=s=>{var y=parseFloat(s.quantity),D=parseFloat(s.stock_quantity);const T=parseFloat(s.unit_price);s.product_type!="service"&&(y=y>D?D:y);const O=s.discount_rate,yt=O>0?O/100*T:0,B=T-yt;var Z=0,ht=B,lt=T;return s.tax_rate>0&&(s.tax_type=="inclusive"?(lt=B*100/(100+s.tax_rate),Z=lt*(s.tax_rate/100)):(Z=B*(s.tax_rate/100),ht=B+Z,lt=B)),{...s,total_discount:yt*y,subtotal:ht*y,quantity:y,total_tax:Z*y,max_quantity:D,single_unit_price:lt}},k=s=>{const y=[];i.value.map(D=>{if(D.xid==s.xid){const T=o(s);y.push(T)}else y.push(D)}),i.value=y,N()},N=()=>{let s=0;i.value.map(O=>{s+=O.subtotal});var y=0;c.value.discount_type=="percentage"?y=c.value.discount_value!=""?parseFloat(c.value.discount_value)*s/100:0:c.value.discount_type=="fixed"&&(y=c.value.discount_value!=""?parseFloat(c.value.discount_value):0);const D=c.value.tax_rate!=""?parseFloat(c.value.tax_rate):0;s=s-y;const T=s*(D/100);s=s+parseFloat(c.value.shipping),c.value.subtotal=A(s+T),c.value.tax_amount=A(T),c.value.discount=y},Pt=s=>{const y=[];let D=1;i.value.map(O=>{O.item_id!=null&&(U.value=[...U.value,O.item_id]),O.xid!=s.xid&&(y.push({...O,sn:D,single_unit_price:A(O.single_unit_price),tax_amount:A(O.tax_amount),subtotal:A(O.subtotal)}),D++)}),i.value=y;const T=u.value.filter(O=>O!=s.xid);u.value=T,N()},Ot=(s,y)=>{c.value.tax_rate=s==null?0:y.tax.rate,N()},It=s=>{x.value={id:s.xid,discount_rate:s.discount_rate,unit_price:s.unit_price,tax_id:s.x_tax_id,tax_type:s.tax_type==null?void 0:s.tax_type},C.value=!0,J.value=s.name},Et=()=>{H.value=!0},qt=()=>{H.value=!1},ft=()=>{i.value=[],u.value=[],c.value={...c.value,tax_id:void 0,category_id:void 0,brand_id:void 0,tax_id:void 0,tax_rate:0,tax_amount:0,discount_value:0,discount:0,shipping:0,subtotal:0},N()},Rt=()=>{const s=i.value.filter(O=>O.xid==x.value.id),y=n.value.filter(O=>O.xid==x.value.tax_id),D=x.value.tax_type!=null?x.value.tax_type:"exclusive",T={...s[0],discount_rate:parseFloat(x.value.discount_rate),unit_price:parseFloat(x.value.unit_price),tax_id:x.value.tax_id,tax_rate:y[0]?y[0].rate:0,tax_type:D};k(T),gt()},gt=()=>{x.value={},C.value=!1},Ut=()=>{axiosAdmin.get(m).then(s=>{l.value=s.data})},Tt=s=>{ft();var y=R.value&&R.value.xid?R.value.xid:void 0;c.value={...c.value,user_id:y},G(),H.value=!1,$.value=s,X.value=!0};return{taxes:n,customers:l,categories:t,brands:h,productLists:M,formData:c,reFetchProducts:G,selectSaleProduct:ot,taxChanged:Ot,quantityChanged:k,recalculateFinalTotal:N,payNow:Et,payNowVisible:H,payNowClosed:qt,resetPos:ft,appSetting:z,permsArray:j,...$t(I),fetchProducts:et,searchValueSelected:nt,selectedProducts:i,orderItemColumns:V,formatAmount:A,formatAmountCurrency:P,containerStyle:{height:window.innerHeight-110+"px",overflow:"scroll","overflow-y":"scroll"},customerAdded:Ut,editItem:It,addEditVisible:C,addEditFormData:x,addEditFormSubmitting:K,addEditRules:Q,addEditPageTitle:J,onAddEditSubmit:Rt,onAddEditClose:gt,taxTypes:S,showDeleteConfirm:Pt,payNowSuccess:Tt,printInvoiceModalVisible:X,printInvoiceOrder:$,postLayout:W,innerWidth:window.innerWidth,inputValueChanged:st,showMobileCart:tt}}},Je={style:{display:"flex"}},Xe={key:0},Ze=f("br",null,null,-1),Ge={class:"pos-left-wrapper"},Ye={class:"pos-left-header"},$e={class:"bill-filters"},ta={style:{display:"flex"}},ea={key:0},aa=f("br",null,null,-1),na={style:{display:"flex"}},oa={class:"pos-left-content"},la={class:"bill-body"},da={class:"bill-table"},ia=f("br",null,null,-1),sa={key:0},ra={class:"pos-left-footer"},ua={class:"bill-footer"},ca={style:{right:0,bottom:20,width:"100%",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},ma={class:"pos-grand-total"},pa={class:"pos-grand-total"},_a={style:{display:"flex"}},fa={class:"pos1-left-wrapper"},ga={key:0,class:"pos-left-header"},ya={key:1,class:"pos-left-content"},ha={key:2},va=f("br",null,null,-1),xa={key:0},ba={key:3,class:"pos-left-footer"},Ca={class:"bill-footer",style:{paddingBotton:"30px"}},ka={key:0,class:"pos-mobile-footer"},wa={class:"pos-grand-total"};function Sa(n,l,h,t,M,V){const c=_t,m=pt,v=q("CustomerAddButton"),R=le,i=dt,u=it,U=ne,W=q("SearchOutlined"),I=de,A=ie,P=se,z=q("EditOutlined"),S=kt,j=q("DeleteOutlined"),E=wt,C=St,K=At,x=re,Q=q("PosLayout1"),J=q("PosLayout2"),H=q("ProductCardNew"),X=ue,$=q("perfect-scrollbar"),tt=q("ShoppingCartOutlined"),G=q("UnorderedListOutlined"),et=Dt,at=q("SaveOutlined"),st=oe,nt=q("PayNow"),ot=q("InvoiceModal");return d(),g(w,null,[a(U,{class:"page-content-sub-header breadcrumb-left-border",bodyStyle:{padding:"0px",margin:"0px 16px 0"}},{default:e(()=>[a(u,null,{default:e(()=>[a(i,{span:24},{default:e(()=>[a(R,{title:n.$t("menu.pos"),onBack:l[1]||(l[1]=()=>n.$router.go(-1)),class:"p-0"},rt({_:2},[t.innerWidth<=768?{name:"extra",fn:e(()=>[f("span",Je,[a(m,{value:t.formData.user_id,"onUpdate:value":l[0]||(l[0]=o=>t.formData.user_id=o),placeholder:n.$t("user.walk_in_customer"),style:{width:"100%"},optionFilterProp:"title","show-search":""},{default:e(()=>[(d(!0),g(w,null,L(t.customers,o=>(d(),_(c,{key:o.xid,title:o.name,value:o.xid},{default:e(()=>[p(r(o.name)+" ",1),o.phone&&o.phone!=""?(d(),g("span",Xe,[Ze,p(" "+r(o.phone),1)])):F("",!0)]),_:2},1032,["title","value"]))),128))]),_:1},8,["value","placeholder"]),a(v,{onOnAddSuccess:t.customerAdded},null,8,["onOnAddSuccess"])])]),key:"0"}:void 0]),1032,["title"])]),_:1})]),_:1})]),_:1}),a(et,{layout:"vertical"},{default:e(()=>[t.innerWidth>=768?(d(),_(u,{key:0,gutter:[8,8],class:"mt-5",style:{margin:"10px 16px 0"}},{default:e(()=>[a(i,{xs:24,sm:24,md:24,lg:10,xl:10},{default:e(()=>[f("div",Ge,[f("div",Ye,[a(U,{class:"left-pos-top",style:{marginBottom:"10px"}},{default:e(()=>[f("div",$e,[a(u,{gutter:16},{default:e(()=>[a(i,{xs:24,sm:24,md:24,lg:24,xl:24},{default:e(()=>[f("span",ta,[a(m,{value:t.formData.user_id,"onUpdate:value":l[2]||(l[2]=o=>t.formData.user_id=o),placeholder:n.$t("user.walk_in_customer"),style:{width:"100%"},optionFilterProp:"title","show-search":""},{default:e(()=>[(d(!0),g(w,null,L(t.customers,o=>(d(),_(c,{key:o.xid,title:o.name,value:o.xid},{default:e(()=>[p(r(o.name)+" ",1),o.phone&&o.phone!=""?(d(),g("span",ea,[aa,p(" "+r(o.phone),1)])):F("",!0)]),_:2},1032,["title","value"]))),128))]),_:1},8,["value","placeholder"]),a(v,{onOnAddSuccess:t.customerAdded},null,8,["onOnAddSuccess"])])]),_:1})]),_:1}),a(u,{class:"mt-20 mb-30"},{default:e(()=>[a(i,{xs:24,sm:24,md:24,lg:24,xl:24},{default:e(()=>[f("span",na,[a(m,{value:null,searchValue:n.orderSearchTerm,"show-search":"","filter-option":!1,placeholder:n.$t("product.search_scan_product"),style:{width:"100%"},"not-found-content":n.productFetching?void 0:null,onSearch:l[3]||(l[3]=o=>{n.orderSearchTerm=o,t.fetchProducts(o)}),"option-label-prop":"label",onFocus:l[4]||(l[4]=o=>n.products=[]),onSelect:t.searchValueSelected,onInputKeyDown:t.inputValueChanged},rt({suffixIcon:e(()=>[a(W)]),default:e(()=>[(d(!0),g(w,null,L(n.products,o=>(d(),_(c,{key:o.xid,value:o.xid,label:o.name,product:o},{default:e(()=>[p(" => "+r(o.name),1)]),_:2},1032,["value","label","product"]))),128))]),_:2},[n.productFetching?{name:"notFoundContent",fn:e(()=>[a(I,{size:"small"})]),key:"0"}:void 0]),1032,["searchValue","placeholder","not-found-content","onSelect","onInputKeyDown"])])]),_:1})]),_:1})])]),_:1})]),f("div",oa,[a(U,{class:"left-pos-middle-table",style:{marginBottom:"10px"}},{default:e(()=>[f("div",la,[f("div",da,[a(u,{class:"mt-20 mb-30"},{default:e(()=>[a(i,{xs:24,sm:24,md:24,lg:24},{default:e(()=>[a(E,{"row-key":o=>o.xid,dataSource:t.selectedProducts,columns:t.orderItemColumns,pagination:!1,size:"middle"},{bodyCell:e(({column:o,record:k})=>[o.dataIndex==="name"?(d(),g(w,{key:0},[p(r(k.name)+" ",1),ia,k.product_type!="service"?(d(),g("small",sa,[a(A,{code:""},{default:e(()=>[p(r(n.$t("product.avl_qty"))+" "+r(`${k.stock_quantity}${k.unit_short_name}`),1)]),_:2},1024)])):F("",!0)],64)):F("",!0),o.dataIndex==="unit_quantity"?(d(),_(P,{key:1,id:"inputNumber",value:k.quantity,"onUpdate:value":N=>k.quantity=N,min:0,onChange:N=>t.quantityChanged(k)},null,8,["value","onUpdate:value","onChange"])):F("",!0),o.dataIndex==="subtotal"?(d(),g(w,{key:2},[p(r(t.formatAmountCurrency(k.subtotal)),1)],64)):F("",!0),o.dataIndex==="action"?(d(),g(w,{key:3},[a(S,{type:"primary",onClick:N=>t.editItem(k),style:{"margin-left":"4px","margin-top":"4px"}},{icon:e(()=>[a(z)]),_:2},1032,["onClick"]),a(S,{type:"primary",onClick:N=>t.showDeleteConfirm(k),style:{"margin-left":"4px","margin-top":"4px"}},{icon:e(()=>[a(j)]),_:2},1032,["onClick"])],64)):F("",!0)]),_:1},8,["row-key","dataSource","columns"])]),_:1})]),_:1})])])]),_:1})]),f("div",ra,[a(U,null,{default:e(()=>[f("div",ua,[a(u,{gutter:[16,16]},{default:e(()=>[a(i,{xs:24,sm:24,md:8,lg:8,xl:8},{default:e(()=>[a(C,{label:n.$t("stock.order_tax")},{default:e(()=>[a(m,{value:t.formData.tax_id,"onUpdate:value":l[5]||(l[5]=o=>t.formData.tax_id=o),placeholder:n.$t("common.select_default_text",[n.$t("stock.order_tax")]),allowClear:!0,style:{width:"100%"},onChange:t.taxChanged},{default:e(()=>[(d(!0),g(w,null,L(t.taxes,o=>(d(),_(c,{key:o.xid,value:o.xid,tax:o},{default:e(()=>[p(r(o.name)+" ("+r(o.rate)+"%) ",1)]),_:2},1032,["value","tax"]))),128))]),_:1},8,["value","placeholder","onChange"])]),_:1},8,["label"])]),_:1}),a(i,{xs:24,sm:24,md:8,lg:8,xl:8},{default:e(()=>[a(C,{label:n.$t("stock.discount")},{default:e(()=>[a(K,{compact:""},{default:e(()=>[a(m,{value:t.formData.discount_type,"onUpdate:value":l[6]||(l[6]=o=>t.formData.discount_type=o),onChange:t.recalculateFinalTotal,style:{width:"30%"}},{default:e(()=>[a(c,{value:"percentage"},{default:e(()=>[p(" % ")]),_:1}),a(c,{value:"fixed"},{default:e(()=>[p(r(t.appSetting.currency.symbol),1)]),_:1})]),_:1},8,["value","onChange"]),a(P,{value:t.formData.discount_value,"onUpdate:value":l[7]||(l[7]=o=>t.formData.discount_value=o),placeholder:n.$t("common.placeholder_default_text",[n.$t("stock.discount")]),onChange:t.recalculateFinalTotal,min:"0",style:{width:"70%"}},null,8,["value","placeholder","onChange"])]),_:1})]),_:1},8,["label"])]),_:1}),a(i,{xs:24,sm:24,md:8,lg:8,xl:8},{default:e(()=>[a(C,{label:n.$t("stock.shipping")},{default:e(()=>[a(P,{value:t.formData.shipping,"onUpdate:value":l[8]||(l[8]=o=>t.formData.shipping=o),placeholder:n.$t("common.placeholder_default_text",[n.$t("stock.shipping")]),onChange:t.recalculateFinalTotal,min:"0",style:{width:"100%"}},{addonBefore:e(()=>[p(r(t.appSetting.currency.symbol),1)]),_:1},8,["value","placeholder","onChange"])]),_:1},8,["label"])]),_:1})]),_:1})])]),_:1}),f("div",ca,[a(u,{gutter:16},{default:e(()=>[a(i,{xs:24,sm:24,md:10,lg:10,xl:10},{default:e(()=>[a(u,{gutter:16,style:{background:"#dbdbdb",padding:"5px"}},{default:e(()=>[a(i,{xs:24,sm:24,md:12,lg:12,xl:12},{default:e(()=>[f("span",ma,r(n.$t("stock.grand_total"))+" : ",1)]),_:1}),a(i,{xs:24,sm:24,md:12,lg:12,xl:12},{default:e(()=>[f("span",pa,r(t.formatAmountCurrency(t.formData.subtotal)),1)]),_:1})]),_:1})]),_:1}),a(i,{xs:24,sm:24,md:6,lg:6,xl:6,class:"mt-10"},{default:e(()=>[f("small",null,r(n.$t("product.tax"))+" : "+r(t.formatAmountCurrency(t.formData.tax_amount))+" | "+r(n.$t("product.discount"))+" : "+r(t.formatAmountCurrency(t.formData.discount)),1)]),_:1}),a(i,{xs:24,sm:24,md:8,lg:8,xl:8},{default:e(()=>[a(x,null,{default:e(()=>[a(S,{type:"primary",onClick:t.payNow,disabled:t.formData.subtotal<=0||t.formData.user_id==null||t.formData.user_id==""||!t.formData.user_id},{default:e(()=>[p(r(n.$t("stock.pay_now")),1)]),_:1},8,["onClick","disabled"]),a(S,{onClick:t.resetPos},{default:e(()=>[p(r(n.$t("stock.reset")),1)]),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1})])])])]),_:1}),a(i,{class:"right-pos-sidebar",xs:24,sm:24,md:24,lg:14,xl:14},{default:e(()=>[a($,{options:{wheelSpeed:1,swipeEasing:!0,suppressScrollX:!0}},{default:e(()=>[t.postLayout==1?(d(),_(Q,{key:0,brands:t.brands,categories:t.categories,formData:t.formData,onChanged:t.reFetchProducts},null,8,["brands","categories","formData","onChanged"])):(d(),_(J,{key:1,brands:t.brands,categories:t.categories,formData:t.formData,onChanged:t.reFetchProducts},null,8,["brands","categories","formData","onChanged"])),t.productLists.length>0?(d(),_(u,{key:2,gutter:30},{default:e(()=>[(d(!0),g(w,null,L(t.productLists,o=>(d(),_(i,{key:o.xid,xxl:6,lg:6,md:12,xs:24,onClick:k=>t.selectSaleProduct(o)},{default:e(()=>[a(H,{product:o},null,8,["product"])]),_:2},1032,["onClick"]))),128))]),_:1})):(d(),_(u,{key:3},{default:e(()=>[a(i,{span:24},{default:e(()=>[a(X,{title:n.$t("stock.no_product_found"),style:{marginTop:"20%"}},null,8,["title"])]),_:1})]),_:1}))]),_:1})]),_:1})]),_:1})):(d(),_(u,{key:1,gutter:[8,8],class:"mt-5",style:{margin:"10px 16px 0"}},{default:e(()=>[a(i,{span:24},{default:e(()=>[f("span",_a,[a(m,{value:null,searchValue:n.orderSearchTerm,"show-search":"","filter-option":!1,placeholder:n.$t("product.search_scan_product"),style:{width:"90%"},"not-found-content":n.productFetching?void 0:null,onSearch:l[9]||(l[9]=o=>{n.orderSearchTerm=o,t.fetchProducts(o)}),"option-label-prop":"label",onFocus:l[10]||(l[10]=o=>n.products=[]),onSelect:t.searchValueSelected,onInputKeyDown:t.inputValueChanged},rt({suffixIcon:e(()=>[a(W)]),default:e(()=>[(d(!0),g(w,null,L(n.products,o=>(d(),_(c,{key:o.xid,value:o.xid,label:o.name,product:o},{default:e(()=>[p(" => "+r(o.name),1)]),_:2},1032,["value","label","product"]))),128))]),_:2},[n.productFetching?{name:"notFoundContent",fn:e(()=>[a(I,{size:"small"})]),key:"0"}:void 0]),1032,["searchValue","placeholder","not-found-content","onSelect","onInputKeyDown"]),t.showMobileCart?(d(),_(S,{key:0,class:"ml-5",style:{width:"100%"},onClick:l[11]||(l[11]=()=>t.showMobileCart=!1),type:"primary"},{icon:e(()=>[a(tt)]),_:1})):(d(),_(S,{key:1,class:"ml-5",style:{width:"100%"},onClick:l[12]||(l[12]=()=>t.showMobileCart=!0),type:"primary"},{icon:e(()=>[a(G)]),_:1}))])]),_:1}),a(i,{span:24},{default:e(()=>[f("div",fa,[t.showMobileCart?F("",!0):(d(),g("div",ga,[t.postLayout==1?(d(),_(Q,{key:0,brands:t.brands,categories:t.categories,formData:t.formData,onChanged:t.reFetchProducts},null,8,["brands","categories","formData","onChanged"])):(d(),_(J,{key:1,brands:t.brands,categories:t.categories,formData:t.formData,onChanged:t.reFetchProducts},null,8,["brands","categories","formData","onChanged"]))])),t.showMobileCart?F("",!0):(d(),g("div",ya,[t.productLists.length>0?(d(),_(u,{key:0,gutter:30,class:"pos1-products-lists"},{default:e(()=>[(d(!0),g(w,null,L(t.productLists,o=>(d(),_(i,{key:o.xid,xxl:8,lg:8,md:8,sm:12,xs:12,onClick:k=>t.selectSaleProduct(o)},{default:e(()=>[a(H,{product:o},null,8,["product"])]),_:2},1032,["onClick"]))),128))]),_:1})):F("",!0)])),t.showMobileCart?(d(),g("div",ha,[a(u,{class:"mt-5 mb-5"},{default:e(()=>[a(i,{xs:24,sm:24,md:24,lg:24},{default:e(()=>[a(E,{"row-key":o=>o.xid,dataSource:t.selectedProducts,columns:t.orderItemColumns,pagination:!1,size:"middle"},{bodyCell:e(({column:o,record:k})=>[o.dataIndex==="name"?(d(),g(w,{key:0},[p(r(k.name)+" ",1),va,k.product_type!="service"?(d(),g("small",xa,[a(A,{code:""},{default:e(()=>[p(r(n.$t("product.avl_qty"))+" "+r(`${k.stock_quantity}${k.unit_short_name}`),1)]),_:2},1024)])):F("",!0)],64)):F("",!0),o.dataIndex==="unit_quantity"?(d(),_(P,{key:1,id:"inputNumber",value:k.quantity,"onUpdate:value":N=>k.quantity=N,min:0,onChange:N=>t.quantityChanged(k)},null,8,["value","onUpdate:value","onChange"])):F("",!0),o.dataIndex==="subtotal"?(d(),g(w,{key:2},[p(r(t.formatAmountCurrency(k.subtotal)),1)],64)):F("",!0),o.dataIndex==="action"?(d(),g(w,{key:3},[a(S,{type:"primary",onClick:N=>t.editItem(k),style:{"margin-left":"4px","margin-top":"4px"}},{icon:e(()=>[a(z)]),_:2},1032,["onClick"]),a(S,{type:"primary",onClick:N=>t.showDeleteConfirm(k),style:{"margin-left":"4px","margin-top":"4px"}},{icon:e(()=>[a(j)]),_:2},1032,["onClick"])],64)):F("",!0)]),_:1},8,["row-key","dataSource","columns"])]),_:1})]),_:1})])):F("",!0),t.showMobileCart?(d(),g("div",ba,[a(U,null,{default:e(()=>[f("div",Ca,[a(u,{gutter:[16]},{default:e(()=>[a(i,{xs:24,sm:24,md:8,lg:8},{default:e(()=>[a(C,{label:n.$t("stock.order_tax")},{default:e(()=>[a(m,{value:t.formData.tax_id,"onUpdate:value":l[13]||(l[13]=o=>t.formData.tax_id=o),placeholder:n.$t("common.select_default_text",[n.$t("stock.order_tax")]),allowClear:!0,style:{width:"100%"},onChange:t.taxChanged},{default:e(()=>[(d(!0),g(w,null,L(t.taxes,o=>(d(),_(c,{key:o.xid,value:o.xid,tax:o},{default:e(()=>[p(r(o.name)+" ("+r(o.rate)+"%) ",1)]),_:2},1032,["value","tax"]))),128))]),_:1},8,["value","placeholder","onChange"])]),_:1},8,["label"])]),_:1}),a(i,{xs:24,sm:24,md:8,lg:8},{default:e(()=>[a(C,{label:n.$t("stock.discount")},{default:e(()=>[a(K,{compact:""},{default:e(()=>[a(m,{value:t.formData.discount_type,"onUpdate:value":l[14]||(l[14]=o=>t.formData.discount_type=o),onChange:t.recalculateFinalTotal,style:{width:"30%"}},{default:e(()=>[a(c,{value:"percentage"},{default:e(()=>[p(" % ")]),_:1}),a(c,{value:"fixed"},{default:e(()=>[p(r(t.appSetting.currency.symbol),1)]),_:1})]),_:1},8,["value","onChange"]),a(P,{value:t.formData.discount_value,"onUpdate:value":l[15]||(l[15]=o=>t.formData.discount_value=o),placeholder:n.$t("common.placeholder_default_text",[n.$t("stock.discount")]),onChange:t.recalculateFinalTotal,min:"0",style:{width:"70%"}},null,8,["value","placeholder","onChange"])]),_:1})]),_:1},8,["label"])]),_:1}),a(i,{xs:24,sm:24,md:8,lg:8},{default:e(()=>[a(C,{label:n.$t("stock.shipping")},{default:e(()=>[a(P,{value:t.formData.shipping,"onUpdate:value":l[16]||(l[16]=o=>t.formData.shipping=o),placeholder:n.$t("common.placeholder_default_text",[n.$t("stock.shipping")]),onChange:t.recalculateFinalTotal,min:"0",style:{width:"100%"}},{addonBefore:e(()=>[p(r(t.appSetting.currency.symbol),1)]),_:1},8,["value","placeholder","onChange"])]),_:1},8,["label"])]),_:1})]),_:1})])]),_:1})])):F("",!0)])]),_:1})]),_:1}))]),_:1}),t.innerWidth<=768?(d(),g("div",ka,[a(u,{gutter:16},{default:e(()=>[a(i,{span:10},{default:e(()=>[a(u,{gutter:16,style:{padding:"10px"}},{default:e(()=>[a(i,{span:24},{default:e(()=>[f("span",wa,r(n.$t("common.total"))+" : "+r(t.formatAmountCurrency(t.formData.subtotal)),1)]),_:1})]),_:1})]),_:1}),a(i,{span:14},{default:e(()=>[a(x,{style:{marginTop:"5px"}},{default:e(()=>[t.showMobileCart?(d(),_(S,{key:0,onClick:l[17]||(l[17]=()=>t.showMobileCart=!1),type:"primary"},{icon:e(()=>[a(tt)]),_:1})):(d(),_(S,{key:1,onClick:l[18]||(l[18]=()=>t.showMobileCart=!0),type:"primary"},{icon:e(()=>[a(G)]),_:1})),a(S,{type:"primary",onClick:t.payNow,disabled:t.formData.subtotal<=0||t.formData.user_id==null||t.formData.user_id==""||!t.formData.user_id},{default:e(()=>[p(r(n.$t("stock.pay_now")),1)]),_:1},8,["onClick","disabled"]),a(S,{onClick:t.resetPos},{default:e(()=>[p(r(n.$t("stock.reset")),1)]),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1})])):F("",!0),a(st,{open:t.addEditVisible,closable:!1,centered:!0,title:t.addEditPageTitle,onOk:t.onAddEditSubmit},{footer:e(()=>[a(S,{key:"submit",type:"primary",loading:t.addEditFormSubmitting,onClick:t.onAddEditSubmit},{icon:e(()=>[a(at)]),default:e(()=>[p(" "+r(n.$t("common.update")),1)]),_:1},8,["loading","onClick"]),a(S,{key:"back",onClick:t.onAddEditClose},{default:e(()=>[p(r(n.$t("common.cancel")),1)]),_:1},8,["onClick"])]),default:e(()=>[a(et,{layout:"vertical"},{default:e(()=>[a(u,{gutter:16},{default:e(()=>[a(i,{xs:24,sm:24,md:24,lg:24},{default:e(()=>[a(C,{label:n.$t("product.unit_price"),name:"unit_price",help:t.addEditRules.unit_price?t.addEditRules.unit_price.message:null,validateStatus:t.addEditRules.unit_price?"error":null},{default:e(()=>[a(P,{value:t.addEditFormData.unit_price,"onUpdate:value":l[19]||(l[19]=o=>t.addEditFormData.unit_price=o),placeholder:n.$t("common.placeholder_default_text",[n.$t("product.unit_price")]),min:"0",style:{width:"100%"}},{addonBefore:e(()=>[p(r(t.appSetting.currency.symbol),1)]),_:1},8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),a(u,{gutter:16},{default:e(()=>[a(i,{xs:24,sm:24,md:24,lg:24},{default:e(()=>[a(C,{label:n.$t("product.discount"),name:"discount_rate",help:t.addEditRules.discount_rate?t.addEditRules.discount_rate.message:null,validateStatus:t.addEditRules.discount_rate?"error":null},{default:e(()=>[a(P,{value:t.addEditFormData.discount_rate,"onUpdate:value":l[20]||(l[20]=o=>t.addEditFormData.discount_rate=o),placeholder:n.$t("common.placeholder_default_text",[n.$t("product.discount")]),min:"0",style:{width:"100%"}},{addonAfter:e(()=>[p("%")]),_:1},8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),a(u,{gutter:16},{default:e(()=>[a(i,{xs:24,sm:24,md:24,lg:24},{default:e(()=>[a(C,{label:n.$t("product.tax"),name:"tax_id",help:t.addEditRules.tax_id?t.addEditRules.tax_id.message:null,validateStatus:t.addEditRules.tax_id?"error":null},{default:e(()=>[a(m,{value:t.addEditFormData.tax_id,"onUpdate:value":l[21]||(l[21]=o=>t.addEditFormData.tax_id=o),placeholder:n.$t("common.select_default_text",[n.$t("product.tax")]),allowClear:!0},{default:e(()=>[(d(!0),g(w,null,L(t.taxes,o=>(d(),_(c,{key:o.xid,value:o.xid},{default:e(()=>[p(r(o.name)+" ("+r(o.rate)+"%) ",1)]),_:2},1032,["value"]))),128))]),_:1},8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),a(u,{gutter:16},{default:e(()=>[a(i,{xs:24,sm:24,md:24,lg:24},{default:e(()=>[a(C,{label:n.$t("product.tax_type"),name:"tax_type",help:t.addEditRules.tax_type?t.addEditRules.tax_type.message:null,validateStatus:t.addEditRules.tax_type?"error":null},{default:e(()=>[a(m,{value:t.addEditFormData.tax_type,"onUpdate:value":l[22]||(l[22]=o=>t.addEditFormData.tax_type=o),placeholder:n.$t("common.select_default_text",[n.$t("product.tax_type")]),allowClear:!0},{default:e(()=>[(d(!0),g(w,null,L(t.taxTypes,o=>(d(),_(c,{key:o.key,value:o.key},{default:e(()=>[p(r(o.value),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1})]),_:1})]),_:1},8,["open","title","onOk"]),a(nt,{visible:t.payNowVisible,onClosed:t.payNowClosed,onSuccess:t.payNowSuccess,data:t.formData,selectedProducts:t.selectedProducts},null,8,["visible","onClosed","onSuccess","data","selectedProducts"]),a(ot,{visible:t.printInvoiceModalVisible,order:t.printInvoiceOrder,onClosed:l[23]||(l[23]=o=>t.printInvoiceModalVisible=!1)},null,8,["visible","order"])],64)}const Ha=Y(He,[["render",Sa]]);export{Ha as default};
