1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9474],{7829:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/product/[id]/form/[cid]",function(){return a(78936)}])},78936:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return v}});var s=a(85893),c=a(67294),n=a(9008),i=a.n(n),l=a(11163),r=a(7851),d=a(82826),u=a(87603),o=a(8751),h=a(92477),p=a(26855),m=a(4393),f=a(3363),x=a(71230),g=a(15746),j=a(71577),k=a(74019),Z=a(9138),_=a(96281),N=a(83473);let S=e=>{let{pid:t,id:a}=e,[n]=h.Z.useForm(),[i]=h.Z.useForm(),S=(0,l.useRouter)(),{query:F}=S,[v,b]=(0,c.useState)(0),[y,C]=(0,c.useState)(!1),[E,w]=(0,c.useState)({}),[P,D]=(0,c.useState)({}),[O,V]=(0,c.useState)(!1),[J,R]=(0,c.useState)({}),[T,H]=(0,c.useState)({}),[z,X]=(0,c.useState)({}),[q,K]=(0,c.useState)(null),L=e=>{let t=JSON.parse(JSON.stringify({...z,...e}));t.success_page||(t.success_page=i.getFieldsValue()),X(t)},M=e=>{let t=JSON.parse(JSON.stringify(z));t.success_page=e,X(t)},U=[{title:"Halaman Checkout",forceRender:!0,content:(0,s.jsx)(k.Z,{loading:O,product:T,form:n,onChange:L})},{title:"Halaman Sukses",forceRender:!0,content:(0,s.jsx)(Z.Z,{loading:O,product:T,form:i,onChange:M})}],A=U.map(e=>({key:e.title,title:e.title,disabled:e.disabled})),B=()=>{switch(v){case 0:n.validateFields().then(e=>{b(1),w(e),y<1&&C(1)}).catch(e=>{C(1),(0,N.rD)(e,n)});break;case 1:i.validateFields().then(e=>{D(e),n.validateFields().then(s=>{V(!0),r.api.post("/api/product/".concat(t,"/checkout/").concat("create"==a?"":a),{...E,success_page:e}).then(e=>{let{data:s}=e;V(!1),S.push("/product/".concat(t)),p.Z.success({message:"Halaman Checkout berhasil "+(""==a?"dibuat":"diubah")})}).catch(e=>{let{response:t}=e;V(!1),p.Z.error({message:"Terjadi kesalahan"})})}).catch(e=>{b(1),(0,N.rD)(e,n)})}).catch(e=>{(0,N.rD)(e,i)})}},G=e=>{e>v?B():b(e)};(0,c.useEffect)(()=>{"create"!=a&&(V(!0),r.api.get("/api/product/".concat(t,"/checkout/").concat(a)).then(e=>{let{data:t}=e;V(!1),R(t.data),X(t.data),n.setFieldsValue(t.data),i.setFieldsValue(t.data.success_page)}).catch(e=>{let{response:t}=e;V(!1)}))},[a]),(0,c.useEffect)(()=>{b(0),F.clone&&(V(!0),r.api.get("/api/product/".concat(t,"/checkout/").concat(F.clone)).then(e=>{let{data:t}=e;V(!1),R(t.data),X(t.data),n.setFieldsValue(t.data),i.setFieldsValue(t.data.success_page)}).catch(e=>{let{response:t}=e;V(!1)}))},[]),(0,c.useEffect)(()=>{V(!0),r.api.get("/api/product/".concat(t)).then(e=>{let{data:t}=e;H(t.data),V(!1)}).catch(e=>{let{response:t}=e;V(!1)})},[]);let I=()=>{S.push("/product/".concat(t))};return(0,c.useEffect)(()=>{(0,N.SM)()},[v]),(0,s.jsxs)("div",{children:[(0,s.jsx)(m.Z,{className:"mb-5",children:(0,s.jsx)(f.Z,{type:"navigation",onChange:G,current:v,className:"site-navigation-steps",style:{paddingTop:24},items:A})}),(0,s.jsxs)("div",{className:"text-lg mb-4 ml-3",children:[(0,s.jsx)(d.Z,{className:"mr-1 cursor-pointer",onClick:I})," ",J.name]}),(0,s.jsxs)(x.Z,{gutter:24,ref:K,children:[(0,s.jsxs)(g.Z,{md:12,children:[(0,s.jsx)("div",{className:"steps-content",children:U[v].content}),(0,s.jsxs)("div",{className:"flex mt-5",children:[v>0&&(0,s.jsx)("div",{className:"flex-none",children:(0,s.jsxs)(j.ZP,{disabled:O,size:"large",type:"default",onClick:()=>b(v-1),children:[(0,s.jsx)(d.Z,{})," Kembali"]})}),(0,s.jsx)("div",{className:"flex-auto text-right",children:(0,s.jsx)(j.ZP,{loading:O,size:"large",type:"primary",onClick:B,children:v<1?(0,s.jsxs)(s.Fragment,{children:["Selanjutnya ",(0,s.jsx)(u.Z,{})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.Z,{})," Update Form"]})})})]})]}),(0,s.jsx)(g.Z,{md:12,children:(0,s.jsx)(_.Z,{product:T,checkout:z,container:q})})]})]})};function F(){let e=(0,l.useRouter)(),{id:t,cid:a}=e.query;return(0,s.jsxs)(c.Fragment,{children:[(0,s.jsxs)(i(),{children:[(0,s.jsx)("title",{children:"Daftar Produk"}),(0,s.jsx)("meta",{name:"Daftar Produk",content:"Daftar Produk Lincah.id"})]}),(0,s.jsx)("main",{children:(0,s.jsx)(S,{pid:t,id:a})})]})}F.layout="main";var v=F}},function(e){e.O(0,[4310,4393,2808,5742,4533,6920,8611,9330,8811,8463,5045,7609,3363,1971,9164,8875,723,5394,6164,4019,6281,3212,9774,2888,179],function(){return e(e.s=7829)}),_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.