PageSourceSearch

https://livinglife.com.tw/_next/static/chunks/pages/self-construct-singlereservation-862e0162fb9e14c7.js

js livinglife.com.tw collected 2026-09-24 10:34:44 UTC 84,730 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7315],{39057:function(e,i,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/self-construct-singlereservation",function(){return n(33512)}])},62634:function(e,i,n){"use strict";var t=n(7297),l=n(85893),o=n(75158),r=n(75084),d=n(61953),s=n(96540),a=n(94895),u=n(77366);function c(){let e=(0,t.Z)(["\n  &.MuiCheckbox-root {\n    padding-left: 14px;\n  }\n"]);return c=function(){return e},e}function v(){let e=(0,t.Z)(["\n  &.MuiButton-root {\n    justify-content: flex-start;\n    align-items: center;\n    padding: 0;\n    flex-direction: column;\n    margin-bottom: ",";\n    &:last-child {\n      margin-bottom: 0;\n    }\n  }\n"]);return v=function(){return e},e}function m(){let e=(0,t.Z)(["\n  width: 100%;\n  display: inherit;\n  justify-content: inherit;\n  align-items: inherit;\n  cursor: pointer;\n"]);return m=function(){return e},e}function h(){let e=(0,t.Z)(["\n  display: inline-block;\n  padding: ",";\n"]);return h=function(){return e},e}function f(){let e=(0,t.Z)(["\n  ","\n"]);return f=function(){return e},e}let p=(0,u.Z)(o.Z)(c()),x=(0,u.Z)(r.Z)(v(),e=>e.isMargin?"16px":"0"),g=u.Z.label(m()),Z=u.Z.span(h(),e=>{let{type:i,direction:n}=e;return"add"===i?"vertical"===n?"20px 16px 12px 16px":"18px 16px":"vertical"===n?"12px 16px 20px 16px":"18px 16px"}),j=u.Z.span(f(),e=>{let{theme:i,disabled:n}=e;return"\n    width: 18px;\n    height: 18px;\n    border: 2px solid ".concat(n?i.palette.text.disabled:i.palette.primary.main,";\n    border-radius: 2px;\n    display: flex;\n    justify-content: center;
1\n    align-items: center;\n\n    > .MuiSvgIcon-root {\n      width: 16px;\n      height: 16px;\n      font-size: ").concat(i.typography.body1.fontSize,";\n      color: ").concat(n?i.palette.text.disabled:i.palette.primary.main,";\n    }\n  ")}),y={vertical:"column",horizontal:"row"},b=e=>{let i,{checked:n,multiple:t,multipleControlDirection:o,count:r,onClick:u,onRemove:c,children:v,disabled:m,addDisabled:h,bottomContent:f,isMargin:b,isOutLined:C,...S}=e,w=e=>{e.stopPropagation(),e.preventDefault(),(!h||n&&!t)&&u&&u(e)},I=e=>{e.stopPropagation(),e.preventDefault(),c&&c(e)};return(0,l.jsxs)(x,{variant:C?"outlined":"contained",color:(i="white",C?i=n?"primary":"grey":i),onClick:w,disabled:m,isMargin:b,...S,children:[(0,l.jsxs)(g,{children:[t?(0,l.jsx)(l.Fragment,{children:r>0?(0,l.jsxs)(d.Z,{display:"flex",flexWrap:"nowrap",flexDirection:y[o],justifyContent:"space-between",alignItems:"center",children:[(0,l.jsx)(Z,{type:"add",direction:o,children:(0,l.jsx)(j,{disabled:m||t&&h,children:(0,l.jsx)(s.Z,{})})}),(0,l.jsx)(d.Z,{mt:3,mb:3,children:r}),(0,l.jsx)(Z,{type:"minus",onClick:I,direction:o,children:(0,l.jsx)(j,{disabled:m,children:(0,l.jsx)(a.Z,{})})})]}):(0,l.jsx)(p,{checked:!1,onClick:w,disabled:m})}):(0,l.jsx)(p,{checked:n,onClick:w,disabled:m}),(0,l.jsx)(d.Z,{pt:4,pb:4,pr:4,display:"flex",alignItems:"center",flexGrow:1,textAlign:"left",fontWeight:"fontWeightRegular",height:"100%",children:v})]}),f]})};b.defaultProps={multipleControlDirection:"vertical",bottomContent:null,isMargin:!0,isOutLined:!0},i.Z=b}
1,46779:function(e,i,n){"use strict";n.d(i,{Z:function(){return j}});var t=n(7297),l=n(85893),o=n(67294),r=n(39705),d=n(23855),s=n(5152),a=n.n(s),u=n(55343),c=n(90060),v=n(77366),m=n(78327),h=n(54806);let f=e=>(0,l.jsx)(h.Z,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",...e,children:(0,l.jsx)("g",{className:"x-circle",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10zm-6.293-3.707a1 1 0 010 1.414L13.414 12l2.293 2.293a1 1 0 01-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 01-1.414-1.414L10.586 12 8.293 9.707a1 1 0 011.414-1.414L12 10.586l2.293-2.293a1 1 0 011.414 0z",className:"Subtract",clipRule:"evenodd"})})});function p(){let e=(0,t.Z)(["\n  position: absolute;\n  right: 7px;\n  cursor: pointer;\n  ","\n"]);return p=function(){return e},e}let x=a()(()=>n.e(8204).then(n.bind(n,48204)),{loadableGenerated:{webpack:()=>[48204]}}),g=(0,v.Z)(f)(p(),e=>{let{theme:i}=e;return"\n    fill: ".concat(i.palette.text.disabled,";\n  ")}),Z=e=>{let{open:i,onClick:n,date:t,onChange:s,onClose:a,placeholder:v}=e,[h,f]=(0,o.useState)(!1),[p,Z]=(0,o.useState)(!1);(0,o.useEffect)(()=>{(void 0===i?h:i)?Z(!0):setTimeout(()=>Z(!1),100)},[h,i]);let j=e=>{void 0===i?f(!0):n(e)},y=e=>{s&&s(e),void 0===i&&f(!1)},b=()=>{void 0===i?f(!1):a()},C=e=>{e.stopPropagation(),s&&s(null)};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(u.Z,{fullWidth:!0,children:(0,l.jsxs)(m.Z,{open:!1,value:!!t||"",native:!1,displayEmpty:!0,onClick:j,IconComponent:t?()=>(0,l.jsx)(g,{onClick:C}):null,children:[(0,l.jsx)(c.Z,{value:"",children:v||"選擇日期"}),(0,l.jsx)(c.Z,{value:!0,children:!!t&&(0,l.jsx)(l.Fragment,{children:(0,r.Z)((0,d.Z)(t),"yyyy/MM/dd")})})]})}),p&&(0,l.jsx)(x,{open:p,onClose:b,date:t,onDateSelect:y})]})};Z.defaultProps={open:void 0};var j=Z},73605:function(e,i,n){"use strict";n.d(i,{M:function(){return b}});var t=n(7297),l=n(85893),o=n(67294),r=n(61953),d=n(79072),s=n(29630),a=n(50594),u=n(66909),c=n(77366),v=n(61225),m=n(62097),h=n(20996),f=n(24887);function p(){let e=(0,t.Z)(["\n  cursor: pointer;\n\n  ","\n"]);return p=function(){return e},e}function x(){let e=(0,t.Z)(["\n  ","\n"]);return x=function(){return e},e}function g(){let e=(0,t.Z)(["\n  ","\n"]);return g=function(){return e},e}function Z(){let e=(0,t.Z)(["\n  width: 100%;\n  height: 100%;\n  object-fit: cover;\n"]);return Z=function(){return e},e}let j=(0,c.Z)(r.Z)(p(),e=>{let{theme:i,isSelfConstructPage:n}=e;return"\n    width: ".concat(n?"100%":"122px",";\n    height: 142px;\n    border: 1px dashed ").concat(i.palette.text.disabled,";\n    color: ").concat(i.palette.primary.main,";\n    border-radius: ").concat(i.shape.borderRadius,"px;\n\n    ").concat(i.breakpoints.up("lg")," {\n      width: 100%;\n    }\n  ")}),y=(0,c.Z)(r.Z)(x(),e=>{let{theme:i}=e;return"\n    position: relative;\n    width: 122px;\n    height: 142px;\n    border: 1px solid ".concat(i.palette.text.disabled,";\n    border-radius: ").concat(i.shape.borderRadius,"px;\n  ")}),b=e=>{let{file:i,onRemove:n,className:t}=e;return(0,l.jsx)(y,{className:t,children:(0,l.jsxs)(r.Z,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",children:[(0,l.jsx)(S,{src:i._previewUrl||i.url}),i._isPending&&(0,l.jsx)(f.Z,{}),(0,l.jsx)(C,{onClick:()=>n&&n(i),children:(0,l.jsx)(a.Z,{})})]})})},C=c.Z.div(g(),e=>{let{theme:i}=e;return"\n    display: flex;\n    justify-content: center;
1\n    align-items: center;\n    position: absolute;\n    right: -1px;\n    top: -1px;\n    width: 36px;\n    height: 36px;\n    background-color: white;\n    color: ".concat(i.palette.text.primary,";\n    cursor: pointer;\n  ")}),S=c.Z.img(Z()),w=e=>{let{files:i,fileType:n,multiple:t,maxFiles:a,onChange:c,onFileUpload:f,onFileRemove:p,onError:x,className:g,customText:Z,hideInnerPreviews:y,previews:C,setPreviews:S,onUploadStart:w,onUploadFinish:I,isSelfConstructPage:k=!1,fileSizeLimit:_}=e,[E,P]=(0,o.useState)(i),D=C||E,{getRootProps:M,getInputProps:T,onOneFileRemoveClick:N}=(0,h.B)({previews:D,setPreviews:S||P,files:i,fileType:n,multiple:t,maxFiles:a,onChange:c,onFileUpload:f,onFileRemove:p,onError:x,onUploadStart:w,onUploadFinish:I,fileSizeLimit:_}),R=(0,m.Z)(),z=(0,v.Z)(R.breakpoints.up("lg"));return(0,l.jsx)(r.Z,{className:g,children:(0,l.jsxs)(d.ZP,{container:!0,spacing:1,children:[(0,l.jsx)(d.ZP,{item:!0,xs:k&&12,lg:12,children:(0,l.jsxs)(j,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",isSelfConstructPage:k,...M(),children:[(0,l.jsx)("canvas",{style:{position:"fixed",zIndex:-1,top:"-100000px"},id:"thumb-image-canvas",content:"user-scalable=no"}),(0,l.jsx)("input",{...T()}),(0,l.jsx)(u.Z,{}),(0,l.jsx)(s.Z,{variant:"h6",children:(0,l.jsx)(r.Z,{mt:3,mb:2.5,children:Z?(0,l.jsx)(l.Fragment,{children:Z}):(0,l.jsx)(l.Fragment,{children:z?"拖放或按一下,進行圖片上傳":"上傳圖片"})})}),!!a&&(0,l.jsx)(s.Z,{variant:"body2",children:(0,l.jsxs)(r.Z,{color:"text.disabled",children:["上限",a,"張"]})})]})}),!y&&!!D.length&&D.map(e=>(0,l.jsx)(d.ZP,{item:!0,children:(0,l.jsx)(b,{file:e,onRemove:()=>N(e)})},e._id))]})})};w.defaultProps={files:[],multiple:!0,maxFiles:0,hideInnerPreviews:!1},i.Z=w},24887:function(e,i,n){"use strict";n.d(i,{Z:function(){return p}});var t=n(7297),l=n(85893),o=n(77366),r=n(70917),d=n(54806);let s=e=>(0,l.jsxs)(d.Z,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",...e,children:[(0,l.jsxs)("g",{className:"rotate-ccw",clipPath:"url(#clip0_9066:1101501)",children:[(0,l.jsx)("path",{fillRule:"evenodd",d:"M1 3a1 1 0 011 1v5h5a1 1 0 010 2H1a1 1 0 01-1-1V4a1 1 0 011-1z",className:"Vector (Stroke)",clipRule:"evenodd"}),(0,l.jsx)("path",{fillRule:"evenodd",d:"M10.605 2.107a10 10 0 11-8.038 13.225 1 1 0 111.886-.664 8 8 0 101.872-8.3l-4.64 4.36a1 1 0 11-1.37-1.457l4.63-4.35a10 10 0 015.66-2.814z",className:"Vector (Stroke)_2",clipRule:"evenodd"})]}),(0,l.jsx)("defs",{children:(0,l.jsx)("clipPath",{id:"clip0_9066:1101501",className:"clip0_9066:1101501",children:(0,l.jsx)("path",{d:"M0 0h24v24H0z"})})})]});function a(){let e=(0,t.Z)(["\n  from {\n    transform: rotate(0deg);\n  }\n  to {\n    transform: rotate(-360deg);\n  }\n"]);return a=function(){return e},e}function u(){let e=(0,t.Z)(["\n  animation: "," 1s linear infinite;\n"]);return u=function(){return e},e}let c=(0,r.F4)(a()),v=(0,o.Z)(s)(u(),c);function m(){let e=(0,t.Z)(["\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  background-color: rgba(0, 0, 0, 0.5);\n"]);return m=function(){return e},e}let h=o.Z.div(m()),f=()=>(0,l.jsx)(h,{children:(0,l.jsx)(v,{white:!0})});var p=f},79747:function(e,i,n){"use strict";var t=n(7297),l=n(85893),o=n(8519),r=n(75084),d=n(61953),s=n(77366);function a(){let e=(0,t.Z)(["\n  &.MuiRadio-root {\n    padding-left: 14px;\n  }\n"]);return a=function(){return e},e}function u(){let e=(0,t.Z)(["\n  ","\n"]);return u=function(){return e},e}function c(){let e=(0,t.Z)(["\n  width: 100%;\n  display: inherit;\n  justify-content: inherit;\n  align-items: inherit;\n  cursor: pointer;\n"]);return c=function(){return e},e}let v=(0,s.Z)(o.Z)(a()),m=(0,s.Z)(r.Z)(u(),e=>{let{theme:i}=e;return"\n    &.MuiButton-root {\n      justify-content: flex-start;\n      align-items: stretch;\n      padding: 0;\n      flex-direction: column;\n\n      margin-bottom: ".concat(i.spacing(4),";\n      &:last-child {\n        margin-bottom: 0;\n      }\n\n    }\n  ")}),h=s.Z.label(c()),f=e=>{let{name:i,value:n,checked:t,children:o,onClick:r,disabled:s,bottomContent:a,...u}=e;return(0,l.jsxs)(m,{variant:"outlined",color:t?"primary":"grey",...u,children:[(0,l.jsxs)(h,{children:[(0,l.jsx)(v,{name:i,value:n,checked:t,onClick:r,disabled:s}),(0,l.jsx)(d.Z,{pt:4,pb:4,pr:4,display:"flex",alignItems:"center",flexGrow:1,textAlign:"left",fontWeight:"fontWeightRegular",children:o})]}),a]})};i.Z=f},54996:function(e,i,n){"use strict";var t=n(7297),l=n(98700),o=n(77366);function r(){let e=(0,t.Z)(["\n  ","\n"]);return r=function(){return e},e}let d=o.Z.div(r(),l.ZP);i.Z=d},16995:function(e,i,n){"use strict";n.d(i,{P:function(){return l}});var t=n(79697);let l=e=>{let{hour:i,minute:n}=e;return!(0,t.Z)(i)&&!(0,t.Z)(n)}},82287:function(e,i,n){"use strict";var t=n(85893),l=n(29630),o=n(61953);n(77366);let r=e=>{let{children:i,title:n,remark:r,variant:d="h5",color:s,titleId:a,remarkId:u,...c}=e;return(0,t.jsxs)(o.Z,{display:"flex",flexWrap:"wrap",alignItems:"center",...c,children:[(0,t.jsx)(l.Z,{variant:d,children:(0,t.jsx)(o.Z,{mr:1,fontWeight:"fontWeightBold",color:s,id:a,children:i||n})}),r&&(0,t.jsx)(l.Z,{component:"span",variant:"subtitle1",color:"textSecondary",id:u,children:r})]})};i.Z=r},69365:function(e,i,n){"use strict";n.d(i,{P:function(){return t}});let t={name:256,address:256,default:256}},33512:function(e,i,n){"use strict";n.r(i),n.d(i,{default:function(){return nC}});var t=n(85893),l=n(89289),o=n(67030),r=n(7297),d=n(61953),s=n(77366);function a(){let e=(0,r.Z)(["\n  ","\n"]);return a=function(){return e},e}let u=(0,s.Z)(d.Z)(a(),e=>{let{theme:i}=e;return"\n    width: 100%;\n    max-width: 540px;\n    margin-left: auto;\n    margin-right: auto;\n    margin-top: 40px;\n    margin-bottom: 60px;\n\n    padding-left: ".concat(i.spacing(4),";\n    padding-right: ").concat(i.spacing(4),";\n\n    ").concat(i.breakpoints.up("lg")," {\n      padding-left: ").concat(i.spacing(0),";\n      padding-right: ").concat(i.spacing(0),";\n    }\n  ")});var c=n(67294),v=n(38816),m=n(79697),h=n(9373),f=n(19658),p=n(18717),x=n(4543),g=n(37042),Z=n(23855),j=n(55250),y=n(25675),b=n.n(y),C=n(5152),S=n.n(C),w=n(29630),I=n(67836),k=n(22841),_=n(75158),E=n(75084);function P(){let e=(0,r.Z)(["\n  display: flex;\n  justify-content: start;\n  align-items: center;\n"]);return P=function(){return e},e}let D=(0,s.Z)(d.Z)(P()),M=e=>{let{content:i,isAllRequire:n=!1,isImportant:l=!0}=e;return(0,t.jsxs)(D,{mb:7.5,children:[(0,t.jsxs)(w.Z,{variant:"headlineSmall",children:[l&&(0,t.jsx)(d.Z,{component:"span",fontWeight:"fontWeightBold",color:"primary.main",mr:1,children:"*"}),i]}),!n&&(0,t.jsx)(w.Z,{color:"text.secondary",ml:1.5,children:"部分必填"})]})};var T=n(23660);function N(){let e=(0,r.Z)(["\n  white-space: pre-wrap;\n"]);return N=function(){return e},e}let R=(0,s.Z)(w.Z)(N());var z=n(72673);let A=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(0,z.Ev)((0,z.UY)("/supports/sinyiStaffs/".concat(e)))};var W=n(30587);let L=e=>{var i,n;let{selfConstructRole:o,isStaffNumberLock:r}=e,s=(0,l.I0)(),a=(0,l.v9)(W.ky),[u,v]=(0,c.useState)(null),[h,f]=(0,c.useState)(!1),p="sinyiIntranet"===o||"ta3"===o,x=e=>{s((0,W.$H)(e.target.value))};return(0,c.useEffect)(()=>{var e,i;let n=async()=>{f(!0);let[e,i]=await A(null==a?void 0:a.staffNumber);i||0===Object.keys(e).length||v(e),f(!1)};(null==a?void 0:null===(e=a.staffNumber)||void 0===e?void 0:e.length)===6?n():u&&(null==a?void 0:null===(i=a.staffNumber)||void 0===i?void 0:i.length)<6&&v(null)},[null==a?void 0:a.staffNumber]),(0,t.jsxs)(d.Z,{children:[(0,t.jsxs)(d.Z,{mb:4,children:[(0,t.jsx)(d.Z,{mb:2,children:(0,t.jsx)(T.Z,{label:"輸入推薦人信義員編",variant:"outlined",fullWidth:!0,value:null==a?void 0:a.staffNumber,inputProps:{maxLength:6},onChange:x,disabled:r})}),(0,t.jsxs)(d.Z,{display:"flex",children:[(0,m.Z)(null==a?void 0:a.staffNumber)&&(0,t.jsx)(w.Z,{variant:"body2",color:"text.disabled",ml:1,children:"員編無需輸入S"}),(null==a?void 0:null===(i=a.staffNumber)||void 0===i?void 0:i.length)===6&&u&&(0,t.jsxs)(R,{variant:"body2",color:"primary.main",ml:1,children:[u.depName," ",u.empTitle," ",u.empName," ",!p&&u.empPhone]}),(null==a?void 0:null===(n=a.staffNumber)||void 0===n?void 0:n.length)===6&&!u&&!h&&(0,t.jsx)(w.Z,{variant:"body2",color:"primary.main",ml:1,children:"非員工資料"})]})]}),("serviceAdmin"===o||p)&&(0,t.jsx)(d.Z,{mb:4,children:(0,t.jsx)(T.Z,{label:"輸入物件編號",variant:"outlined",fullWidth:!0,value:null==a?void 0:a.objectNo,onChange:e=>s((0,W.bk)(e.target.value))})})]})};var O=n(55343),B=n(58316);let U=e=>(0,z.Ev)((0,z.UY)("/users/otherRoles",e)),F=()=>(0,z.Ev)((0,z.UY)("/systemSettings/selfConstructedBookingReason"));var V=n(78327),q=n(47092);let G=S()(()=>n.e(5579).then(n.bind(n,65579)),{loadableGenerated:{webpack:()=>[65579]},ssr:!1}),H=S()(()=>n.e(6306).then(n.bind(n,36306)),{loadableGenerated:{webpack:()=>[36306]},ssr:!1}),Q=e=>{var i,n,o,r,s,a,u,v,h,f,p;let{isRoleVender:x,isLivingLifeRole:g,origin:Z,customerId:j,setCustomerId:y,setIsRoleLoading:b,utm:C,webview:S}=e,I=(0,l.I0)(),k=(0,l.v9)(W.ky),[_,E]=(0,c.useState)(null),[P,D]=(0,c.useState)(!1),[M,N]=(0,c.useState)(!1),[R,z]=(0,c.useState)(null),A=(0,c.useRef)(!1);return(0,c.useEffect)(()=>{var e,i;let n=async()=>{b(!0);let[e,i]=await U({phone:null==k?void 0:k.verificationPhone});if(i){b(!1),I((0,q.fz)({open:!0,message:"請檢查電話格式"}));return}if(!i){var n;b(!1),E(e),y(null==e?void 0:null===(n=e.user)||void 0===n?void 0:n._id)}};(null==k?void 0:null===(e=k.verificationPhone)||void 0===e?void 0:e.length)===10?n():_&&(null==k?void 0:null===(i=k.verificationPhone)||void 0===i?void 0:i.length)<10&&(E(null),y(""))},[null==k?void 0:k.verificationPhone]),(0,c.useEffect)(()=>{let e=async()=>{let[e,i]=await F();i||z(e)};if(_){var i,n,t,l,o,r,d,s,a,u;e();let c=null==_?void 0:null===(i=_.user)||void 0===i?void 0:i.fullname;if("新朋友"===c||"尚未設定姓名"===c||""===c)return N(!0);A.current?"reservation"!==Z&&(x||!g?(I((0,W.EP)(null==_?void 0:null===(n=_.user)||void 0===n?void 0:n.fullname)),I((0,W._E)(null==_?void 0:null===(t=_.user)||void 0===t?void 0:t.phone))):(I((0,W.EP)(null==_?void 0:null===(l=_.user)||void 0===l?void 0:l.fullname)),I((0,W._E)(null==_?void 0:null===(o=_.user)||void 0===o?void 0:o.phone)),I((0,W.si)(null==_?void 0:null===(r=_.user)||void 0===r?void 0:r.email)))):"reservation"!==Z&&(x||!g?I((0,W._E)(null==_?void 0:null===(d=_.user)||void 0===d?void 0:d.phone)):(I((0,W.EP)(null==_?void 0:null===(s=_.user)||void 0===s?void 0:s.fullname)),I((0,W._E)(null==_?void 0:null===(a=_.user)||void 0===a?void 0:a.phone)),I((0,W.si)(null==_?void 0:null===(u=_.user)||void 0===u?void 0:u.email))))}_||(I((0,W.EP)("")),I((0,W._E)("")),I((0,W.si)("")),z(null))},[_,x]),(0,c.useEffect)(()=>{var e,i;(null==k?void 0:null===(e=k.verificationPhone)||void 0===e?void 0:e.length)!==10||(0,m.Z)(_)||(null===(i=null==_?void 0:_.otherRoles[0])||void 0===i?void 0:i.key)!=="newUser"||D(!0)},[null===(i=null==_?void 0:_.otherRoles[0])||void 0===i?void 0:i.key,null==k?void 0:k.verificationPhone]),(0,t.jsxs)(d.Z,{children:[(0,t.jsxs)(d.Z,{mb:4,children:[(0,t.jsx)(d.Z,{mb:2,children:(0,t.jsx)(T.Z,{label:"*輸入訂購人手機",variant:"outlined",fullWidth:!0,value:null==k?void 0:k.verificationPhone,inputProps:{maxLength:10},onChange:e=>I((0,W.et)(e.target.value)),disabled:"normal"!==Z})}),(0,t.jsxs)(d.Z,{display:"flex",children:[!_&&(0,t.jsx)(w.Z,{variant:"body2",color:"text.disabled",ml:1,children:"訂單資訊會歸屬於該手機帳號底下"}),g&&(null==_?void 0:_.otherRoles)&&(null==_?void 0:null===(n=_.otherRoles)||void 0===n?void 0:n.map((e,i)=>(0,t.jsxs)(w.Z,{variant:"body2",color:"primary.main",ml:0===i?1:0,children:[0!==i&&(0,t.jsx)("span",{children:"、"}),null==e?void 0:e.name]},i)))]})]}),(0,t.jsx)(d.Z,{mb:4,children:(0,t.jsx)(T.Z,{disabled:(0,m.Z)(null==k?void 0:k.verificationPhone)||(null==k?void 0:null===(o=k.verificationPhone)||void 0===o?void 0:o.length)<10,label:"*輸入聯絡人姓名",variant:"outlined",fullWidth:!0,value:null==k?void 0:null===(r=k.customerContact)||void 0===r?void 0:r.name,onChange:e=>I((0,W.EP)(e.target.value)),InputLabelProps:{shrink:null!=k&&null!==(s=k.customerContact)&&void 0!==s&&!!s.name}})}),(0,t.jsx)(d.Z,{mb:4,children:(0,t.jsx)(T.Z,{disabled:(0,m.Z)(null==k?void 0:k.verificationPhone)||(null==k?void 0:null===(a=k.verificationPhone)||void 0===a?void 0:a.length)<10,label:"*輸入聯絡人手機",variant:"outlined",fullWidth:!0,value:null==k?void 0:null===(u=k.customerContact)||void 0===u?void 0:u.phone,inputProps:{maxLength:10},onChange:e=>I((0,W._E)(e.target.value)),InputLabelProps:{shrink:null!=k&&null!==(v=k.customerContact)&&void 0!==v&&!!v.phone}})}),(0,t.jsxs)(d.Z,{mb:4,children:[(0,t.jsx)(d.Z,{mb:2,children:(0,t.jsx)(T.Z,{disabled:(0,m.Z)(null==k?void 0:k.verificationPhone)||(null==k?void 0:null===(h=k.verificationPhone)||void 0===h?void 0:h.length)<10,label:"輸入聯絡人Email",variant:"outlined",fullWidth:!0,value:null==k?void 0:null===(f=k.customerContact)||void 0===f?void 0:f.email,onChange:e=>I((0,W.si)(e.target.value)),InputLabelProps:{shrink:null!=k&&null!==(p=k.customerContact)&&void 0!==p&&!!p.email}})}),(0,t.jsx)(d.Z,{display:"flex",children:(0,t.jsx)(w.Z,{variant:"body2",color:"text.disabled",ml:1,children:"如付款方式為信用卡,請務必輸入E-mail,避免使用者無法完成信用卡結帳"})})]}),!x&&g&&(0,t.jsxs)(O.Z,{fullWidth:!0,mb:4,children:[(0,t.jsx)(B.Z,{id:"select-reason-label",children:"建立訂單原因"}),(0,t.jsxs)(V.Z,{labelId:"select-reason-label",muiLabel:"建立訂單原因",disabled:!_,value:null==k?void 0:k.selfBookingReason,onChange(e){I((0,W.tM)(e.target.value))},children:[(0,t.jsx)("option",{value:"",children:"取消選取"}),null==R?void 0:R.map((e,i)=>(0,t.jsx)("option",{value:null==e?void 0:e.content,children:null==e?void 0:e.content},"reason"+i))]})]}),(0,t.jsx)(G,{registerModalOpen:P,setRegisterModalOpen:D,setCustomerId:y,utm:C,webview:S,customRole:_,setCustomRole:E,isSetName:A}),(0,t.jsx)(H,{nameSettingModalOpen:M,setNameSettingModalOpen:N,customerId:j,setCustomRole:E,isSetName:A,origin:Z})]})};var K=n(27961),Y=n(90060),$=n(65428),J=n(69365);function X(){let e=(0,r.Z)(["\n  width: 100%;\n  display: flex;\n  justify-content: start;\n  align-items: center;\n  margin-bottom: 16px;\n"]);return X=function(){return e},e}let ee=(0,s.Z)(d.Z)(X()),ei=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1?arguments[1]:void 0,n=e.find(e=>e.county===i);return null==n?void 0:n.districts},en=(0,$.Z)(void 0,!0),et=e=>{var i,n;let{label:o,addressData:r,onCountyChange:s,onDistrictChange:a,onAddressDetailChange:u,onHasElevatorChange:v}=e,m=(0,l.v9)(W.ky),[h,f]=(0,c.useState)([]),[p,x]=(0,c.useState)([]),{county:g,district:Z,details:j,hasElevator:y}=r,b=null==m?void 0:null===(i=m.serviceClassificationDetail)||void 0===i?void 0:i.venderDispatchRegions,C=(null==m?void 0:null===(n=m.serviceClassificationDetail)||void 0===n?void 0:n.mode)==="relocation";return(0,c.useEffect)(()=>
1{if(b){if(C){f(en.counties());return}f(b.map(e=>e.county))}},[b,C]),(0,c.useEffect)(()=>{C?x(en.districts(g)):x(ei(b,g))},[g,b,C]),(0,t.jsxs)(d.Z,{mb:4,children:[(0,t.jsxs)(ee,{children:[(0,t.jsx)(d.Z,{sx:{width:"50%"},mr:4,children:(0,t.jsxs)(O.Z,{fullWidth:!0,children:[(0,t.jsx)(B.Z,{id:"select-county-label",children:"*縣市"}),(0,t.jsx)(V.Z,{labelId:"select-county-label",muiLabel:"*縣市",value:g||"",onChange:s,children:null==h?void 0:h.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]})}),(0,t.jsx)(d.Z,{sx:{width:"50%"},children:(0,t.jsxs)(O.Z,{fullWidth:!0,children:[(0,t.jsx)(B.Z,{id:"select-district-label",children:"*行政區"}),(0,t.jsx)(V.Z,{labelId:"select-district-label",muiLabel:"*行政區",value:Z||"",onChange:a,children:null==p?void 0:p.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]})})]}),(0,t.jsx)(d.Z,{children:(0,t.jsx)(T.Z,{label:o,variant:"outlined",fullWidth:!0,value:j||"",onChange:u,inputProps:{maxLength:J.P.address}})}),C&&(0,t.jsx)(d.Z,{children:(0,t.jsx)(k.Z,{control:(0,t.jsx)(_.Z,{checked:y,onChange:v}),label:(0,t.jsx)(w.Z,{color:y?"primary":"textSecondary",children:"有電梯"})})})]})},el=()=>{var e;let i=(0,l.I0)(),n=(0,l.v9)(W.ky),o=(null==n?void 0:null===(e=n.serviceClassificationDetail)||void 0===e?void 0:e.mode)==="relocation"?"*填寫遷出地址":"*填寫服務地址",r=e=>{i((0,W.VP)(e.target.value)),i((0,W.wG)())},d=e=>{i((0,W.vO)(e.target.value)),i((0,W.wG)())},s=e=>i((0,W.lw)(e.target.value)),a=e=>i((0,W.jJ)(e.target.checked));return(0,t.jsx)(et,{label:o,addressData:n.serviceAddress,onCountyChange:r,onDistrictChange:d,onAddressDetailChange:s,onHasElevatorChange:a})};var eo=n(96540);function er(){let e=(0,r.Z)(["\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n"]);return er=function(){return e},e}let ed=(0,s.Z)(d.Z)(er()),es=e=>{let{title:i,onRemoveClick:n}=e;return(0,t.jsxs)(ed,{mb:7.5,children:[(0,t.jsx)(w.Z,{variant:"paraBodyMedium",color:"text.secondary",children:i}),(0,t.jsx)(E.Z,{onClick:n,children:(0,t.jsx)(b(),{src:"/img/btn_trash_normal.svg",width:"24",height:"24",alt:""})})]})},ea=()=>{var e;let i=(0,l.I0)(),n=(0,l.v9)(W.ky),o=()=>i((0,W.hq)()),r=(e,t)=>{let l={...null==n?void 0:n.moveInAddress[t],county:e.target.value};i((0,W.Q_)({index:t,address:l}))},s=(e,t)=>{let l={...null==n?void 0:n.moveInAddress[t],district:e.target.value};i((0,W.Q_)({index:t,address:l}))},a=(e,t)=>{let l={...null==n?void 0:n.moveInAddress[t],details:e.target.value};i((0,W.Q_)({index:t,address:l}))},u=(e,t)=>{let l={...null==n?void 0:n.moveInAddress[t],hasElevator:e.target.checked};i((0,W.Q_)({index:t,address:l}))},c=e=>{i((0,W.R_)(e))};return(0,t.jsx)(d.Z,{mb:4,children:null===(e=n.moveInAddress)||void 0===e?void 0:e.map((e,i)=>{var l;return(0,t.jsxs)(d.Z,{mt:0!==i?7.5:0,children:[i>0&&(0,t.jsx)(es,{title:"遷入地址".concat(i+1),onRemoveClick:()=>c(i)}),(0,t.jsx)(et,{addressData:e,onCountyChange:e=>r(e,i),onDistrictChange:e=>s(e,i),onAddressDetailChange:e=>a(e,i),onHasElevatorChange:e=>u(e,i),label:"*填寫遷入地址"},"address-".concat(i)),0===i&&(0,t.jsxs)(E.Z,{size:"small",onClick:o,disabled:(null==n?void 0:null===(l=n.moveInAddress)||void 0===l?void 0:l.length)>=5,color:"primary",children:[(0,t.jsx)(eo.Z,{})," 新增遷入地址"]})]},"address-".concat(i))})})},eu=["不拘(09:00-18:00)","上午(09:00-12:00)","下午(13:30-18:00)"],ec=()=>{let e=(0,l.I0)(),i=(0,l.v9)(W.ky);return(0,t.jsx)(d.Z,{mb:4,children:(0,t.jsxs)(O.Z,{fullWidth:!0,children:[(0,t.jsx)(B.Z,{id:"select-label",children:"方便聯絡時間"}),(0,t.jsx)(V.Z,{labelId:"select-label",id:"select",muiLabel:"方便聯絡時間",value:(null==i?void 0:i.contactTime)||"",onChange:i=>e((0,W.qE)(i.target.value)),children:eu.map((e,i)=>(0,t.jsx)("option",{value:e,children:e},"option-".concat(i)))})]})})};var ev=n(29422),em=n(3151),eh=n(584),ef=n(43703),ep=n(11640),ex=n(20466),eg=n(71048),eZ=n(49160),ej=n(18203),ey=n(39705),eb=n(313),eC=n(34468),eS=n(73386),ew=n(25891),eI=n(80129);let ek=e=>(0,z.Ev)((0,z.UY)("/services/bookingDay?".concat((0,eI.stringify)(e))));function e_(){let e=(0,r.Z)(["\n  ","\n"]);return e_=function(){return e},e}let eE=s.Z.span(e_(),e=>{let{theme:i}=e;return"\n    color: ".concat(i.palette.primary.main,"\n  ")}),eP=S()(()=>Promise.all([n.e(6973),n.e(4741)]).then(n.bind(n,74741)),{loadableGenerated:{webpack:()=>[74741]}}),eD=(e,i,n)=>{let t=(0,ev.Z)(e,{days:i});return n.filter(e=>(0,em.Z)(e,t)).length?eD(e,i+=1,n):t},eM=e=>(0,eh.Z)((0,ef.Z)(e),{weekStartsOn:1}
1),eT=e=>(0,eh.Z)((0,ep.Z)((0,ef.Z)(e),1),{weekStartsOn:1}),eN=e=>[0,1,2,3,4,5,6].map(i=>(0,ev.Z)(e,{days:i})),eR=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[];return e.filter(e=>{let r=o.some(i=>(0,em.Z)((0,Z.Z)(i),e));if(r)return!0;let d=(0,ex.Z)(e);if(d>=1&&d<=5){let s=t.some(i=>(0,em.Z)((0,Z.Z)(i),e));return!(s?n:i)}if(6===d||0===d){let a=l.some(i=>(0,em.Z)((0,Z.Z)(i),e));return!(a?i:n)}})},ez=e=>{var i,n,o,r,s,a,u,v,h,f,p,x,j,y,b,C,S,I;let{serviceIds:k,onBookingDateClick:_,packageInfo:E,recentPickableInterval:P,selfConstructRole:D,servicePlans:M}=e,T=(0,l.I0)(),N=(0,l.v9)(W.ky),[R,z]=(0,c.useState)(!1),[A,L]=(0,c.useState)(!1),[U,F]=(0,c.useState)(new Date),[q,G]=(0,c.useState)(null),[H,Q]=(0,c.useState)(null),{data:$}=(0,eS.j)(),{data:J}=(0,ew.M)(),X={selectedDate:null,hour:"",minute:""},ee=eM(U),ei=eT(U),en=Array.from(Array((0,eg.Z)(U,{weekStartsOn:1}))),et=Array.from(Array((0,eg.Z)((0,ep.Z)((0,ef.Z)(U),1),{weekStartsOn:1}))),el=en.map((e,i)=>eN((0,ev.Z)(ee,{weeks:i}))),eo=et.map((e,i)=>eN((0,ev.Z)(ei,{weeks:i}))),er=el.concat(eo),ed=null==$?void 0:$.filter(e=>(0,eZ.Z)((0,Z.Z)(e),U)),es=P>7?P:7,ea=null==E?void 0:E.isActivate,eu=(null==E?void 0:null===(i=E.frequency)||void 0===i?void 0:i.unit)==="days"?"天":(null==E?void 0:null===(n=E.frequency)||void 0===n?void 0:n.unit)==="weeks"?"週":"月";(0,c.useEffect)(()=>{U&&F(new Date)},[]),(0,c.useEffect)(()=>{var e,i;let n=async function(e,i){let n,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],[r,d]=await ek({county:null==i?void 0:i.county,district:null==i?void 0:i.district,serviceIds:e});d||(n=(0,eC.Z)(null==r?void 0:r.notServiceInList,null==r?void 0:r.allDeactivatedServiceDateList)),null==i||i.county,null==i||i.district,!(0,m.Z)(e)&&((null==r?void 0:r.isIncludeNormalDay)||(null==r?void 0:r.isIncludeHoliday))&&G(eR(t,null==r?void 0:r.isIncludeNormalDay,null==r?void 0:r.isIncludeHoliday,l,o,n))};!(0,m.Z)(k)&&(null==N?void 0:null===(e=N.serviceAddress)||void 0===e?void 0:e.county)&&(null==N?void 0:null===(i=N.serviceAddress)||void 0===i?void 0:i.district)&&n(k,null==N?void 0:N.serviceAddress,(0,K.Z)(er),ed,J),(0,m.Z)(k)&&G(null)},[k,null==N?void 0:null===(o=N.serviceAddress)||void 0===o?void 0:o.county,null==N?void 0:null===(r=N.serviceAddress)||void 0===r?void 0:r.district]),(0,c.useEffect)(()=>{R?L(!0):setTimeout(()=>L(!1),500)},[R]),(0,c.useEffect)(()=>{q?Q(eD(U,es,q)):Q(null)},[q,U,es]),(0,c.useEffect)(()=>{T((0,W.V0)(!1)),H?(T((0,W.gn)({from:(0,g.Z)(H,0).toISOString(),to:(0,ej.Z)((0,g.Z)(H,11)).toISOString()})),T((0,W.gx)({...X,selectedDate:(0,g.Z)(H,0).toISOString()}))):(T((0,W.gn)({})),T((0,W.gx)(X)))},[H]);let ec=()=>{"function"==typeof _?!1!==_()&&z(!0):z(!0)},em=(0,c.useCallback)(()=>{z(!1)},[z]);return(0,t.jsxs)(d.Z,{mb:4,children:[(0,t.jsx)(d.Z,{children:(0,t.jsxs)(O.Z,{fullWidth:!0,children:[(0,t.jsx)(B.Z,{id:"select-date-label",children:"*選擇服務日期"}),(0,t.jsx)(V.Z,{labelId:"select-date-label",muiLabel:"*選擇服務日期",open:!1,value:!!(null==N?void 0:null===(s=N.serviceDateTime)||void 0===s?void 0:s.from)&&!!(null==N?void 0:null===(a=N.serviceDateTime)||void 0===a?void 0:a.to)||!!(null==N?void 0:null===(u=N.serviceConfirmTime)||void 0===u?void 0:u.selectedDate)&&!!(null==N?void 0:null===(v=N.serviceConfirmTime)||void 0===v?void 0:v.hour)&&!!(null==N?void 0:null===(h=N.serviceConfirmTime)||void 0===h?void 0:h.minute)||"",native:!1,fullWidth:!0,displayEmpty:!0,onClick:ec,children:(0,t.jsxs)(Y.Z,{value:!0,children:[!!(null==N?void 0:null===(f=N.serviceDateTime)||void 0===f?void 0:f.from)&&(0,t.jsxs)(t.Fragment,{children:[(0,ey.Z)((0,Z.Z)(null==N?void 0:null===(p=N.serviceDateTime)||void 0===p?void 0:p.from),"yyyy/MM/dd"),(0,eb.Z)((0,Z.Z)(null==N?void 0:null===(x=N.serviceDateTime)||void 0===x?void 0:x.from),(0,g.Z)((0,Z.Z)(null==N?void 0:null===(j=N.serviceDateTime)||void 0===j?void 0:j.from),12))?" 上午":" 下午"]}),!!(null==N?void 0:null===(y=N.serviceConfirmTime)||void 0===y?void 0:y.hour)&&(0,t.jsxs)(t.Fragment,{children:[(0,ey.Z)((0,Z.Z)(null==N?void 0:null===(b=N.serviceConfirmTime)||void 0===b?void 0:b.selectedDate),"yyyy/MM/dd"),"  ".concat(null==N?void 0:null===(C=N.serviceConfirmTime)||void 0===C?void 0:C.hour,"時").concat(null==N?void 0:null===(S=N.serviceConfirmTime)||void 0===S?void 0:S.minute,"分")]})]})})]})}),ea&&(0,t.jsx)(d.Z,{display:"flex",mt:2,children:(0,t.jsxs)(w.Z,{variant:"body2",color:"text.disabled",ml:1,children:["將預先以此服務日期往後預約;每","",(0,t.jsxs)(eE,{children:[null==E?void 0:null===(I=E.frequency)||void 0===I?void 0:I.everyN," ",eu]})," ","1 次,安排"," ",(0,t.jsx)(eE,{children:null==E?void 0:E.times})," ","次的服務。"]})}),A&&(0,t.jsx)(eP,{open:R,onClose:em,serviceIds:k,recentPickableInterval:P,initServiceConfirmTime:X,showConFirmTimeRole:"serviceAdmin"===D||"vender"===D||"venderStaff"===D,servicePlans:M})]})};var eA=(0,c.memo)(ez),eW=n(41470),eL=n(3557),eO=n(8961),eB=n(79747),eU=n(62634),eF=n(46857),eV=n(60738);function eq(){let e=(0,r.Z)(["\n  ","\n"]);return eq=function(){return e},e}let eG=s.Z.span(eq(),e=>{let{theme:i}=e;return"\n    display: inline-block;\n    width: ".concat(i.typography.h6.fontSize,";\n    height: ").concat(i.typography.h6.fontSize,";\n    border: 2px solid ").concat(i.palette.secondary.light,";\n    border-radius: 50%;\n    display: flex;\n    justify-content: center;
1\n    align-items: center;\n    margin-right: ").concat(i.spacing(1.5),";\n\n    > .MuiSvgIcon-root {\n      font-size: ").concat(i.typography.body1.fontSize,";\n      color: ").concat(i.palette.secondary.light,";\n    }\n  ")}),eH=function(e,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},l="該服務分類只能擇一方案選取",o=Object.keys(t);if((0,m.Z)(t)||t[e._id])return{isServiceSingle:!1,toastMessage:l};if((null==i?void 0:i.reservationListMode)==="stateUnordered"){let r=[...o.map(e=>null==n?void 0:n[e]),null==n?void 0:n[e._id]],d=(0,eO.Z)(...r);return{isServiceSingle:!(null==d?void 0:d.length),toastMessage:"所選方案服務廠商不同無法同時選取"}}if((null==i?void 0:i.reservationListMode)!=="stateUnordered")return(null==i?void 0:i.canCrossoverStandardService)?e.isStandard?{isServiceSingle:!1,toastMessage:l}:{isServiceSingle:!0,toastMessage:l}:{isServiceSingle:!(0,m.Z)(t)&&!t[e._id],toastMessage:l}},eQ=e=>{let{servicePlan:i,showPrice:n,date:l,amount:o,region:r}=e,[s,a]=(0,c.useState)(new Date().toISOString());return(0,c.useEffect)(()=>{s&&a(new Date().toISOString())},[]),(0,t.jsxs)(d.Z,{mt:1.5,children:[(null==i?void 0:i.isStandard)?(0,t.jsx)(t.Fragment,{children:n?(0,t.jsx)(w.Z,{variant:"body1",children:(0,t.jsx)(d.Z,{fontWeight:"fontWeightBold",color:"text.minus2",children:(0,eV.os)((0,eV.fv)(i,l,r,s),o)})}):(0,t.jsx)(w.Z,{color:"secondary.light",className:"setup-region-hint",fontWeight:"fontWeightBold",children:(0,t.jsxs)(d.Z,{display:"flex",alignItems:"center",children:[(0,t.jsx)(eG,{children:(0,t.jsx)(eF.Z,{})}),(0,t.jsx)("span",{className:"setup-region-hint-text",children:"設定地區後顯示價格"})]})})}):(0,t.jsx)(w.Z,{color:"secondary.light",className:"nonstandard-price-hint",fontWeight:"fontWeightBold",children:(0,t.jsxs)(d.Z,{display:"flex",alignItems:"center",children:[(0,t.jsx)(eG,{children:(0,t.jsx)(eF.Z,{})}),(0,t.jsx)("span",{className:"nonstandard-price-hint-text",children:"需估後提供報價"})]})}),!!(null==i?void 0:i.minimumCharge)&&(null==i?void 0:i.minimumCharge)>0&&(0,t.jsxs)(w.Z,{variant:"bodyXs",color:"secondary.minus2",mt:1.5,children:["最低消費門檻:",(0,eV.os)(i.minimumCharge),"元"]})]})},eK=(0,c.memo)(eQ),eY=e=>{let{servicePlan:i,amount:n,showPrice:l,date:o,region:r}=e;return(0,t.jsx)(d.Z,{display:"flex",alignItems:"center",width:"100%",children:(0,t.jsxs)(d.Z,{flexGrow:1,children:[(0,t.jsx)(d.Z,{fontWeight:"fontWeightBold",children:i.name}),(0,t.jsx)(eK,{servicePlan:i,showPrice:l,date:o,amount:n,region:r})]})})},e$=(0,c.memo)(eY),eJ=e=>{var i,n;let{servicePlan:o,inputType:r,addressCompleted:s,date:a,isFirst:u,supportVenderMap:v,isStandard:h,servicePlansCount:f}=e,p=(0,l.I0)(),x=(0,l.v9)(W.ky),g=(null==x?void 0:null===(i=x.serviceClassificationDetail)||void 0===i?void 0:i.reservationListMode)==="stateUnordered",Z=null==x?void 0:x.serviceAddress,j=(0,c.useMemo)(()=>null==x?void 0:x.services[o._id],[null==x?void 0:x.services,o._id]),{isServiceSingle:y,toastMessage:b}=(0,c.useMemo)(()=>eH(o,null==x?void 0:x.serviceClassificationDetail,v,null==x?void 0:x.services),[o,null==x?void 0:x.serviceClassificationDetail,v,null==x?void 0:x.services]),C=()=>{p((0,W.Sh)(o))},S=(0,c.useCallback)(()=>{y?(p((0,W.jH)({servicePlan:o,isServiceSingle:y,inputType:r,crossSelect:!1})),"radio"===r||(0,m.Z)(null==x?void 0:x.services)||p((0,q.fz)({open:!0,message:b}))):h?(null==o?void 0:o.isStandardRepeatable)?p((0,W.ne)(o)):p((0,W.jH)({servicePlan:o,isServiceSingle:y,inputType:r,crossSelect:!1})):(p((0,W.jH)({servicePlan:o,isServiceSingle:y,inputType:r,crossSelect:!g})),"radio"===r||(0,m.Z)(null==x?void 0:x.services)||g||p((0,q.fz)({open:!0,message:b})))},[y,h,r,null==x?void 0:x.services,null==o?void 0:o.isStandardRepeatable]);if((0,c.useEffect)(()=>{1===f&&(0,m.Z)(null==x?void 0:x.services)&&s&&S()},[f,null==x?void 0:x.services,s]),!(null==o?void 0:o.isStandardRepeatable)&&"radio"===r)return(0,t.jsx)(d.Z,{mt:!u&&4,width:"100%",children:(0,t.jsx)(eB.Z,{disabled:!s,name:null===(n=o.classification)||void 0===n?void 0:n._id,value:o._id,onClick:S,checked:!!j,fullWidth:!0,children:(0,t.jsx)(eY,{servicePlan:o,amount:null==j?void 0:j.count,showPrice:s,date:a,region:Z})})});{let I=!1;if(o.isStandardRepeatable){let k=o.repeatableQuantity||0,_=(null==j?void 0:j.count)||0;I=k>0&&_>=k}return(0,t.jsxs)(d.Z,{mt:!u&&4,width:"100%",children:[(0,t.jsx)(eU.Z,{fullWidth:!0,checked:!!j,count:null==j?void 0:j.count,multiple:null==o?void 0:o.isStandardRepeatable,onClick:S,onRemove:C,addDisabled:I,disabled:!s,isMargin:!1,multipleControlDirection:"horizontal",children:(0,t.jsx)(e$,{servicePlan:o,amount:null==j?void 0:j.count,showPrice:s,date:a,region:Z})}),(null==o?void 0:o.isStandardRepeatable)&&(0,t.jsx)(w.Z,{variant:"bodySmall",color:"text.disabled",mt:2,children:(null==o?void 0:o.repeatableQuantity)&&(null==o?void 0:o.repeatableQuantity)>0?"最多".concat(null==o?void 0:o.repeatableQuantity,"組"):"無上限"})]})}};var eX=(0,c.memo)(eJ);let e0=function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,t=arguments.length>3?arguments[3]:void 0;return(n||t?i.some(e=>e.isStandardRepeatable):(null==e?void 0:e.reservationListMode)==="stateUnordered"?null==e?void 0:e.canCrossoverService:!(!(null==e?void 0:e.canCrossoverStandardService)&&i.every(e=>!e.isStandardRepeatable)))?"checkbox":"radio"},e1=e=>{var i,n,o;let{isAnyActivate:r,isStandard:s,serviceClassificationId:a,servicePlans:u}=e,v=(0,l.v9)(W.ky),m=(null==v?void 0:null===(i=v.serviceClassificationDetail)||void 0===i?void 0:i.mode)==="relocation",h=(0,c.useMemo)(()=>e0(null==v?void 0:v.serviceClassificationDetail,u,r,m),[null==v?void 0:v.serviceClassificationDetail,u,r,m]),f=(0,c.useMemo)(()=>{var e,i;return(null==v?void 0:null===(e=v.serviceAddress)||void 0===e?void 0:e.county)&&(null==v?void 0:null===(i=v.serviceAddress)||void 0===i?void 0:i.district)},[null==v?void 0:null===(n=v.serviceAddress)||void 0===n?void 0:n.county,null==v?void 0:null===(o=v.serviceAddress)||void 0===o?void 0:o.district]),{data:p}=(0,eL.i)(Object.keys((null==v?void 0:v.services)||{}));return(0,t.jsx)(d.Z,{width:"100%",children:(0,t.jsx)(O.Z,{fullWidth:!0,children:"radio"===h?(0,t.jsx)(eW.Z,{name:a,children:null==u?void 0:u.map((e,i)=>{var n,l;return(0,t.jsx)(eX,{isFirst:0===i,inputType:h,servicePlan:e,addressCompleted:f,date:(null==v?void 0:null===(n=v.serviceDateTime)||void 0===n?void 0:n.from)||(null==v?void 0:null===(l=v.serviceConfirmTime)||void 0===l?void 0:l.selectedDate),supportVenderMap:p,isStandard:s,servicePlansCount:u.length},e._id)})}):(0,t.jsx)(t.Fragment,{children:null==u?void 0:u.map((e,i)=>{var n,l;return(0,t.jsx)(eX,{isFirst:0===i,inputType:h,servicePlan:e,addressCompleted:f,date:(null==v?void 0:null===(n=v.serviceDateTime)||void 0===n?void 0:n.from)||(null==v?void 0:null===(l=v.serviceConfirmTime)||void 0===l?void 0:l.selectedDate),supportVenderMap:p,isStandard:s,servicePlansCount:u.length},e._id)})})})})};e1.defaultProps={servicePlans:[],inputType:"radio"};var e2=(0,c.memo)(e1);let e7=e=>(0,z.Ev)((0,z.UY)("/services",e));var e3=n(84104),e6=n(96329),e4=n(20796);let e5=S()(()=>Promise.all([n.e(5795),n.e(7192)]).then(n.bind(n,7192)),{loadableGenerated:{webpack:()=>[7192]}}),e9=e=>{var i,n,r,s,a,u,v,h,f;let{serviceIds:p,setServiceIds:x,serviceDetails:g,setServiceDetails:Z,isStandard:j,serviceClassificationId:y,setServiceClassificationId:b,isServiceClfIdLock:C,setIsServiceClfIdError:S,selfConstructRole:w}=e,I=(0,l.I0)(),k=(0,l.v9)(W.ky),_=(0,l.v9)(o.k$),[E,P]=(0,c.useState)(!1),[D,T]=(0,c.useState)(null),[N,R]=(0,c.useState)([]),z=(0,c.useMemo)(()=>{var e,i;return(null==k?void 0:null===(e=k.serviceAddress)||void 0===e?void 0:e.county)&&(null==k?void 0:null===(i=k.serviceAddress)||void 0===i?void 0:i.district)},[null==k?void 0:null===(i=k.serviceAddress)||void 0===i?void 0:i.county,null==k?void 0:null===(n=k.serviceAddress)||void 0===n?void 0:n.district]),A=(0,c.useMemo)(()=>N.some(e=>{var i;return e.packageInfo&&(null==e?void 0:null===(i=e.packageInfo)||void 0===i?void 0:i.isActivate)}),[N]),L=(0,c.useMemo)(()=>{let e=(null==g?void 0:g.map(e=>e.recentPickableInterval))||[];return(0,m.Z)(e)?7:Math.max(...e)},[g]),{data:U}=(0,e4.$)({isDisplayBelowBannerInfo:!0,isSelfBookingSource:null!=_&&!!_.active,isGetBelongsSubCatalogs:!0,isVisible:!0}),F=()=>z?(0,m.Z)(p)?(I((0,q.fz)({open:!0,message:"請先選擇方案"})),!1):void 0:(I((0,q.fz)({open:!0,message:"請先設定縣市、地區"})),!1);(0,c.useEffect)(()=>{let e=async()=>{let[e,i]=await e7({classificationId:y,displayVisible:"all"});i||R(e)},i=async()=>{var e,i;let[n,t]=await e7({classificationId:y,displayVisible:"all",county:null==k?void 0:null===(e=k.serviceAddress)||void 0===e?void 0:e.county,district:null==k?void 0:null===(i=k.serviceAddress)||void 0===i?void 0:i.district});t||R(n)};if(!(0,m.Z)(y)){var n,t,l,o;(0,m.Z)(null==k?void 0:null===(n=k.serviceAddress)||void 0===n?void 0:n.county)&&(0,m.Z)(null==k?void 0:null===(t=k.serviceAddress)||void 0===t?void 0:t.district)&&e(),(null==k?void 0:null===(l=k.serviceAddress)||void 0===l?void 0:l.county)&&(null==k?void 0:null===(o=k.serviceAddress)||void 0===o?void 0:o.district)&&i()}},[y,null==k?void 0:null===(r=k.serviceAddress)||void 0===r?void 0:r.county,null==k?void 0:null===(s=k.serviceAddress)||void 0===s?void 0:s.district]),(0,c.useEffect)(()=>{let e=async()=>{let[e,i]=await (0,e3.J)(y);i?S(!0):I((0,W.JW)(e))};(0,m.Z)(y)||e()},[y]),(0,c.useEffect)(()=>{let e=async()=>{let e=await Promise.all(null==p?void 0:p.map(e=>(0,e6.k)(e)));e&&Z((0,K.Z)(e))};(0,m.Z)(p)?Z([]):e()},[p]);let G=(0,c.useMemo)(()=>{var e;return g&&(null===(e=g[0])||void 0===e?void 0:e.packageInfo)||{}},[g]);return(0,t.jsxs)(d.Z,{mb:4,children:[(0,t.jsx)(d.Z,{mb:4,children:(0,t.jsxs)(O.Z,{fullWidth:!0,children:[(0,t.jsx)(B.Z,{id:"select-service-label",children:"*選擇預約服務"}),(0,t.jsx)(V.Z,{labelId:"select-service-label",muiLabel:"*選擇預約服務",id:"service-info",open:!1,value:!!D||!(0,m.Z)(null==k?void 0:k.serviceClassificationDetail)||"",native:!1,displayEmpty:!0,onClick:()=>!C&&P(!0),disabled:C,children:(0,t.jsxs)(Y.Z,{value:!0,children:[!!D&&(0,t.jsx)(t.Fragment,{children:null==D?void 0:D.name}),!D&&!(0,m.Z)(null==k?void 0:k.serviceClassificationDetail)&&(0,t.jsx)(t.Fragment,{children:null==k?void 0:null===(a=k.serviceClassificationDetail)||void 0===a?void 0:a.name})]})})]})}),(0,t.jsx)(el,{}),y&&(0,t.jsx)(d.Z,{mb:4,children:(0,t.jsx)(e2,{isAnyActivate:A,isStandard:j,serviceClassificationId:y,servicePlans:N})}),(null==k?void 0:null===(u=k.serviceClassificationDetail)||void 0===u?void 0:u.reservationListMode)==="stateOrdered"&&(0,t.jsx)(eA,{serviceIds:p,onBookingDateClick:F,packageInfo:G,recentPickableInterval:L,selfConstructRole:w,servicePlans:N}),(null==k?void 0:null===(v=k.serviceClassificationDetail)||void 0===v?void 0:v.reservationListMode)==="stateUnordered"&&(0,t.jsx)(ec,{}),(null==k?void 0:null===(h=k.serviceClassificationDetail)||void 0===h?void 0:h.mode)==="relocation"&&(null==k?void 0:null===(f=k.serviceClassificationDetail)||void 0===f?void 0:f.isAddMoveInAddressInfo)&&(0,t.jsxs)(d.Z,{mt:12.5,
1children:[(0,t.jsx)(M,{content:"填寫遷入地址",isAllRequire:!0}),(0,t.jsx)(ea,{})]}),(0,t.jsx)(e5,{open:E,onClose:()=>P(!1),setServiceModalOpen:P,catalogsData:U,setServiceClassification:T,setServiceClassificationId:b,setServiceIds:x})]})};var e8=(0,c.memo)(e9),ie=n(95773),ii=n(30301),it=n(16995),il=n(39477),io=n(25425),ir=n(58735),id=n(70918);function is(){let e=(0,r.Z)(["\n  width: calc(100% - 60px);\n  max-width: 540px;\n  z-index: 0;\n"]);return is=function(){return e},e}let ia=(0,s.Z)(id.Z)(is()),iu=()=>{let e=(0,l.I0)(),i=(0,l.v9)(W.ky),[n,o]=(0,c.useState)(!1),[r,s]=(0,c.useState)(null==i?void 0:i.vatNo),[a,u]=(0,c.useState)(null==i?void 0:i.vatTitle);(0,c.useEffect)(()=>{s(null==i?void 0:i.vatNo),u(null==i?void 0:i.vatTitle)},[null==i?void 0:i.vatNo,null==i?void 0:i.vatTitle]);let v=()=>{e((0,W.Ot)(r)),e((0,W.nJ)(a)),o(!1)},m=()=>{e((0,W.Ot)("")),e((0,W.nJ)("")),o(!1)};return(0,t.jsxs)(O.Z,{fullWidth:!0,children:[(0,t.jsx)(B.Z,{id:"select-vat-label",children:"統編設定"}),(0,t.jsx)(V.Z,{labelId:"select-vat-label",muiLabel:"統編設定",open:!1,value:!!(null==i?void 0:i.vatNo)&&!!(null==i?void 0:i.vatTitle)||"",native:!1,displayEmpty:!0,onClick:()=>o(!0),fullWidth:!0,children:(0,t.jsxs)(Y.Z,{value:!0,children:[(0,t.jsx)("div",{children:null==i?void 0:i.vatNo}),(0,t.jsx)("div",{children:null==i?void 0:i.vatTitle})]})}),(0,t.jsx)(il.Z,{open:n,onClose:()=>o(!1),closeAfterTransition:!0,BackdropComponent:ir.Z,BackdropProps:{timeout:500},children:(0,t.jsx)(io.Z,{direction:"up",in:n,children:(0,t.jsx)(d.Z,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",children:(0,t.jsxs)(ia,{children:[(0,t.jsx)(d.Z,{display:"flex",alignItems:"center",children:(0,t.jsx)(d.Z,{flexGrow:1,p:5,children:(0,t.jsx)(w.Z,{variant:"h6",children:"設定統編"})})}),(0,t.jsxs)(d.Z,{p:7.5,children:[(0,t.jsx)(d.Z,{mb:2,children:(0,t.jsx)(T.Z,{placeholder:"請輸入統一編號",variant:"outlined",fullWidth:!0,value:r,onChange:e=>s(e.target.value),inputProps:{inputMode:"numeric",maxLength:8}})}),(0,t.jsx)(w.Z,{variant:"body2",children:(0,t.jsx)(d.Z,{color:"text.disabled",mb:4,children:"選填,若需打統編則必填"})}),(0,t.jsx)(d.Z,{mb:2,children:(0,t.jsx)(T.Z,{placeholder:"請輸入公司抬頭",variant:"outlined",fullWidth:!0,value:a,onChange:e=>u(e.target.value)})}),(0,t.jsx)(w.Z,{variant:"body2",children:(0,t.jsx)(d.Z,{color:"text.disabled",mb:4,children:"選填,若需打統編則必填"})})]}),(0,t.jsxs)(d.Z,{p:5,wrap:"nowrap",display:"flex",justifyContent:"flex-end",children:[(null==i?void 0:i.vatNo)&&(null==i?void 0:i.vatTitle)&&(0,t.jsx)(d.Z,{flexGrow:1,children:(0,t.jsx)(E.Z,{variant:"outlined",onClick:m,children:"不填寫統編"})}),(0,t.jsx)(d.Z,{pr:2,children:(0,t.jsx)(E.Z,{variant:"outlined",fullWidth:!0,onClick:()=>o(!1),children:"取消"})}),(0,t.jsx)(d.Z,{children:(0,t.jsx)(E.Z,{variant:"contained",color:"primary",fullWidth:!0,onClick:v,disabled:!r||!a,children:"確認"})})]})]})})})})]})},ic=S()(()=>Promise.all([n.e(1743),n.e(6685)]).then(n.bind(n,90227)),{loadableGenerated:{webpack:()=>[90227]}}),iv=e=>{var i;let{onConfirm:n,onDeselect:o,basicFee:r,sourceRestriction:d,isStandard:s,serviceIds:a,customerId:u}=e,v=(0,l.v9)(W.ky),[h,f]=(0,c.useState)(!1),[p,x]=(0,c.useState)(!1);(0,c.useEffect)(()=>{h?x(!0):setTimeout(()=>x(!1),500)},[h]);let g=()=>{u&&f(!0)},Z=async e=>{if("function"==typeof n){let i=await n(e);!1!==i&&f(!1)}},j=()=>{"function"==typeof o&&(o(),f(!1))};return(0,t.jsxs)(O.Z,{fullWidth:!0,children:[(0,t.jsx)(B.Z,{id:"select-coupon-label",children:"選擇優惠券"}),(0,t.jsx)(V.Z,{labelId:"select-coupon-label",muiLabel:"*選擇優惠券",open:!1,value:!(0,m.Z)(null==v?void 0:v.coupon)||"",native:!1,displayEmpty:!0,onClick:g,disabled:!u,children:(0,t.jsx)(Y.Z,{value:!0,children:null==v?void 0:null===(i=v.coupon)||void 0===i?void 0:i.title})}),p&&(0,t.jsx)(ic,{open:h,onClose:()=>f(!1),onConfirm:Z,onDeselect:j,checkUsage:!0,checkStandardUsage:s,presentCost:r,serviceIds:a,sourceRestriction:d,customerId:u})]})};var im=n(47983),ih=n(62756),ip=n(73221),ix=n(86377);let ig=(e,i,n)=>{let[t,l]=(0,c.useState)([]),[o,r]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let t=async()=>{let t=(e||[]).map(e=>e.paymentMethods).reduce((e,i)=>(null==e?void 0:e.length)?(0,eO.Z)(e,i):i,[]).filter(e=>"applePay"!==e&&"test"!==ip.Wi||"test"==ip.Wi),o=await (0,im.Y)(t,null==n?void 0:n.name,null==n?void 0:n.device,null==n?void 0:n.appVersion);(0,f.Z)(o,"cash")||o.push("cash"),i||(0,f.Z)(o,"card")||o.push("card"),(0,f.Z)(o,"branchBudget")||o.push("branchBudget"),l(o),r(!0)};(null==n?void 0:n.initialized)&&e&&t()},[i,e,null==n?void 0:n.appVersion,null==n?void 0:n.device,null==n?void 0:n.initialized,null==n?void 0:n.name]),{validPaymentMethods:t,isValidPaymentMethodsReady:o}},iZ=e=>{var i,n;let{customerId:o,reservationId:r,serviceIds:s,serviceDetails:a,isStandard:u}=e,v=(0,l.I0)(),h=(0,l.v9)(W.ky),f=(0,l.v9)(ix.hn),[p,j]=(0,c.useState)(!1),[y,b]=(0,c.useState)(0),[C,S]=(0,c.useState)(null),I=(null==h?void 0:null===(i=h.serviceClassificationDetail)||void 0===i?void 0:i.reservationListMode)==="stateUnordered",{validPaymentMethods:k}=ig(a,I,f),_=e=>{v((0,W.tl)(e))},E=()=>{var e;v((0,W.si)(null==h?void 0:null===(e=h.customerContact)||void 0===e?void 0:e.email))};(0,c.useEffect)(()=>{var e,i,n,t,l;if((null==h?void 0:h.isCheckingBookedSession)&&(0,it.P)(null==h?void 0:h.serviceConfirmTime)){let o=(0,ii.Z)((0,x.Z)((0,g.Z)((0,Z.Z)(null==h?void 0:null===(i=h.serviceConfirmTime)||void 0===i?void 0:i.selectedDate),Number(null==h?void 0:null===(n=h.serviceConfirmTime)||void 0===n?void 0:n.hour)),Number(null==h?void 0:null===(t=h.serviceConfirmTime)||void 0===t?void 0:t.minute))).toISOString();S(o)}(null==h?void 0:h.isCheckingBookedSession)||(0,m.Z)(null==h?void 0:null===(e=h.serviceDateTime)||void 0===e?void 0:e.from)||S(null==h?void 0:null===(l=h.serviceDateTime)||void 0===l?void 0:l.from)});let P=async e=>{var i,n,t;let[l,d]=await (0,ih.j)({aim:null==h?void 0:null===(i=h.serviceClassificationDetail)||void 0===i?void 0:i.reservationListMode,code:null==e?void 0:e.code,presentCost:y,expectedTime:C,sourceRestriction:null==f?void 0:f.name,serviceIds:s,isForThirdStage:u,customerId:o,reservationId:r,isDirectlyBuild:!0});d||!l.allowUse?v((0,q.fz)({open:!0,message:null===(n=l.denyReasons)||void 0===n?void 0:null===(t=n[0])||void 0===t?void 0:t.message})):v((0,W.BB)(e))},D=()=>{v((0,W.BB)({}))};return(0,c.useEffect)(()=>{k?v((0,W.tl)({method:"cash"})):v((0,W.tl)({}))},[k]),(0,c.useEffect)(()=>
1{if(a){let e=a.map(e=>e.basicPrice).reduce((e,i)=>e+i,0);b(e)}},[a]),(0,t.jsx)(d.Z,{children:(0,t.jsxs)(O.Z,{fullWidth:!0,children:[(0,t.jsx)(ie.Z,{isSelfConstruct:!0,placeholder:"*選擇付款方式",value:k.length?null==h?void 0:h.payment:"",disabled:!1,open:p,onClick:()=>j(!0),onClose:()=>j(!1),onConfirm:_,validPaymentMethods:k,onUserEmailChange:E,userEmailCandidate:null==h?void 0:null===(n=h.customerContact)||void 0===n?void 0:n.email}),(0,t.jsx)(d.Z,{my:4,children:(0,t.jsx)(O.Z,{fullWidth:!0,children:(0,t.jsx)(iv,{onConfirm:P,onDeselect:D,basicFee:y,sourceRestriction:null==f?void 0:f.name,isStandard:u,serviceIds:s,customerId:o})})}),(0,t.jsx)(O.Z,{fullWidth:!0,children:(0,t.jsx)(iu,{})}),(0,t.jsx)(w.Z,{variant:"body2",children:(0,t.jsx)(d.Z,{color:"text.disabled",mt:2,mb:4,children:"選填,發票需打統編請設定"})})]})})};var ij=(0,c.memo)(iZ),iy=n(69884),ib=n(23508),iC=n(60181),iS=n(54996),iw=n(82287),iI=n(73605);let ik=e=>{let{customization:i}=e,n=!!i.quantityMax||!!i.quantityMin;return(0,t.jsxs)(t.Fragment,{children:["multiple"===i.selectType&&!n&&(0,t.jsx)(t.Fragment,{children:"可複選"}),"multiple"===i.selectType&&n&&(0,t.jsxs)(t.Fragment,{children:[!!i.quantityMin&&"至少".concat(i.quantityMin,"項"),!!i.quantityMin&&!!i.quantityMax&&"、",!!i.quantityMax&&"最多".concat(i.quantityMax,"項")]})]})},i_=e=>{let{customization:i}=e;return(0,t.jsx)(iw.Z,{title:i.title,remark:(0,t.jsx)(ik,{customization:i})})};var iE=n(46779),iP=n(18450);function iD(){let e=(0,r.Z)(["\n  width: 100%;\n  border-collapse: collapse;\n"]);return iD=function(){return e},e}function iM(){let e=(0,r.Z)(["\n  padding: 0;\n"]);return iM=function(){return e},e}function iT(){let e=(0,r.Z)(["\n  padding: 0;\n  min-width: 50%;\n"]);return iT=function(){return e},e}let iN=s.Z.table(iD()),iR=s.Z.td(iM()),iz=s.Z.td(iT()),iA=e=>{e.stopPropagation(),32===e.keyCode&&e.preventDefault()},iW=e=>{e.stopPropagation()},iL=e=>{e.stopPropagation(),e.preventDefault()},iO=e=>{e.stopPropagation()},iB=e=>{let{item:i,showPrice:n,inputText:l,onInputTextChange:o,count:r}=e,s=e=>{o(i,e.target.value)};return(0,t.jsxs)(d.Z,{display:"flex",alignItems:"center",width:"100%",children:[(0,t.jsxs)(d.Z,{children:[(0,t.jsx)(d.Z,{fontWeight:"fontWeightBold",children:i.name}),!!i.description&&(0,t.jsx)(d.Z,{color:"text.secondary",children:(0,t.jsx)(w.Z,{children:i.description})}),!!i.addCost&&(0,t.jsx)(w.Z,{variant:"body1",children:(0,t.jsxs)(d.Z,{fontWeight:"fontWeightBold",color:"text.minus2",children:[i.addCost<0&&"-",(0,eV.os)(Math.abs(i.addCost),r>1?r:1)]})})]}),(null==i?void 0:i.isCustomizedOption)&&(0,t.jsx)(iP.dz,{flexGrow:1,ml:5,children:(0,t.jsx)(T.Z,{placeholder:(i.required?"*必填":"選填")+"輸入欄位",variant:"outlined",fullWidth:!0,onMouseDown:iO,onFocus:iL,onClick:iW,value:l,onChange:s,onKeyUp:iA})})]})},iU=e=>{var i,n,o,r;let{customization:s}=e,a=(0,l.I0)(),u=(0,l.v9)(W.ky),c=null==u?void 0:null===(i=u.customizations)||void 0===i?void 0:i[null==s?void 0:s._id],v=e=>{(null==s?void 0:s.isRepeatable)?p(e,null==s?void 0:s._id):g(e,null==s?void 0:s._id)},f=(e,i)=>{j(e,null==s?void 0:s._id,i)},p=(e,i)=>{let n=(0,h.Z)(null==u?void 0:u.customizations);n[i]||(n[i]={}),n[i][e._id]?n[i][e._id].count+=1:n[i][e._id]={itemId:e._id,count:1},a((0,W.Kd)(n))},x=(e,i)=>{var n,t,l,o;let r=(0,h.Z)(null==u?void 0:u.customizations);(null===(n=r[i])||void 0===n?void 0:null===(t=n[e._id])||void 0===t?void 0:t.count)<=1?((null===(l=r[i])||void 0===l?void 0:null===(o=l[e._id])||void 0===o?void 0:o.customizedValue)?r[i][e._id].count=0:delete r[i][e._id],(0,m.Z)(r[i])&&delete r[i]):r[i][e._id].count-=1,a((0,W.Kd)(r))},g=(e,i)=>{var n;let t=(0,h.Z)(null==u?void 0:u.customizations);(null==t?void 0:null===(n=t[i])||void 0===n?void 0:n[e._id])?(delete t[i][e._id],(0,m.Z)(t[i])&&delete t[i]):(t[i]||(t[i]={}),t[i][e._id]={itemId:e._id,count:1}),a((0,W.Kd)(t))},Z=(e,i,n)=>{let t=(0,h.Z)(null==u?void 0:u.customizations);for(let l in t[i])l!==e._id&&(t[i][l].customizedValue?t[i][l].count=0:delete t[i][l]);t[i]||(t[i]={}),t[i][e._id]={itemId:e._id,count:1},n&&(t[i][e._id].customizedValue=n),a((0,W.Kd)(t))},j=(e,i,n)=>{var t;let l=(0,h.Z)(null==u?void 0:u.customizations);l[i]||(l[i]={}),(null===(t=l[i])||void 0===t?void 0:t[e._id])?l[i][e._id].customizedValue=n:l[i][e._id]={itemId:e._id,c
1ount:0,customizedValue:n},a((0,W.Kd)(l))},y=(e,i)=>{var n,t;!i||(null==c?void 0:null===(n=c[e._id])||void 0===n?void 0:n.count)?!i&&(null==c?void 0:null===(t=c[e._id])||void 0===t?void 0:t.count)>0&&x(e,null==s?void 0:s._id):p(e,null==s?void 0:s._id),j(e,null==s?void 0:s._id,i)},b=(e,i)=>{var n,t;let l=(null==i?void 0:null===(n=i.toISOString)||void 0===n?void 0:n.call(i))||i,o=(0,h.Z)(null==u?void 0:u.customizations),r=null==s?void 0:s._id;(null==o?void 0:o[r])||(o[r]={}),(null===(t=o[r])||void 0===t?void 0:t[e._id])?l?o[r][e._id].customizedValue=l:delete o[r][e._id]:o[r][e._id]={itemId:e._id,count:1,customizedValue:l},a((0,W.Kd)(o))};if((null==s?void 0:s.selectType)==="single")return(0,t.jsx)(eW.Z,{name:null==s?void 0:s._id,children:null===(n=s.items)||void 0===n?void 0:n.map(e=>{var i,n,l,o,r;return(0,t.jsx)(eB.Z,{name:null==s?void 0:s._id,value:e._id,checked:(null==c?void 0:null===(i=c[e._id])||void 0===i?void 0:i.count)>0,onClick(){var i;return Z(e,null==s?void 0:s._id,null==c?void 0:null===(i=c[e._id])||void 0===i?void 0:i.customizedValue)},bottomContent:!!e.isCustomizedOption&&(0,t.jsx)(iP.aI,{mx:4,mb:4,textAlign:"left",children:(0,t.jsx)(T.Z,{placeholder:(e.required?"*必填":"選填")+"輸入欄位",variant:"outlined",fullWidth:!0,onMouseDown:iO,onFocus:iL,onKeyUp:iA,value:null==c?void 0:null===(n=c[e._id])||void 0===n?void 0:n.customizedValue,onChange:i=>f(e,i.target.value)})}),children:(0,t.jsx)(iB,{item:e,inputText:null==u?void 0:null===(l=u.customizations)||void 0===l?void 0:null===(o=l[e._id])||void 0===o?void 0:o.customizedValue,onInputTextChange:f,count:null==c?void 0:null===(r=c[e._id])||void 0===r?void 0:r.count})},e._id)})});if((null==s?void 0:s.selectType)==="multiple"){let C=Object.values(c||{}).map(e=>null==e?void 0:e.count).reduce((e,i)=>e+i,0),S=s.quantityMax&&C>=s.quantityMax;return(0,t.jsx)(O.Z,{fullWidth:!0,component:"fieldset",children:null===(o=s.items)||void 0===o?void 0:o.map(e=>{var i,n,l,o,r;return(0,t.jsx)(eU.Z,{checked:(null==c?void 0:null===(i=c[e._id])||void 0===i?void 0:i.count)>0,multiple:s.isRepeatable,multipleControlDirection:"horizontal",count:null==c?void 0:null===(n=c[e._id])||void 0===n?void 0:n.count,onClick:()=>v(e),onRemove:()=>x(e,null==s?void 0:s._id),addDisabled:S,disabled:!!S&&!(null==c?void 0:c[e._id]),bottomContent:!!e.isCustomizedOption&&(0,t.jsx)(iP.aI,{mx:4,mb:4,textAlign:"left",children:(0,t.jsx)(T.Z,{placeholder:(e.required?"*必填":"選填")+"輸入欄位",variant:"outlined",fullWidth:!0,onMouseDown:iO,onFocus:iL,onClick:iW,onKeyUp:iA,value:null==c?void 0:null===(l=c[e._id])||void 0===l?void 0:l.customizedValue,onChange:i=>f(e,i.target.value)})}),children:(0,t.jsx)(iB,{item:e,showPrice:s.isAcceptance,inputText:null==c?void 0:null===(o=c[e._id])||void 0===o?void 0:o.customizedValue,onInputTextChange:f,count:null==c?void 0:null===(r=c[e._id])||void 0===r?void 0:r.count})},e._id)})})}return(null==s?void 0:s.selectType)==="customizedInput"?(0,t.jsx)(iN,{children:null===(r=s.items)||void 0===r?void 0:r.map(e=>{var i,n;return(0,t.jsxs)("tr",{children:[(0,t.jsx)(iR,{children:(0,t.jsx)(d.Z,{mb:4,children:(0,t.jsx)(w.Z,{variant:"h6",children:e.name})})}),(0,t.jsx)(iz,{children:(0,t.jsxs)(d.Z,{mb:4,children:["word"===e.expandedItem&&(0,t.jsx)(T.Z,{placeholder:e.required?"*必填":"選填",variant:"outlined",fullWidth:!0,value:null==c?void 0:null===(i=c[e._id])||void 0===i?void 0:i.customizedValue,handleInputMouseDown:iO,onKeyUp:iA,onChange:i=>y(e,i.target.value)}),"date"===e.expandedItem&&(0,t.jsx)(iE.Z,{date:null==c?void 0:null===(n=c[e._id])||void 0===n?void 0:n.customizedValue,onChange:i=>b(e,i),placeholder:e.required&&"*選擇日期"})]})})]},e._id)})}):null};function iF(){let e=(0,r.Z)(["\n  &.MuiButton-root {\n    width: 100%;\n    margin: ",";\n  }\n"]);return iF=function(){return e},e}function iV(){let e=(0,r.Z)(["\n  ","\n"]);return iV=function(){return e},e}function iq(){let e=(0,r.Z)(["\n  ","\n"]);return iq=function(){return e},e}let iG=(0,s.Z)(E.Z)(iF(),e=>e.isShow?"32px 0 4px":"4px 0px"),iH=(0,s.Z)(ib.Z)(iV(),e=>{let{theme:i}=e;return"\n    fill: ".concat(i.palette.text.primary,";\n  ")}),iQ=(0,s.Z)(iC.Z)(iq(),e=>{let{theme:i}=e;return"\n    fill: ".concat(i.palette.text.primary,";\n  ")}),iK=e=>{let{customizationItems:i,hasSiteImages:n,isImagesUploading:o,setIsImagesUploading:r}=e,s=(0,l.I0)(),a=(0,l.v9)(W.ky),[u,v]=(0,c.useState)(!1),h=(e,i)=>{s((0,W.jh)((0,iy.Z)(i,e=>e._id)))},f=()=>{o||v(!1)};return(0,c.useEffect)(()=>{n||(0,m.Z)(null==a?void 0:a.siteImages)||s((0,W.jh)({}))},[n,null==a?void 0:a.siteImages]),(0,t.jsxs)(d.Z,{p:5,backgroundColor:"#F8FFE8",children:[u&&!!i.length&&(null==i?void 0:i.map((e,i)=>(0,t.jsxs)(d.Z,{children:[0===i?(0,t.jsx)(iS.Z,{mb:7.5,children:(0,t.jsx)(i_,{customization:e})}):(0,t.jsx)(d.Z,{mt:12.5,mb:7.5,fontWeight:"fontWeightBold",children:(0,t.jsx)(i_,{customization:e})}),(0,t.jsx)(d.Z,{children:(0,t.jsx)(iU,{customization:e})})]},e._id))),u&&n&&(0,t.jsxs)(d.Z,{children:[(0,t.jsx)(iw.Z,{mt:!!i.length&&12.5,mb:7.5,title:"上傳說明圖片"}),(0,t.jsx)(d.Z,{children:(0,t.jsx)(iI.Z,{isSelfConstructPage:!0,files:Object.values(null==a?void 0:a.siteImages),fileType:"image",maxFiles:10,fileSizeLimit:"1000000",onChange:h,onError(e){s((0,q.fz)({open:!0,message:e.message}))},onUploadStart:()=>r(!0),onUploadFinish:()=>r(!1)})})]}),!u&&(0,t.jsxs)(iG,{isShow:!1,onClick:()=>v(!0),children:[(0,t.jsx)(w.Z,{variant:"body2",color:"text.primary",children:"展開補充資訊"}),(0,t.jsx)(iH,{})]}),u&&(0,t.jsxs)(iG,{isShow:!0,onClick:f,children:[(0,t.jsx)(w.Z,{variant:"body2",color:"text.primary",children:"收合補充資訊"}),(0,t.jsx)(iQ,{})]})]})};var iY=n(70754),i$=n(61225),iJ=n(62097);function iX(){let e=(0,r.Z)(["\n  width: 100vw;\n  height: 100vh;\n  position: fixed;\n  top: 0;\n  left: 0;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  background-color: rgba(100, 100, 100, 0.1);\n  z-index: 10;\n"]);return iX=function(){return e},e}let i0=(0,s.Z)(d.Z)(iX()),i1=()=>{let e=(0,iJ.Z)(),i=(0,i$.Z)(e.breakpoints.down("sm"));return(0,t.jsx)(i0,{children:(0,t.jsx)(iY.Z,{color:"primary",size:i?40:60})})};var i2=n(83868),i7=n.n(i2),i3=n(28355),i6=n(30663),i4=n(68056),i5=n(2315),i9=n(1447);let i8=e=>{var i;
1let{coupon:n,email:t,payment:l,selfBookingInfo:o,moveInAddress:r,...d}=e,s={...d,customizations:(0,i9.G)(null==d?void 0:d.customizations),siteImages:Object.values(null==d?void 0:d.siteImages).map(e=>e._id),paymentMethod:null==l?void 0:l.method,selfBookingInfo:o};return t&&(s.email=t),n&&(s.couponId=null==n?void 0:n._id),(null===(i=r[0])||void 0===i?void 0:i.county)&&(s.moveInAddress=r),s},ne=function(e,i){var n;let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},l=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"stateOrdered",r=arguments.length>5?arguments[5]:void 0,d=i8(e),s={...d,utm:t,isStandard:l,envInfo:(0,i5.bz)(i)};return(null==i?void 0:i.name)&&(null==i?void 0:i.name)!=="lsApp"&&(s.sourceRestriction=null==i?void 0:i.name),(0,m.Z)(null==i?void 0:i.additionalNote)||(s.additionalNote=i.additionalNote),(0,m.Z)(null==i?void 0:i.serviceAdminNote)||(s.serviceAdminNote=i.serviceAdminNote),(0,m.Z)(null==i?void 0:i.priorityVenderIds)||(s.vendersAssignedPriority=i.priorityVenderIds),(null==r?void 0:null===(n=r.vender)||void 0===n?void 0:n._id)&&(s.dispatchVenderId=r.vender._id),(null==r?void 0:r._id)&&(s.selfBookingInfo.fromUserBookedReservation=r._id),(0,z.Ev)((0,z.HR)(("stateUnordered"===o?"/unorderedReservations":"/reservations")+"/selfConstructedBooking",s))};var ni=n(35904),nn=n(21095),nt=n(83832),nl=n(27582),no=n(17797),nr=n(53130);let nd=S()(()=>Promise.all([n.e(9361),n.e(9921)]).then(n.bind(n,48069)),{loadableGenerated:{webpack:()=>[48069]}}),ns=S()(()=>n.e(3187).then(n.bind(n,33187)),{loadableGenerated:{webpack:()=>[33187]}}),na=S()(()=>Promise.all([n.e(9361),n.e(6234)]).then(n.bind(n,76234)),{loadableGenerated:{webpack:()=>[76234]}}),nu=(e,i)=>{var n,t,l;let o=(e,i)=>e.name===i.name&&e.addCost===i.addCost;return["selectType","quantityMin","quantityMax","isRepeatable","isAcceptance"].every(n=>e[n]===i[n])&&(null===(n=e.items)||void 0===n?void 0:n.length)===(null===(t=i.items)||void 0===t?void 0:t.length)&&(null===(l=e.items)||void 0===l?void 0:l.every((e,n)=>o(e,i.items[n])))},nc=e=>{let i=[];return Object.keys(e).forEach(n=>{i.push(e[n])}),i},nv=e=>{let{isGenFeeCheck:i,isBusy:n,onConfirm:l}=e;return(0,t.jsx)(E.Z,{variant:"contained",color:"primary",fullWidth:!0,onClick:l,disabled:i||n,children:"送出訂單"})},nm=e=>{var i,n;let{reservationCustomerId:r,reservationId:s,specificReservation:a,sinyiStaffNumber:u,sinyiServiceClfId:y,origin:C}=e,S=(0,l.I0)(),E=(0,l.v9)(W.ky),{setToken:P}=(0,c.useContext)(nr.Vo),{isLoading:D,me:T,error:N}=(0,i4.Q)(),R=null==T?void 0:T.role,z=(null==R?void 0:R.includes("vender"))||(null==R?void 0:R.includes("venderStaff")),A="serviceAdmin"===R||"vender"===R||"venderStaff"===R,O=(0,i6.Q)(),B=(0,l.v9)(ix.hn),U=(0,l.v9)(nn.pG),[F,V]=(0,c.useState)(!1),[G,H]=(0,c.useState)(!1),[K,Y]=(0,c.useState)(!1),[$,J]=(0,c.useState)(!1),[X,ee]=(0,c.useState)(!1),[ei,en]=(0,c.useState)(""),[et,el]=(0,c.useState)(!1),[eo,er]=(0,c.useState)(!1),ed=(0,c.useRef)([]),[es,ea]=(0,c.useState)(!1),[eu,ec]=(0,c.useState)(!1),[ev,em]=(0,c.useState)(!1),[eh,ef]=(0,c.useState)(!1),[ep,ex]=(0,c.useState)(""),[eg,eZ]=(0,c.useState)(""),[ej,ey]=(0,c.useState)([]),[eb,eC]=(0,c.useState)([]),[eS,ew]=(0,c.useState)(!1),[eI,ek]=(0,c.useState)({}),e_=(0,c.useMemo)(()=>{var e;return null===(e=null==eb?void 0:eb.filter(e=>!!(null==E?void 0:E.services[e._id])))||void 0===e?void 0:e.map(e=>e.customizations||[]).reduce((e,i)=>(0,v.Z)(e,i,nu),[])},[eb,null==E?void 0:E.services]),eE=(0,c.useMemo)(()=>{var e;return!!ej.length&&(!!(null==e_?void 0:e_.length)||(null==E?void 0:null===(e=E.serviceClassificationDetail)||void 0===e?void 0:e.isDisplaySiteImages))},[ej,e_,null==E?void 0:null===(i=E.serviceClassificationDetail)||void 0===i?void 0:i.isDisplaySiteImages]),eP=()=>{P(""),S((0,o.V2)(!1)),localStorage.removeItem("isSelfConstruct"),localStorage.removeItem("refreshToken"),localStorage.removeItem("isLogin")},eD=()=>{var e,i,n,t,l,o,r,d,s,a;let u={services:nc(null==E?void 0:E.services),name:null==E?void 0:null===(e=E.customerContact)||void 0===e?void 0:e.name,isCheckingBookedSession:null==E?void 0:E.isCheckingBookedSession,bookedSession:(null==E?void 0:E.isCheckingBookedSession)?{from:(0,p.Z)((0,x.Z)((0,g.Z)((0,Z.Z)(null==E?void 0:null===(i=E.serviceConfirmTime)||void 0===i?void 0:i.selectedDate),Number(null==E?void 0:null===(n=E.serviceConfirmTime)||void 0===n?void 0:n.hour)),Number(null==E?void 0:null===(t=E.serviceConfirmTime)||void 0===t?void 0:t.minute))).toISOString(),to:(0,j.Z)((0,x.Z)((0,g.Z)((0,Z.Z)(null==E?void 0:null===(l=E.serviceConfirmTime)||void 0===l?void 0:l.selectedDate),Number(null==E?void 0:null===(o=E.serviceConfirmTime)||void 0===o?void 0:o.hour)),Number(null==E?void 0:null===(r=E.serviceConfirmTime)||void 0===r?void 0:r.minute))).toISOString()}
1:null==E?void 0:E.serviceDateTime,contactDate:null==E?void 0:E.contactTime,payment:null==E?void 0:E.payment,phone:null==E?void 0:null===(d=E.customerContact)||void 0===d?void 0:d.phone,verificationPhone:null==E?void 0:E.verificationPhone,address:null==E?void 0:E.serviceAddress,moveInAddress:null==E?void 0:E.moveInAddress,email:null==E?void 0:null===(s=E.customerContact)||void 0===s?void 0:s.email,vatNo:null==E?void 0:E.vatNo,vatTitle:null==E?void 0:E.vatTitle,objectNo:null==E?void 0:E.objectNo,couponId:null==E?void 0:null===(a=E.coupon)||void 0===a?void 0:a._id,note:null==E?void 0:E.note,staffNumber:null==E?void 0:E.staffNumber,siteImages:null==E?void 0:E.siteImages,customizations:null==E?void 0:E.customizations,selfBookingInfo:{reason:null==E?void 0:E.selfBookingReason,copyOpt:{mode:"none"}},isDirectlyBuild:!0,isSendNewOrderNotify:null==E?void 0:E.isSendNewOrderNotify};return u},eM=(e,i)=>{let n={feeCheck:e,classification:null==E?void 0:E.serviceClassificationDetail,reservation:i,services:eb};(0,nt.g)(n),nl.b.directSendToGTM({event:"form_submit"}),nl.b.directSendToGTM({event:"living_purchase2"}),no.t.eventSender.sendPurchase({...n,encryptedUserId:null==U?void 0:U.value}),no.t.eventSender.sendLivingEvent("living_order_submit",{classification:null==E?void 0:E.serviceClassificationDetail,encryptedUserId:null==U?void 0:U.value}),window.onbeforeunload=null},eT=()=>{ea(!0),Y(!1);let e=eD(),i=async()=>{var i;return ne(e,B,O,eS,null==E?void 0:null===(i=E.serviceClassificationDetail)||void 0===i?void 0:i.reservationListMode,a)},n=async(i,n)=>{if(n)S((0,q.fz)({open:!0,message:n.message||"自建單建立錯誤,請稍後再試"})),ea(!1);else{if((0,m.Z)(eI)){let[t,l]=await (0,ni.E)({...e,coupon:null==E?void 0:E.coupon},null==E?void 0:E.serviceClassificationDetail);if(l)return S((0,q.fz)({open:!0,message:l.message}));eM(t,i)}else eM(eI,i);if(A){let o=(null==i?void 0:i.reservationListMode)==="stateUnordered"?"unordered-reservation?unorderedReservationNo=".concat(null==i?void 0:i.unorderedReservationNo):"reservation?reservationNo=".concat(null==i?void 0:i.reservationNo);window.open("".concat(ip.H9,"/").concat(z?"vender":"service-admin","/").concat(o),"_self")}else J(!0)}},t=async()=>{let[e,t]=await i();await n(e,t)};t()},eN=e=>{let i=async(e,i)=>{i?S((0,q.fz)({open:!0,message:i.message||"訂單明細產生錯誤,請稍後再試"})):(ek(e),e&&Y(!0)),ef(!1)},n=async()=>{ef(!0);let[n,t]=await (0,ni.E)({...e,coupon:null==E?void 0:E.coupon},null==E?void 0:E.serviceClassificationDetail);await i(n,t)};n()},eR=()=>{var e,i;let n=[];null===(e=eb[0])||void 0===e||null===(i=e.customizations)||void 0===i||i.forEach(e=>{var i;if(!e.quantityMin&&!e.quantityMax)return;let t=(null==E?void 0:null===(i=E.customizations)||void 0===i?void 0:i[e._id])||{},l=Object.values(t).map(e=>null==e?void 0:e.count).reduce((e,i)=>e+i,0);0!==l&&(e.quantityMin&&l<e.quantityMin||e.quantityMax&&l>e.quantityMax)&&n.push(null==e?void 0:e.title)}),ed.current=n},ez=()=>{if(eu){S((0,q.fz)({open:!0,message:"圖片上傳中,請等候上傳完成再送出訂單"}));return}let e=eD();eR();try{var i,n,t,l,o,r,d,s,a,u,c;if(!ep)throw Error("請先填寫訂購人手機並建立會員帳號才可進行下訂");if((null==e?void 0:e.staffNumber)&&!/^[0-9]{6}$/.test(null==e?void 0:e.staffNumber))throw Error("請檢查員編格式");if((0,m.Z)(null==e?void 0:e.name))throw Error("請輸入訂購聯絡人姓名");if((0,m.Z)(null==e?void 0:e.phone)||!(0,i3.ZP)(null==e?void 0:e.phone,"zh-TW"))throw Error("請輸入訂購聯絡人手機或檢查電話格式");if((null==e?void 0:e.email)&&!i7()(null==e?void 0:e.email))throw Error("請檢查Email格式");if(!ej.length)throw Error("請選擇服務方案");if((null==E?void 0:null===(i=E.serviceClassificationDetail)||void 0===i?void 0:i.reservationListMode)!=="stateUnordered"&&(0,m.Z)(null==e?void 0:e.bookedSession))throw Error("請選擇服務時間");if((0,m.Z)(null==e?void 0:null===(n=e.address)||void 0===n?void 0:n.county)||(0,m.Z)(null==e?void 0:null===(t=e.address)||void 0===t?void 0:t.district))throw Error("請填入服務地址縣市地區");if((null==e?void 0:null===(l=e.address)||void 0===l?void 0:l.details.search("號"))<0)throw Error("服務地址請填寫至門牌號");if((null==E?void 0:null===(o=E.serviceClassificationDetail)||void 0===o?void 0:o.mode)==="relocation"&&(null==E?void 0:null===(r=E.serviceClassificationDetail)||void 0===r?void 0:r.isAddMoveInAddressInfo)){let v=null==E?void 0:null===(a=E.moveInAddress)||void 0===a?void 0:a.every(e=>["county","district","details"].every(i=>e[i]));if(!v)throw Error("請填寫完整遷入地址");let h=null==E?void 0:null===(u=E.moveInAddress)||void 0===u?void 0:u.some(e=>{var i;return(null==e?void 0:null===(i=e.details)||void 0===i?void 0:i.search("號"))<0});if(h)throw Error("遷入地址請填寫至門牌號")}if(!(null==e?void 0:null===(d=e.payment)||void 0===d?void 0:d.method))throw Error("請選擇付款方式");if((null==e?void 0:e.vatNo)&&(0,m.Z)(null==e?void 0:e.vatTitle)||(0,m.Z)(null==e?void 0:e.vatNo)&&(null==e?void 0:e.vatTitle))throw Error("統編設定需全部填寫或全部清除");if(null===(s=ed.current)||void 0===s?void 0:s.length)throw Error("客製化項目『".concat(null===(c=ed.current)||void 0===c?void 0:c.join("、"),"』必須符合選擇數量限制"))}catch(f){console.log("err",f),S((0,q.fz)({open:!0,message:f.message}));return}A?eT():eN(e)};return(0,c.useEffect)(()=>()=>S((0,W.Fx)()),[]),(0,c.useEffect)(()=>(window.onbeforeunload=()=>!0,()=>{window.onbeforeunload=null}),[]),(0,c.useEffect)(()=>{u&&(/^[0-9]{6}$/.test(u)?(S((0,W.$H)(u)),A||V(!0)):el(!0))},[u,A]),(0,c.useEffect)(()=>{y&&(eZ(y),H(!0))},[y]),(0,c.useEffect)(()=>{r&&ex(r)},[r]),(0,c.useEffect)(()=>{let e=e_.map(e=>
1e._id),i=(0,h.Z)(null==E?void 0:E.customizations);Object.keys(i).forEach(n=>{(0,f.Z)(e,n)||delete i[n]}),S((0,W.Kd)(i))},[e_]),(0,c.useEffect)(()=>{ey(Object.keys(null==E?void 0:E.services))},[null==E?void 0:E.services]),(0,c.useEffect)(()=>{if(!(0,m.Z)(eb)){let e=eb.map(e=>e.isStandard);ew(e.every(e=>e))}},[eb]),(0,c.useEffect)(()=>{D||T||!N||(window.onbeforeunload=null,eP(),ee(!0))},[D,T,N]),(0,c.useEffect)(()=>{(et||eo)&&(window.onbeforeunload=null,et&&en("isStaffNumberError"),eo&&en("isServiceClfIdError"),ee(!0))},[et,eo]),(0,t.jsxs)(d.Z,{children:[(0,t.jsx)(b(),{src:"/img/logo.svg",width:135,height:20,priority:!0,alt:""}),ev&&(0,t.jsx)(i1,{}),(0,t.jsx)(w.Z,{variant:"h3",mt:4,mb:10,children:"居家預約服務"}),(0,t.jsxs)(d.Z,{children:[(0,t.jsxs)(d.Z,{mb:12,children:[(0,t.jsx)(M,{content:"訂單資訊"}),(0,t.jsx)(L,{selfConstructRole:R,isStaffNumberLock:F}),(0,t.jsx)(Q,{isRoleVender:z,isLivingLifeRole:A,origin:C,customerId:ep,setCustomerId:ex,setIsRoleLoading:em,utm:O,webview:B})]}),(0,t.jsxs)(d.Z,{mb:12,children:[(0,t.jsx)(M,{content:"服務資訊",isAllRequire:!0}),(0,t.jsx)(e8,{serviceIds:ej,setServiceIds:ey,serviceDetails:eb,setServiceDetails:eC,isStandard:eS,serviceClassificationId:eg,setServiceClassificationId:eZ,isServiceClfIdLock:G,setIsServiceClfIdError:er,selfConstructRole:R})]}),(0,t.jsxs)(d.Z,{mb:12,children:[(0,t.jsx)(M,{content:"付款資訊",isAllRequire:!1}),(0,t.jsx)(ij,{reservationId:s,serviceIds:ej,customerId:ep,serviceDetails:eb,isStandard:eS})]}),eE&&(0,t.jsxs)(d.Z,{mb:12,children:[(0,t.jsx)(M,{content:"補充資訊",isAllRequire:!0,isImportant:!1}),(0,t.jsx)(iK,{customizationItems:e_,hasSiteImages:null==E?void 0:null===(n=E.serviceClassificationDetail)||void 0===n?void 0:n.isDisplaySiteImages,isImagesUploading:eu,setIsImagesUploading:ec})]}),(0,t.jsxs)(d.Z,{mb:12,children:[(0,t.jsx)(M,{content:"備註",isAllRequire:!0,isImportant:!1}),(0,t.jsxs)(d.Z,{children:[(0,t.jsx)(d.Z,{mb:2,children:(0,t.jsx)(I.Z,{label:"備註說明",variant:"outlined",multiline:!0,rows:2,fullWidth:!0,value:null==E?void 0:E.note,onChange:e=>S((0,W.U3)(e.target.value))})}),(0,t.jsx)(d.Z,{display:"flex",children:(0,t.jsx)(w.Z,{variant:"body2",color:"text.disabled",ml:1,children:"客戶將收到此訂單備註資訊,若非需要提供客戶之備註內容,請勿輸入"})})]})]}),(0,t.jsx)(d.Z,{ml:1,mb:3,children:(0,t.jsx)(k.Z,{control:(0,t.jsx)(_.Z,{checked:null==E?void 0:E.isSendNewOrderNotify,onChange:()=>S((0,W.$I)())}),label:(0,t.jsx)(w.Z,{color:"textPrimary",children:"我要發送訂單成立通知"})})}),(0,t.jsx)(nv,{isGenFeeCheck:eh,isBusy:es,onConfirm:ez})]}),K&&(0,t.jsx)(ns,{open:K,setIsDetailModalOpen:Y,feeCheck:eI,serviceDetails:eb,onConfirm:eT,isBusy:es,setIsBusy:ea}),$&&(0,t.jsx)(nd,{open:$,onModalClose:()=>J(!1),logoutSelfConstruct:eP}),X&&(0,t.jsx)(na,{open:X,onModalClose:()=>ee(!1),sinyiErrorType:ei||"isTokenError",logoutSelfConstruct:eP})]})};var nh=(0,c.memo)(nm),nf=n(97870),np=n(86700);let nx=e=>{let i=()=>{try{if(null==e)return null;let i="function"==typeof e?e():e;return["/unorderedReservations/".concat(i),z.ZP.getToken()]}catch(n){return null}};return(0,np.LW)(i,z.n8)};var ng=n(56339);let nZ=e=>{var i,n,t;let r=(0,l.I0)(),d=(0,c.useRef)(!1),s=(0,l.v9)(o.k$),{data:a}=(0,nf.V)(e),{data:u}=nx(e),v=a||u,{me:m}=(0,i4.Q)();(null==m?void 0:null===(i=m.role)||void 0===i?void 0:i.includes("vender"))||null==m||null===(n=m.role)||void 0===n||n.includes("venderStaff");let h="normal";(null==s?void 0:s.reservationId)?h="reservation":(null==s?void 0:s.userId)&&(h="member"),(0,c.useEffect)(()=>{(null==s?void 0:s.active)&&v&&!d.current&&(r((0,W.bk)(v.objectNo)),r((0,W.et)(v.user.phone)),r((0,W._E)(v.phone)),r((0,W.Ot)(v.vatNo)),r((0,W.nJ)(v.vatTitle)),"normal"!==h&&(r((0,W.EP)(v.name)),r((0,W.si)(v.email))),d.current=!0)},[s,v]);let{data:f}=(0,ng.a)(null==s?void 0:s.userId);return(0,c.useEffect)(()=>{(null==s?void 0:s.active)&&f&&!d.current&&(r((0,W.et)(f.phone)),r((0,W._E)(f.phone)),"normal"!==h&&(r((0,W.EP)(f.fullname)),r((0,W.si)(f.email))),d.current=!0)},[s,f]),{reservationCustomerId:(null==v?void 0:null===(t=v.user)||void 0===t?void 0:t._id)||(null==f?void 0:f._id)||"",specificReservation:v||{},origin:h}},nj=()=>{let e=(0,l.v9)(o.k$),{reservationCustomerId:i,specificReservation:n,origin:r}=nZ(null==e?void 0:e.reservationId);return(0,t.jsx)(u,{children:(0,t.jsx)(nh,{reservationCustomerId:i,specificReservation:n,reservationId:null==e?void 0:e.reservationId,origin:r,sinyiStaffNumber:(null==e?void 0:e.staffNumber)||"",sinyiServiceClfId:(null==e?void 0:e.serviceClfId)||""})})};var ny=n(93756);let nb=()=>(0,t.jsx)(nj,{});var nC=(0,ny.Z)(nb,{syDealCustomerVerify:!1})},62756:function(e,i,n){"use strict";n.d(i,{j:function(){return l}});var t=n(72673);let l=e=>(0,t.Ev)((0,t.HR)("/coupons/checkUsage",e))},35904:function(e,i,n){"use strict";n.d(i,{E:function(){return d}});var t=n(72673),l=n(30905),o=n(1447);let r=e=>{var i,n,t,l;return{services:Object.values(null==e?void 0:e.services),serviceTime:null==e?void 0:null===(i=e.bookedSession)||void 0===i?void 0:i.from,county:null==e?void 0:null===(n=e.address)||void 0===n?void 0:n.county,district:null==e?void 0:null===(t=e.address)||void 0===t?void 0:t.district,customizations:(0,o.G)(null==e?void 0:e.customizations),couponCode:null==e?void 0:null===(l=e.coupon)||void 0===l?void 0:l.code}},d=(e,i)=>{let{address:n,...o}=e,d=(null==i?void 0:i.mode)!=="relocation"||(0,l.Be)(null==e?void 0:e.address,null==i?void 0:i.venderDispatchRegions)?e:o;return(0,t.Ev)((0,t.HR)("/services/feeCheck",r(d)))}},96329:function(e,i,n){"use strict";n.d(i,{k:function(){return l}});var t=n(72673);let l=e=>(0,t.Ev)((0,t.UY)("/services/".concat(e)))},84104:function(e,i,n){"use strict";n.d(i,{J:function(){return l}});var t=n(72673);let l=e=>(0,t.Ev)((0,t.UY)("/serviceClassifications/".concat(e)))},1447:function(e,i,n){"use strict";n.d(i,{G:function(){return l}});var t=n(27961);let l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=Object.values(e).map(e=>Object.values(e));return(0,t.Z)(i)}},40685:function(e,i,n){"use strict";n.d(i,{c:function(){return l}});var t=n(72673);let l=e=>{let i=new FormData;return i.append("file",e),(0,t.Ev)((0,t.HR)("/files",i,{uploadFile:!0}))}},20796:function(e,i,n){"use strict";n.d(i,{$:function(){return r}});var t=n(80129),l=n(86700),o=n(72673);let r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{limit:999},i=()=>o.ZP.getToken()?["/catalogs?".concat((0,t.stringify)(e)),o.ZP.getToken()]:"/catalogs?".concat((0,t.stringify)(e));return(0,l.LW)(i,o.n8)}},25891:function(e,i,n){"use strict";n.d(i,{M:function(){return l}});var t=n(86700);let l=e=>{var i;let{data:n,...l}=(0,t.LW)("/systemSettings/specificKey?key=makeUpDay");return{data:null==n?void 0:null===(i=n[0])||void 0===i?void 0:i.value,...l}}},73386:function(e,i,n){"use strict";n.d(i,{j:function(){return l}});var t=n(86700);let l=e=>{var i;let{data:n,...l}=(0,t.LW)("/systemSettings/specificKey?key=nationalHoliday");return{data:null==n?void 0:null===(i=n[0])||void 0===i?void 0:i.value,...l}}},3557:function(e,i,n){"use strict";n.d(i,{i:function(){return r}});var t=n(80129),l=n(86700),o=n(72673);let r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=()=>(null==e?void 0:e.length)?["/services/supportVenders?".concat((0,t.stringify)({serviceIds:e})),o.ZP.getToken()]:null;return(0,l.LW)(i,o.n8)}},56339:function(e,i,n){"use strict";n.d(i,{a:function(){return o}});var t=n(86700),l=n(72673);let o=e=>{let i=()=>e?["/users/".concat(e),l.ZP.getToken()]:null;return(0,t.LW)(i,l.n8)}},47983:function(e,i,n){"use strict";n.d(i,{vF:function(){return a},ur:function(){return d},pt:function(){return s},RQ:function(){return u},Y:function(){return c}});var t=n(61303),l=n(72673);let o=(e,i)=>
1(0,l.Ev)((0,l.HR)("/thirdPartyPayments/applePay/auth",{url:e,displayName:i}));var r=n(11634);let d=async(e,i,n)=>{var t,l;return"lsApp"===e&&"ios"===i?n?await (0,r.p2)():Promise.resolve(!1):null===(t=window.ApplePaySession)||void 0===t?void 0:null===(l=t.canMakePayments)||void 0===l?void 0:l.call(t)},s=(e,i)=>({countryCode:"TW",currencyCode:"TWD",supportedNetworks:["visa","masterCard"],merchantCapabilities:["supports3DS","supportsCredit"],total:{label:i,amount:"".concat((0,t.Z)([e,0]),".00"),type:"final"}}),a=(e,i,n,t)=>{if([i,n,t].some(e=>"function"!=typeof e))throw Error("beginApplePay: All callback parameters should be functions");let l=new ApplePaySession(6,e);return l.onvalidatemerchant=e=>{i(e.validationURL,e=>l.completeMerchantValidation(e),()=>l.completePayment(l.STATUS_FAILURE))},l.onpaymentauthorized=e=>{var i,t;n(null===(i=e.payment)||void 0===i?void 0:null===(t=i.token)||void 0===t?void 0:t.paymentData,()=>l.completePayment(l.STATUS_SUCCESS),()=>l.completePayment(l.STATUS_FAILURE))},l.oncancel=e=>{t(e)},l.begin(),l},u=e=>async(i,n,t)=>{let[l,r]=await o(i,e);r?t():n(l)},c=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return arguments.length>1&&arguments[1],arguments.length>2&&arguments[2],arguments.length>3&&arguments[3],e.filter(e=>"applePay"!==e)}},27582:function(e,i,n){"use strict";n.d(i,{b:function(){return o}});var t=n(73221),l=n(42395);let o=function(){let e=[],i=()=>{for(let i of e)v(i);e=[]},n=!1,o=e=>{n=!0,v({event:l.E1,category:"livingec",userId:e}),n&&r&&i()},r=!1,d=e=>{r=!0,n&&r&&i()},s=!1,a=e=>s=e,u=e=>{window[t.MH]=window[t.MH]||[],window[t.MH].push(e)},c=i=>{s||(n&&r?u(i):e.push(i))},v=e=>{s||u(e)};return{setDisable:a,sendAuthEvent:o,setSID:d,sendToGTMAfterSID:c,directSendToGTM:v}}()},70558:function(e,i,n){"use strict";n.d(i,{e:function(){return l}});var t=n(27582);let l=e=>{let{gtmEventName:i,eCommerceData:n,url:l}=e;t.b.directSendToGTM({ecommerce:null}),t.b.directSendToGTM({event:i,ecommerce:n})}},83832:function(e,i,n){"use strict";n.d(i,{g:function(){return r}});var t=n(59227),l=n(42395),o=n(70558);let r=e=>{let{feeCheck:i,classification:n,services:r,reservation:d}=e;if(!d)throw Error("data is missing. Can not send GTM data.");let s=(0,t.s)({feeCheck:i,classification:n,services:r});(0,o.e)({gtmEventName:l.CV,eCommerceData:{purchase:{actionField:{id:d.reservationNo||d.unorderedReservationNo,affiliation:"Web Store",revenue:d.isStandard?"".concat(d.total):l.vL,tax:"0",shipping:"0",coupon:(null==d?void 0:d.couponCode)||""},products:s}}})}},42395:function(e,i,n){"use strict";n.d(i,{CV:function(){return a},E1:function(){return t},G2:function(){return d},L_:function(){return x},Qn:function(){return f},Xi:function(){return o},YT:function(){return m},Zd:function(){return h},a4:function(){return u},hf:function(){return l},iK:function(){return s},jQ:function(){return c},lY:function(){return p},nM:function(){return r},q6:function(){return v},vL:function(){return g}});let t="livingmid",l="productImpression",o="productImpressionClick",r="productDetail",d="addToCart",s="checkout",a="purchase",u="living_article",c="living_prodintro",v="photo_album",m="photo_detail",h="living_banner",f="banner_unique_imp",p="banner_repeated_imp",x="living_partner_view",g="0"},20996:function(e,i,n){"use strict";n.d(i,{B:function(){return s}});var t=n(67294),l=n(55162),o=n(40685);let r="image/jpeg,image/png",d={image:r,document:"".concat(r,",").concat("application/pdf",",").concat("application/vnd.openxmlformats-officedocument.presentationml.presentation",",").concat("application/vnd.openxmlformats-officedocument.wordprocessingml.document",",").concat("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")},s=e=>{let{previews:i,setPreviews:n,files:r,fileType:s,multiple:a,maxFiles:u,onChange:c,onFileUpload:v,onFileRemove:m,onError:h,onUploadStart:f,onUploadFinish:p,fileSizeLimit:x}=e,[g,Z]=(0,t.useState)(!1),j=e=>{if(u&&e.length+r.length>u){h(Error("數量超出上限"));return}let i=e.map(e=>Object.assign(e,{_isPending:!0,_id:Math.random().toString(36).substr(2,9),_previewUrl:/^image/.test(e.type)&&URL.createObjectURL(e)}));n(e=>e.concat(i))},{getRootProps:y,getInputProps:b}=(0,l.u)({onDrop:j,multiple:a,disabled:u&&r.length>=u,accept:d[s]||""});(0,t.useEffect)(()=>{let e=i.find(e=>e._isPending);e&&!e._isUploading&&(n(i=>i.map(i=>i._id===e._id?Object.assign(i,{_isUploading:!0}):i)),C(e)),!e&&g&&(Z(!1),p&&p())},[i]);let C=async e=>{async function i(i){let[t,l]=await (0,o.c)(i);if(l)n(i=>i.filter(i=>i._id!==e._id)),h(l);else{if(v){let r=await v(t);if(r){n(i=>i.filter(i=>i._id!==e._id));return}}n(i=>i.map(i=>i._id===e._id?t:i))}}!g&&(Z(!0),f&&f(!0)),x&&e.size>x?function(e,i){let n=new FileReader;n.addEventListener("load",()=>i(n.result)),n.readAsDataURL(e)}(e,n=>{setTimeout(()=>{let t=document.getElementById("thumb-image-canvas"),l=t.getContext("2d");var o=new Image;o.onload=function(){this.naturalHeight>
1this.naturalWidth?(t.width=1e3,t.height=1e3*this.naturalHeight/this.naturalWidth,l.drawImage(this,0,0,this.naturalWidth,this.naturalHeight,0,0,1e3,1e3*this.naturalHeight/this.naturalWidth)):(t.width=1e3*this.naturalWidth/this.naturalHeight,t.height=1e3,l.drawImage(this,0,0,this.naturalWidth,this.naturalHeight,0,0,1e3*this.naturalWidth/this.naturalHeight,1e3))},o.src=n,setTimeout(()=>{t.toBlob(async function(n){n.name=e.name,i(n)},e.type,.8)},100)},100)}):i(e)},S=async e=>{if(!e._isPending&&m){let i=await m(e);if(i)return}let t=e._id;n(e=>e.filter(e=>e._id!==t))};return(0,t.useEffect)(()=>{if(c){let e=i.filter(e=>!e._isPending);c(e.map(e=>e._id),e)}},[i]),{isUploading:g,getRootProps:y,getInputProps:b,onOneFileRemoveClick:S}}},30663:function(e,i,n){"use strict";n.d(i,{Q:function(){return d}});var t=n(67294),l=n(89289),o=n(39166);let r=()=>{let e=localStorage.getItem("lsutm");return JSON.parse(e)||{}},d=()=>{let e=(0,l.v9)(o.vw),[i,n]=(0,t.useState)(null);return((0,t.useEffect)(()=>{let e=r();(null==e?void 0:e.source)&&n(e)},[]),null==e?void 0:e.source)?e:i}}},function(e){e.O(0,[3829,5897,9072,9477,231,9705,6541,988,9864,6567,2100,5162,9410,693,718,9531,3756,5428,7797,1553,9774,2888,179],function(){return e(e.s=39057)}),_N_E=e.O()}]);

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.