1"use strict";(self.webpackChunklamaco=self.webpackChunklamaco||[]).push([[627],{15697:(e,t,n)=>{n.d(t,{Fw:()=>p,aZ:()=>m,fw:()=>x,tD:()=>u});var l=n(89379),i=n(80045),d=n(203),o=n(59781),c=n(12836),s=n(96444);const a=["data"],r=["id"];function u(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=(0,d.I)({queryKey:["product-included-item-templates"],queryFn:async()=>(0,s.default)("/admin/included-item-templates",{method:"GET"}),enabled:e}),{data:n}=t,o=(0,i.A)(t,a);return(0,l.A)((0,l.A)({},n),o)}const m=()=>{const e=(0,o.jE)();return(0,c.n)({mutationKey:["create-product-included-item-template"],mutationFn:async e=>(0,s.default)("/admin/included-item-templates",{method:"POST",data:e}),onSuccess:()=>{e.invalidateQueries(["product-included-item-templates"])}})},p=()=>{const e=(0,o.jE)();return(0,c.n)({mutationKey:["post-product-included-item-template"],mutationFn:async e=>{let{id:t}=e,n=(0,i.A)(e,r);return(0,s.default)("/admin/included-item-templates/".concat(t),{method:"POST",data:n})},onSuccess:()=>{e.invalidateQueries(["product-included-item-templates"])}})},x=()=>{const e=(0,o.jE)();return(0,c.n)({mutationKey:["delete-product-included-item-template"],mutationFn:async e=>(0,s.default)("/admin/included-item-templates/".concat(e),{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries(["product-included-item-templates"])}})}},55319:(e,t,n)=>{n.d(t,{A:()=>o});var l,i=n(57528),d=n(63935);const o=n(2826).Ay.div(l||(l=(0,i.A)(["\n border-radius: ","px;\n border: 1px solid ",";\n"])),e=>{let{radius:t}=e;return t||10},d.cQ)},61351:(e,t,n)=>{n.d(t,{A:()=>j});var l=n(89379),i=n(74117),d=n(43801),o=n(16569),c=n(88991),s=n(26399),a=n(98734),r=n(89352),u=n(65043),m=n(4686),p=n(26449),x=n(94171),v=n(15697),h=n(83503),g=n(95406),y=n(70579);const j=e=>{var t;let{open:n,onCancel:j,productForm:A,productIncludedItem:f,productIncludedItemTemplate:_}=e;const{isSignup:I}=(0,g.IT)(),{t:C}=(0,i.Bd)("store/products/create/general"),[w]=d.A.useForm(),T=(0,s.al)(),[k,b]=(0,u.useState)(!1),[F,N]=(0,u.useState)(!1),{mutateAsync:S,isLoading:P}=(0,v.fw)(),{mutateAsync:D,isLoading:L}=(0,v.Fw)(),{includedItemTemplates:E}=(0,v.tD)(!I);(0,u.useEffect)(()=>{f&&w.setFieldsValue({title:f.title,description:f.description,icon:f.icon,save_template:f.createTemplate})},[f]),(0,u.useEffect)(()=>{_&&w.setFieldsValue({title:_.title,description:_.description,icon:_.icon})},[_]);const q=(0,u.useMemo)(()=>{var e,t,n,l;return f?null!==f&&void 0!==f&&f.template_id?null===E||void 0===E||null===(e=E.find(e=>e.id===(null===f||void 0===f?void 0:f.template_id)))||void 0===e||null===(t=e.product_included_items)||void 0===t||null===(n=t.filter(e=>!(null!==A&&void 0!==A&&A.productIncludedItems.find(t=>t.id===e.id))))||void 0===n?void 0:n.length:0:(null===_||void 0===_||null===(l=_.product_included_items)||void 0===l?void 0:l.length)||0},[E,f,null===A||void 0===A?void 0:A.productIncludedItems,_]);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.A,{open:k,onCancel:()=>b(!1),onConfirm:async()=>{try{if(f){var e,t;if(f.template_id)await S(f.template_id),null===A||void 0===A||null===(e=A.setProductIncludedItems)||void 0===e||e.call(A,null===(t=A.productIncludedItems)||void 0===t?void 0:t.map(e=>e.template_id===f.template_id?(0,l.A)((0,l.A)({},e),{},{template_id:null}):e));b(!1)}else _&&(await S(_.id||""),b(!1))}catch(n){console.log(n),o.Ay.error(C("product_included_items.template.delete.error"))}},cancelText:C("cancel"),loading:P,title:C("delete_template"),bodyText:C("delete_template_body"),confirmText:C("delete"),danger:!0}),(0,y.jsx)(x.A,{open:F,onCancel:()=>N(!1),onConfirm:()=>{var e,t;f&&(null===A||void 0===A||null===(e=A.setProductIncludedItems)||void 0===e||e.call(A,null===(t=A.productIncludedItems)||void 0===t?void 0:t.map(e=>e.id===f.id?(0,l.A)((0,l.A)({},e),{},{template_id:null}):e)),N(!1))},cancelText:C("cancel"),title:C("unlink_template"),bodyText:C("unlink_template_body"),confirmText:C("unlink"),danger:!0}),(0,y.jsx)(c.oZ,{open:n,onCancel:j,title:C("edit_additional_detail",{title:'"'.concat(null===(t=f||_)||void 0===t?void 0:t.title,'"')}),removePadding:!0,footer:null!==f&&void 0!==f&&f.template_id||null!==_&&void 0!==_&&_.id?(0,y.jsxs)(a.A,{className:"w-100",alignItems:"center",gap:"sm",flexDirection:T?"column-reverse":"row",justifyContent:"between",children:[(0,y.jsx)(m.Ay,{type:"destructive",onClick:async()=>{b(!0)},icon:p.Delete02Icon,loading:P,children:C("product_details.template.delete")}),(0,y.jsxs)(a.A,{alignItems:"center",gap:"sm",className:T?"w-100":"",flexDirection:T?"column-reverse":"row",children:[!T&&(0,y.jsx)(m.Ay,{type:"secondary",onClick:j,children:C("cancel")}),(0,y.jsx)(m.Ay,{onClick:()=>w.submit(),loading:L,children:q?C("apply_instances",{count:q}):C("save")})]})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(m.Ay,{type:"secondary",onClick:j,children:C("cancel")}),(0,y.jsx)(m.Ay,{onClick:()=>w.submit(),children:C("save")})]}),children:(0,y.jsxs)(a.A,{flexDirection:"column",children:[(null===f||void 0===f?void 0:f.template_id)&&!!q&&(0,y.jsx)("div",{className:"pt-3 pr-3 pl-3",children:(0,y.jsx)(r.A,{type:"warning",content:C("template_warning.description",{count:q}),action:(0,y.jsx)(m.Ay,{icon:p.Unlink04Icon,type:"secondary",onClick:()=>N(!0),children:C("unlink")})})}),(0,y.jsx)(h.A,{form:w,handleSave:async e=>{let{title:t,description:n,icon:i,save_template:d}=e;var c,s;if(f)if(f.template_id)try{var a,r;await D({id:f.template_id,title:t,description:n,icon:i}),null===A||void 0===A||null===(a=A.setProductIncludedItems)||void 0===a||a.call(A,null===(r=A.productIncludedItems)||void 0===r?void 0:r.map(e=>e.template_id===f.template_id?(0,l.A)((0,l.A)({},e),{},{title:t,description:n,icon:i}):e)),j()}catch(u){console.log(u),o.Ay.error(C("product_included_items.template.update.error"))}else null===A||void 0===A||null===(c=A.setProductIncludedItems)||void 0===c||c.call(A,null===(s=A.productIncludedItems)||void 0===s?void 0:s.map(e=>e.id===f.id?(0,l.A)((0,l.A)({},e),{},{title:t,icon:i,description:n,createTemplate:d}):e)),j();else if(_)try{await D({id:_.id,title:t,description:n,icon:i}),j()}catch(u){console.log(u),o.Ay.error(C("product_included_items.template.update.error"))}},hideTemplateField:!!(null!==f&&void 0!==f&&f.template_id||null!==_&&void 0!==_&&_.id)})]})})]})}},83503:(e,t,n)=>{n.d(t,{A:()=>p});var l=n(43801),i=n(98734),d=n(62704),o=n(87790),c=n(76910),s=n(74117),a=n(26399),r=n(6682),u=n(16561),m=n(70579);const p=e=>{let{form:t,handleSave:n,hideTemplateField:p}=e;const{t:x}=(0,s.Bd)("store/products/create/general"),v=(0,a.al)(),h=l.A.useWatch("icon",t),g=l.A.useWatch("save_template",t);return(0,m.jsxs)(l.A,{form:t,layout:"vertical",requiredMark:!1,className:"w-100 p-3 d-flex flex-column",style:{gap:v?24:16},onFinish:n,children:[(0,m.jsx)(d.A,{name:"icon",children:(0,m.jsx)(u.A,{icon:h,setIcon:e=>t.setFieldValue("icon",e)})}
1),(0,m.jsx)(d.A,{name:"title",label:x("details.form.title"),required:!0,rules:[{required:!0,message:x("details.form.title.validation.required")}],children:(0,m.jsx)(o.A,{placeholder:x("details.form.title.placeholder"),maxLength:40})}),(0,m.jsx)(d.A,{name:"description",label:x("details.form.description"),required:!0,rules:[{required:!0,message:x("details.form.description.validation.required")},{validator:(e,t)=>t&&"<p><br></p>"===t?Promise.reject(x("details.form.description.validation.required")):t&&t.length>2e3?Promise.reject(x("details.form.description.validation.length")):Promise.resolve()}],children:(0,m.jsx)(r.A,{placeholder:x("details.form.description.placeholder")})}),!p&&(0,m.jsx)(d.A,{name:"save_template",valuePropName:"checked",children:(0,m.jsxs)(i.A,{gap:"sm",alignItems:"center",children:[(0,m.jsx)(c.A,{checked:g,onChange:e=>t.setFieldValue("save_template",e)}),x("details.form.save_template")]})})]})}},89352:(e,t,n)=>{n.d(t,{A:()=>m});var l,i=n(57528),d=n(67298),o=n(98734),c=n(63935),s=n(2826),a=n(26449),r=n(70579);const u=s.Ay.div(l||(l=(0,i.A)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 8px;\n background-color: ",";\n border-radius: 8px;\n color: ",";\n padding: ",";\n"])),e=>{let{type:t}=e;return"info"===t?c.H6:"warning"===t?c.Vm:"error"===t?c.Ir:c.mP},e=>{let{type:t}=e;return"info"===t?c.hL:"warning"===t?c.hK:"error"===t?c.a4:c.LE},e=>{let{hasTitle:t}=e;return t?"16px":"12px"}),m=e=>{let{type:t="default",content:n,title:l,hideInfoIcon:i,icon:c,action:s,textStyle:m}=e;return(0,r.jsxs)(u,{type:t,hasTitle:!!l,children:[(0,r.jsxs)(o.A,{flexDirection:"column",gap:"xs",children:[l&&(0,r.jsx)("div",{className:"text-sm-medium",children:l}),(0,r.jsxs)(o.A,{alignItems:"start",gap:"sm",className:"text-xs",children:[!l&&!i&&(0,r.jsx)(o.A,{style:{minWidth:16},alignItems:"center",children:(0,r.jsx)(d.n,{icon:c||a.InformationCircleIcon,size:16})}),(0,r.jsx)("div",{className:"text-xs",style:m,children:n})]})]}),s&&s]})}},90627:(e,t,n)=>{n.r(t),n.d(t,{default:()=>T});var l=n(98734),i=n(4686),d=n(96810),o=n(15697),c=n(65043),s=n(74117),a=n(26449),r=n(67263),u=n(72053),m=n(55319),p=n(67298),x=n(63935),v=n(40006),h=n(94171),g=n(16569),y=n(61351),j=n(70579);const A=e=>{let{search:t,handleNew:n,includedItemTemplates:d,isLoading:r}=e;const{t:A}=(0,s.Bd)("store/settings/templates"),[f,_]=(0,c.useState)(null),[I,C]=(0,c.useState)(null),{mutateAsync:w,isLoading:T}=(0,o.fw)(),k=(0,c.useMemo)(()=>null===d||void 0===d?void 0:d.filter(e=>e.title.toLowerCase().includes(t.toLowerCase())),[d,t]);return(0,j.jsxs)("div",{children:[(0,j.jsx)(h.A,{open:!!I,onCancel:()=>C(null),onConfirm:async()=>{try{await w((null===I||void 0===I?void 0:I.id)||""),C(null)}catch(e){console.log(e),g.Ay.error(A("product_details.template.delete.error"))}},cancelText:A("cancel"),title:A("delete_template"),bodyText:A("delete_template_body"),confirmText:A("delete"),loading:T,danger:!0}),f&&(0,j.jsx)(y.A,{open:!!f,onCancel:()=>_(null),productIncludedItemTemplate:f}),null!==d&&void 0!==d&&d.length?(0,j.jsxs)(l.A,{flexDirection:"column",gap:"xs",children:[null===k||void 0===k?void 0:k.map(e=>{var t,n,l,i;return(0,j.jsx)(m.A,{children:(0,j.jsx)(v.A,{actions:[{icon:a.Edit02Icon,onClick:()=>(e=>{_(e)})(e)},{icon:a.Delete02Icon,onClick:()=>(e=>{C(e)})(e)}],icon:e.icon,subtitle:"".concat(null!==e&&void 0!==e&&null!==(t=e.product_included_items)&&void 0!==t&&t.length&&(null===e||void 0===e||null===(n=e.product_included_items)||void 0===n?void 0:n.length)>1?A("linked.products",{count:null===e||void 0===e||null===(l=e.product_included_items)||void 0===l?void 0:l.length}):A("linked.product",{count:null===e||void 0===e||null===(i=e.product_included_items)||void 0===i?void 0:i.length})),id:e.id||"",title:e.title||""})},e.id)}),0===(null===k||void 0===k?void 0:k.length)&&(0,j.jsx)(m.A,{className:"w-100 p-3 text-center",style:{color:x.f},children:A("no_templates_found")})]}):(0,j.jsx)(m.A,{children:(0,j.jsx)(l.A,{className:"w-100",gap:"md",style:{padding:"32px 0px"},alignItems:"center",justifyContent:"center",flexDirection:"column",children:r?(0,j.jsx)(u.A,{}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(l.A,{flexDirection:"column",gap:"xs",alignItems:"center",justifyContent:"center",className:"text-center w-100",style:{color:x.PV},children:[(0,j.jsx)(p.n,{icon:a.FolderLibraryIcon,size:16}),(0,j.jsxs)(l.A,{flexDirection:"column",gap:"xxs",alignItems:"center",justifyContent:"center",className:"text-center w-100",children:[(0,j.jsx)("div",{className:"text-sm-medium",children:A("items.empty")}),(0,j.jsx)("div",{className:"text-sm",children:A("items.empty.description")})]})]}),(0,j.jsx)(i.Ay,{icon:a.PlusSignIcon,onClick:n,children:A("new")})]})})})]})};var f=n(43801),_=n(88991),I=n(26399),C=n(83503);const w=e=>{let{open:t,onCancel:n}=e;const{t:l}=(0,s.Bd)("store/products/create/general"),[d]=f.A.useForm(),{mutateAsync:a,isLoading:r}=(0,o.aZ)();(0,c.useEffect)(()=>{t||d.resetFields()},[t]);const u=(0,I.al)();return(0,j.jsx)(_.oZ,{open:t,onCancel:n,title:l("extras.create_new"),removePadding:!0,footer:(0,j.jsxs)(j.Fragment,{children:[!u&&(0,j.jsx)(i.Ay,{type:"secondary",onClick:n,children:l("cancel")}),(0,j.jsx)(i.Ay,{onClick:()=>d.submit(),loading:r,size:u?"large":void 0,children:l("add")})]}),children:(0,j.jsx)(C.A,{form:d,handleSave:async e=>
1{try{await a({title:e.title,description:e.description,icon:e.icon}),n()}catch(t){console.log(t),g.Ay.error(l("error.create_product_detail_template"))}},hideTemplateField:!0})})},T=()=>{const{t:e}=(0,s.Bd)("store/settings/header"),t=(0,I.al)(),[n,u]=(0,c.useState)(""),[m,p]=(0,c.useState)(!1),{includedItemTemplates:x,isLoading:v}=(0,o.tD)(),h=()=>{p(!0)};return(0,j.jsxs)(d.oC,{children:[m&&(0,j.jsx)(w,{open:m,onCancel:()=>p(!1)}),(0,j.jsxs)(l.A,{alignItems:"center",justifyContent:"between",className:"w-100",children:[(0,j.jsx)("div",{className:"text-2xl",children:e("included_items")}),!(null===x||void 0===x||!x.length)&&(0,j.jsx)(i.Ay,{icon:a.PlusSignIcon,onClick:h,children:e("new")})]}),!(null===x||void 0===x||!x.length)&&(0,j.jsx)(l.A,{className:"w-100",alignItems:"center",gap:"xs",justifyContent:"end",children:(0,j.jsx)(r.A,{className:t?"w-100":"",style:{maxWidth:t?"":220},placeholder:e("search"),value:n,onChange:e=>u(e.target.value)})}),(0,j.jsx)(A,{search:n,handleNew:h,includedItemTemplates:x,isLoading:v})]})}},94171:(e,t,n)=>{n.d(t,{A:()=>r});var l=n(65043),i=n(98734),d=n(4686),o=n(87790),c=n(88991),s=n(63935),a=n(70579);const r=e=>{let{open:t,onCancel:n,onConfirm:r,confirmText:u,cancelText:m,title:p,bodyText:x,danger:v,loading:h,confirmPhrase:g}=e;const[y,j]=(0,l.useState)("");(0,l.useEffect)(()=>{t||j("")},[t]);const A=!!r&&!!u&&(!g||y===g);return(0,a.jsx)(c.oZ,{open:t,onCancel:n,title:p,removeDivider:!0,size:"small",destroyOnClose:!0,fullScreenOnMobile:!0,zIndex:3e3,footer:(0,a.jsxs)(i.A,{justifyContent:"end",alignItems:"center",gap:"sm",className:"w-100",children:[(0,a.jsx)(d.Ay,{type:"secondary",className:"text-sm",onClick:n,children:m}),!!r&&!!u&&(0,a.jsx)(d.Ay,{type:v?"destructive":"default",onClick:()=>{A&&!h&&(null===r||void 0===r||r())},loading:h,disabled:!A,children:u})]}),children:(0,a.jsxs)(i.A,{flexDirection:"column",gap:"md",children:[(0,a.jsx)("div",{className:"text-sm",style:{color:s.f,whiteSpace:"pre-line"},children:x}),g&&(0,a.jsx)(o.A,{value:y,onChange:e=>j(e.target.value),placeholder:g})]})})}}}]);
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.