import{c as d,b as i,t as m,a,g as o,i as u,w as b,d as g,l as $,o as r,A as k}from"./app-CYVHboi-.js";import{_ as j}from"./SecondaryButton-CHQvCfls.js";import{_ as n}from"./AutoComplete-Ao6jtcfm.js";import{_ as U}from"./LoadingButton-CH88QwYm.js";import{_ as V}from"./DateInput-DOfTfK52.js";import"./browser-BwNzv7vE.js";import"./InputError-u5FIXCwc.js";import"./InputLabel-dHPaqRUC.js";import"./Keyboard-VWzCpVN-.js";import"./composable-DK3kcOvi.js";const w={class:"border-b border-gray-200 px-6 py-4 dark:border-gray-700"},C={class:"sm:flex sm:items-baseline sm:justify-between"},K={class:"sm:w-0 sm:flex-1"},S={class:"text-focus text-base font-semibold"},B={class:"text-mute mt-1 truncate text-sm"},M={key:0,class:"grid grid-cols-6 gap-6 p-6"},N={class:"col-span-6 sm:col-span-3"},D={key:0,class:"col-span-6 sm:col-span-3"},E={key:1,class:"col-span-6 sm:col-span-3"},O={key:2,class:"col-span-6 sm:col-span-3"},P={key:3,class:"col-span-6 sm:col-span-3"},z={key:4,class:"col-span-6 sm:col-span-3"},A={key:5,class:"col-span-6 sm:col-span-3"},F={key:6,class:"col-span-6 sm:col-span-3"},R={class:"col-span-6 sm:col-span-3"},T={class:"col-span-6 sm:col-span-3"},q={class:"flex flex-row justify-end rounded-b-lg bg-gray-100 px-6 py-4 text-end dark:bg-gray-950"},x={__name:"Form",props:["fields","filters","categories","brands","stores","users","paymentMethods"],emits:["close","done"],setup(e,{emit:y}){const c=y,h=e,p=()=>{c("close")};function v(){const l=Object.entries(h.filters).reduce((s,[t,f])=>(f&&(s[t]=f),s),{});k.visit(route(route().current(),Object.keys(l).length?{filters:l}:""),{preserveScroll:!0}),c("close")}return(l,s)=>(r(),d("form",{onSubmit:$(v,["prevent"]),method:"get"},[i("div",w,[i("div",C,[i("div",K,[i("h1",S,m(l.$t("Customize Report")),1),i("p",B,m(l.$t("Please select the desired filters below.")),1)])])]),e.fields.includes("payment_methods")?(r(),d("div",M,[i("div",N,[a(o(n),{json:!0,clearable:!0,searchable:!1,label:l.$t("Method"),modelValue:e.filters.method,"onUpdate:modelValue":s[0]||(s[0]=t=>e.filters.method=t),suggestions:e.paymentMethods,error:l.$page.props.errors.method},null,8,["label","modelValue","suggestions","error"])]),e.fields.includes("brands")?(r(),d("div",D,[a(o(n),{json:!0,id:"brands",multiple:!0,searchable:!0,label:l.$t("Brands"),suggestions:e.brands,modelValue:e.filters.brands,"onUpdate:modelValue":s[1]||(s[1]=t=>e.filters.brands=t)},null,8,["label","suggestions","modelValue"])])):u("",!0),e.fields.includes("categories")?(r(),d("div",E,[a(o(n),{json:!0,id:"categories",multiple:!0,searchable:!0,label:l.$t("Categories"),suggestions:e.categories,modelValue:e.filters.categories,"onUpdate:modelValue":s[2]||(s[2]=t=>e.filters.categories=t)},null,8,["label","suggestions","modelValue"])])):u("",!0),e.fields.includes("products")?(r(),d("div",O,[a(o(n),{json:!0,valueKey:"id",id:"products",labelKey:"name",multiple:!0,searchable:!0,label:l.$t("Products"),modelValue:e.filters.products,"onUpdate:modelValue":s[3]||(s[3]=t=>e.filters.products=t),suggestions:l.route("search.products")},null,8,["label","modelValue","suggestions"])])):u("",!0),e.fields.includes("customer")?(r(),d("div",P,[a(o(n),{json:!0,valueKey:"id",id:"customer_id",labelKey:"company",clearable:!0,searchable:!0,label:l.$t("Customer"),modelValue:e.filters.customer_id,"onUpdate:modelValue":s[4]||(s[4]=t=>e.filters.customer_id=t),suggestions:l.route("search.customers")},null,8,["label","modelValue","suggestions"])])):u("",!0),e.fields.includes("supplier")?(r(),d("div",z,[a(o(n),{json:!0,valueKey:"id",id:"supplier_id",labelKey:"company",clearable:!0,searchable:!0,label:l.$t("Supplier"),modelValue:e.filters.supplier_id,"onUpdate:modelValue":s[5]||(s[5]=t=>e.filters.supplier_id=t),suggestions:l.route("search.suppliers")},null,8,["label","modelValue","suggestions"])])):u("",!0),e.fields.includes("store")?(r(),d("div",A,[a(o(n),{json:!0,id:"store_id",clearable:!0,searchable:!1,label:l.$t("Store"),suggestions:e.stores,modelValue:e.filters.store_id,"onUpdate:modelValue":s[6]||(s[6]=t=>e.filters.store_id=t)},null,8,["label","suggestions","modelValue"])])):u("",!0),e.fields.includes("user")?(r(),d("div",F,[a(o(n),{json:!0,id:"user_id",clearable:!0,searchable:!1,label:l.$t("User"),suggestions:e.users,modelValue:e.filters.user_id,"onUpdate:modelValue":s[7]||(s[7]=t=>e.filters.user_id=t)},null,8,["label","suggestions","modelValue"])])):u("",!0),i("div",R,[a(o(V),{id:"start_date",label:l.$t("Start Date"),modelValue:e.filters.start_date,"onUpdate:modelValue":s[8]||(s[8]=t=>e.filters.start_date=t)},null,8,["label","modelValue"])]),i("div",T,[a(o(V),{id:"end_date",label:l.$t("End Date"),modelValue:e.filters.end_date,"onUpdate:modelValue":s[9]||(s[9]=t=>e.filters.end_date=t)},null,8,["label","modelValue"])])])):u("",!0),i("div",q,[a(o(j),{onClick:p},{default:b(()=>[g(m(l.$t("Cancel")),1)]),_:1}),a(o(U),{class:"ms-3"},{default:b(()=>[g(m(l.$t("Update")),1)]),_:1})])],32))}};export{x as default};
