PageSourceSearch

https://lakki-app.com/static/js/async/3363.0ba5f7e1a3.js

js lakki-app.com collected 2026-10-02 00:53:41 UTC 9,184 bytes, 1 lines download raw bytes

1"use strict";(globalThis.rspackChunksimpo||=[]).push([[3363],{32062(e,t,r){r.r(t),r.d(t,{default:()=>H});var n=r(74848),i=r(45560),o=r(96540),s=r(96804),a=r(61571),l=r(95381),d=r(76613);let c=(i.Ay.h2.withConfig({displayName:"styled__Title",componentId:"sc-4e6e7a35-0"}))(["color:var(--font-color-accent);text-align:center;font-weight:500;margin-top:0;font-size:18px;"]),p=(i.Ay.div.withConfig({displayName:"styled__Dropzone",componentId:"sc-4e6e7a35-1"}))(["border-radius:var(--root-br);background-color:var(--bg-elevate);padding:24px;min-height:150px;margin-top:15px;"]),m=(i.Ay.div.withConfig({displayName:"styled__DropzoneMessage",componentId:"sc-4e6e7a35-2"}))(["display:flex;flex-direction:column;align-items:center;p{margin-top:0;margin-bottom:22px;}"]),u=(0,i.Ay)(l.UC).withConfig({displayName:"styled__Content",componentId:"sc-4e6e7a35-3"})(["color:var(--font-color-main);"]),h=(i.Ay.div.withConfig({displayName:"styled__FooterButtonsWrap",componentId:"sc-4e6e7a35-4"}))(["text-align:center;margin-top:15px;"]),_=(i.Ay.div.withConfig({displayName:"styled__FileRequirements",componentId:"sc-4e6e7a35-5"}))(["a{color:var(--color-cta);}"]),f=(0,i.Ay)(d.A).withConfig({displayName:"styled__Accordion",componentId:"sc-4e6e7a35-6"})(["button{box-shadow:none;}"]);var g=r(30676),y=r(72043),x=r(57077),j=r(17709),v=r(44809),w=r.n(v),b=r(23658),C=r(53530),I=r(46984),S=r(44140),A=r(42877),k=r.n(A),L=r(24239),N=r(69287),B=r(32307),E=r(53027),F=r(2274),q=r(43959),Y=r(53092),O=r(41899),z=r(88472),D=r(71328),M=r(95093),P=r.n(M),$=r(86424);let Q="common:clients_import_editor.",U=({color:e="currentColor",width:t="69"})=>(0,n.jsx)("svg",{width:t,viewBox:"0 0 69 65",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)("path",{d:"M34.5 0L42.4702 24.5299H68.2625L47.3961 39.6902L55.3664 64.2201L34.5 49.0598L13.6336 64.2201L21.6039 39.6902L0.737495 24.5299H26.5298L34.5 0Z",fill:e})});var H=e=>{let t,{eventBus:r}=(0,$.i)(),i=(0,O.B)(),d=(0,z.Y)(),u=(0,E.jE)(),[v,S]=(0,o.useState)(0),[A,M]=(0,o.useState)(0),{t:H,ready:J}=(0,a.Bd)(["common","errors"],{useSuspense:!1}),[ee,et]=(0,o.useState)(null),[er,en]=(0,o.useState)(null),ei=(0,g.A)(),eo=(0,o.useCallback)(e=>{(0,j.A)(e)||et(e[0])},[]),{getRootProps:es,getInputProps:ea}=(0,s.VB)({onDrop:eo,maxSize:1048576,accept:{"text/csv":[".csv"]}}),el=(0,x.U)(async()=>{let t=await new Promise((e,t)=>{w().parse(ee,{header:!0,error(e){t(e)},complete(t){e(t.data)}})});if(t.length>200)throw H(Q+"too_many_entries_err");let r={created:[],failed:[],skipped:[]},n=0,o=[];for(let e of t){if(n++,!e)continue;if(!ei())return;if(Object.values(e).every(e=>!e))continue;let t={first_name:e["First name"]?e["First name"].trim():void 0,last_name:e["Last name"]?e["Last name"].trim():void 0,birthdate:e.Birthday||void 0,phone:e.Phone||void 0,input:e,row:n};try{await B.UL.validate(t,{abortEarly:!1})}catch(t){if(console.error(t),t instanceof b.yI){let i=t.errors;r.failed.push({row:n,errors:i.map(e=>H([`errors:${e}`,"errors:unspecified"])),input:e})}else r.failed.push({row:n,errors:[H("errors:unspecified")],input
1:e});continue}o.push(t)}if(M((o=(0,C.A)(o,e=>e.phone)).length),(0,j.A)(o))if(!(0,j.A)(r.failed))return void en(r);else throw H(Q+"no_entries_err");let s=[],{saloon:a,master:l}=e;l?s=await u.xFetchQuery(F.u.buildListQueryKey({domain:"master",masterId:l}),()=>L.N.getClients(l).then(e=>e.data)):a&&(s=await u.xFetchQuery(F.u.buildListQueryKey({domain:"saloon",saloonId:a}),()=>q.t.getClients(a).then(e=>e.data))),s=(0,N.A)(s);let c=await (0,D.dL)();for(let e of o){if(!ei())return;let t=s.find(t=>t.phone===c(e.phone));if(t)r.skipped.push({client:t,row:e.row,input:e.input});else try{let t=await Y._.createClient({domain:a?"saloon":"master",master:l||void 0,saloon:a||void 0,first_name:e.first_name,last_name:e.last_name,birthdate:e.birthdate?P()(e.birthdate,B.SB).seconds(0).milliseconds(0).toISOString():void 0,sex:!1,phone:e.phone,timezone:i,locale:d});s.push(t),r.created.push({client:t,row:e.row,input:e.input})}catch(t){r.failed.push({row:e.row,errors:[I.H.serverError(H,t)],input:e.input})}S(e=>e+1)}en(r)},{t:H,notifyOnError:!1});return J?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.Y9,{onClick:()=>{er?.created.length&&r.emit("clients_imported_from_file",{successCount:er.created.length,masterId:e.master||void 0,saloonId:e.saloon||void 0}),e.onClose()},children:H("common:close")}),(0,n.jsxs)(G,{as:"form",onSubmit:e=>{e.preventDefault(),el.mutate()},children:[(t=el.isError?H(Q+"title_error"):el.isSuccess?H(Q+"title_success"):H(Q+"title"),(0,n.jsx)(c,{children:t})),(()=>{if(el.isError)return(0,n.jsxs)(_,{children:[(0,n.jsx)("span",{children:el.error||H("errors:unspecified")})," ",(0,n.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"/clients-import-template.csv",children:H(Q+"download_tmpl")})]});if(el.isSuccess){if(!er)return null;let e=k()([...er.created,...er.skipped,...er.failed],"row"),t=e=>(0,n.jsxs)(R,{children:[(0,n.jsxs)("strong",{children:[e.row,"."]})," ",(0,n.jsx)("span",{children:[e.input["First name"],e.input.Phone].filter(Boolean).join(" - ")})]},e.row);return(0,n.jsxs)("div",{children:[(0,n.jsx)(f,{title:H(Q+"entries_count",{count:e.length}),defaultOpen:!1,children:(0,n.jsx)("ul",{children:e.map(t)})}),(0,n.jsx)(T,{title:H(Q+"entries_created_count",{count:er.created.length}),defaultOpen:!1,children:(0,n.jsx)("ul",{children:er.created.map(t)})}),(0,n.jsx)(X,{title:H(Q+"entries_failed_count",{count:er.failed.length}),defaultOpen:!1,children:(0,n.jsx)("ul",{children:er.failed.map(e=>(0,n.jsxs)(W,{children:[(0,n.jsxs)("strong",{children:[e.row,"."]})," ",(0,n.jsx)("span",{children:[e.input["First name"],e.input.Phone].filter(Boolean).join(" - ")})," ",(0,n.jsx)(V,{children:e.errors.join(" * ")})]},e.row))})}),er.skipped.length>0&&(0,n.jsx)(Z,{title:H(Q+"entries_skipped_count",{count:er.skipped.length}),defaultOpen:!1,children:(0,n.jsx)("ul",{children:er.skipped.map(t)})})]})}return el.isIdle?(0,n.jsxs)(_,{children:[(0,n.jsx)("strong",{children:H(Q+"file_requirements.head")})," ",(0,n.jsx)("span",{children:H(Q+"file_requirements.text")})," ",(0,n.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"/clients-import-template.csv",children:H(Q+"download_tmpl")})]}):null})(),(()=>{let e,t;if(el.isLoading)return null;if(ee&&el.isIdle)return(0,n.jsx)(p,{children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,n.jsx)("span",{style:{marginInlineEnd:"10px"},children:ee.name}),(0,n.jsx)("button",{onClick:()=>et(null),children:"X"})]})});let r=!er;return e=el.isIdle?H(Q+"dropzone_title"):el.isError?H(Q+"title_2_error"):el.isSuccess?H(Q+"title_2_success"):H(Q+"dropzone_title"),t=el.isIdle?"var(--color-primary)":el.isError?"var(--color-danger)":el.isSuccess?"var(--color-cta)":"var(--font-color-main)",(0,n.jsxs)(p,{...r?es():{},children:[r&&(0,n.jsx)("input",{...ea()}),(0,n.jsxs)(m,{style:{color:t},children:[(0,n.jsx)("p",{children:e}),(0,n.jsx)(U,{})]})]})})(),el.isLoading&&A?(0,n.jsx)(K,{progress:v/A*100,text:`${v} / ${A}`}):null,(()=>{if(!er)return null})(),(0,n.jsxs)(h,{children:[ee&&el.isIdle&&(0,n.jsx)(y.$,{medium:!0,greenish:!0,type:"submit",children:H(Q+"btn_start")}),(el.isError||el.isSuccess)&&(0,n.jsx)(y.$,{type:"button",medium:!0,greenish:!0,onClick:()=>{el.reset(),et(null),en(null),S(0),M(0)},children:H(Q+"btn_retry")})]})]})]}):null},K=(0,i.Ay)(S.A).withConfig({displayName:"main___StyledProgressBar",componentId:"sc-231ac234-0"})(["margin:0 auto;margin-top:10px;"]),R=(0,i.Ay)("li").withConfig({displayName:"main___StyledLi",componentId:"sc-231ac234-1"})(["border-bottom:",";padding:10px;"],({theme:e})=>e.border.light),T=(0,i.Ay)(f).withConfig({displayName:"main___StyledSAccordion",componentId:"sc-231ac234-2"})(["button{background:var(--color-cta);}"]),V=(0,i.Ay)("span").withConfig({displayName:"main___StyledSpan",componentId:"sc-231ac234-3"})(["color:var(--color-danger);"]),W=(0,i.Ay)("li").withConfig({displayName:"main___StyledLi2",componentId:"sc-231ac234-4"})(["border-bottom:",";padding:10px;"],({theme:e})=>e.border.light),X=(0,i.Ay)(f).withConfig({displayName:"main___StyledSAccordion2",componentId:"sc-231ac234-5"})(["button{background:var(--color-danger);}"]),Z=(0,i.Ay)(f).withConfig({displayName:"main___StyledSAccordion3",componentId:"sc-231ac234-6"})(["button{background:var(--color-primary-3);}"]),G=(0,i.Ay)(u).withConfig({displayName:"main___StyledSContent",componentId:"sc-231ac234-7"})(["color:var(--font-color-main);"])},30676(e,t,r){var n=r(96540);t.A=function(){let e=(0,n.useRef)(!1);return(0,n.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),(0,n.useCallback)(()=>e.current,[])}},41899(e,t,r){var n=r(96540),i=r(3681);r.d(t,{},{B:()=>(0,n.useMemo)(()=>(0,i.t0)(),[])})},32307(e,t,r){var n=r(95093),i=r.n(n),o=r(23658),s=r(15298);let a=(0,o.Yj)().max(20,"bad_client_name"),l=(0,o.Ik)().shape({first_name:a.required(),last_name:a,phone:s.a,extra_phone:s.a}),d="DD/MM/YYYY",c=(0,o.Ik)().shape({phone:s.a.required("clients_file_import_phone_required"),first_name:a.required("clients_file_import_name_required"),last_name:a,birthdate:(0,o.Yj)().test("birthday-test","clients_file_import_bad_birthdate",e=>!e||i()(e,d,!0).isValid()),row:(0,o.ai)()});r.d(t,{},{SB:d,UL:c,bF:l})}}]);

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.