"use strict";(self.webpackChunkwheelsmart_admin_react=self.webpackChunkwheelsmart_admin_react||[]).push([[7751],{57751:(e,a,s)=>{s.r(a),s.d(a,{default:()=>N});var n=s(65043),t=s(68493),l=s(5835),i=s(47419),r=s(11645),d=s(26655),c=s(5397),o=s(83003),p=s(60273),m=s(16876),h=s(20541),g=s(8113),x=s(16569),j=s(47196),u=s(94406),A=s(89421),f=s(64124),w=s(11670),y=(s(30657),s(72517),s(44474),s(53623),s(55881),s(70579));const{Dragger:C}=w.A,{Option:b}=u.A;const k=function(){const e=(0,o.wA)(),a=(0,o.d4)((e=>e.masters.plant.rowdata)),s=(0,o.d4)((e=>e.masters.plant.model)),d=(0,o.d4)((e=>e.masters.plant.loading)),[c]=t.A.useForm();(0,p.MD)("mini","miniLocationList"),(0,p.MD)("mini","miniLocationParams");const m=()=>a.id&&0!==a.id?(0,y.jsx)(n.Fragment,{children:(0,y.jsx)(A.A,{type:"primary",onClick:()=>{c.submit()},block:!0,children:"Update"})}):(0,y.jsx)(n.Fragment,{children:(0,y.jsx)(A.A,{type:"primary",block:!0,loading:d,onClick:()=>{d||c.submit()},children:"Add"})}),h=()=>{c.resetFields(),e((0,x.q2)(!1))},u=()=>(0,y.jsx)(n.Fragment,{children:(0,y.jsx)(A.A,{onClick:()=>{c.resetFields(),h()},type:"primary",block:!0,ghost:!0,children:"Cancel"})}),w=(0,y.jsxs)("h5",{className:"modal-title",children:[a.id&&0!==a.id?"Update":"Add"," plant"]});return(0,n.useEffect)((()=>{console.log("row data:",a)}),[a]),(0,y.jsx)(f.A,{visible:s,title:w,onCancel:()=>{h()},className:"hp-modal-p-24",footer:(0,y.jsxs)(i.A,{justify:"center",children:[(0,y.jsx)(r.A,{span:12,className:"hp-pr-4",children:(0,y.jsx)(u,{})}),(0,y.jsx)(r.A,{span:12,className:"hp-pl-4",children:(0,y.jsx)(m,{})})]}),centered:!0,closeIcon:(0,y.jsx)(j.dCQ,{className:"remix-icon text-color-black-100",size:24}),width:800,children:(0,y.jsx)(i.A,{children:(0,y.jsx)(r.A,{span:24,children:(0,y.jsx)(t.A,{layout:"vertical",form:c,autoComplete:"off",onFinish:()=>{a.id||(async()=>{c.validateFields();const s={id:0,...a};try{await e((0,g.Dn)(s)),e((0,g.wH)({page:1,search:"",page_size:10})),e((0,x.q2)(!1)),c.resetFields()}catch(n){console.error("Error adding plant:",n)}})()},children:(0,y.jsx)(i.A,{gutter:[12,12],children:(0,y.jsx)(r.A,{span:24,md:12,children:(0,y.jsx)(t.A.Item,{label:"Name:",name:"name",rules:[{required:!0,message:"Please Input plant Name"}],hasFeedback:!0,children:(0,y.jsx)(l.A,{id:"name",name:"name",style:{width:"100%"},placeholder:"Name",value:a.name,onChange:a=>{e((0,x.O2)({key:"name",value:a.target.value}))}})})})})})})})})};const N=function(){const e=(0,o.wA)(),a=(0,p.MD)("masters","plant").lotlist,s=((0,o.d4)((e=>e.masters.plant.noofpages)),(0,o.d4)((e=>e.masters.plant.listCount))),j=(0,o.d4)((e=>e.masters.plant.lotParams)),u=(0,o.d4)((e=>e.masters.plant.loading)),A=(0,o.d4)((e=>e.masters.plant.model)),[f]=((0,o.d4)((e=>e.system.userAccessList)),t.A.useForm());(0,n.useEffect)((()=>{e((0,g.wH)({page:1,search:"",page_size:10}))}),[]);const w=[{title:"S.No",dataIndex:"index",width:"5%"},{title:"Name",render:e=>(0,y.jsx)("span",{children:e.name}),filterMode:"tree",filterSearch:!0},{title:"Code",render:e=>(0,y.jsx)("span",{children:e.code}),filterMode:"tree",filterSearch:!0}],C=null===a||void 0===a?void 0:a.map(((e,a)=>({...e,index:(j.page-1)*j.page_size+a+1}))),{Search:b}=l.A;return(0,y.jsx)(i.A,{gutter:[12,12],className:"hp-mt-32",children:(0,y.jsxs)(r.A,{span:24,children:[(0,y.jsx)(m.A,{prefix:"Masters",postfix:"plant",pageTitle:"Plant",goBack:!0,addModelTile:"Add Plant",setIsModalVisible:a=>{e((0,x.q2)(a))},isModalVisible:A}),(0,y.jsxs)(d.A,{children:[(0,y.jsxs)(i.A,{children:[(0,y.jsx)(r.A,{span:12,xs:24,sm:24,md:12,className:"hp-mb-12",children:(0,y.jsx)(b,{placeholder:"Search...",allowClear:!0,onChange:a=>{""==a.target.value&&(e((0,g.wH)({...j,page:1,search:""})),e((0,x.yc)({...j,page:1,search:""})))},onSearch:a=>{var s;s=a,e((0,x.yc)({...j,page:1,search:s})),e((0,g.wH)({...j,page:1,search:s}))}})}),(0,y.jsx)(r.A,{span:24,children:(0,y.jsx)(c.A,{tip:"Loading...",spinning:u,delay:500,children:(0,y.jsx)(h.A,{page:j.page,count:s,pageSize:j.page_size,columns:w,data:C,loading:u,onPageChange:function(a,s){e((0,x.yc)({...j,page_size:s,page:0==a?1:a})),e((0,g.wH)({...j,page_size:s,page:0==a?1:a}))},showTotal:function(e){return"Total "+e+" items"},scroll:!0})})})]}),(0,y.jsx)(k,{})]})]})})}}}]);
//# sourceMappingURL=7751.86195325.chunk.js.map