"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[90157],{24659:(e,a,s)=>{s.d(a,{A:()=>u});s(65043);var t=s(67784),n=s(4701),l=s(17392),i=s(10155),r=s(70579);const d=(0,n.A)({}),o=e=>{let{onClick:a}=e;return(0,r.jsx)(l.A,{onClick:a,children:(0,r.jsx)(i.A,{})})},u=e=>{const a=d();return(0,r.jsx)(t.A,{InputProps:{...a,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.jsx)(o,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},90157:(e,a,s)=>{s.r(a),s.d(a,{default:()=>b});var t=s(65043),n=s(68903),l=s(11906),i=s(96446),r=s(63516),d=s(24659),o=s(73216),u=s(66675),c=s(14556),m=s(96801),h=s(11852),v=s(6994),x=s(73033),y=s(70579);const j={statusName:"",leadDay:""},A=x.Ik().shape({statusName:x.Yj().required("Status Name is required"),leadDay:x.ai().required("Lead Day is required")}),p=(0,m.Gq)("enuseloc"),f=p&&Object.keys(p).length>0?p.user_id:null,N=[];const b=function(e){const a=(0,c.wA)(),s=(0,o.Zp)(),m=t.useRef(null),[x,p]=(0,t.useState)(j),[b,D]=(0,t.useState)([]),S=(0,c.d4)((e=>{var a;return null===(a=e.bd.getFunctionalityPermissionDetail)||void 0===a?void 0:a.data})),g=(0,t.useRef)("NO"),k=(0,t.useRef)("NO");return(0,t.useEffect)((()=>{const e={userID:f,functionalityID:295,functionalityItemIDs:N};return a((0,h.P8M)(e)),()=>{a((0,h.qo7)())}}),[]),(0,t.useEffect)((()=>(S&&295===(null===S||void 0===S?void 0:S.functionalityID)&&(D(S),g.current=null===S||void 0===S?void 0:S.permission_report,k.current=null===S||void 0===S?void 0:S.permission_admin),()=>{D([]),g.current="NO",k.current="NO"})),[S]),(0,y.jsxs)("div",{className:"component-list",children:[(0,y.jsx)(n.Ay,{container:!0,className:"d-flex justify-content-between align-items-center",py:1,children:(0,y.jsxs)(n.Ay,{item:!0,className:"common-header-label",children:[(0,y.jsx)(l.A,{onClick:()=>{s(-1)},children:(0,y.jsx)(u.A,{})}),"Add Site Status"]})}),b&&Object.keys(b).length>0&&295===(null===b||void 0===b?void 0:b.functionalityID)&&"YES"===(null===b||void 0===b?void 0:b.permission_admin)?(0,y.jsx)(r.l1,{enableReinitialize:!0,innerRef:m,initialValues:x,validationSchema:A,onSubmit:async(e,t)=>{const n={statusName:null!==e&&void 0!==e&&e.statusName?null===e||void 0===e?void 0:e.statusName:"",leadDay:null!==e&&void 0!==e&&e.leadDay?null===e||void 0===e?void 0:e.leadDay:"",statusColor:""};console.log("finalPayload",n),t.setSubmitting(!0),await a((0,v.DbF)(n)),t.resetForm({}),s("/crm/crm-site-status")},children:e=>{let{errors:a,handleSubmit:s,handleChange:t,setFieldValue:o,handleBlur:u,isSubmitting:c,isValid:m,touched:h,values:v}=e;return(0,y.jsx)(r.lV,{onSubmit:s,children:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(n.Ay,{container:!0,className:"component-form",children:(0,y.jsxs)(n.Ay,{container:!0,children:[(0,y.jsx)(n.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,y.jsx)(d.A,{fullWidth:!0,name:"statusName",onBlur:u,onChange:t,value:v.statusName,error:h.statusName&&Boolean(a.statusName),helperText:h.statusName&&a.statusName,id:"statusName",size:"small",label:"Status Name *",variant:"outlined"})}),(0,y.jsx)(n.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,y.jsx)(d.A,{fullWidth:!0,name:"leadDay",onBlur:u,onChange:t,value:v.leadDay,error:h.leadDay&&Boolean(a.leadDay),helperText:h.leadDay&&a.leadDay,id:"leadDay",type:"number",size:"small",label:"Lead Day *",variant:"outlined"})})]})}),(0,y.jsxs)(n.Ay,{className:"d-flex justify-content-end",p:2,children:[(0,y.jsxs)(i.A,{mx:2,children:[" ",(0,y.jsx)(l.A,{text:"CANCEL",variant:"contained",size:"medium",type:"reset",color:"secondary",onClick:()=>{p({...j})},children:"RESET"})]}),(0,y.jsx)(i.A,{children:(0,y.jsx)(l.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:c,children:"SAVE"})})]})]})})}}):(0,y.jsx)("div",{className:"common-header-label-bold",children:"You don't have permission to access this page!"})]})}},10155:(e,a,s)=>{var t=s(24994);a.A=void 0;var n=t(s(40039)),l=s(70579);a.A=(0,n.default)((0,l.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear")},66675:(e,a,s)=>{var t=s(24994);a.A=void 0;var n=t(s(40039)),l=s(70579);a.A=(0,n.default)((0,l.jsx)("path",{d:"M3 18h13v-2H3zm0-5h10v-2H3zm0-7v2h13V6zm18 9.59L17.42 12 21 8.41 19.59 7l-5 5 5 5z"}),"MenuOpen")}}]);
//# sourceMappingURL=90157.7466e6a5.chunk.js.map