@djb25/digit-ui-module-pgr 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var e,n=require("react"),l=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-router-dom"),a=require("react-i18next"),r=require("@djb25/digit-ui-react-components"),i=require("redux"),s=require("react-redux"),c=require("react-query");require("lodash.merge");var u=require("react-hook-form");function m(){return(m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}function d(e,t){if(null==e)return{};var n={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(-1!==t.indexOf(l))continue;n[l]=e[l]}return n}function p(e,t){switch(void 0===e&&(e={}),t.type){case"CREATE_COMPLAINT":return m({},e,{response:t.payload});case"FETCH_COMPLAINTS":return m({},e,{list:t.payload.complaints});case"UPDATE_COMPLAINT":return m({},e,{response:t.payload});case"APPLY_INBOX_FILTER":return m({},e,{response:t.payload.response.instances});default:return e}}const E=(e,t)=>""+e.path+t,C=e=>{const t=o.useHistory(),{t:i}=a.useTranslation(),{id:s}=o.useParams(),[c,u]=n.useState(null),[d,p]=n.useState(!0);return l.createElement(r.Card,null,l.createElement(r.CardHeader,null,i("CS_REOPEN_COMPLAINT")),l.createElement(r.CardText,null),d?null:l.createElement(r.CardLabelError,null,i("CS_ADDCOMPLAINT_ERROR_REOPEN_REASON")),l.createElement(r.RadioButtons,{onSelect:e=>{let t=Digit.SessionStorage.get("reopen."+s);Digit.SessionStorage.set("reopen."+s,m({},t,{reason:e})),u(e)},selectedOption:c,options:[i("CS_REOPEN_OPTION_ONE"),i("CS_REOPEN_OPTION_TWO"),i("CS_REOPEN_OPTION_THREE"),i("CS_REOPEN_OPTION_FOUR")]}),l.createElement(r.SubmitBar,{label:i("CS_COMMON_NEXT"),onSubmit:function(){null===c?p(!1):t.push(e.match.path+"/upload-photo/"+s)}}))},S=e=>{var t,i;const{t:s}=a.useTranslation(),c=o.useHistory();let{id:u}=o.useParams();const[d,p]=n.useState(null),[E,C]=n.useState(!0);return n.useEffect(()=>{let e=Digit.SessionStorage.get("reopen."+u);Digit.SessionStorage.set("reopen."+u,m({},e,{verificationDocuments:d}))},[d,u]),l.createElement(l.Fragment,null,l.createElement(r.Card,null,l.createElement(r.ImageUploadHandler,{header:s("CS_ADDCOMPLAINT_UPLOAD_PHOTO"),tenantId:null==e||null===(t=e.complaintDetails)||void 0===t||null===(i=t.service)||void 0===i?void 0:i.tenantId,cardText:"",onPhotoChange:e=>{(e=>{if(null!=e&&e.length){const t=e.map(e=>({documentType:"PHOTO",fileStoreId:e,documentUid:"",additionalDetails:{}}));p(t)}})(e)},uploadedImages:null}),E?null:l.createElement(r.CardLabelError,null,s("CS_ADDCOMPLAINT_UPLOAD_ERROR_MESSAGE")),l.createElement(r.SubmitBar,{label:s("PT_COMMONS_NEXT"),onSubmit:function(){null===d?C(!1):c.push(e.match.path+"/addional-details/"+u)}}),e.skip?l.createElement(r.LinkButton,{label:s("CORE_COMMON_SKIP_CONTINUE"),onClick:function(){c.push(e.match.path+"/addional-details/"+u)}}):null))};function _(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const v=e=>{let{cityCode:t,complaintType:n,priorityLevel:l,description:o,landmark:a,city:r,district:i,region:s,state:c,pincode:u,localityCode:m,localityName:d,uploadedImages:p,mobileNumber:E,name:C,emailId:S,additionalDetails:_}=e;return function(e,v){try{return Promise.resolve(Digit.Complaint.create({cityCode:t,complaintType:n,priorityLevel:l,description:o,landmark:a,city:r,district:i,region:s,state:c,pincode:u,localityCode:m,localityName:d,uploadedImages:p,mobileNumber:E,name:C,emailId:S,additionalDetails:_})).then(function(t){e({type:"CREATE_COMPLAINT",payload:t})})}catch(e){return Promise.reject(e)}}},f=e=>function(t){try{return Promise.resolve(Digit.PGRService.update(e)).then(function(e){t({type:"UPDATE_COMPLAINT",payload:e})})}catch(e){return Promise.reject(e)}},O=e=>{const t=o.useHistory();let{id:i}=o.useParams();const c=s.useDispatch(),u=s.useSelector(e=>e).common;let{t:d}=a.useTranslation();const[p,E]=n.useState(!1),[C,S]=n.useState(null),{complaintDetails:v}=e;n.useEffect(()=>{if(u.complaints){const{response:n}=u.complaints;n&&"successful"===n.responseInfo.status&&t.push(e.match.path+"/response/:"+i)}},[u.complaints,e.history]);const O=n.useCallback(function(n){try{const l=_(function(){return Promise.resolve(c(f(n))).then(function(){t.push(e.match.path+"/response/"+i)})},function(e){var t,n,l,o,a,r;E({isError:!1,isWarning:!0,key:"error",message:null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors[0])||void 0===l?void 0:l.message}),S(null==e||null===(o=e.response)||void 0===o||null===(a=o.data)||void 0===a||null===(r=a.Errors[0])||void 0===r?void 0:r.message)});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[c]);return l.createElement(l.Fragment,null,l.createElement(r.Card,null,l.createElement(r.CardHeader,null,d("CS_ADDCOMPLAINT_PROVIDE_ADDITIONAL_DETAILS")),l.createElement(r.CardText,null,d("CS_ADDCOMPLAINT_ADDITIONAL_DETAILS_TEXT")),l.createElement(r.TextArea,{name:"AdditionalDetails",onChange:function(e){let t=Digit.SessionStorage.get("reopen."+i);Digit.SessionStorage.set("reopen."+i,m({},t,{addtionalDetail:e.target.value}))}}),l.createElement("div",{onClick:function(){E(!1);let t=Digit.SessionStorage.get("reopen."+i);return v&&(v.workflow=((e,t)=>({action:"REOPEN",comments:e.addtionalDetail,assignes:[],verificationDocuments:e.verificationDocuments}))(t),v.service.additionalDetail={REOPEN_REASON:t.reason},O({service:v.service,workflow:v.workflow})),l.createElement(o.Redirect,{to:{pathname:e.parentRoute+"/response",state:{complaintDetails:v}}})}},l.createElement(r.SubmitBar,{label:d("CS_HEADER_REOPEN_COMPLAINT")}))),l.createElement(l.Fragment,null,p&&l.createElement(r.Toast,{error:"error"===p.key,label:C,onClose:()=>{E(!1)}})),";")},T=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.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 12 19 6.41z"})),g=e=>{let{text:t,rating:n}=e;return l.createElement(r.Rating,{text:t,withText:!0,currentRating:n,maxRating:5,onFeedback:()=>{}})},y=e=>l.createElement("h1",{className:"heading-m"},e.label),N=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(T,null)),I=e=>{let{data:t,comments:n}=e;const{t:o}=a.useTranslation();return l.createElement("div",null,(null==t?void 0:t.date)&&l.createElement("p",null,null==t?void 0:t.date),l.createElement("p",null,null==t?void 0:t.name),l.createElement("p",null,null==t?void 0:t.mobileNumber),(null==t?void 0:t.source)&&l.createElement("p",null,o("ES_COMMON_FILED_VIA_"+(null==t?void 0:t.source.toUpperCase()))),null==n?void 0:n.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,o("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e))))},A=e=>{var t,o,a,i,s,c,u;let{workflowDetails:m,complaintDetails:d,close:p,popup:E,selectedAction:C,onAssign:S,tenantId:v,t:f}=e;const O=null==m||null===(t=m.data)||void 0===t||null===(o=t.initialActionState)||void 0===o||null===(a=o.nextActions)||void 0===a?void 0:a.filter(e=>(null==e?void 0:e.action)==C),T=Digit.Hooks.pgr.useEmployeeFilter(v,(null==O||null===(i=O[0])||void 0===i||null===(s=i.assigneeRoles)||void 0===s?void 0:s.length)>0?null==O||null===(c=O[0])||void 0===c||null===(u=c.assigneeRoles)||void 0===u?void 0:u.join(","):"",d,!0),g=T?T.map(e=>({heading:e.department,options:e.employees})):null,[I,A]=n.useState(null),[M,h]=n.useState(""),[D,P]=n.useState(null),[L,b]=n.useState(null),[R,k]=n.useState(null),w=Digit.ULBService.getCurrentUlb(),[x,F]=n.useState(null);n.useEffect(()=>{!function(){try{k(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)k(f("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=_(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",D,w.code)).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?b(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):k(f("CS_FILE_UPLOAD_ERROR"))})},function(){k(f("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]);const H=[f("CS_REOPEN_OPTION_ONE"),f("CS_REOPEN_OPTION_TWO"),f("CS_REOPEN_OPTION_THREE"),f("CS_REOPEN_OPTION_FOUR")];return l.createElement(r.Modal,{headerBarMain:l.createElement(y,{label:f("ASSIGN"===C||"REASSIGN"===C?"CS_ACTION_ASSIGN":"REJECT"===C?"CS_ACTION_REJECT":"REOPEN"===C?"CS_COMMON_REOPEN":"CS_COMMON_RESOLVE")}),headerBarEnd:l.createElement(N,{onClick:()=>p(E)}),actionCancelLabel:f("CS_COMMON_CANCEL"),actionCancelOnSubmit:()=>p(E),actionSaveLabel:f("ASSIGN"===C||"REASSIGN"===C?"CS_COMMON_ASSIGN":"REJECT"===C?"CS_COMMON_REJECT":"REOPEN"===C?"CS_COMMON_REOPEN":"CS_COMMON_RESOLVE"),actionSaveOnSubmit:()=>{M?S(I,M,L):k(f("CS_MANDATORY_COMMENTS"))},error:R,setError:k},l.createElement(r.Card,null,"REJECT"===C||"RESOLVE"===C||"REOPEN"===C?null:l.createElement(l.Fragment,null,l.createElement(r.CardLabel,null,f("CS_COMMON_EMPLOYEE_NAME")),g&&l.createElement(r.SectionalDropdown,{selected:I,menuData:g,displayKey:"name",select:function(e){A(e)}})),"REOPEN"===C?l.createElement(l.Fragment,null,l.createElement(r.CardLabel,null,f("CS_REOPEN_COMPLAINT")),l.createElement(r.Dropdown,{selected:x,option:H,select:function(e){F(e)}})):null,l.createElement(r.CardLabel,null,f("CS_COMMON_EMPLOYEE_COMMENTS")),l.createElement(r.TextArea,{name:"comment",onChange:function(e){k(null),h(e.target.value)},value:M}),l.createElement(r.CardLabel,null,f("CS_ACTION_SUPPORTING_DOCUMENTS")),l.createElement(r.CardLabelDesc,null,f("CS_UPLOAD_RESTRICTIONS")),l.createElement(r.UploadFile,{id:"pgr-doc",accept:".jpg",onUpload:function(e){P(e.target.files[0])},onDelete:()=>{b(null)},message:L?"1 "+f("CS_ACTION_FILEUPLOADED"):f("CS_ACTION_NO_FILEUPLOADED")})))},M=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");let n=h(t);return"NA"!=n&&P(e)?(n=n.toUpperCase(),b(e,n+"_REVENUE")):"PGR_NA"},h=function(e){return void 0===e&&(e=""),P(e)&&(e.replaceAll&&e.replaceAll(".","_")||e.replace&&D(e,".","_"))||"NA"},D=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e},P=function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)},L=function(e){void 0===e&&(e="");let t=h(e);return"NA"!=t&&P(e)?(t=t.toUpperCase(),b(t,"TENANT_TENANTS")):"PGR_NA"},b=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");let n=h(e);return"NA"==n?"PGR_NA":t+"_"+n},R=e=>e.substr(0,1).toUpperCase()+e.substr(1),k=function(e,t,n){try{var l,o,a,r,i,s,c,u,m,d,p,E,C,S,_,v,f;return console.log("complaintDetails?.details?.CS_ADDCOMPLAINT_COMPLAINT_TYPE",null==e||null===(l=e.details)||void 0===l?void 0:l.CS_ADDCOMPLAINT_COMPLAINT_TYPE),Promise.resolve({t:n,tenantId:null==t?void 0:t.code,name:n(null==t?void 0:t.i18nKey)+" "+(O=n("ULBGRADE_"+(null==t||null===(o=t.city)||void 0===o?void 0:o.ulbGrade.toUpperCase().replace(" ","_").replace(".","_"))),O.toLowerCase().split(" ").map(R).join(" ")),email:null==t?void 0:t.emailId,phoneNumber:null==t?void 0:t.contactNumber,heading:n("NEW_GRIEVANCE_APPLICATION"),applicationNumber:null==e||null===(a=e.service)||void 0===a?void 0:a.serviceRequestId,details:[{title:n("CS_TITLE_APPLICATION_DETAILS"),values:[{title:n("CS_COMPLAINT_FILED_DATE"),value:Digit.DateUtils.ConvertTimestampToDate(null==e||null===(r=e.audit)||void 0===r||null===(i=r.details)||void 0===i?void 0:i.createdTime,"dd/MM/yyyy")},{title:n("CS_COMPLAINT_TYPE"),value:n(null==e||null===(s=e.details)||void 0===s?void 0:s.CS_ADDCOMPLAINT_COMPLAINT_TYPE)},{title:n("CS_COMPLAINT_SUB_TYPE"),value:n(null==e||null===(c=e.details)||void 0===c?void 0:c.CS_ADDCOMPLAINT_COMPLAINT_SUB_TYPE)},{title:n("CS_COMPLAINT_PRIORITY_LEVEL"),value:n(null==e||null===(u=e.service)||void 0===u?void 0:u.priority)},{title:n("CS_COMPLAINT_ADDITIONAL_DETAILS"),value:(null==e||null===(m=e.details)||void 0===m?void 0:m.CS_COMPLAINT_ADDTIONAL_DETAILS)||"NA"}]},{title:n("PGR_ADDRESS_SUB_HEADER"),values:[{title:n("PGR_ADDRESS_PINCODE"),value:(null==e||null===(d=e.service)||void 0===d||null===(p=d.address)||void 0===p?void 0:p.pincode)||n("CS_NA")},{title:n("PT_ADDRESS_CITY"),value:n(L(null==e||null===(E=e.service)||void 0===E?void 0:E.tenantId))||n("CS_NA")},{title:n("PT_ADDRESS_MOHALLA"),value:n(""+M(null==e||null===(C=e.service)||void 0===C||null===(S=C.address)||void 0===S||null===(_=S.locality)||void 0===_?void 0:_.code,null==t?void 0:t.code))||n("CS_NA")},{title:n("PGR_ADDRESS_STREET_NAME"),value:(null==e||null===(v=e.service)||void 0===v||null===(f=v.address)||void 0===f?void 0:f.street)||n("CS_NA")}]}]})}catch(e){return Promise.reject(e)}var O},w=e=>{let{action:t}=e;const{t:n}=a.useTranslation();switch(t){case"REOPEN":return n("CS_COMMON_COMPLAINT_REOPENED");case"RATE":return n("CS_COMMON_THANK_YOU");default:return n("CS_COMMON_COMPLAINT_SUBMITTED")}},x=e=>{let{response:t}=e;const{complaints:n}=t,{t:o}=a.useTranslation();return l.createElement(r.Banner,n&&n.response&&n.response.responseInfo?{message:w(n.response.ServiceWrappers[0].workflow),complaintNumber:n.response.ServiceWrappers[0].service.serviceRequestId,successful:!0}:{message:o("CS_COMMON_COMPLAINT_NOT_SUBMITTED"),successful:!1})},F=e=>{let{response:t}=e;const{complaints:n}=t,{t:o}=a.useTranslation();if(n&&n.response&&n.response.responseInfo){const{action:e}=n.response.ServiceWrappers[0].workflow;return l.createElement(r.CardText,null,o("RATE"===e?"CS_COMMON_RATING_SUBMIT_TEXT":"CS_COMMON_TRACK_COMPLAINT_TEXT"))}},H=e=>{var t,i,c,u,d,p,E,C;const{t:S}=a.useTranslation(),_=s.useSelector(e=>e).pgr,{data:v}=Digit.Hooks.useStore.getInitData(),{tenants:f}=v||{},[O,T]=n.useState(!1);let g=null==_||null===(t=_.complaints)||void 0===t||null===(i=t.response)||void 0===i||null===(c=i.ServiceWrappers)||void 0===c||null===(u=c[0])||void 0===u||null===(d=u.service)||void 0===d?void 0:d.serviceRequestId;const{complaintDetails:y}=Digit.Hooks.pgr.useComplaintDetails({tenantId:Digit.ULBService.getCurrentTenantId(),id:g},{enabled:!!O});return console.log("appStateappState",_),l.createElement(r.Card,null,_.complaints.response&&l.createElement(x,{response:_}),_.complaints.response&&l.createElement(F,{response:_}),"RATE"==(null===(p=_.complaints.response)||void 0===p||null===(E=p.ServiceWrappers)||void 0===E||null===(C=E[0])||void 0===C?void 0:C.workflow.action)?"":l.createElement("div",{style:{marginBottom:"10px"}},l.createElement(r.SubmitBar,{label:S("PT_DOWNLOAD_ACK_FORM"),onSubmit:e=>{!function(e){try{const t=f.find(e=>e.code===Digit.ULBService.getCurrentTenantId());e.preventDefault(),T(!0),Promise.resolve(k(m({},y),t,S)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}}(e)}})),l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(r.SubmitBar,{label:S("CORE_COMMON_GO_TO_HOME")})))},B=e=>{var t;let{match:n,parentRoute:a}=e;const r=window.location.pathname.split("/"),i=r[r.length-1],s=(null===(t=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===t?void 0:t.code)||Digit.ULBService.getCurrentTenantId(),c=Digit.Hooks.pgr.useComplaintDetails({tenantId:s,id:i}).complaintDetails;return l.createElement(o.Switch,null,l.createElement(o.Route,{exact:!0,path:E(n,"/:id"),component:()=>l.createElement(C,{match:n,complaintDetails:c})}),l.createElement(o.Route,{path:E(n,"/upload-photo/:id"),component:()=>l.createElement(S,{match:n,skip:!0,complaintDetails:c})}),l.createElement(o.Route,{path:E(n,"/addional-details/:id"),component:()=>l.createElement(O,{match:n,parentRoute:a,complaintDetails:c})}),l.createElement(o.Route,{path:E(n,"/response"),component:()=>l.createElement(H,{match:n})}))},U=e=>{let{action:t}=e;const{t:n}=a.useTranslation();switch(t){case"REOPEN":return n("CS_COMMON_COMPLAINT_REOPENED");case"RATE":return n("CS_COMMON_THANK_YOU");default:return n("CS_COMMON_COMPLAINT_SUBMITTED")}},G=e=>{let{response:n}=e;const{complaints:o}=n;return o&&o.response&&o.response.responseInfo?(sessionStorage.removeItem("type"),sessionStorage.removeItem("pincode"),sessionStorage.removeItem("tenantId"),sessionStorage.removeItem("localityCode"),sessionStorage.removeItem("landmark"),sessionStorage.removeItem("propertyid"),l.createElement(r.Banner,{message:U(o.response.ServiceWrappers[0].workflow),complaintNumber:o.response.ServiceWrappers[0].service.serviceRequestId,successful:!0})):l.createElement(r.Banner,{message:t("CS_COMMON_COMPLAINT_NOT_SUBMITTED"),successful:!1})},j=e=>{var t,i,c,u,d,p,E,C;const{data:S}=Digit.Hooks.useStore.getInitData(),{tenants:_}=S||{},[v,f]=n.useState(!1),O=s.useSelector(e=>e).pgr;let T=null==O||null===(t=O.complaints)||void 0===t||null===(i=t.response)||void 0===i||null===(c=i.ServiceWrappers)||void 0===c||null===(u=c[0])||void 0===u||null===(d=u.service)||void 0===d?void 0:d.serviceRequestId;const{complaintDetails:g}=Digit.Hooks.pgr.useComplaintDetails({tenantId:Digit.ULBService.getCurrentTenantId(),id:T},{enabled:!!v}),{t:y}=a.useTranslation();return l.createElement(r.Card,null,O.complaints.response&&l.createElement(G,{response:O}),l.createElement(r.CardText,null,y("CS_COMMON_TRACK_COMPLAINT_TEXT")),"RATE"==(null===(p=O.complaints.response)||void 0===p||null===(E=p.ServiceWrappers)||void 0===E||null===(C=E[0])||void 0===C?void 0:C.workflow.action)?"":l.createElement("div",{style:{marginBottom:"10px"}},l.createElement(r.SubmitBar,{label:y("PT_DOWNLOAD_ACK_FORM"),onSubmit:e=>{!function(e){try{const t=_.find(e=>e.code===Digit.ULBService.getCurrentTenantId());e.preventDefault(),f(!0),Promise.resolve(k(m({},g),t,y)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}}(e)}})),l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(r.SubmitBar,{label:y("CORE_COMMON_GO_TO_HOME")})))},V=e=>{const{register:t,handleSubmit:o,errors:i,control:s,setValue:c,getValues:d,watch:p,setError:E,clearErrors:C,formState:S}=u.useForm(),{t:_}=a.useTranslation(),v=p();n.useEffect(()=>{e.getFormAccessors&&e.getFormAccessors({setValue:c,getValues:d})},[]);const f=n.useMemo(()=>{var n;return null===(n=e.config)||void 0===n?void 0:n.map((n,o,a)=>l.createElement(l.Fragment,{key:o},l.createElement(r.CardSectionHeader,null,n.head),n.body.map((n,o)=>{var a,d;return l.createElement(l.Fragment,{key:o},i[null==n||null===(a=n.populators)||void 0===a?void 0:a.name]&&(null===(d=n.populators)||void 0===d||!d.validate||i[n.populators.validate])&&l.createElement(r.CardLabelError,null,n.populators.error),l.createElement(r.LabelFieldPair,null,l.createElement(r.CardLabel,null,n.label,n.isMandatory?" * ":null),l.createElement("div",{className:"field"},((n,o,a,d,p)=>{const f="string"==typeof a?Digit.ComponentRegistryService.getComponent(a):a;switch(n){case"text":return l.createElement("div",{className:"field-container"},o.componentInFront?o.componentInFront:null,l.createElement(r.TextInput,m({className:"field desktop-w-full"},o,{inputRef:t(o.validation),value:d})));case"textarea":return l.createElement(r.TextArea,m({className:"field desktop-w-full",value:d,name:o.name||""},o,{inputRef:t(o.validation)}));case"component":var O,T,g,y;if(null!=e&&null!==(O=e.config)&&void 0!==O&&null!==(T=O[1])&&void 0!==T&&null!==(g=T.body)&&void 0!==g&&null!==(y=g[2])&&void 0!==y&&y.isProperty)return l.createElement(u.Controller,{render:e=>l.createElement(f,{userType:"employee",t:_,setValue:c,onSelect:c,config:p,data:v,formData:v,register:t,errors:i,props:e,setError:E,clearErrors:C,formState:S,onBlur:e.onBlur}),name:p.key,control:s});default:return!1!==(null==o?void 0:o.dependency)?o:null}})(n.type,n.populators,null==n?void 0:n.component,n.value,n))))}),a.length-1===o?null:l.createElement(r.BreakLine,null)))},[e.config,i]),O=e.isDisabled||!1;return l.createElement("form",{onSubmit:o(function(t){e.onSubmit(t)}),onChange:e=>{sessionStorage.setItem(e.target.name,e.target.value)}},l.createElement(r.Card,null,l.createElement(r.CardSubHeader,null,e.heading),f,e.children,l.createElement(r.ActionBar,null,l.createElement(r.SubmitBar,{disabled:O,label:_(e.label),submit:"submit"}))))},W={routes:{"complaint-type":{component:e=>{let{t:t,onSelect:o,value:a}=e;const i=Digit.GetServiceDefinitions,[s,c]=n.useState(()=>{const{complaintType:e}=a;return e||{}}),[u,d]=n.useState(()=>{const{subType:e}=a;return e||{}}),[p,E]=n.useState(()=>{const{priorityLevel:e}=a;return e||{}}),C={key:"PropertyTax",name:"Property Tax"},S=Digit.Hooks.pgr.useComplaintTypes({stateCode:Digit.ULBService.getCurrentTenantId()}),[_,v]=(Digit.Hooks.pgr.useTenants(),n.useState([])),f=sessionStorage.getItem("type");n.useEffect(()=>{!function(){try{const e=function(){if("PT"==f)return c(C),Promise.resolve(i.getSubMenu(Digit.ULBService.getCurrentTenantId(),C,t)).then(function(e){v(e)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[]);const O=[{head:t("CS_COMPLAINT_DETAILS_COMPLAINT_DETAILS"),body:[{label:t("CS_COMPLAINT_DETAILS_COMPLAINT_TYPE"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{option:S,optionKey:"name",id:"complaintType",selected:s,select:function(e){try{const n=function(){if(e.key!==s.key){const n=function(){if("Others"!==e.key)return d({name:""}),c(e),Promise.resolve(i.getSubMenu(Digit.ULBService.getCurrentTenantId(),e,t)).then(function(e){v(e)});d({name:""}),v([{key:"Others",name:t("SERVICEDEFS.OTHERS")}])}();if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},disable:f})},{label:t("CS_COMPLAINT_DETAILS_COMPLAINT_SUBTYPE"),isMandatory:!0,type:"dropdown",menu:m({},_),populators:l.createElement(r.Dropdown,{option:_,optionKey:"name",id:"complaintSubType",selected:u,select:function(e){console.log("selectedSubType",e),d(e)}})},{label:t("CS_COMPLAINT_DETAILS_COMPLAINT_PRIORITY_LEVEL"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{option:[{name:"LOW",code:"LOW",active:!0},{name:"MEDIUM",code:"MEDIUM",active:!0},{name:"HIGH",code:"HIGH",active:!0}],optionKey:"name",id:"priorityLevel",selected:p,select:function(e){try{return sessionStorage.setItem("priorityLevel",JSON.stringify(e)),E(e),Promise.resolve()}catch(e){return Promise.reject(e)}}})}]}];return window.Digit.SessionStorage.get("Digit.Citizen.tenantId"),l.createElement(V,{heading:t("ES_CREATECOMPLAINT_NEW_COMPLAINT"),config:O,onSubmit:()=>{console.log("complaintType",s),sessionStorage.setItem("complaintType",JSON.stringify(s)),o({subType:u,priorityLevel:p})},isDisabled:0===Object.keys(s).length||null===s,label:"NEXT"})},texts:{headerCaption:"",header:"CS_ADDCOMPLAINT_COMPLAINT_TYPE_PLACEHOLDER",cardText:"CS_COMPLAINT_TYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"map"},"sub-type":{component:e=>{let{t:t,config:o,onSelect:a,value:i}=e;const[s,c]=n.useState(()=>{const{subType:e}=i;return e||{}}),{complaintType:u}=i,d=Digit.Hooks.pgr.useComplaintSubType(u,t),p=m({},o.texts,{headerCaption:t("SERVICEDEFS."+u.key.toUpperCase())},{menu:d},{optionsKey:"name"},{selected:function(e){c(e)}},{selectedOption:s},{onSave:()=>{a({subType:s})}});return l.createElement(r.TypeSelectCard,m({},p,{disabled:0===Object.keys(s).length||null===s,t:t}))},texts:{header:"CS_ADDCOMPLAINT_COMPLAINT_SUBTYPE_PLACEHOLDER",cardText:"CS_COMPLAINT_SUBTYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"map"},map:{component:e=>{let{onSelect:t,t:n}=e,o="";return l.createElement(r.LocationSearchCard,{header:n("CS_ADDCOMPLAINT_SELECT_GEOLOCATION_HEADER"),cardText:n("CS_ADDCOMPLAINT_SELECT_GEOLOCATION_TEXT"),nextText:n("CS_COMMON_NEXT"),skipAndContinueText:n("CS_COMMON_SKIP"),skip:()=>t(),onSave:()=>t({pincode:o}),onChange:e=>o=e})},nextStep:"pincode"},pincode:{component:e=>{let{t:t,config:o,onSelect:a,value:i}=e;const s=sessionStorage.getItem("type");let c=sessionStorage.getItem("pincode");"null"==c&&(c="");let u=i;const d=Digit.Hooks.pgr.useTenants(),[p,E]=n.useState(()=>{if("PT"==s)return u=c,u;{const{pincode:e}=i;return e}});let C=!p;const[S,_]=n.useState(null);return l.createElement(r.FormStep,{t:t,config:o,onSelect:function(e){try{var t=d.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==(null==e?void 0:e.pincode))});const n=function(){if(t)return Digit.SessionStorage.set("city_complaint",t),Promise.resolve(Digit.LocationService.getLocalities(t.code)).then(function(n){Digit.LocalityService.get(n.TenantBoundary[0]).filter(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==e.pincode)}),a(m({},e,{city_complaint:t}))});Digit.SessionStorage.set("city_complaint",void 0),Digit.SessionStorage.set("selected_localities",void 0),_("CS_COMMON_PINCODE_NOT_SERVICABLE")}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},value:p,onChange:function(e){E(e.target.value),C=!e.target.value,_(null)},onSkip:()=>a(),forcedError:t(S),isDisabled:C})},texts:{headerCaption:"CS_ADDCOMPLAINT_COMPLAINT_LOCATION",header:"CS_FILE_APPLICATION_PINCODE_LABEL",cardText:"CS_ADDCOMPLAINT_CHANGE_PINCODE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},inputs:[{label:"CORE_COMMON_PINCODE",type:"text",name:"pincode",validation:{minLength:6,maxLength:7},error:"CORE_COMMON_PINCODE_INVALID"}],nextStep:"address"},address:{component:e=>{let{t:t,config:o,onSelect:a,value:i}=e;const s=Digit.Hooks.pgr.useTenants(),c=null!=i&&i.pincode?s.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==i.pincode)}):s,u=sessionStorage.getItem("type"),m=sessionStorage.getItem("tenantId"),d=sessionStorage.getItem("localityCode");let p=i;const[E,C]=n.useState(()=>{if("PT"==u){let e=c.filter(e=>e.code===m);return console.log("filteredcities",e),e&&(p=e[0]),console.log("val2",p),p}{const{city_complaint:e}=i;return e||null}}),{data:S}=Digit.Hooks.useBoundaryLocalities(null==E?void 0:E.code,"admin",{enabled:!!E},t),[_,v]=n.useState(null),[f,O]=n.useState(()=>{const{locality_complaint:e}=i;return e||null});function T(e){O(null),v(null),C(e)}function g(e){O(e)}return n.useEffect(function(){try{const e=function(){if(E&&S){const{pincode:e}=i;let t=e?S.filter(t=>t.pincode==e):S;return Promise.resolve(v(t)).then(function(){if("PT"==u){let e=t.filter(e=>e.code===d);e&&O(e[0])}else v(t)})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[E,S]),l.createElement(r.FormStep,{config:o,onSelect:function(){a({city_complaint:E,locality_complaint:f})},t:t,isDisabled:!f},l.createElement("div",null,l.createElement(r.CardLabel,null,t("MYCITY_CODE_LABEL")),(null==c?void 0:c.length)<5?l.createElement(r.RadioButtons,{selectedOption:E,options:c,optionsKey:"i18nKey",onSelect:T}):l.createElement(r.Dropdown,{isMandatory:!0,selected:E,option:c,select:T,optionKey:"i18nKey",t:t}),E&&_&&l.createElement(r.CardLabel,null,t("CS_CREATECOMPLAINT_MOHALLA")),E&&_&&l.createElement(l.Fragment,null,(null==_?void 0:_.length)<5?l.createElement(r.RadioButtons,{selectedOption:f,options:_,optionsKey:"i18nkey",onSelect:g}):l.createElement(r.Dropdown,{isMandatory:!0,selected:f,optionKey:"i18nkey",option:_,select:g,t:t}))))},texts:{headerCaption:"CS_ADDCOMPLAINT_COMPLAINT_LOCATION",header:"CS_ADDCOMPLAINT_PROVIDE_COMPLAINT_ADDRESS",cardText:"CS_ADDCOMPLAINT_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"landmark"},landmark:{component:e=>{let{t:t,config:o,onSelect:a,value:i}=e;const[s,c]=n.useState(()=>{const{landmark:e}=i;return e||""});return l.createElement(r.FormStep,{config:o,value:s,onChange:function(e){c(e.target.value)},onSelect:e=>a(e),onSkip:()=>a(),t:t})},texts:{headerCaption:"CS_ADDCOMPLAINT_COMPLAINT_LOCATION",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TITLE",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TITLE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},inputs:[{label:"CS_ADDCOMPLAINT_LANDMARK",type:"textarea",name:"landmark"}],nextStep:"upload-photos"},"upload-photos":{component:e=>{var t;let{t:o,config:a,onSelect:i,onSkip:s,value:c}=e;const[u,m]=n.useState(()=>{const{uploadedImages:e}=c;return e||null});return l.createElement(r.FormStep,{config:a,onSelect:()=>{if(!u||0===u.length)return s();i({uploadedImages:u})},onSkip:s,t:o},l.createElement(r.ImageUploadHandler,{tenantId:null===(t=c.city_complaint)||void 0===t?void 0:t.code,uploadedImages:u,onPhotoChange:e=>{m(e)}}))},texts:{header:"CS_ADDCOMPLAINT_UPLOAD_PHOTO",cardText:"CS_ADDCOMPLAINT_UPLOAD_PHOTO_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"additional-details"},"additional-details":{component:e=>{let{t:t,config:o,onSelect:a,value:i}=e;const s=sessionStorage.getItem("type"),c=sessionStorage.getItem("propertyid");let u=i;const[m,d]=n.useState(()=>{if("PT"==s)return u=c,u;{const{details:e}=i;return e||""}});return l.createElement(r.FormStep,{config:o,onChange:e=>{const{value:t}=e.target;d(t)},onSelect:()=>a({details:m}),value:m,t:t})},texts:{header:"CS_ADDCOMPLAINT_PROVIDE_ADDITIONAL_DETAILS",cardText:"CS_ADDCOMPLAINT_ADDITIONAL_DETAILS_TEXT",submitBarLabel:"CS_COMMON_NEXT"},inputs:[{label:"CS_ADDCOMPLAINT_ADDITIONAL_DETAILS",type:"textarea",name:"details"}],nextStep:null}},indexRoute:"complaint-type"},Y=["city_complaint","locality_complaint","uploadedImages","complaintType","subType","prioritylevel","details"],$=e=>{let{data:t,path:n}=e,{serviceCode:i,serviceRequestId:s,applicationStatus:c}=t;const u=o.useHistory(),{t:m}=a.useTranslation(),d=["RESOLVED","REJECTED","CLOSEDAFTERREJECTION","CLOSEDAFTERRESOLUTION"];return l.createElement(l.Fragment,null,l.createElement(r.Card,{onClick:()=>{u.push(n+"/"+s)}},l.createElement(r.CardSubHeader,null,m("SERVICEDEFS."+i.toUpperCase())),l.createElement(r.DateWrap,{date:Digit.DateUtils.ConvertTimestampToDate(t.auditDetails.createdTime)}),l.createElement(r.KeyNote,{keyValue:m("CS_COMMON_COMPLAINT_NO"),note:s}),l.createElement("div",{className:"status-highlight "+(d.includes(c)?"success":"")},l.createElement("p",null,(d.includes(c)?m("CS_COMMON_CLOSED"):m("CS_COMMON_OPEN")).toUpperCase())),m("CS_COMMON_"+c)))},K=e=>{let{name:t,isCompleted:n,mobile:o,text:i,customChild:s}=e,{t:c}=a.useTranslation();return l.createElement(r.CheckPoint,{label:c("CS_COMMON_PENDINGATLME"),isCompleted:n,customChild:l.createElement("div",null,t&&o?l.createElement(r.TelePhone,{mobile:o,text:i+" "+t}):null,s)})},z=e=>{let{isCompleted:t,text:n,customChild:o}=e;return l.createElement(r.CheckPoint,{isCompleted:t,label:n,customChild:o})},q=e=>{let{action:t,nextActions:n,complaintDetails:i,ComplainMaxIdleTime:s=36e5,serviceRequestId:c,reopenDate:u,isCompleted:m,customChild:d}=e;const{t:p}=a.useTranslation();if("RESOLVE"===t){let e=n&&n.map((e,t)=>{if(e&&"COMMENT"!==e)return l.createElement(o.Link,{key:t,to:"/digit-ui/citizen/pgr/"+e.toLowerCase()+"/"+c},l.createElement(r.ActionLinks,null,p("CS_COMMON_"+e)))});return l.createElement(r.CheckPoint,{isCompleted:m,label:p("CS_COMMON_COMPLAINT_RESOLVED"),customChild:l.createElement("div",null,e,d)})}if("RATE"===t)return l.createElement(r.CheckPoint,{isCompleted:m,label:p("CS_COMMON_COMPLAINT_RESOLVED"),customChild:l.createElement("div",null,d)});if("REOPEN"===t)return l.createElement(r.CheckPoint,{isCompleted:m,label:p("CS_COMMON_COMPLAINT_REOPENED"),info:u,customChild:d});{let e=n&&n.map((e,t)=>{var n,a;if(e&&"COMMENT"!==e&&("REOPEN"!==e||"REOPEN"===e&&(null===Date||void 0===Date?void 0:Date.now())-(null==i||null===(n=i.service)||void 0===n||null===(a=n.auditDetails)||void 0===a?void 0:a.lastModifiedTime)<s))return l.createElement(o.Link,{key:t,to:"/digit-ui/citizen/pgr/"+e.toLowerCase()+"/"+c},l.createElement(r.ActionLinks,null,p("CS_COMMON_"+e)))});return l.createElement(r.CheckPoint,{isCompleted:m,label:p("CS_COMMON_COMPLAINT_RESOLVED"),customChild:l.createElement("div",null,e,d)})}},X=e=>{let{action:t,nextActions:n,complaintDetails:i,ComplainMaxIdleTime:s=36e5,rating:c,serviceRequestId:u,reopenDate:m,isCompleted:d}=e;const{t:p}=a.useTranslation();if("REJECTED"===t){let e=n&&n.map((e,t)=>{if(e&&"COMMENT"!==e&&"CANCEL"!==e)return l.createElement(o.Link,{key:t,to:"/digit-ui/citizen/pgr/"+e.toLowerCase()+"/"+u},l.createElement(r.ActionLinks,null,p("CS_COMMON_"+e)))});return l.createElement(r.CheckPoint,{isCompleted:d,label:p("CS_COMMON_COMPLAINT_REJECTED"),customChild:l.createElement("div",null,e)})}if("RATE"===t&&c)return l.createElement(r.CheckPoint,{isCompleted:d,label:p("CS_COMMON_COMPLAINT_REJECTED"),customChild:l.createElement("div",null,c?l.createElement(g,{text:p("CS_ADDCOMPLAINT_YOU_RATED"),rating:c}):null,customChild)});if("REOPEN"===t)return l.createElement(r.CheckPoint,{isCompleted:d,label:p("CS_COMMON_COMPLAINT_REOPENED"),info:m});{let e=n&&n.map((e,t)=>{var n,a;if(e&&"COMMENT"!==e&&"CANCEL"!==e&&("REOPEN"!==e||"REOPEN"===e&&(null===Date||void 0===Date?void 0:Date.now())-(null==i||null===(n=i.service)||void 0===n||null===(a=n.auditDetails)||void 0===a?void 0:a.lastModifiedTime)<s))return l.createElement(o.Link,{key:t,to:"/digit-ui/citizen/pgr/"+e.toLowerCase()+"/"+u},l.createElement(r.ActionLinks,null,p("CS_COMMON_"+e)))});return l.createElement(r.CheckPoint,{isCompleted:d,label:p("CS_COMMON_COMPLAINT_REJECTED"),customChild:l.createElement("div",null,e)})}},J=e=>{let{data:t}=e;const{t:n}=a.useTranslation();return l.createElement("div",null,(null==t?void 0:t.date)&&l.createElement("p",null,null==t?void 0:t.date),l.createElement("p",null,null==t?void 0:t.name),l.createElement("p",null,null==t?void 0:t.mobileNumber),(null==t?void 0:t.source)&&l.createElement("p",null,n("ES_COMMON_FILED_VIA_"+(null==t?void 0:t.source.toUpperCase()))))},Z=e=>{let{data:t,serviceRequestId:o,complaintWorkflow:i,rating:s,zoomImage:c,complaintDetails:u,ComplainMaxIdleTime:d}=e;const{t:p}=a.useTranslation();let{timeline:E}=t;const C=n.useMemo(()=>null==E?void 0:E.length,[E]);n.useEffect(()=>{null==E||E.filter((e,t,n)=>t===n.length-1&&"PENDINGFORASSIGNMENT"===e.status);const e=(null==E?void 0:E.filter(e=>"PENDINGFORASSIGNMENT"===(null==e?void 0:e.status))).at(-1);null==E||E.push(m({},e,{performedAction:"FILED",status:"COMPLAINT_FILED"}))},[E]);const[S,_]=n.useState(!1),v=e=>{var t;let{comment:o,thumbnailsToShow:a,auditDetails:i,assigner:s,status:m}=e;const d={date:null==i?void 0:i.lastModified,name:null==s?void 0:s.name,mobileNumber:null==s?void 0:s.mobileNumber,source:"COMPLAINT_FILED"==m?null==u?void 0:u.audit.source:""};return l.createElement(n.Fragment,null,o?l.createElement("div",null,null==o?void 0:o.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,p("WF_COMMON_COMMENTS")),l.createElement("p",null,e)))):null,(null==a||null===(t=a.thumbs)||void 0===t?void 0:t.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,p("CS_COMMON_ATTACHMENTS")),l.createElement(r.DisplayPhotos,{srcs:a.thumbs,onClick:(e,t)=>{!function(e,t,n){var l,o;let a=null===(l=n.thumbs)||void 0===l?void 0:l.findIndex(t=>t===e);c(a>-1&&(null==n||null===(o=n.fullImage)||void 0===o?void 0:o[a])||e)}(e,0,a)}})):null,null!=d&&d.date?l.createElement(J,{data:d,comments:o}):null)};return l.createElement(l.Fragment,null,l.createElement(r.CardSubHeader,null,p("CS_COMPLAINT_DETAILS_COMPLAINT_TIMELINE")),E&&C>0?l.createElement(r.ConnectingCheckPoints,null,E.slice(0,S?E.length:2).map((e,t,n)=>{let{status:a,caption:c,auditDetails:E,timeLineActions:S,performedAction:_,wfComment:f,thumbnailsToShow:O,assigner:T}=e;return(e=>{let{status:t,caption:n,auditDetails:a,timeLineActions:c,index:E,comment:C,thumbnailsToShow:S,assigner:_,totalTimelineLength:f}=e;const O=0===E;switch(t){case"PENDINGFORREASSIGNMENT":return l.createElement(r.CheckPoint,{isCompleted:O,key:E,label:p("CS_COMMON_"+t),customChild:v({comment:C,thumbnailsToShow:S,auditDetails:a,assigner:_})});case"PENDINGFORASSIGNMENT":const e=f-(E+1)==0;return l.createElement(z,{key:E,isCompleted:O,text:p("CS_COMMON_"+t),customChild:v(m({comment:C},e?{auditDetails:a}:{thumbnailsToShow:S,auditDetails:a}))});case"PENDINGFORASSIGNMENT_AFTERREOPEN":return l.createElement(z,{isCompleted:O,key:E,text:p("CS_COMMON_"+t),customChild:v({comment:C,thumbnailsToShow:S,auditDetails:a,assigner:_})});case"PENDINGATLME":let{name:T,mobileNumber:y}=n&&n.length>0?n[0]:{name:"",mobileNumber:""};const N=""+p("CS_COMMON_"+t);return l.createElement(K,{isCompleted:O,key:E,name:T,mobile:y,text:N,customChild:v({comment:C,thumbnailsToShow:S,auditDetails:a,assigner:_})});case"RESOLVED":return l.createElement(q,{key:E,isCompleted:O,action:i.action,nextActions:E<=1&&c,complaintDetails:u,ComplainMaxIdleTime:d,serviceRequestId:o,reopenDate:Digit.DateUtils.ConvertTimestampToDate(a.lastModifiedTime),customChild:v({comment:C,thumbnailsToShow:S,auditDetails:a,assigner:_})});case"REJECTED":return l.createElement(X,{key:E,isCompleted:O,action:i.action,nextActions:E<=1&&c,complaintDetails:u,ComplainMaxIdleTime:d,serviceRequestId:o,reopenDate:Digit.DateUtils.ConvertTimestampToDate(a.lastModifiedTime),customChild:v({comment:C,thumbnailsToShow:S,auditDetails:a,assigner:_})});case"CLOSEDAFTERRESOLUTION":return l.createElement(r.CheckPoint,{isCompleted:O,key:E,label:p("CS_COMMON_CS_COMMON_"+t),customChild:l.createElement("div",null,v({comment:C,thumbnailsToShow:S,auditDetails:a,assigner:_}),s?l.createElement(g,{text:p("CS_ADDCOMPLAINT_YOU_RATED"),rating:s}):null)});case"COMPLAINT_FILED":return l.createElement(r.CheckPoint,{isCompleted:O,key:E,label:p("CS_COMMON_COMPLAINT_FILED"),customChild:v({comment:C,auditDetails:a,assigner:_,status:t})});default:return l.createElement(r.CheckPoint,{isCompleted:O,key:E,label:p("CS_COMMON_"+t),customChild:v({comment:C,thumbnailsToShow:S,auditDetails:a,assigner:_,status:t})})}})({status:a,caption:c,auditDetails:E,timeLineActions:S,index:t,array:n,performedAction:_,comment:f,thumbnailsToShow:O,assigner:T,totalTimelineLength:C})})):l.createElement(r.Loader,null),(null==E?void 0:E.length)>2&&l.createElement(r.LinkButton,{label:p(S?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{_(e=>!e)}}))},Q=e=>{var t;let{complaintDetails:o,id:a,getWorkFlow:r,zoomImage:i}=e;const s=(null===(t=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===t?void 0:t.code)||o.service.tenantId;let c=Digit.Hooks.useWorkflowDetails({tenantId:s,id:a,moduleCode:"PGR"});const{data:u}=Digit.Hooks.pgr.useMDMS.ComplainClosingTime(null==s?void 0:s.split(".")[0]);return n.useEffect(()=>{r(c.data)},[c.data]),n.useEffect(()=>{c.revalidate()},[]),!c.isLoading&&l.createElement(Z,{data:c.data,serviceRequestId:a,complaintWorkflow:o.workflow,rating:o.audit.rating,zoomImage:i,complaintDetails:o,ComplainMaxIdleTime:u})},ee=["path","url"],te=()=>{var e,t,n,i,s,c,u,p,E,C;const{t:S}=a.useTranslation(),_=o.useRouteMatch(),{path:v,url:f}=_,O=d(_,ee),T=o.useLocation(),g=null===(e=Digit)||void 0===e||null===(t=e.ComponentRegistryService)||void 0===t?void 0:t.getComponent("PGRCreateComplaintCitizen"),y=null===(n=Digit)||void 0===n||null===(i=n.ComponentRegistryService)||void 0===i?void 0:i.getComponent("PGRComplaintsList"),N=null===(s=Digit)||void 0===s||null===(c=s.ComponentRegistryService)||void 0===c?void 0:c.getComponent("PGRComplaintDetailsPage"),I=null===(u=Digit)||void 0===u||null===(p=u.ComponentRegistryService)||void 0===p?void 0:p.getComponent("PGRSelectRating"),A=null===(E=Digit)||void 0===E||null===(C=E.ComponentRegistryService)||void 0===C?void 0:C.getComponent("PGRResponseCitzen");return l.createElement(l.Fragment,null,l.createElement("div",{className:"pgr-citizen-wrapper"},!T.pathname.includes("/response")&&l.createElement(r.BackButton,null,S("CS_COMMON_BACK")),l.createElement(o.Switch,null,l.createElement(r.PrivateRoute,{path:v+"/create-complaint",component:g}),l.createElement(r.PrivateRoute,{path:v+"/complaints",exact:!0,component:y}),l.createElement(r.PrivateRoute,{path:v+"/complaints/:id*",component:N}),l.createElement(r.PrivateRoute,{path:v+"/reopen",component:()=>l.createElement(B,{match:m({},O,{url:f,path:v+"/reopen"}),parentRoute:v})}),l.createElement(r.PrivateRoute,{path:v+"/rate/:id*",component:()=>l.createElement(I,{parentRoute:v})}),l.createElement(r.PrivateRoute,{path:v+"/response",component:()=>l.createElement(A,{match:m({},O,{url:f,path:v})})}))))},ne=()=>{var e,t,i,s,c,u,m,d;const[p,E]=n.useState(!1),[C,S]=n.useState(!1),_=o.useRouteMatch(),{t:v}=a.useTranslation(),f={home:{content:v("CS_COMMON_HOME"),path:"/digit-ui/employee"},inbox:{content:v("CS_COMMON_INBOX"),path:_.url+"/inbox"},createComplaint:{content:v("CS_PGR_CREATE_COMPLAINT"),path:_.url+"/complaint/create"},complaintDetails:{content:v("CS_PGR_COMPLAINT_DETAILS"),path:_.url+"/complaint/details/:id"},response:{content:v("CS_PGR_RESPONSE"),path:_.url+"/response"},editApplication:{content:v("CS_PGR_EDIT_APPLICATION"),path:_.url+"/modify-application"}};let O=o.useLocation().pathname;const T=null===(e=Digit)||void 0===e||null===(t=e.ComponentRegistryService)||void 0===t?void 0:t.getComponent("PGRCreateComplaintEmp"),g=null===(i=Digit)||void 0===i||null===(s=i.ComponentRegistryService)||void 0===s?void 0:s.getComponent("PGRComplaintDetails"),y=null===(c=Digit)||void 0===c||null===(u=c.ComponentRegistryService)||void 0===u?void 0:u.getComponent("PGRInbox"),N=null===(m=Digit)||void 0===m||null===(d=m.ComponentRegistryService)||void 0===d?void 0:d.getComponent("PGRResponseEmp"),I=Digit.ComponentRegistryService.getComponent("PGREditApplication");return l.createElement(l.Fragment,null,l.createElement("div",{className:"ground-container"},!O.includes("/response")&&l.createElement(o.Switch,null,l.createElement(o.Route,{path:_.url+"/complaint/create",component:()=>l.createElement(r.BreadCrumb,{crumbs:[f.home,f.createComplaint]})}),l.createElement(o.Route,{path:_.url+"/complaint/details/:id",component:()=>l.createElement(r.BreadCrumb,{crumbs:[f.home,f.inbox,f.complaintDetails]})}),l.createElement(o.Route,{path:_.url+"/inbox",component:()=>l.createElement(r.BreadCrumb,{crumbs:[f.home,f.inbox]})}),l.createElement(o.Route,{path:_.url+"/response",component:l.createElement(r.BreadCrumb,{crumbs:[f.home,f.response]})}),l.createElement(o.Route,{path:_.url+"/modify-application:id",component:l.createElement(r.BreadCrumb,{crumbs:[f.home,f.editApplication]})})),l.createElement(o.Switch,null,l.createElement(o.Route,{path:_.url+"/complaint/create",component:()=>l.createElement(T,{parentUrl:_.url})}),l.createElement(o.Route,{path:_.url+"/complaint/details/:id*",component:()=>l.createElement(g,null)}),l.createElement(o.Route,{path:_.url+"/inbox",component:y}),l.createElement(o.Route,{path:_.url+"/response",component:N}),l.createElement(o.Route,{path:_.url+"/modify-application:id*",component:I}))))},le=()=>l.createElement(r.EmployeeAppContainer,null,l.createElement(ne,null)),oe=e=>{const{t:t}=a.useTranslation(),i=[{text:"ES_PGR_NEW_COMPLAINT",link:"/digit-ui/employee/pgr/complaint/create",accessTo:["CSR"]}],[s,c]=n.useState([]);return n.useEffect(()=>{let e=[];i.forEach(t=>{t.accessTo?Digit.UserService.hasAccess(t.accessTo)&&e.push(t):e.push(t)}),c(e)},[]),l.createElement(r.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 9h-2V5h2v6zm0 4h-2v-2h2v2z",fill:"white"})))," ",l.createElement("span",{className:"text"},t("ES_PGR_HEADER_COMPLAINT"))),l.createElement("div",{className:"body"},s.map((e,n)=>{let{link:a,text:r}=e;return l.createElement("span",{className:"link",key:n},l.createElement(o.Link,{to:a},t(r)))}))))},ae=e=>{let{t:t,columns:n,data:o,getCellProps:a,onNextPage:i,onPrevPage:s,currentPage:c,totalRecords:u,pageSizeLimit:m,onPageSizeChange:d}=e;return l.createElement(r.Table,{t:t,data:o,columns:n,getCellProps:a,onNextPage:i,onPrevPage:s,currentPage:c,totalRecords:u,onPageSizeChange:d,pageSizeLimit:m})},re=e=>{var t;let{complaints:n,onAssignmentChange:o,pgrfilters:i}=e;const{t:s}=a.useTranslation(),c=Digit.Hooks.pgr.useComplaintStatusCount(n);let u=null==i||null===(t=i.applicationStatus)||void 0===t?void 0:t.length;return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},s("ES_PGR_FILTER_STATUS")),0===c.length&&l.createElement(r.Loader,null),c.map((e,t)=>l.createElement(r.CheckBox,{key:t,onChange:t=>o(t,e),checked:!!u&&0!==i.applicationStatus.filter(t=>t.code===e.code).length,label:e.name+" ("+(e.count||0)+")"})))};let ie={},se={};const ce=e=>{var t,o,i,s,c,u,d;let{uuid:p}=Digit.UserService.getUser().info;const{searchParams:E}=e,{t:C}=a.useTranslation(),S=!(null==E||null===(t=E.filters)||void 0===t||null===(o=t.wfFilters)||void 0===o||!o.assignee||null==E||null===(i=E.filters)||void 0===i||null===(s=i.wfFilters)||void 0===s||null===(c=s.assignee[0])||void 0===c||!c.code),_=n.useMemo(()=>[{code:"ASSIGNED_TO_ME",name:C("ASSIGNED_TO_ME")},{code:"ASSIGNED_TO_ALL",name:C("ASSIGNED_TO_ALL")}],[C]),[v,f]=n.useState(S?_[0]:_[1]);n.useEffect(()=>f(S?_[0]:_[1]),[C]);const[O,T]=n.useState(null),[g,y]=n.useState(null),[N,I]=n.useState((null==E||null===(u=E.filters)||void 0===u?void 0:u.pgrfilters)||{serviceCode:[],locality:[],applicationStatus:[]}),[A,M]=n.useState((null==E||null===(d=E.filters)||void 0===d?void 0:d.wfFilters)||{assignee:[{code:p}]}),h=Digit.ULBService.getCurrentTenantId(),{data:D}=Digit.Hooks.useBoundaryLocalities(h,"admin",{},C);let P=Digit.Hooks.pgr.useServiceDefs(h,"PGR");n.useEffect(()=>{var t;let n=0;for(const e in N)if(Array.isArray(N[e])){n+=N[e].length;let t=N[e].map(e=>e.code).join();var l;t?ie[e]=t:null===(l=ie)||void 0===l||delete l[e]}for(const e in A)if(Array.isArray(A[e])){let t=A[e].map(e=>e.code).join();t?se[e]=t:se={}}n+=(null==A||null===(t=A.assignee)||void 0===t?void 0:t.length)||0,"mobile"!==e.type&&k(),Digit.inboxFilterCount=n},[N,A]);const L=(e,t)=>e.filter(e=>e.code===t.code).length;n.useEffect(()=>{T(N.serviceCode.length>1?{i18nKey:N.serviceCode.length+" selected"}:N.serviceCode[0])},[N.serviceCode]),n.useEffect(()=>{y(N.locality.length>1?{name:N.locality.length+" selected"}:N.locality[0])},[N.locality]);const b=(e,t)=>{let n=N[t].filter((t,n)=>n!==e);I(m({},N,{[t]:n}))};function R(){I({serviceCode:[],locality:[],applicationStatus:[]}),M({assigned:[{code:[]}]}),ie={},se={},f(""),T(null),y(null)}const k=()=>{e.onFilterChange({pgrQuery:ie,wfQuery:se,wfFilters:A,pgrfilters:N})},w=function(e,t,n,o,a,i,s){return void 0===n&&(n=null),n=n||{[a]:" ",code:""},l.createElement("div",null,l.createElement("div",{className:"filter-label"},e),l.createElement(r.Dropdown,{option:t,selected:n,select:e=>o(e,s),optionKey:a}),l.createElement("div",{className:"tag-container"},N[s].length>0&&N[s].map((e,t)=>l.createElement(r.RemoveableTag,{key:t,text:e[a].slice(0,22)+" ...",onClick:()=>i(t,s)}))))};return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},C("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:R},C("ES_COMMON_CLEAR_ALL")),"desktop"===e.type&&l.createElement("span",{className:"clear-search",onClick:R},C("ES_COMMON_CLEAR_ALL")),"mobile"===e.type&&l.createElement("span",{onClick:e.onClose},l.createElement(r.CloseSvg,null))),l.createElement("div",null,l.createElement(r.RadioButtons,{onSelect:e=>{f(e),p="ASSIGNED_TO_ME"===e.code?p:"",M(m({},A,{assignee:[{code:p}]}))},selectedOption:v,optionsKey:"name",options:_}),l.createElement("div",null,w(C("CS_COMPLAINT_DETAILS_COMPLAINT_SUBTYPE"),P,O,function(e){const t={i18nKey:C("SERVICEDEFS."+e.serviceCode.toUpperCase()),code:e.serviceCode};L(N.serviceCode,t)||I(m({},N,{serviceCode:[...N.serviceCode,t]}))},"i18nKey",b,"serviceCode")),l.createElement("div",null,w(C("CS_PGR_LOCALITY"),D,g,function(e,t){L(N.locality,e)||I(m({},N,{locality:[...N.locality,e]}))},"i18nkey",b,"locality")),l.createElement(re,{complaints:e.complaints,onAssignmentChange:(e,t)=>{if(e.target.checked)I(m({},N,{applicationStatus:[...N.applicationStatus,{code:t.code}]}));else{const e=N.applicationStatus.filter(e=>e.code!==t.code);I(m({},N,{applicationStatus:e}))}},pgrfilters:N})))),l.createElement(r.ActionBar,null,"mobile"===e.type&&l.createElement(r.ApplyFilterBar,{labelLink:C("ES_COMMON_CLEAR_ALL"),buttonLink:C("ES_COMMON_FILTER"),onClear:R,onSubmit:function(){k(),e.onClose()}})))},ue=e=>{var t,o;let{onSearch:i,type:s,onClose:c,searchParams:m}=e;const[d,p]=n.useState((null==m||null===(t=m.search)||void 0===t?void 0:t.serviceRequestId)||""),[E,C]=n.useState((null==m||null===(o=m.search)||void 0===o?void 0:o.mobileNumber)||""),{register:S,errors:_,handleSubmit:v,reset:f}=u.useForm(),{t:O}=a.useTranslation();return l.createElement("form",{onSubmit:v(e=>{Object.keys(_).filter(e=>_[e]).length||(i(""!==e.serviceRequestId?{serviceRequestId:e.serviceRequestId}:""!==e.mobileNumber?{mobileNumber:e.mobileNumber}:{}),"mobile"===s&&c())}),style:{marginLeft:"24px"}},l.createElement(l.Fragment,null,l.createElement("div",{className:"search-container",style:{width:"auto"}},l.createElement("div",{className:"search-complaint-container"},"mobile"===s&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null," ",O("CS_COMMON_SEARCH_BY"),":"),l.createElement("span",{onClick:c},l.createElement(r.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container",style:{display:"grid"}},l.createElement("span",{className:"complaint-input"},l.createElement(r.Label,null,O("CS_COMMON_COMPLAINT_NO"),"."),l.createElement(r.TextInput,{name:"serviceRequestId",value:d,onChange:function(e){p(e.target.value)},inputRef:S({pattern:/(?!^$)([^\s])/}),style:{marginBottom:"8px"}})),l.createElement("span",{className:"mobile-input"},l.createElement(r.Label,null,O("CS_COMMON_MOBILE_NO"),"."),l.createElement(r.TextInput,{name:"mobileNumber",value:E,onChange:function(e){C(e.target.value)},inputRef:S({pattern:/^[6-9]\d{9}$/})})),"desktop"===s&&l.createElement(r.SubmitBar,{style:{marginTop:32,marginLeft:"16px",width:"calc( 100% - 16px )"},label:O("ES_COMMON_SEARCH"),submit:!0,disabled:Object.keys(_).filter(e=>_[e]).length})),"desktop"===s&&l.createElement("span",{className:"clear-search"},l.createElement(r.LinkLabel,{className:"clear-search-label",onClick:function(){f(),i({}),p(""),C("")}},O("ES_COMMON_CLEAR_SEARCH"))))),"mobile"===s&&l.createElement(r.ActionBar,null,l.createElement(r.SubmitBar,{label:"Search",submit:!0}))))},me=e=>{let{data:t,onFilterChange:n,onSearch:i,isLoading:s,searchParams:c,onNextPage:u,onPrevPage:m,currentPage:d,pageSizeLimit:p,onPageSizeChange:E,totalRecords:C}=e;const{t:S}=a.useTranslation(),_=e=>l.createElement("span",{className:"cell-text"},e),v=l.useMemo(()=>[{Header:S("CS_COMMON_COMPLAINT_NO"),Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:"/digit-ui/employee/pgr/complaint/details/"+t.original.serviceRequestId},t.original.serviceRequestId)),l.createElement("br",null),l.createElement("span",{className:"complain-no-cell-text"},S("SERVICEDEFS."+t.original.complaintSubType.toUpperCase())))}},{Header:S("WF_INBOX_HEADER_LOCALITY"),Cell:e=>{let{row:t}=e;return _(S(Digit.Utils.locale.getLocalityCode(t.original.locality,t.original.tenantId)))}},{Header:S("CS_COMPLAINT_DETAILS_CURRENT_STATUS"),Cell:e=>{let{row:t}=e;return _(S("CS_COMMON_"+t.original.status))}},{Header:S("WF_INBOX_HEADER_CURRENT_OWNER"),Cell:e=>{let{row:t}=e;return _(t.original.taskOwner)}},{Header:S("WF_INBOX_HEADER_SLA_DAYS_REMAINING"),Cell:e=>{let{row:t}=e;return l.createElement("span",(n=t.original.sla)<0?{className:"sla-cell-error"}:{className:"sla-cell-success"},n||"");var n}}],[S]);let f;return f=s?l.createElement(r.Loader,null):t&&0===t.length?l.createElement(r.Card,{style:{marginTop:20}},S("CS_MYCOMPLAINTS_NO_COMPLAINTS_EMPLOYEE").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):t.length>0?l.createElement(ae,{t:S,data:t,columns:v,getCellProps:e=>({style:{minWidth:e.column.Header===S("CS_COMMON_COMPLAINT_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onNextPage:u,onPrevPage:m,totalRecords:C,onPageSizeChagne:E,currentPage:d,pageSizeLimit:p}):l.createElement(r.Card,{style:{marginTop:20}},S("CS_COMMON_ERROR_LOADING_RESULTS").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(oe,null),l.createElement("div",null,l.createElement(ce,{complaints:t,onFilterChange:n,type:"desktop",searchParams:c}))),l.createElement("div",{style:{flex:1}},l.createElement(ue,{onSearch:i,type:"desktop"}),l.createElement("div",{style:{marginTop:"24px",marginTop:"24px",marginLeft:"24px",flex:1}},f)))},de=e=>{let{data:t,onFilterChange:o,onSearch:i,serviceRequestIdKey:s,searchParams:c}=e;const{t:u}=a.useTranslation(),[m,d]=n.useState(!1),[p,E]=n.useState(null),[C,S]=n.useState(Digit.inboxFilterCount||1),_=e=>{"SEARCH"===e?E(l.createElement(ue,{type:"mobile",onClose:v,onSearch:i,searchParams:c})):"FILTER"===e&&E(l.createElement(ce,{complaints:t,onFilterChange:o,onClose:v,type:"mobile",searchParams:c})),d(!0)},v=()=>{d(!1),E(null)};let f;return f=t&&0===(null==t?void 0:t.length)?l.createElement(r.Card,{style:{marginTop:20}},u("CS_MYCOMPLAINTS_NO_COMPLAINTS_EMPLOYEE").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):t&&(null==t?void 0:t.length)>0?l.createElement(r.DetailsCard,{data:t,serviceRequestIdKey:s,linkPrefix:"/digit-ui/employee/pgr/complaint/details/"}):l.createElement(r.Card,{style:{marginTop:20}},u("CS_COMMON_ERROR_LOADING_RESULTS").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},l.createElement(r.SearchAction,{text:"SEARCH",handleActionClick:()=>_("SEARCH")}),l.createElement(r.FilterAction,{filterCount:C,text:"FILTER",handleActionClick:()=>_("FILTER")})),f,m&&l.createElement(r.PopUp,null,l.createElement("div",{className:"popup-module"},p)))};function pe(e,t){return e(t={exports:{}},t.exports),t.exports
1
+ var e,n=require("react"),l=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-router-dom"),a=require("react-i18next"),r=require("@djb25/digit-ui-react-components"),i=require("redux"),s=require("react-redux"),c=require("react-query");require("lodash.merge");var u=require("react-hook-form");function m(e,t){switch(void 0===e&&(e={}),t.type){case"CREATE_COMPLAINT":return{...e,response:t.payload};case"FETCH_COMPLAINTS":return{...e,list:t.payload.complaints};case"UPDATE_COMPLAINT":return{...e,response:t.payload};case"APPLY_INBOX_FILTER":return{...e,response:t.payload.response.instances};default:return e}}const d=(e,t)=>`${e.path}${t}`,p=e=>{const t=o.useHistory(),{t:i}=a.useTranslation(),{id:s}=o.useParams(),[c,u]=n.useState(null),[m,d]=n.useState(!0);return l.createElement(r.Card,null,l.createElement(r.CardHeader,null,i("CS_REOPEN_COMPLAINT")),l.createElement(r.CardText,null),m?null:l.createElement(r.CardLabelError,null,i("CS_ADDCOMPLAINT_ERROR_REOPEN_REASON")),l.createElement(r.RadioButtons,{onSelect:e=>{let t=Digit.SessionStorage.get("reopen."+s);Digit.SessionStorage.set("reopen."+s,{...t,reason:e}),u(e)},selectedOption:c,options:[i("CS_REOPEN_OPTION_ONE"),i("CS_REOPEN_OPTION_TWO"),i("CS_REOPEN_OPTION_THREE"),i("CS_REOPEN_OPTION_FOUR")]}),l.createElement(r.SubmitBar,{label:i("CS_COMMON_NEXT"),onSubmit:function(){null===c?d(!1):t.push(`${e.match.path}/upload-photo/${s}`)}}))},E=e=>{var t,i;const{t:s}=a.useTranslation(),c=o.useHistory();let{id:u}=o.useParams();const[m,d]=n.useState(null),[p,E]=n.useState(!0);return n.useEffect(()=>{let e=Digit.SessionStorage.get("reopen."+u);Digit.SessionStorage.set("reopen."+u,{...e,verificationDocuments:m})},[m,u]),l.createElement(l.Fragment,null,l.createElement(r.Card,null,l.createElement(r.ImageUploadHandler,{header:s("CS_ADDCOMPLAINT_UPLOAD_PHOTO"),tenantId:null==e||null===(t=e.complaintDetails)||void 0===t||null===(i=t.service)||void 0===i?void 0:i.tenantId,cardText:"",onPhotoChange:e=>{(e=>{if(null!=e&&e.length){const t=e.map(e=>({documentType:"PHOTO",fileStoreId:e,documentUid:"",additionalDetails:{}}));d(t)}})(e)},uploadedImages:null}),p?null:l.createElement(r.CardLabelError,null,s("CS_ADDCOMPLAINT_UPLOAD_ERROR_MESSAGE")),l.createElement(r.SubmitBar,{label:s("PT_COMMONS_NEXT"),onSubmit:function(){null===m?E(!1):c.push(`${e.match.path}/addional-details/${u}`)}}),e.skip?l.createElement(r.LinkButton,{label:s("CORE_COMMON_SKIP_CONTINUE"),onClick:function(){c.push(`${e.match.path}/addional-details/${u}`)}}):null))};function C(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const S=e=>{let{cityCode:t,complaintType:n,priorityLevel:l,description:o,landmark:a,city:r,district:i,region:s,state:c,pincode:u,localityCode:m,localityName:d,uploadedImages:p,mobileNumber:E,name:C,emailId:S,additionalDetails:_}=e;return function(e,v){try{return Promise.resolve(Digit.Complaint.create({cityCode:t,complaintType:n,priorityLevel:l,description:o,landmark:a,city:r,district:i,region:s,state:c,pincode:u,localityCode:m,localityName:d,uploadedImages:p,mobileNumber:E,name:C,emailId:S,additionalDetails:_})).then(function(t){e({type:"CREATE_COMPLAINT",payload:t})})}catch(e){return Promise.reject(e)}}},_=e=>function(t){try{return Promise.resolve(Digit.PGRService.update(e)).then(function(e){t({type:"UPDATE_COMPLAINT",payload:e})})}catch(e){return Promise.reject(e)}},v=e=>{const t=o.useHistory();let{id:i}=o.useParams();const c=s.useDispatch(),u=s.useSelector(e=>e).common;let{t:m}=a.useTranslation();const[d,p]=n.useState(!1),[E,S]=n.useState(null),{complaintDetails:v}=e;n.useEffect(()=>{if(u.complaints){const{response:n}=u.complaints;n&&"successful"===n.responseInfo.status&&t.push(`${e.match.path}/response/:${i}`)}},[u.complaints,e.history]);const f=n.useCallback(function(n){try{const l=C(function(){return Promise.resolve(c(_(n))).then(function(){t.push(`${e.match.path}/response/${i}`)})},function(e){var t,n,l,o,a,r;p({isError:!1,isWarning:!0,key:"error",message:null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors[0])||void 0===l?void 0:l.message}),S(null==e||null===(o=e.response)||void 0===o||null===(a=o.data)||void 0===a||null===(r=a.Errors[0])||void 0===r?void 0:r.message)});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[c]);return l.createElement(l.Fragment,null,l.createElement(r.Card,null,l.createElement(r.CardHeader,null,m("CS_ADDCOMPLAINT_PROVIDE_ADDITIONAL_DETAILS")),l.createElement(r.CardText,null,m("CS_ADDCOMPLAINT_ADDITIONAL_DETAILS_TEXT")),l.createElement(r.TextArea,{name:"AdditionalDetails",onChange:function(e){let t=Digit.SessionStorage.get("reopen."+i);Digit.SessionStorage.set("reopen."+i,{...t,addtionalDetail:e.target.value})}}),l.createElement("div",{onClick:function(){p(!1);let t=Digit.SessionStorage.get("reopen."+i);return v&&(v.workflow=((e,t)=>({action:"REOPEN",comments:e.addtionalDetail,assignes:[],verificationDocuments:e.verificationDocuments}))(t),v.service.additionalDetail={REOPEN_REASON:t.reason},f({service:v.service,workflow:v.workflow})),l.createElement(o.Redirect,{to:{pathname:e.parentRoute+"/response",state:{complaintDetails:v}}})}},l.createElement(r.SubmitBar,{label:m("CS_HEADER_REOPEN_COMPLAINT")}))),l.createElement(l.Fragment,null,d&&l.createElement(r.Toast,{error:"error"===d.key,label:E,onClose:()=>{p(!1)}})),";")},f=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.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 12 19 6.41z"})),O=e=>{let{text:t,rating:n}=e;return l.createElement(r.Rating,{text:t,withText:!0,currentRating:n,maxRating:5,onFeedback:()=>{}})},T=e=>l.createElement("h1",{className:"heading-m"},e.label),g=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(f,null)),y=e=>{let{data:t,comments:n}=e;const{t:o}=a.useTranslation();return l.createElement("div",null,(null==t?void 0:t.date)&&l.createElement("p",null,null==t?void 0:t.date),l.createElement("p",null,null==t?void 0:t.name),l.createElement("p",null,null==t?void 0:t.mobileNumber),(null==t?void 0:t.source)&&l.createElement("p",null,o("ES_COMMON_FILED_VIA_"+(null==t?void 0:t.source.toUpperCase()))),null==n?void 0:n.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,o("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e))))},N=e=>{var t,o,a,i,s,c,u;let{workflowDetails:m,complaintDetails:d,close:p,popup:E,selectedAction:S,onAssign:_,tenantId:v,t:f}=e;const O=null==m||null===(t=m.data)||void 0===t||null===(o=t.initialActionState)||void 0===o||null===(a=o.nextActions)||void 0===a?void 0:a.filter(e=>(null==e?void 0:e.action)==S),y=Digit.Hooks.pgr.useEmployeeFilter(v,(null==O||null===(i=O[0])||void 0===i||null===(s=i.assigneeRoles)||void 0===s?void 0:s.length)>0?null==O||null===(c=O[0])||void 0===c||null===(u=c.assigneeRoles)||void 0===u?void 0:u.join(","):"",d,!0),N=y?y.map(e=>({heading:e.department,options:e.employees})):null,[I,A]=n.useState(null),[M,h]=n.useState(""),[P,D]=n.useState(null),[L,b]=n.useState(null),[R,k]=n.useState(null),w=Digit.ULBService.getCurrentUlb(),[x,F]=n.useState(null);n.useEffect(()=>{!function(){try{k(null);const e=function(){if(P){const e=function(){if(P.size>=5242880)k(f("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=C(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",P,w.code)).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?b(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):k(f("CS_FILE_UPLOAD_ERROR"))})},function(){k(f("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[P]);const H=[f("CS_REOPEN_OPTION_ONE"),f("CS_REOPEN_OPTION_TWO"),f("CS_REOPEN_OPTION_THREE"),f("CS_REOPEN_OPTION_FOUR")];return l.createElement(r.Modal,{headerBarMain:l.createElement(T,{label:f("ASSIGN"===S||"REASSIGN"===S?"CS_ACTION_ASSIGN":"REJECT"===S?"CS_ACTION_REJECT":"REOPEN"===S?"CS_COMMON_REOPEN":"CS_COMMON_RESOLVE")}),headerBarEnd:l.createElement(g,{onClick:()=>p(E)}),actionCancelLabel:f("CS_COMMON_CANCEL"),actionCancelOnSubmit:()=>p(E),actionSaveLabel:f("ASSIGN"===S||"REASSIGN"===S?"CS_COMMON_ASSIGN":"REJECT"===S?"CS_COMMON_REJECT":"REOPEN"===S?"CS_COMMON_REOPEN":"CS_COMMON_RESOLVE"),actionSaveOnSubmit:()=>{M?_(I,M,L):k(f("CS_MANDATORY_COMMENTS"))},error:R,setError:k},l.createElement(r.Card,null,"REJECT"===S||"RESOLVE"===S||"REOPEN"===S?null:l.createElement(l.Fragment,null,l.createElement(r.CardLabel,null,f("CS_COMMON_EMPLOYEE_NAME")),N&&l.createElement(r.SectionalDropdown,{selected:I,menuData:N,displayKey:"name",select:function(e){A(e)}})),"REOPEN"===S?l.createElement(l.Fragment,null,l.createElement(r.CardLabel,null,f("CS_REOPEN_COMPLAINT")),l.createElement(r.Dropdown,{selected:x,option:H,select:function(e){F(e)}})):null,l.createElement(r.CardLabel,null,f("CS_COMMON_EMPLOYEE_COMMENTS")),l.createElement(r.TextArea,{name:"comment",onChange:function(e){k(null),h(e.target.value)},value:M}),l.createElement(r.CardLabel,null,f("CS_ACTION_SUPPORTING_DOCUMENTS")),l.createElement(r.CardLabelDesc,null,f("CS_UPLOAD_RESTRICTIONS")),l.createElement(r.UploadFile,{id:"pgr-doc",accept:".jpg",onUpload:function(e){D(e.target.files[0])},onDelete:()=>{b(null)},message:L?"1 "+f("CS_ACTION_FILEUPLOADED"):f("CS_ACTION_NO_FILEUPLOADED")})))},I=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");let n=A(t);return"NA"!=n&&h(e)?(n=n.toUpperCase(),D(e,n+"_REVENUE")):"PGR_NA"},A=function(e){return void 0===e&&(e=""),h(e)&&(e.replaceAll&&e.replaceAll(".","_")||e.replace&&M(e,".","_"))||"NA"},M=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e},h=function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)},P=function(e){void 0===e&&(e="");let t=A(e);return"NA"!=t&&h(e)?(t=t.toUpperCase(),D(t,"TENANT_TENANTS")):"PGR_NA"},D=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");let n=A(e);return"NA"==n?"PGR_NA":`${t}_${n}`},L=e=>e.substr(0,1).toUpperCase()+e.substr(1),b=function(e,t,n){try{var l,o,a,r,i,s,c,u,m,d,p,E,C,S,_,v,f;return console.log("complaintDetails?.details?.CS_ADDCOMPLAINT_COMPLAINT_TYPE",null==e||null===(l=e.details)||void 0===l?void 0:l.CS_ADDCOMPLAINT_COMPLAINT_TYPE),Promise.resolve({t:n,tenantId:null==t?void 0:t.code,name:`${n(null==t?void 0:t.i18nKey)} ${O=n("ULBGRADE_"+(null==t||null===(o=t.city)||void 0===o?void 0:o.ulbGrade.toUpperCase().replace(" ","_").replace(".","_"))),O.toLowerCase().split(" ").map(L).join(" ")}`,email:null==t?void 0:t.emailId,phoneNumber:null==t?void 0:t.contactNumber,heading:n("NEW_GRIEVANCE_APPLICATION"),applicationNumber:null==e||null===(a=e.service)||void 0===a?void 0:a.serviceRequestId,details:[{title:n("CS_TITLE_APPLICATION_DETAILS"),values:[{title:n("CS_COMPLAINT_FILED_DATE"),value:Digit.DateUtils.ConvertTimestampToDate(null==e||null===(r=e.audit)||void 0===r||null===(i=r.details)||void 0===i?void 0:i.createdTime,"dd/MM/yyyy")},{title:n("CS_COMPLAINT_TYPE"),value:n(null==e||null===(s=e.details)||void 0===s?void 0:s.CS_ADDCOMPLAINT_COMPLAINT_TYPE)},{title:n("CS_COMPLAINT_SUB_TYPE"),value:n(null==e||null===(c=e.details)||void 0===c?void 0:c.CS_ADDCOMPLAINT_COMPLAINT_SUB_TYPE)},{title:n("CS_COMPLAINT_PRIORITY_LEVEL"),value:n(null==e||null===(u=e.service)||void 0===u?void 0:u.priority)},{title:n("CS_COMPLAINT_ADDITIONAL_DETAILS"),value:(null==e||null===(m=e.details)||void 0===m?void 0:m.CS_COMPLAINT_ADDTIONAL_DETAILS)||"NA"}]},{title:n("PGR_ADDRESS_SUB_HEADER"),values:[{title:n("PGR_ADDRESS_PINCODE"),value:(null==e||null===(d=e.service)||void 0===d||null===(p=d.address)||void 0===p?void 0:p.pincode)||n("CS_NA")},{title:n("PT_ADDRESS_CITY"),value:n(P(null==e||null===(E=e.service)||void 0===E?void 0:E.tenantId))||n("CS_NA")},{title:n("PT_ADDRESS_MOHALLA"),value:n(""+I(null==e||null===(C=e.service)||void 0===C||null===(S=C.address)||void 0===S||null===(_=S.locality)||void 0===_?void 0:_.code,null==t?void 0:t.code))||n("CS_NA")},{title:n("PGR_ADDRESS_STREET_NAME"),value:(null==e||null===(v=e.service)||void 0===v||null===(f=v.address)||void 0===f?void 0:f.street)||n("CS_NA")}]}]})}catch(e){return Promise.reject(e)}var O},R=e=>{let{action:t}=e;const{t:n}=a.useTranslation();switch(t){case"REOPEN":return n("CS_COMMON_COMPLAINT_REOPENED");case"RATE":return n("CS_COMMON_THANK_YOU");default:return n("CS_COMMON_COMPLAINT_SUBMITTED")}},k=e=>{let{response:t}=e;const{complaints:n}=t,{t:o}=a.useTranslation();return l.createElement(r.Banner,n&&n.response&&n.response.responseInfo?{message:R(n.response.ServiceWrappers[0].workflow),complaintNumber:n.response.ServiceWrappers[0].service.serviceRequestId,successful:!0}:{message:o("CS_COMMON_COMPLAINT_NOT_SUBMITTED"),successful:!1})},w=e=>{let{response:t}=e;const{complaints:n}=t,{t:o}=a.useTranslation();if(n&&n.response&&n.response.responseInfo){const{action:e}=n.response.ServiceWrappers[0].workflow;return l.createElement(r.CardText,null,o("RATE"===e?"CS_COMMON_RATING_SUBMIT_TEXT":"CS_COMMON_TRACK_COMPLAINT_TEXT"))}},x=e=>{var t,i,c,u,m,d,p,E;const{t:C}=a.useTranslation(),S=s.useSelector(e=>e).pgr,{data:_}=Digit.Hooks.useStore.getInitData(),{tenants:v}=_||{},[f,O]=n.useState(!1);let T=null==S||null===(t=S.complaints)||void 0===t||null===(i=t.response)||void 0===i||null===(c=i.ServiceWrappers)||void 0===c||null===(u=c[0])||void 0===u||null===(m=u.service)||void 0===m?void 0:m.serviceRequestId;const{complaintDetails:g}=Digit.Hooks.pgr.useComplaintDetails({tenantId:Digit.ULBService.getCurrentTenantId(),id:T},{enabled:!!f});return console.log("appStateappState",S),l.createElement(r.Card,null,S.complaints.response&&l.createElement(k,{response:S}),S.complaints.response&&l.createElement(w,{response:S}),"RATE"==(null===(d=S.complaints.response)||void 0===d||null===(p=d.ServiceWrappers)||void 0===p||null===(E=p[0])||void 0===E?void 0:E.workflow.action)?"":l.createElement("div",{style:{marginBottom:"10px"}},l.createElement(r.SubmitBar,{label:C("PT_DOWNLOAD_ACK_FORM"),onSubmit:e=>{!function(e){try{const t=v.find(e=>e.code===Digit.ULBService.getCurrentTenantId());e.preventDefault(),O(!0),Promise.resolve(b({...g},t,C)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}}(e)}})),l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(r.SubmitBar,{label:C("CORE_COMMON_GO_TO_HOME")})))},F=e=>{var t;let{match:n,parentRoute:a}=e;const r=window.location.pathname.split("/"),i=r[r.length-1],s=(null===(t=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===t?void 0:t.code)||Digit.ULBService.getCurrentTenantId(),c=Digit.Hooks.pgr.useComplaintDetails({tenantId:s,id:i}).complaintDetails;return l.createElement(o.Switch,null,l.createElement(o.Route,{exact:!0,path:d(n,"/:id"),component:()=>l.createElement(p,{match:n,complaintDetails:c})}),l.createElement(o.Route,{path:d(n,"/upload-photo/:id"),component:()=>l.createElement(E,{match:n,skip:!0,complaintDetails:c})}),l.createElement(o.Route,{path:d(n,"/addional-details/:id"),component:()=>l.createElement(v,{match:n,parentRoute:a,complaintDetails:c})}),l.createElement(o.Route,{path:d(n,"/response"),component:()=>l.createElement(x,{match:n})}))},H=e=>{let{action:t}=e;const{t:n}=a.useTranslation();switch(t){case"REOPEN":return n("CS_COMMON_COMPLAINT_REOPENED");case"RATE":return n("CS_COMMON_THANK_YOU");default:return n("CS_COMMON_COMPLAINT_SUBMITTED")}},B=e=>{let{response:n}=e;const{complaints:o}=n;return o&&o.response&&o.response.responseInfo?(sessionStorage.removeItem("type"),sessionStorage.removeItem("pincode"),sessionStorage.removeItem("tenantId"),sessionStorage.removeItem("localityCode"),sessionStorage.removeItem("landmark"),sessionStorage.removeItem("propertyid"),l.createElement(r.Banner,{message:H(o.response.ServiceWrappers[0].workflow),complaintNumber:o.response.ServiceWrappers[0].service.serviceRequestId,successful:!0})):l.createElement(r.Banner,{message:t("CS_COMMON_COMPLAINT_NOT_SUBMITTED"),successful:!1})},U=e=>{var t,i,c,u,m,d,p,E;const{data:C}=Digit.Hooks.useStore.getInitData(),{tenants:S}=C||{},[_,v]=n.useState(!1),f=s.useSelector(e=>e).pgr;let O=null==f||null===(t=f.complaints)||void 0===t||null===(i=t.response)||void 0===i||null===(c=i.ServiceWrappers)||void 0===c||null===(u=c[0])||void 0===u||null===(m=u.service)||void 0===m?void 0:m.serviceRequestId;const{complaintDetails:T}=Digit.Hooks.pgr.useComplaintDetails({tenantId:Digit.ULBService.getCurrentTenantId(),id:O},{enabled:!!_}),{t:g}=a.useTranslation();return l.createElement(r.Card,null,f.complaints.response&&l.createElement(B,{response:f}),l.createElement(r.CardText,null,g("CS_COMMON_TRACK_COMPLAINT_TEXT")),"RATE"==(null===(d=f.complaints.response)||void 0===d||null===(p=d.ServiceWrappers)||void 0===p||null===(E=p[0])||void 0===E?void 0:E.workflow.action)?"":l.createElement("div",{style:{marginBottom:"10px"}},l.createElement(r.SubmitBar,{label:g("PT_DOWNLOAD_ACK_FORM"),onSubmit:e=>{!function(e){try{const t=S.find(e=>e.code===Digit.ULBService.getCurrentTenantId());e.preventDefault(),v(!0),Promise.resolve(b({...T},t,g)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}}(e)}})),l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(r.SubmitBar,{label:g("CORE_COMMON_GO_TO_HOME")})))};function G(){return(G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}const $=e=>{const{register:t,handleSubmit:o,errors:i,control:s,setValue:c,getValues:m,watch:d,setError:p,clearErrors:E,formState:C}=u.useForm(),{t:S}=a.useTranslation(),_=d();n.useEffect(()=>{e.getFormAccessors&&e.getFormAccessors({setValue:c,getValues:m})},[]);const v=n.useMemo(()=>{var n;return null===(n=e.config)||void 0===n?void 0:n.map((n,o,a)=>l.createElement(l.Fragment,{key:o},l.createElement(r.CardSectionHeader,null,n.head),n.body.map((n,o)=>{var a,m;return l.createElement(l.Fragment,{key:o},i[null==n||null===(a=n.populators)||void 0===a?void 0:a.name]&&(null===(m=n.populators)||void 0===m||!m.validate||i[n.populators.validate])&&l.createElement(r.CardLabelError,null,n.populators.error),l.createElement(r.LabelFieldPair,null,l.createElement(r.CardLabel,null,n.label,n.isMandatory?" * ":null),l.createElement("div",{className:"field"},((n,o,a,m,d)=>{const v="string"==typeof a?Digit.ComponentRegistryService.getComponent(a):a;switch(n){case"text":return l.createElement("div",{className:"field-container"},o.componentInFront?o.componentInFront:null,l.createElement(r.TextInput,G({className:"field desktop-w-full"},o,{inputRef:t(o.validation),value:m})));case"textarea":return l.createElement(r.TextArea,G({className:"field desktop-w-full",value:m,name:o.name||""},o,{inputRef:t(o.validation)}));case"component":var f,O,T,g;if(null!=e&&null!==(f=e.config)&&void 0!==f&&null!==(O=f[1])&&void 0!==O&&null!==(T=O.body)&&void 0!==T&&null!==(g=T[2])&&void 0!==g&&g.isProperty)return l.createElement(u.Controller,{render:e=>l.createElement(v,{userType:"employee",t:S,setValue:c,onSelect:c,config:d,data:_,formData:_,register:t,errors:i,props:e,setError:p,clearErrors:E,formState:C,onBlur:e.onBlur}),name:d.key,control:s});default:return!1!==(null==o?void 0:o.dependency)?o:null}})(n.type,n.populators,null==n?void 0:n.component,n.value,n))))}),a.length-1===o?null:l.createElement(r.BreakLine,null)))},[e.config,i]),f=e.isDisabled||!1;return l.createElement("form",{onSubmit:o(function(t){e.onSubmit(t)}),onChange:e=>{sessionStorage.setItem(e.target.name,e.target.value)}},l.createElement(r.Card,null,l.createElement(r.CardSubHeader,null,e.heading),v,e.children,l.createElement(r.ActionBar,null,l.createElement(r.SubmitBar,{disabled:f,label:S(e.label),submit:"submit"}))))},j={routes:{"complaint-type":{component:e=>{let{t:t,onSelect:o,value:a}=e;const i=Digit.GetServiceDefinitions,[s,c]=n.useState(()=>{const{complaintType:e}=a;return e||{}}),[u,m]=n.useState(()=>{const{subType:e}=a;return e||{}}),[d,p]=n.useState(()=>{const{priorityLevel:e}=a;return e||{}}),E={key:"PropertyTax",name:"Property Tax"},C=Digit.Hooks.pgr.useComplaintTypes({stateCode:Digit.ULBService.getCurrentTenantId()}),[S,_]=(Digit.Hooks.pgr.useTenants(),n.useState([])),v=sessionStorage.getItem("type");n.useEffect(()=>{!function(){try{const e=function(){if("PT"==v)return c(E),Promise.resolve(i.getSubMenu(Digit.ULBService.getCurrentTenantId(),E,t)).then(function(e){_(e)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[]);const f=[{head:t("CS_COMPLAINT_DETAILS_COMPLAINT_DETAILS"),body:[{label:t("CS_COMPLAINT_DETAILS_COMPLAINT_TYPE"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{option:C,optionKey:"name",id:"complaintType",selected:s,select:function(e){try{const n=function(){if(e.key!==s.key){const n=function(){if("Others"!==e.key)return m({name:""}),c(e),Promise.resolve(i.getSubMenu(Digit.ULBService.getCurrentTenantId(),e,t)).then(function(e){_(e)});m({name:""}),_([{key:"Others",name:t("SERVICEDEFS.OTHERS")}])}();if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},disable:v})},{label:t("CS_COMPLAINT_DETAILS_COMPLAINT_SUBTYPE"),isMandatory:!0,type:"dropdown",menu:{...S},populators:l.createElement(r.Dropdown,{option:S,optionKey:"name",id:"complaintSubType",selected:u,select:function(e){console.log("selectedSubType",e),m(e)}})},{label:t("CS_COMPLAINT_DETAILS_COMPLAINT_PRIORITY_LEVEL"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{option:[{name:"LOW",code:"LOW",active:!0},{name:"MEDIUM",code:"MEDIUM",active:!0},{name:"HIGH",code:"HIGH",active:!0}],optionKey:"name",id:"priorityLevel",selected:d,select:function(e){try{return sessionStorage.setItem("priorityLevel",JSON.stringify(e)),p(e),Promise.resolve()}catch(e){return Promise.reject(e)}}})}]}];return window.Digit.SessionStorage.get("Digit.Citizen.tenantId"),l.createElement($,{heading:t("ES_CREATECOMPLAINT_NEW_COMPLAINT"),config:f,onSubmit:()=>{console.log("complaintType",s),sessionStorage.setItem("complaintType",JSON.stringify(s)),o({subType:u,priorityLevel:d})},isDisabled:0===Object.keys(s).length||null===s,label:"NEXT"})},texts:{headerCaption:"",header:"CS_ADDCOMPLAINT_COMPLAINT_TYPE_PLACEHOLDER",cardText:"CS_COMPLAINT_TYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"map"},"sub-type":{component:e=>{let{t:t,config:o,onSelect:a,value:i}=e;const[s,c]=n.useState(()=>{const{subType:e}=i;return e||{}}),{complaintType:u}=i,m=Digit.Hooks.pgr.useComplaintSubType(u,t),d={...o.texts,headerCaption:t("SERVICEDEFS."+u.key.toUpperCase()),menu:m,optionsKey:"name",selected:function(e){c(e)},selectedOption:s,onSave:()=>{a({subType:s})}};return l.createElement(r.TypeSelectCard,G({},d,{disabled:0===Object.keys(s).length||null===s,t:t}))},texts:{header:"CS_ADDCOMPLAINT_COMPLAINT_SUBTYPE_PLACEHOLDER",cardText:"CS_COMPLAINT_SUBTYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"map"},map:{component:e=>{let{onSelect:t,t:n}=e,o="";return l.createElement(r.LocationSearchCard,{header:n("CS_ADDCOMPLAINT_SELECT_GEOLOCATION_HEADER"),cardText:n("CS_ADDCOMPLAINT_SELECT_GEOLOCATION_TEXT"),nextText:n("CS_COMMON_NEXT"),skipAndContinueText:n("CS_COMMON_SKIP"),skip:()=>t(),onSave:()=>t({pincode:o}),onChange:e=>o=e})},nextStep:"pincode"},pincode:{component:e=>{let{t:t,config:o,onSelect:a,value:i}=e;const s=sessionStorage.getItem("type");let c=sessionStorage.getItem("pincode");"null"==c&&(c="");let u=i;const m=Digit.Hooks.pgr.useTenants(),[d,p]=n.useState(()=>{if("PT"==s)return u=c,u;{const{pincode:e}=i;return e}});let E=!d;const[C,S]=n.useState(null);return l.createElement(r.FormStep,{t:t,config:o,onSelect:function(e){try{var t=m.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==(null==e?void 0:e.pincode))});const n=function(){if(t)return Digit.SessionStorage.set("city_complaint",t),Promise.resolve(Digit.LocationService.getLocalities(t.code)).then(function(n){Digit.LocalityService.get(n.TenantBoundary[0]).filter(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==e.pincode)}),a({...e,city_complaint:t})});Digit.SessionStorage.set("city_complaint",void 0),Digit.SessionStorage.set("selected_localities",void 0),S("CS_COMMON_PINCODE_NOT_SERVICABLE")}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},value:d,onChange:function(e){p(e.target.value),E=!e.target.value,S(null)},onSkip:()=>a(),forcedError:t(C),isDisabled:E})},texts:{headerCaption:"CS_ADDCOMPLAINT_COMPLAINT_LOCATION",header:"CS_FILE_APPLICATION_PINCODE_LABEL",cardText:"CS_ADDCOMPLAINT_CHANGE_PINCODE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},inputs:[{label:"CORE_COMMON_PINCODE",type:"text",name:"pincode",validation:{minLength:6,maxLength:7},error:"CORE_COMMON_PINCODE_INVALID"}],nextStep:"address"},address:{component:e=>{let{t:t,config:o,onSelect:a,value:i}=e;const s=Digit.Hooks.pgr.useTenants(),c=null!=i&&i.pincode?s.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==i.pincode)}):s,u=sessionStorage.getItem("type"),m=sessionStorage.getItem("tenantId"),d=sessionStorage.getItem("localityCode");let p=i;const[E,C]=n.useState(()=>{if("PT"==u){let e=c.filter(e=>e.code===m);return console.log("filteredcities",e),e&&(p=e[0]),console.log("val2",p),p}{const{city_complaint:e}=i;return e||null}}),{data:S}=Digit.Hooks.useBoundaryLocalities(null==E?void 0:E.code,"admin",{enabled:!!E},t),[_,v]=n.useState(null),[f,O]=n.useState(()=>{const{locality_complaint:e}=i;return e||null});function T(e){O(null),v(null),C(e)}function g(e){O(e)}return n.useEffect(function(){try{const e=function(){if(E&&S){const{pincode:e}=i;let t=e?S.filter(t=>t.pincode==e):S;return Promise.resolve(v(t)).then(function(){if("PT"==u){let e=t.filter(e=>e.code===d);e&&O(e[0])}else v(t)})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[E,S]),l.createElement(r.FormStep,{config:o,onSelect:function(){a({city_complaint:E,locality_complaint:f})},t:t,isDisabled:!f},l.createElement("div",null,l.createElement(r.CardLabel,null,t("MYCITY_CODE_LABEL")),(null==c?void 0:c.length)<5?l.createElement(r.RadioButtons,{selectedOption:E,options:c,optionsKey:"i18nKey",onSelect:T}):l.createElement(r.Dropdown,{isMandatory:!0,selected:E,option:c,select:T,optionKey:"i18nKey",t:t}),E&&_&&l.createElement(r.CardLabel,null,t("CS_CREATECOMPLAINT_MOHALLA")),E&&_&&l.createElement(l.Fragment,null,(null==_?void 0:_.length)<5?l.createElement(r.RadioButtons,{selectedOption:f,options:_,optionsKey:"i18nkey",onSelect:g}):l.createElement(r.Dropdown,{isMandatory:!0,selected:f,optionKey:"i18nkey",option:_,select:g,t:t}))))},texts:{headerCaption:"CS_ADDCOMPLAINT_COMPLAINT_LOCATION",header:"CS_ADDCOMPLAINT_PROVIDE_COMPLAINT_ADDRESS",cardText:"CS_ADDCOMPLAINT_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"landmark"},landmark:{component:e=>{let{t:t,config:o,onSelect:a,value:i}=e;const[s,c]=n.useState(()=>{const{landmark:e}=i;return e||""});return l.createElement(r.FormStep,{config:o,value:s,onChange:function(e){c(e.target.value)},onSelect:e=>a(e),onSkip:()=>a(),t:t})},texts:{headerCaption:"CS_ADDCOMPLAINT_COMPLAINT_LOCATION",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TITLE",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TITLE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},inputs:[{label:"CS_ADDCOMPLAINT_LANDMARK",type:"textarea",name:"landmark"}],nextStep:"upload-photos"},"upload-photos":{component:e=>{var t;let{t:o,config:a,onSelect:i,onSkip:s,value:c}=e;const[u,m]=n.useState(()=>{const{uploadedImages:e}=c;return e||null});return l.createElement(r.FormStep,{config:a,onSelect:()=>{if(!u||0===u.length)return s();i({uploadedImages:u})},onSkip:s,t:o},l.createElement(r.ImageUploadHandler,{tenantId:null===(t=c.city_complaint)||void 0===t?void 0:t.code,uploadedImages:u,onPhotoChange:e=>{m(e)}}))},texts:{header:"CS_ADDCOMPLAINT_UPLOAD_PHOTO",cardText:"CS_ADDCOMPLAINT_UPLOAD_PHOTO_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"additional-details"},"additional-details":{component:e=>{let{t:t,config:o,onSelect:a,value:i}=e;const s=sessionStorage.getItem("type"),c=sessionStorage.getItem("propertyid");let u=i;const[m,d]=n.useState(()=>{if("PT"==s)return u=c,u;{const{details:e}=i;return e||""}});return l.createElement(r.FormStep,{config:o,onChange:e=>{const{value:t}=e.target;d(t)},onSelect:()=>a({details:m}),value:m,t:t})},texts:{header:"CS_ADDCOMPLAINT_PROVIDE_ADDITIONAL_DETAILS",cardText:"CS_ADDCOMPLAINT_ADDITIONAL_DETAILS_TEXT",submitBarLabel:"CS_COMMON_NEXT"},inputs:[{label:"CS_ADDCOMPLAINT_ADDITIONAL_DETAILS",type:"textarea",name:"details"}],nextStep:null}},indexRoute:"complaint-type"},V=e=>{let{data:t,path:n}=e,{serviceCode:i,serviceRequestId:s,applicationStatus:c}=t;const u=o.useHistory(),{t:m}=a.useTranslation(),d=["RESOLVED","REJECTED","CLOSEDAFTERREJECTION","CLOSEDAFTERRESOLUTION"];return l.createElement(l.Fragment,null,l.createElement(r.Card,{onClick:()=>{u.push(`${n}/${s}`)}},l.createElement(r.CardSubHeader,null,m("SERVICEDEFS."+i.toUpperCase())),l.createElement(r.DateWrap,{date:Digit.DateUtils.ConvertTimestampToDate(t.auditDetails.createdTime)}),l.createElement(r.KeyNote,{keyValue:m("CS_COMMON_COMPLAINT_NO"),note:s}),l.createElement("div",{className:"status-highlight "+(d.includes(c)?"success":"")},l.createElement("p",null,(d.includes(c)?m("CS_COMMON_CLOSED"):m("CS_COMMON_OPEN")).toUpperCase())),m("CS_COMMON_"+c)))},W=e=>{let{name:t,isCompleted:n,mobile:o,text:i,customChild:s}=e,{t:c}=a.useTranslation();return l.createElement(r.CheckPoint,{label:c("CS_COMMON_PENDINGATLME"),isCompleted:n,customChild:l.createElement("div",null,t&&o?l.createElement(r.TelePhone,{mobile:o,text:`${i} ${t}`}):null,s)})},Y=e=>{let{isCompleted:t,text:n,customChild:o}=e;return l.createElement(r.CheckPoint,{isCompleted:t,label:n,customChild:o})},K=e=>{let{action:t,nextActions:n,complaintDetails:i,ComplainMaxIdleTime:s=36e5,serviceRequestId:c,reopenDate:u,isCompleted:m,customChild:d}=e;const{t:p}=a.useTranslation();if("RESOLVE"===t){let e=n&&n.map((e,t)=>{if(e&&"COMMENT"!==e)return l.createElement(o.Link,{key:t,to:`/digit-ui/citizen/pgr/${e.toLowerCase()}/${c}`},l.createElement(r.ActionLinks,null,p("CS_COMMON_"+e)))});return l.createElement(r.CheckPoint,{isCompleted:m,label:p("CS_COMMON_COMPLAINT_RESOLVED"),customChild:l.createElement("div",null,e,d)})}if("RATE"===t)return l.createElement(r.CheckPoint,{isCompleted:m,label:p("CS_COMMON_COMPLAINT_RESOLVED"),customChild:l.createElement("div",null,d)});if("REOPEN"===t)return l.createElement(r.CheckPoint,{isCompleted:m,label:p("CS_COMMON_COMPLAINT_REOPENED"),info:u,customChild:d});{let e=n&&n.map((e,t)=>{var n,a;if(e&&"COMMENT"!==e&&("REOPEN"!==e||"REOPEN"===e&&(null===Date||void 0===Date?void 0:Date.now())-(null==i||null===(n=i.service)||void 0===n||null===(a=n.auditDetails)||void 0===a?void 0:a.lastModifiedTime)<s))return l.createElement(o.Link,{key:t,to:`/digit-ui/citizen/pgr/${e.toLowerCase()}/${c}`},l.createElement(r.ActionLinks,null,p("CS_COMMON_"+e)))});return l.createElement(r.CheckPoint,{isCompleted:m,label:p("CS_COMMON_COMPLAINT_RESOLVED"),customChild:l.createElement("div",null,e,d)})}},z=e=>{let{action:t,nextActions:n,complaintDetails:i,ComplainMaxIdleTime:s=36e5,rating:c,serviceRequestId:u,reopenDate:m,isCompleted:d}=e;const{t:p}=a.useTranslation();if("REJECTED"===t){let e=n&&n.map((e,t)=>{if(e&&"COMMENT"!==e&&"CANCEL"!==e)return l.createElement(o.Link,{key:t,to:`/digit-ui/citizen/pgr/${e.toLowerCase()}/${u}`},l.createElement(r.ActionLinks,null,p("CS_COMMON_"+e)))});return l.createElement(r.CheckPoint,{isCompleted:d,label:p("CS_COMMON_COMPLAINT_REJECTED"),customChild:l.createElement("div",null,e)})}if("RATE"===t&&c)return l.createElement(r.CheckPoint,{isCompleted:d,label:p("CS_COMMON_COMPLAINT_REJECTED"),customChild:l.createElement("div",null,c?l.createElement(O,{text:p("CS_ADDCOMPLAINT_YOU_RATED"),rating:c}):null,customChild)});if("REOPEN"===t)return l.createElement(r.CheckPoint,{isCompleted:d,label:p("CS_COMMON_COMPLAINT_REOPENED"),info:m});{let e=n&&n.map((e,t)=>{var n,a;if(e&&"COMMENT"!==e&&"CANCEL"!==e&&("REOPEN"!==e||"REOPEN"===e&&(null===Date||void 0===Date?void 0:Date.now())-(null==i||null===(n=i.service)||void 0===n||null===(a=n.auditDetails)||void 0===a?void 0:a.lastModifiedTime)<s))return l.createElement(o.Link,{key:t,to:`/digit-ui/citizen/pgr/${e.toLowerCase()}/${u}`},l.createElement(r.ActionLinks,null,p("CS_COMMON_"+e)))});return l.createElement(r.CheckPoint,{isCompleted:d,label:p("CS_COMMON_COMPLAINT_REJECTED"),customChild:l.createElement("div",null,e)})}},q=e=>{let{data:t}=e;const{t:n}=a.useTranslation();return l.createElement("div",null,(null==t?void 0:t.date)&&l.createElement("p",null,null==t?void 0:t.date),l.createElement("p",null,null==t?void 0:t.name),l.createElement("p",null,null==t?void 0:t.mobileNumber),(null==t?void 0:t.source)&&l.createElement("p",null,n("ES_COMMON_FILED_VIA_"+(null==t?void 0:t.source.toUpperCase()))))},X=e=>{let{data:t,serviceRequestId:o,complaintWorkflow:i,rating:s,zoomImage:c,complaintDetails:u,ComplainMaxIdleTime:m}=e;const{t:d}=a.useTranslation();let{timeline:p}=t;const E=n.useMemo(()=>null==p?void 0:p.length,[p]);n.useEffect(()=>{null==p||p.filter((e,t,n)=>t===n.length-1&&"PENDINGFORASSIGNMENT"===e.status);const e=(null==p?void 0:p.filter(e=>"PENDINGFORASSIGNMENT"===(null==e?void 0:e.status))).at(-1);null==p||p.push({...e,performedAction:"FILED",status:"COMPLAINT_FILED"})},[p]);const[C,S]=n.useState(!1),_=e=>{var t;let{comment:o,thumbnailsToShow:a,auditDetails:i,assigner:s,status:m}=e;const p={date:null==i?void 0:i.lastModified,name:null==s?void 0:s.name,mobileNumber:null==s?void 0:s.mobileNumber,source:"COMPLAINT_FILED"==m?null==u?void 0:u.audit.source:""};return l.createElement(n.Fragment,null,o?l.createElement("div",null,null==o?void 0:o.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,d("WF_COMMON_COMMENTS")),l.createElement("p",null,e)))):null,(null==a||null===(t=a.thumbs)||void 0===t?void 0:t.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,d("CS_COMMON_ATTACHMENTS")),l.createElement(r.DisplayPhotos,{srcs:a.thumbs,onClick:(e,t)=>{!function(e,t,n){var l,o;let a=null===(l=n.thumbs)||void 0===l?void 0:l.findIndex(t=>t===e);c(a>-1&&(null==n||null===(o=n.fullImage)||void 0===o?void 0:o[a])||e)}(e,0,a)}})):null,null!=p&&p.date?l.createElement(q,{data:p,comments:o}):null)};return l.createElement(l.Fragment,null,l.createElement(r.CardSubHeader,null,d("CS_COMPLAINT_DETAILS_COMPLAINT_TIMELINE")),p&&E>0?l.createElement(r.ConnectingCheckPoints,null,p.slice(0,C?p.length:2).map((e,t,n)=>{let{status:a,caption:c,auditDetails:p,timeLineActions:C,performedAction:S,wfComment:v,thumbnailsToShow:f,assigner:T}=e;return(e=>{let{status:t,caption:n,auditDetails:a,timeLineActions:c,index:p,comment:E,thumbnailsToShow:C,assigner:S,totalTimelineLength:v}=e;const f=0===p;switch(t){case"PENDINGFORREASSIGNMENT":return l.createElement(r.CheckPoint,{isCompleted:f,key:p,label:d("CS_COMMON_"+t),customChild:_({comment:E,thumbnailsToShow:C,auditDetails:a,assigner:S})});case"PENDINGFORASSIGNMENT":const e=v-(p+1)==0;return l.createElement(Y,{key:p,isCompleted:f,text:d("CS_COMMON_"+t),customChild:_({comment:E,...e?{auditDetails:a}:{thumbnailsToShow:C,auditDetails:a}})});case"PENDINGFORASSIGNMENT_AFTERREOPEN":return l.createElement(Y,{isCompleted:f,key:p,text:d("CS_COMMON_"+t),customChild:_({comment:E,thumbnailsToShow:C,auditDetails:a,assigner:S})});case"PENDINGATLME":let{name:T,mobileNumber:g}=n&&n.length>0?n[0]:{name:"",mobileNumber:""};const y=""+d("CS_COMMON_"+t);return l.createElement(W,{isCompleted:f,key:p,name:T,mobile:g,text:y,customChild:_({comment:E,thumbnailsToShow:C,auditDetails:a,assigner:S})});case"RESOLVED":return l.createElement(K,{key:p,isCompleted:f,action:i.action,nextActions:p<=1&&c,complaintDetails:u,ComplainMaxIdleTime:m,serviceRequestId:o,reopenDate:Digit.DateUtils.ConvertTimestampToDate(a.lastModifiedTime),customChild:_({comment:E,thumbnailsToShow:C,auditDetails:a,assigner:S})});case"REJECTED":return l.createElement(z,{key:p,isCompleted:f,action:i.action,nextActions:p<=1&&c,complaintDetails:u,ComplainMaxIdleTime:m,serviceRequestId:o,reopenDate:Digit.DateUtils.ConvertTimestampToDate(a.lastModifiedTime),customChild:_({comment:E,thumbnailsToShow:C,auditDetails:a,assigner:S})});case"CLOSEDAFTERRESOLUTION":return l.createElement(r.CheckPoint,{isCompleted:f,key:p,label:d("CS_COMMON_CS_COMMON_"+t),customChild:l.createElement("div",null,_({comment:E,thumbnailsToShow:C,auditDetails:a,assigner:S}),s?l.createElement(O,{text:d("CS_ADDCOMPLAINT_YOU_RATED"),rating:s}):null)});case"COMPLAINT_FILED":return l.createElement(r.CheckPoint,{isCompleted:f,key:p,label:d("CS_COMMON_COMPLAINT_FILED"),customChild:_({comment:E,auditDetails:a,assigner:S,status:t})});default:return l.createElement(r.CheckPoint,{isCompleted:f,key:p,label:d("CS_COMMON_"+t),customChild:_({comment:E,thumbnailsToShow:C,auditDetails:a,assigner:S,status:t})})}})({status:a,caption:c,auditDetails:p,timeLineActions:C,index:t,array:n,performedAction:S,comment:v,thumbnailsToShow:f,assigner:T,totalTimelineLength:E})})):l.createElement(r.Loader,null),(null==p?void 0:p.length)>2&&l.createElement(r.LinkButton,{label:d(C?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{S(e=>!e)}}))},J=e=>{var t;let{complaintDetails:o,id:a,getWorkFlow:r,zoomImage:i}=e;const s=(null===(t=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===t?void 0:t.code)||o.service.tenantId;let c=Digit.Hooks.useWorkflowDetails({tenantId:s,id:a,moduleCode:"PGR"});const{data:u}=Digit.Hooks.pgr.useMDMS.ComplainClosingTime(null==s?void 0:s.split(".")[0]);return n.useEffect(()=>{r(c.data)},[c.data]),n.useEffect(()=>{c.revalidate()},[]),!c.isLoading&&l.createElement(X,{data:c.data,serviceRequestId:a,complaintWorkflow:o.workflow,rating:o.audit.rating,zoomImage:i,complaintDetails:o,ComplainMaxIdleTime:u})},Z=()=>{var e,t,n,i,s,c,u,m,d,p;const{t:E}=a.useTranslation(),{path:C,url:S,..._}=o.useRouteMatch(),v=o.useLocation(),f=null===(e=Digit)||void 0===e||null===(t=e.ComponentRegistryService)||void 0===t?void 0:t.getComponent("PGRCreateComplaintCitizen"),O=null===(n=Digit)||void 0===n||null===(i=n.ComponentRegistryService)||void 0===i?void 0:i.getComponent("PGRComplaintsList"),T=null===(s=Digit)||void 0===s||null===(c=s.ComponentRegistryService)||void 0===c?void 0:c.getComponent("PGRComplaintDetailsPage"),g=null===(u=Digit)||void 0===u||null===(m=u.ComponentRegistryService)||void 0===m?void 0:m.getComponent("PGRSelectRating"),y=null===(d=Digit)||void 0===d||null===(p=d.ComponentRegistryService)||void 0===p?void 0:p.getComponent("PGRResponseCitzen");return l.createElement(l.Fragment,null,l.createElement("div",{className:"pgr-citizen-wrapper"},!v.pathname.includes("/response")&&l.createElement(r.BackButton,null,E("CS_COMMON_BACK")),l.createElement(o.Switch,null,l.createElement(r.PrivateRoute,{path:C+"/create-complaint",component:f}),l.createElement(r.PrivateRoute,{path:C+"/complaints",exact:!0,component:O}),l.createElement(r.PrivateRoute,{path:C+"/complaints/:id*",component:T}),l.createElement(r.PrivateRoute,{path:C+"/reopen",component:()=>l.createElement(F,{match:{..._,url:S,path:C+"/reopen"},parentRoute:C})}),l.createElement(r.PrivateRoute,{path:C+"/rate/:id*",component:()=>l.createElement(g,{parentRoute:C})}),l.createElement(r.PrivateRoute,{path:C+"/response",component:()=>l.createElement(y,{match:{..._,url:S,path:C}})}))))},Q=()=>{var e,t,i,s,c,u,m,d;const[p,E]=n.useState(!1),[C,S]=n.useState(!1),_=o.useRouteMatch(),{t:v}=a.useTranslation(),f={home:{content:v("CS_COMMON_HOME"),path:"/digit-ui/employee"},inbox:{content:v("CS_COMMON_INBOX"),path:_.url+"/inbox"},createComplaint:{content:v("CS_PGR_CREATE_COMPLAINT"),path:_.url+"/complaint/create"},complaintDetails:{content:v("CS_PGR_COMPLAINT_DETAILS"),path:_.url+"/complaint/details/:id"},response:{content:v("CS_PGR_RESPONSE"),path:_.url+"/response"},editApplication:{content:v("CS_PGR_EDIT_APPLICATION"),path:_.url+"/modify-application"}};let O=o.useLocation().pathname;const T=null===(e=Digit)||void 0===e||null===(t=e.ComponentRegistryService)||void 0===t?void 0:t.getComponent("PGRCreateComplaintEmp"),g=null===(i=Digit)||void 0===i||null===(s=i.ComponentRegistryService)||void 0===s?void 0:s.getComponent("PGRComplaintDetails"),y=null===(c=Digit)||void 0===c||null===(u=c.ComponentRegistryService)||void 0===u?void 0:u.getComponent("PGRInbox"),N=null===(m=Digit)||void 0===m||null===(d=m.ComponentRegistryService)||void 0===d?void 0:d.getComponent("PGRResponseEmp"),I=Digit.ComponentRegistryService.getComponent("PGREditApplication");return l.createElement(l.Fragment,null,l.createElement("div",{className:"ground-container"},!O.includes("/response")&&l.createElement(o.Switch,null,l.createElement(o.Route,{path:_.url+"/complaint/create",component:()=>l.createElement(r.BreadCrumb,{crumbs:[f.home,f.createComplaint]})}),l.createElement(o.Route,{path:_.url+"/complaint/details/:id",component:()=>l.createElement(r.BreadCrumb,{crumbs:[f.home,f.inbox,f.complaintDetails]})}),l.createElement(o.Route,{path:_.url+"/inbox",component:()=>l.createElement(r.BreadCrumb,{crumbs:[f.home,f.inbox]})}),l.createElement(o.Route,{path:_.url+"/response",component:l.createElement(r.BreadCrumb,{crumbs:[f.home,f.response]})}),l.createElement(o.Route,{path:_.url+"/modify-application:id",component:l.createElement(r.BreadCrumb,{crumbs:[f.home,f.editApplication]})})),l.createElement(o.Switch,null,l.createElement(o.Route,{path:_.url+"/complaint/create",component:()=>l.createElement(T,{parentUrl:_.url})}),l.createElement(o.Route,{path:_.url+"/complaint/details/:id*",component:()=>l.createElement(g,null)}),l.createElement(o.Route,{path:_.url+"/inbox",component:y}),l.createElement(o.Route,{path:_.url+"/response",component:N}),l.createElement(o.Route,{path:_.url+"/modify-application:id*",component:I}))))},ee=()=>l.createElement(r.EmployeeAppContainer,null,l.createElement(Q,null)),te=e=>{const{t:t}=a.useTranslation(),i=[{text:"ES_PGR_NEW_COMPLAINT",link:"/digit-ui/employee/pgr/complaint/create",accessTo:["CSR"]}],[s,c]=n.useState([]);return n.useEffect(()=>{let e=[];i.forEach(t=>{t.accessTo?Digit.UserService.hasAccess(t.accessTo)&&e.push(t):e.push(t)}),c(e)},[]),l.createElement(r.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 9h-2V5h2v6zm0 4h-2v-2h2v2z",fill:"white"})))," ",l.createElement("span",{className:"text"},t("ES_PGR_HEADER_COMPLAINT"))),l.createElement("div",{className:"body"},s.map((e,n)=>{let{link:a,text:r}=e;return l.createElement("span",{className:"link",key:n},l.createElement(o.Link,{to:a},t(r)))}))))},ne=e=>{let{t:t,columns:n,data:o,getCellProps:a,onNextPage:i,onPrevPage:s,currentPage:c,totalRecords:u,pageSizeLimit:m,onPageSizeChange:d}=e;return l.createElement(r.Table,{t:t,data:o,columns:n,getCellProps:a,onNextPage:i,onPrevPage:s,currentPage:c,totalRecords:u,onPageSizeChange:d,pageSizeLimit:m})},le=e=>{var t;let{complaints:n,onAssignmentChange:o,pgrfilters:i}=e;const{t:s}=a.useTranslation(),c=Digit.Hooks.pgr.useComplaintStatusCount(n);let u=null==i||null===(t=i.applicationStatus)||void 0===t?void 0:t.length;return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},s("ES_PGR_FILTER_STATUS")),0===c.length&&l.createElement(r.Loader,null),c.map((e,t)=>l.createElement(r.CheckBox,{key:t,onChange:t=>o(t,e),checked:!!u&&0!==i.applicationStatus.filter(t=>t.code===e.code).length,label:`${e.name} (${e.count||0})`})))};let oe={},ae={};const re=e=>{var t,o,i,s,c,u,m;let{uuid:d}=Digit.UserService.getUser().info;const{searchParams:p}=e,{t:E}=a.useTranslation(),C=!(null==p||null===(t=p.filters)||void 0===t||null===(o=t.wfFilters)||void 0===o||!o.assignee||null==p||null===(i=p.filters)||void 0===i||null===(s=i.wfFilters)||void 0===s||null===(c=s.assignee[0])||void 0===c||!c.code),S=n.useMemo(()=>[{code:"ASSIGNED_TO_ME",name:E("ASSIGNED_TO_ME")},{code:"ASSIGNED_TO_ALL",name:E("ASSIGNED_TO_ALL")}],[E]),[_,v]=n.useState(C?S[0]:S[1]);n.useEffect(()=>v(C?S[0]:S[1]),[E]);const[f,O]=n.useState(null),[T,g]=n.useState(null),[y,N]=n.useState((null==p||null===(u=p.filters)||void 0===u?void 0:u.pgrfilters)||{serviceCode:[],locality:[],applicationStatus:[]}),[I,A]=n.useState((null==p||null===(m=p.filters)||void 0===m?void 0:m.wfFilters)||{assignee:[{code:d}]}),M=Digit.ULBService.getCurrentTenantId(),{data:h}=Digit.Hooks.useBoundaryLocalities(M,"admin",{},E);let P=Digit.Hooks.pgr.useServiceDefs(M,"PGR");n.useEffect(()=>{var t;let n=0;for(const e in y)if(Array.isArray(y[e])){n+=y[e].length;let t=y[e].map(e=>e.code).join();var l;t?oe[e]=t:null===(l=oe)||void 0===l||delete l[e]}for(const e in I)if(Array.isArray(I[e])){let t=I[e].map(e=>e.code).join();t?ae[e]=t:ae={}}n+=(null==I||null===(t=I.assignee)||void 0===t?void 0:t.length)||0,"mobile"!==e.type&&R(),Digit.inboxFilterCount=n},[y,I]);const D=(e,t)=>e.filter(e=>e.code===t.code).length;n.useEffect(()=>{O(y.serviceCode.length>1?{i18nKey:y.serviceCode.length+" selected"}:y.serviceCode[0])},[y.serviceCode]),n.useEffect(()=>{g(y.locality.length>1?{name:y.locality.length+" selected"}:y.locality[0])},[y.locality]);const L=(e,t)=>{let n=y[t].filter((t,n)=>n!==e);N({...y,[t]:n})};function b(){N({serviceCode:[],locality:[],applicationStatus:[]}),A({assigned:[{code:[]}]}),oe={},ae={},v(""),O(null),g(null)}const R=()=>{e.onFilterChange({pgrQuery:oe,wfQuery:ae,wfFilters:I,pgrfilters:y})},k=function(e,t,n,o,a,i,s){return void 0===n&&(n=null),n=n||{[a]:" ",code:""},l.createElement("div",null,l.createElement("div",{className:"filter-label"},e),l.createElement(r.Dropdown,{option:t,selected:n,select:e=>o(e,s),optionKey:a}),l.createElement("div",{className:"tag-container"},y[s].length>0&&y[s].map((e,t)=>l.createElement(r.RemoveableTag,{key:t,text:e[a].slice(0,22)+" ...",onClick:()=>i(t,s)}))))};return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},E("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:b},E("ES_COMMON_CLEAR_ALL")),"desktop"===e.type&&l.createElement("span",{className:"clear-search",onClick:b},E("ES_COMMON_CLEAR_ALL")),"mobile"===e.type&&l.createElement("span",{onClick:e.onClose},l.createElement(r.CloseSvg,null))),l.createElement("div",null,l.createElement(r.RadioButtons,{onSelect:e=>{v(e),d="ASSIGNED_TO_ME"===e.code?d:"",A({...I,assignee:[{code:d}]})},selectedOption:_,optionsKey:"name",options:S}),l.createElement("div",null,k(E("CS_COMPLAINT_DETAILS_COMPLAINT_SUBTYPE"),P,f,function(e){const t={i18nKey:E("SERVICEDEFS."+e.serviceCode.toUpperCase()),code:e.serviceCode};D(y.serviceCode,t)||N({...y,serviceCode:[...y.serviceCode,t]})},"i18nKey",L,"serviceCode")),l.createElement("div",null,k(E("CS_PGR_LOCALITY"),h,T,function(e,t){D(y.locality,e)||N({...y,locality:[...y.locality,e]})},"i18nkey",L,"locality")),l.createElement(le,{complaints:e.complaints,onAssignmentChange:(e,t)=>{if(e.target.checked)N({...y,applicationStatus:[...y.applicationStatus,{code:t.code}]});else{const e=y.applicationStatus.filter(e=>e.code!==t.code);N({...y,applicationStatus:e})}},pgrfilters:y})))),l.createElement(r.ActionBar,null,"mobile"===e.type&&l.createElement(r.ApplyFilterBar,{labelLink:E("ES_COMMON_CLEAR_ALL"),buttonLink:E("ES_COMMON_FILTER"),onClear:b,onSubmit:function(){R(),e.onClose()}})))},ie=e=>{var t,o;let{onSearch:i,type:s,onClose:c,searchParams:m}=e;const[d,p]=n.useState((null==m||null===(t=m.search)||void 0===t?void 0:t.serviceRequestId)||""),[E,C]=n.useState((null==m||null===(o=m.search)||void 0===o?void 0:o.mobileNumber)||""),{register:S,errors:_,handleSubmit:v,reset:f}=u.useForm(),{t:O}=a.useTranslation();return l.createElement("form",{onSubmit:v(e=>{Object.keys(_).filter(e=>_[e]).length||(i(""!==e.serviceRequestId?{serviceRequestId:e.serviceRequestId}:""!==e.mobileNumber?{mobileNumber:e.mobileNumber}:{}),"mobile"===s&&c())}),style:{marginLeft:"24px"}},l.createElement(l.Fragment,null,l.createElement("div",{className:"search-container",style:{width:"auto"}},l.createElement("div",{className:"search-complaint-container"},"mobile"===s&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null," ",O("CS_COMMON_SEARCH_BY"),":"),l.createElement("span",{onClick:c},l.createElement(r.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container",style:{display:"grid"}},l.createElement("span",{className:"complaint-input"},l.createElement(r.Label,null,O("CS_COMMON_COMPLAINT_NO"),"."),l.createElement(r.TextInput,{name:"serviceRequestId",value:d,onChange:function(e){p(e.target.value)},inputRef:S({pattern:/(?!^$)([^\s])/}),style:{marginBottom:"8px"}})),l.createElement("span",{className:"mobile-input"},l.createElement(r.Label,null,O("CS_COMMON_MOBILE_NO"),"."),l.createElement(r.TextInput,{name:"mobileNumber",value:E,onChange:function(e){C(e.target.value)},inputRef:S({pattern:/^[6-9]\d{9}$/})})),"desktop"===s&&l.createElement(r.SubmitBar,{style:{marginTop:32,marginLeft:"16px",width:"calc( 100% - 16px )"},label:O("ES_COMMON_SEARCH"),submit:!0,disabled:Object.keys(_).filter(e=>_[e]).length})),"desktop"===s&&l.createElement("span",{className:"clear-search"},l.createElement(r.LinkLabel,{className:"clear-search-label",onClick:function(){f(),i({}),p(""),C("")}},O("ES_COMMON_CLEAR_SEARCH"))))),"mobile"===s&&l.createElement(r.ActionBar,null,l.createElement(r.SubmitBar,{label:"Search",submit:!0}))))},se=e=>{let{data:t,onFilterChange:n,onSearch:i,isLoading:s,searchParams:c,onNextPage:u,onPrevPage:m,currentPage:d,pageSizeLimit:p,onPageSizeChange:E,totalRecords:C}=e;const{t:S}=a.useTranslation(),_=e=>l.createElement("span",{className:"cell-text"},e),v=l.useMemo(()=>[{Header:S("CS_COMMON_COMPLAINT_NO"),Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:"/digit-ui/employee/pgr/complaint/details/"+t.original.serviceRequestId},t.original.serviceRequestId)),l.createElement("br",null),l.createElement("span",{className:"complain-no-cell-text"},S("SERVICEDEFS."+t.original.complaintSubType.toUpperCase())))}},{Header:S("WF_INBOX_HEADER_LOCALITY"),Cell:e=>{let{row:t}=e;return _(S(Digit.Utils.locale.getLocalityCode(t.original.locality,t.original.tenantId)))}},{Header:S("CS_COMPLAINT_DETAILS_CURRENT_STATUS"),Cell:e=>{let{row:t}=e;return _(S("CS_COMMON_"+t.original.status))}},{Header:S("WF_INBOX_HEADER_CURRENT_OWNER"),Cell:e=>{let{row:t}=e;return _(t.original.taskOwner)}},{Header:S("WF_INBOX_HEADER_SLA_DAYS_REMAINING"),Cell:e=>{let{row:t}=e;return l.createElement("span",(n=t.original.sla)<0?{className:"sla-cell-error"}:{className:"sla-cell-success"},n||"");var n}}],[S]);let f;return f=s?l.createElement(r.Loader,null):t&&0===t.length?l.createElement(r.Card,{style:{marginTop:20}},S("CS_MYCOMPLAINTS_NO_COMPLAINTS_EMPLOYEE").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):t.length>0?l.createElement(ne,{t:S,data:t,columns:v,getCellProps:e=>({style:{minWidth:e.column.Header===S("CS_COMMON_COMPLAINT_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onNextPage:u,onPrevPage:m,totalRecords:C,onPageSizeChagne:E,currentPage:d,pageSizeLimit:p}):l.createElement(r.Card,{style:{marginTop:20}},S("CS_COMMON_ERROR_LOADING_RESULTS").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(te,null),l.createElement("div",null,l.createElement(re,{complaints:t,onFilterChange:n,type:"desktop",searchParams:c}))),l.createElement("div",{style:{flex:1}},l.createElement(ie,{onSearch:i,type:"desktop"}),l.createElement("div",{style:{marginTop:"24px",marginTop:"24px",marginLeft:"24px",flex:1}},f)))},ce=e=>{let{data:t,onFilterChange:o,onSearch:i,serviceRequestIdKey:s,searchParams:c}=e;const{t:u}=a.useTranslation(),[m,d]=n.useState(!1),[p,E]=n.useState(null),[C,S]=n.useState(Digit.inboxFilterCount||1),_=e=>{"SEARCH"===e?E(l.createElement(ie,{type:"mobile",onClose:v,onSearch:i,searchParams:c})):"FILTER"===e&&E(l.createElement(re,{complaints:t,onFilterChange:o,onClose:v,type:"mobile",searchParams:c})),d(!0)},v=()=>{d(!1),E(null)};let f;return f=t&&0===(null==t?void 0:t.length)?l.createElement(r.Card,{style:{marginTop:20}},u("CS_MYCOMPLAINTS_NO_COMPLAINTS_EMPLOYEE").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):t&&(null==t?void 0:t.length)>0?l.createElement(r.DetailsCard,{data:t,serviceRequestIdKey:s,linkPrefix:"/digit-ui/employee/pgr/complaint/details/"}):l.createElement(r.Card,{style:{marginTop:20}},u("CS_COMMON_ERROR_LOADING_RESULTS").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},l.createElement(r.SearchAction,{text:"SEARCH",handleActionClick:()=>_("SEARCH")}),l.createElement(r.FilterAction,{filterCount:C,text:"FILTER",handleActionClick:()=>_("FILTER")})),f,m&&l.createElement(r.PopUp,null,l.createElement("div",{className:"popup-module"},p)))};function ue(e,t){return e(t={exports:{}},t.exports),t.exports
2
2
  /** @license React v16.13.1
3
3
  * react-is.production.min.js
4
4
  *
@@ -6,4 +6,4 @@ var e,n=require("react"),l=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */}var Ee="function"==typeof Symbol&&Symbol.for,Ce=Ee?Symbol.for("react.element"):60103,Se=Ee?Symbol.for("react.portal"):60106,_e=Ee?Symbol.for("react.fragment"):60107,ve=Ee?Symbol.for("react.strict_mode"):60108,fe=Ee?Symbol.for("react.profiler"):60114,Oe=Ee?Symbol.for("react.provider"):60109,Te=Ee?Symbol.for("react.context"):60110,ge=Ee?Symbol.for("react.async_mode"):60111,ye=Ee?Symbol.for("react.concurrent_mode"):60111,Ne=Ee?Symbol.for("react.forward_ref"):60112,Ie=Ee?Symbol.for("react.suspense"):60113,Ae=Ee?Symbol.for("react.suspense_list"):60120,Me=Ee?Symbol.for("react.memo"):60115,he=Ee?Symbol.for("react.lazy"):60116,De=Ee?Symbol.for("react.block"):60121,Pe=Ee?Symbol.for("react.fundamental"):60117,Le=Ee?Symbol.for("react.responder"):60118,be=Ee?Symbol.for("react.scope"):60119;function Re(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case Ce:switch(e=e.type){case ge:case ye:case _e:case fe:case ve:case Ie:return e;default:switch(e=e&&e.$$typeof){case Te:case Ne:case he:case Me:case Oe:return e;default:return t}}case Se:return t}}}function ke(e){return Re(e)===ye}var we={AsyncMode:ge,ConcurrentMode:ye,ContextConsumer:Te,ContextProvider:Oe,Element:Ce,ForwardRef:Ne,Fragment:_e,Lazy:he,Memo:Me,Portal:Se,Profiler:fe,StrictMode:ve,Suspense:Ie,isAsyncMode:function(e){return ke(e)||Re(e)===ge},isConcurrentMode:ke,isContextConsumer:function(e){return Re(e)===Te},isContextProvider:function(e){return Re(e)===Oe},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===Ce},isForwardRef:function(e){return Re(e)===Ne},isFragment:function(e){return Re(e)===_e},isLazy:function(e){return Re(e)===he},isMemo:function(e){return Re(e)===Me},isPortal:function(e){return Re(e)===Se},isProfiler:function(e){return Re(e)===fe},isStrictMode:function(e){return Re(e)===ve},isSuspense:function(e){return Re(e)===Ie},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===_e||e===ye||e===fe||e===ve||e===Ie||e===Ae||"object"==typeof e&&null!==e&&(e.$$typeof===he||e.$$typeof===Me||e.$$typeof===Oe||e.$$typeof===Te||e.$$typeof===Ne||e.$$typeof===Pe||e.$$typeof===Le||e.$$typeof===be||e.$$typeof===De)},typeOf:Re},xe=pe(function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,l=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,r=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,E=e?Symbol.for("react.memo"):60115,C=e?Symbol.for("react.lazy"):60116,S=e?Symbol.for("react.block"):60121,_=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,f=e?Symbol.for("react.scope"):60119;function O(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case c:case u:case o:case r:case a:case d:return p;default:var S=p&&p.$$typeof;switch(S){case s:case m:case C:case E:case i:return S;default:return t}}case l:return t}}}var T=u,g=s,y=i,N=n,I=m,A=o,M=C,h=E,D=l,P=r,L=a,b=d,R=!1;function k(e){return O(e)===u}t.AsyncMode=c,t.ConcurrentMode=T,t.ContextConsumer=g,t.ContextProvider=y,t.Element=N,t.ForwardRef=I,t.Fragment=A,t.Lazy=M,t.Memo=h,t.Portal=D,t.Profiler=P,t.StrictMode=L,t.Suspense=b,t.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),k(e)||O(e)===c},t.isConcurrentMode=k,t.isContextConsumer=function(e){return O(e)===s},t.isContextProvider=function(e){return O(e)===i},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return O(e)===m},t.isFragment=function(e){return O(e)===o},t.isLazy=function(e){return O(e)===C},t.isMemo=function(e){return O(e)===E},t.isPortal=function(e){return O(e)===l},t.isProfiler=function(e){return O(e)===r},t.isStrictMode=function(e){return O(e)===a},t.isSuspense=function(e){return O(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===u||e===r||e===a||e===d||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===C||e.$$typeof===E||e.$$typeof===i||e.$$typeof===s||e.$$typeof===m||e.$$typeof===_||e.$$typeof===v||e.$$typeof===f||e.$$typeof===S)},t.typeOf=O}()}),Fe=pe(function(e){e.exports="production"===process.env.NODE_ENV?we:xe}),He=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable;function Ge(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var je=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(e){l[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},l)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,l,o=Ge(e),a=1;a<arguments.length;a++){for(var r in n=Object(arguments[a]))Be.call(n,r)&&(o[r]=n[r]);if(He){l=He(n);for(var i=0;i<l.length;i++)Ue.call(n,l[i])&&(o[l[i]]=n[l[i]])}}return o},Ve="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",We=Function.call.bind(Object.prototype.hasOwnProperty),Ye=function(){};if("production"!==process.env.NODE_ENV){var $e=Ve,Ke={},ze=We;Ye=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function qe(e,t,n,l,o){if("production"!==process.env.NODE_ENV)for(var a in e)if(ze(e,a)){var r;try{if("function"!=typeof e[a]){var i=Error((l||"React class")+": "+n+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw i.name="Invariant Violation",i}r=e[a](t,a,l,n,null,$e)}catch(e){r=e}if(!r||r instanceof Error||Ye((l||"React class")+": type specification of "+n+" `"+a+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof r+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),r instanceof Error&&!(r.message in Ke)){Ke[r.message]=!0;var s=o?o():"";Ye("Failed "+n+" type: "+r.message+(null!=s?s:""))}}}qe.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(Ke={})};var Xe=qe,Je=function(){};function Ze(){return null}function Qe(){}function et(){}"production"!==process.env.NODE_ENV&&(Je=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),et.resetWarningCache=Qe;var tt=pe(function(e){e.exports="production"!==process.env.NODE_ENV?function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,l={array:i("array"),bigint:i("bigint"),bool:i("boolean"),func:i("function"),number:i("number"),object:i("object"),string:i("string"),symbol:i("symbol"),any:r(Ze),arrayOf:function(e){return r(function(t,n,l,o,r){if("function"!=typeof e)return new a("Property `"+r+"` of component `"+l+"` has invalid PropType notation inside arrayOf.");var i=t[n];if(!Array.isArray(i))return new a("Invalid "+o+" `"+r+"` of type `"+u(i)+"` supplied to `"+l+"`, expected an array.");for(var s=0;s<i.length;s++){var c=e(i,s,l,o,r+"["+s+"]",Ve);if(c instanceof Error)return c}return null})},element:r(function(t,n,l,o,r){var i=t[n];return e(i)?null:new a("Invalid "+o+" `"+r+"` of type `"+u(i)+"` supplied to `"+l+"`, expected a single ReactElement.")}),elementType:r(function(e,t,n,l,o){var r=e[t];return Fe.isValidElementType(r)?null:new a("Invalid "+l+" `"+o+"` of type `"+u(r)+"` supplied to `"+n+"`, expected a single ReactElement type.")}),instanceOf:function(e){return r(function(t,n,l,o,r){var i;return t[n]instanceof e?null:new a("Invalid "+o+" `"+r+"` of type `"+((i=t[n]).constructor&&i.constructor.name?i.constructor.name:"<<anonymous>>")+"` supplied to `"+l+"`, expected instance of `"+(e.name||"<<anonymous>>")+"`.")})},node:r(function(e,t,n,l,o){return c(e[t])?null:new a("Invalid "+l+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return r(function(t,n,l,o,r){if("function"!=typeof e)return new a("Property `"+r+"` of component `"+l+"` has invalid PropType notation inside objectOf.");var i=t[n],s=u(i);if("object"!==s)return new a("Invalid "+o+" `"+r+"` of type `"+s+"` supplied to `"+l+"`, expected an object.");for(var c in i)if(We(i,c)){var m=e(i,c,l,o,r+"."+c,Ve);if(m instanceof Error)return m}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&Je(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),Ze;function t(t,n,l,r,i){for(var s=t[n],c=0;c<e.length;c++)if(o(s,e[c]))return null;var u=JSON.stringify(e,function(e,t){return"symbol"===m(t)?String(t):t});return new a("Invalid "+r+" `"+i+"` of value `"+String(s)+"` supplied to `"+l+"`, expected one of "+u+".")}return r(t)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&Je("Invalid argument supplied to oneOfType, expected an instance of array."),Ze;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return Je("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+d(n)+" at index "+t+"."),Ze}return r(function(t,n,l,o,r){for(var i=[],s=0;s<e.length;s++){var c=(0,e[s])(t,n,l,o,r,Ve);if(null==c)return null;c.data&&We(c.data,"expectedType")&&i.push(c.data.expectedType)}return new a("Invalid "+o+" `"+r+"` supplied to `"+l+"`"+(i.length>0?", expected one of type ["+i.join(", ")+"]":"")+".")})},shape:function(e){return r(function(t,n,l,o,r){var i=t[n],c=u(i);if("object"!==c)return new a("Invalid "+o+" `"+r+"` of type `"+c+"` supplied to `"+l+"`, expected `object`.");for(var d in e){var p=e[d];if("function"!=typeof p)return s(l,o,r,d,m(p));var E=p(i,d,l,o,r+"."+d,Ve);if(E)return E}return null})},exact:function(e){return r(function(t,n,l,o,r){var i=t[n],c=u(i);if("object"!==c)return new a("Invalid "+o+" `"+r+"` of type `"+c+"` supplied to `"+l+"`, expected `object`.");var d=je({},t[n],e);for(var p in d){var E=e[p];if(We(e,p)&&"function"!=typeof E)return s(l,o,r,p,m(E));if(!E)return new a("Invalid "+o+" `"+r+"` key `"+p+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var C=E(i,p,l,o,r+"."+p,Ve);if(C)return C}return null})}};function o(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function a(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function r(e){function t(t,n,l,o,r,i,s){if(o=o||"<<anonymous>>",i=i||l,s!==Ve){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}return null==n[l]?t?new a(null===n[l]?"The "+r+" `"+i+"` is marked as required in `"+o+"`, but its value is `null`.":"The "+r+" `"+i+"` is marked as required in `"+o+"`, but its value is `undefined`."):null:e(n,l,o,r,i)}process;var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function i(e){return r(function(t,n,l,o,r,i){var s=t[n];return u(s)!==e?new a("Invalid "+o+" `"+r+"` of type `"+m(s)+"` supplied to `"+l+"`, expected `"+e+"`.",{expectedType:e}):null})}function s(e,t,n,l,o){return new a((e||"React class")+": "+t+" type `"+n+"."+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function c(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(c);if(null===t||e(t))return!0;var l=function(e){var t=e&&(n&&e[n]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!l)return!1;var o,a=l.call(t);if(l!==t.entries){for(;!(o=a.next()).done;)if(!c(o.value))return!1}else for(;!(o=a.next()).done;){var r=o.value;if(r&&!c(r[1]))return!1}return!0;default:return!1}}function u(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function m(e){if(null==e)return""+e;var t=u(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function d(e){var t=m(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return a.prototype=Error.prototype,l.checkPropTypes=Xe,l.resetWarningCache=Xe.resetWarningCache,l.PropTypes=l,l}(Fe.isElement):function(){function e(e,t,n,l,o,a){if(a!==Ve){var r=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw r.name="Invariant Violation",r}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:et,resetWarningCache:Qe};return n.PropTypes=n,n}()});const nt=e=>{let{data:t,onFilterChange:n,onSearch:o,isLoading:i,searchParams:s}=e;const{t:c}=a.useTranslation(),u=null==t?void 0:t.map(e=>{let{locality:t,tenantId:n,serviceRequestId:o,complaintSubType:a,sla:r,status:i,taskOwner:s}=e;return{[c("CS_COMMON_COMPLAINT_NO")]:o,[c("CS_ADDCOMPLAINT_COMPLAINT_SUB_TYPE")]:c("SERVICEDEFS."+a.toUpperCase()),[c("WF_INBOX_HEADER_LOCALITY")]:c(Digit.Utils.locale.getLocalityCode(t,n)),[c("CS_COMPLAINT_DETAILS_CURRENT_STATUS")]:c("CS_COMMON_"+i),[c("WF_INBOX_HEADER_CURRENT_OWNER")]:s,[c("WF_INBOX_HEADER_SLA_DAYS_REMAINING")]:(u=r,l.createElement("span",u<0?{className:"sla-cell-error"}:{className:"sla-cell-success"},u))};var u});let m;return m=i?l.createElement(r.Loader,null):l.createElement(de,{data:u,onFilterChange:n,serviceRequestIdKey:c("CS_COMMON_COMPLAINT_NO"),onSearch:o,searchParams:s}),l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(oe,{isMobile:!0}),m)))};nt.propTypes={data:tt.any,onFilterChange:tt.func,onSearch:tt.func,isLoading:tt.bool,searchParams:tt.any},nt.defaultProps={onFilterChange:()=>{},searchParams:{}};const lt=e=>{let{action:t}=e;const{t:n}=a.useTranslation();return n("REOPEN"===t?"CS_COMMON_COMPLAINT_REOPENED":"CS_COMMON_COMPLAINT_SUBMITTED")},ot=e=>{let{response:n}=e;const{complaints:o}=n;return o&&o.response&&o.response.responseInfo?(sessionStorage.removeItem("type"),sessionStorage.removeItem("pincode"),sessionStorage.removeItem("tenantId"),sessionStorage.removeItem("localityCode"),sessionStorage.removeItem("landmark"),sessionStorage.removeItem("propertyid"),l.createElement(r.Banner,{message:lt(o.response.ServiceWrappers[0].workflow),complaintNumber:o.response.ServiceWrappers[0].service.serviceRequestId,successful:!0})):l.createElement(r.Banner,{message:t("CS_COMMON_COMPLAINT_NOT_SUBMITTED"),successful:!1})},at=e=>{var t,i,u,d,p,E;let{applicationData:C,details:S,complaintDetails:_}=e;_.workflow.action="EDIT",_.workflow.assignes=null,_.workflow.comments=null,_.workflow.verificationDocuments=[],console.log("complaintDetails_inside_edit",_);const{t:v}=a.useTranslation(),[O,T]=(o.useHistory(),n.useState(!0)),g=Digit.Hooks.pgr.useTenants(),y=()=>(null==g?void 0:g.filter(e=>e.code===Digit.ULBService.getCurrentTenantId()))||[],[N,I]=n.useState(""),[A,M]=n.useState({}),[h,D]=n.useState([]),[P,L]=n.useState({}),[b,R]=n.useState({}),[k,w]=n.useState(y()[0]?y()[0]:null),{data:x}=Digit.Hooks.useBoundaryLocalities(null===(t=y()[0])||void 0===t?void 0:t.code,"admin",{enabled:!!y()[0]},v),[F,H]=n.useState(x),[B,U]=n.useState(),[G,j]=n.useState(!1),[W,Y]=n.useState(!1),$=window.Digit.SessionStorage.get("Employee.tenantId"),K=Digit.Hooks.pgr.useComplaintTypes({stateCode:$}),z=s.useDispatch(),q=Digit.GetServiceDefinitions,X=c.useQueryClient(),J=[{name:"LOW",code:"LOW",active:!0},{name:"MEDIUM",code:"MEDIUM",active:!0},{name:"HIGH",code:"HIGH",active:!0}];n.useEffect(()=>{H(x)},[x]),n.useEffect(()=>{var e;const t=g.find(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==N)});if((null==t?void 0:t.code)===(null===(e=y()[0])||void 0===e?void 0:e.code)){Y(!1),w(t),U(null);const e=x.filter(e=>e.pincode==N);H(e)}else""===N||null===N?(Y(!1),H(x)):Y(!0)},[N]),n.useEffect(()=>{null!=K&&function(e){try{const t=function(){if(e.key!==A.key){const t=function(){if("Others"!==e.key)return L({name:""}),M(e),Promise.resolve(q.getSubMenu($,e,v)).then(function(t){return D(t),Promise.resolve(q.getSubMenu($,e,v)).then(function(e){const t=e.filter(e=>e.key.toLocaleLowerCase()==(null==S?void 0:S.CS_ADDCOMPLAINT_COMPLAINT_SUB_TYPE.split("SERVICEDEFS.")[1].toLocaleLowerCase()))[0];L(t)})});{L({name:""}),M(e),D([{key:"Others",name:v("SERVICEDEFS.OTHERS")}]);const t=[{key:"Others",name:v("SERVICEDEFS.OTHERS")}].filter(e=>e.key.toLocaleLowerCase()==(null==S?void 0:S.CS_ADDCOMPLAINT_COMPLAINT_SUB_TYPE.split("SERVICEDEFS.")[1].toLocaleLowerCase()))[0];L(t)}}();if(t&&t.then)return t.then(function(){})}}();Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(K.filter(e=>e.name.toLocaleLowerCase()==(null==S?void 0:S.CS_ADDCOMPLAINT_COMPLAINT_TYPE.split("SERVICEDEFS.")[1].toLocaleLowerCase()))[0]);const e=J.filter(e=>e.name===(null==C?void 0:C.priority))[0];if(R(e),void 0!==F){const e=F.filter(e=>{var t,n;return e.code===(null==C||null===(t=C.address)||void 0===t||null===(n=t.locality)||void 0===n?void 0:n.code)})[0];U(e)}},[F]);const Z=[{head:v("ES_CREATECOMPLAINT_PROVIDE_COMPLAINANT_DETAILS"),body:[{label:v("ES_CREATECOMPLAINT_MOBILE_NUMBER"),isMandatory:!0,type:"text",populators:{name:"mobileNumber",defaultValue:null==C||null===(i=C.citizen)||void 0===i?void 0:i.mobileNumber,disabled:!0,validation:{required:!0,pattern:/^[6-9]\d{9}$/},componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),error:v("CORE_COMMON_MOBILE_ERROR")}},{label:v("ES_CREATECOMPLAINT_COMPLAINT_NAME"),isMandatory:!0,type:"text",populators:{name:"name",defaultValue:null==C||null===(u=C.citizen)||void 0===u?void 0:u.name,disabled:!0,validation:{required:!0,pattern:/^[A-Za-z]/},error:v("CS_ADDCOMPLAINT_NAME_ERROR")}},{label:v("ES_MAIL_ID"),isMandatory:!1,type:"text",populators:{name:"emailId",defaultValue:null==C||null===(d=C.citizen)||void 0===d?void 0:d.emailId,disabled:!0,validation:{pattern:/[A-Za-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/},error:v("CS_ADDCOMPLAINT_EMAIL_ERROR")}}]},{head:v("CS_COMPLAINT_DETAILS_COMPLAINT_DETAILS"),body:[{label:v("CS_COMPLAINT_DETAILS_COMPLAINT_TYPE"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{disable:!0,option:K,optionKey:"name",id:"complaintType",selected:A})},{label:v("CS_COMPLAINT_DETAILS_COMPLAINT_SUBTYPE"),isMandatory:!0,type:"dropdown",menu:m({},h),populators:l.createElement(r.Dropdown,{disable:!0,option:h,optionKey:"name",id:"complaintSubType",selected:P})},{label:v("CS_COMPLAINT_DETAILS_COMPLAINT_PRIORITY_LEVEL"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{option:J,optionKey:"name",id:"priorityLevel",selected:b,select:function(e){try{return R(e),Promise.resolve()}catch(e){return Promise.reject(e)}}})}]},{head:v("CS_ADDCOMPLAINT_LOCATION"),body:[{label:v("CORE_COMMON_PINCODE"),type:"text",populators:{name:"pincode",defaultValue:null==C||null===(p=C.address)||void 0===p?void 0:p.pincode,disabled:!0,validation:{pattern:/^[1-9][0-9]{5}$/,validate:()=>!W},error:v("CORE_COMMON_PINCODE_INVALID")}},{label:v("CS_COMPLAINT_DETAILS_CITY"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{isMandatory:!0,selected:k,freeze:!0,option:y(),id:"city",optionKey:"i18nKey",t:v,disable:!0})},{label:v("CS_CREATECOMPLAINT_MOHALLA"),type:"dropdown",isMandatory:!0,populators:l.createElement(r.Dropdown,{disable:!0,selected:B,optionKey:"i18nkey",id:"locality",option:F,t:v})},{label:v("CS_COMPLAINT_DETAILS_LANDMARK"),type:"textarea",populators:{name:"landmark",value:null==C||null===(E=C.address)||void 0===E?void 0:E.landmark,disabled:!0}}]},{head:v("CS_COMPLAINT_DETAILS_ADDITIONAL_DETAILS"),body:[{label:v("CS_COMPLAINT_DETAILS_ADDITIONAL_DETAILS"),type:"textarea",isDisabled:!0,populators:{name:"description",value:null==C?void 0:C.description,disabled:!0}}]}];return l.createElement(V,{heading:v("ES_EDIT_NEW_COMPLAINT"),config:Z,onSubmit:function(){try{return delete _.details,_.service.priority=b.code,Promise.resolve(z(f(_))).then(function(){return Promise.resolve(X.refetchQueries(["fetchInboxData"])).then(function(){var e;e=window.location.href.split("modify")[0]+"response",window.location.href=e})})}catch(e){return Promise.reject(e)}},isDisabled:!O&&!G,label:v("CS_UPDATE_COMPLAINT")})},rt={PGRModule:e=>{let{stateCode:t,userType:n,tenants:o}=e;const a=Digit.StoreData.getCurrentLanguage(),{isLoading:i}=Digit.Services.useStore({stateCode:t,moduleCode:"PGR",language:a});return i?l.createElement(r.Loader,null):(Digit.SessionStorage.set("PGR_TENANTS",o),l.createElement("citizen"===n?te:le,null))},PGRLinks:e=>{let{matchPath:t}=e;const{t:o}=a.useTranslation(),[i,s,c]=Digit.Hooks.useSessionStorage("PGR_CITIZEN_CREATE_COMPLAINT",{});n.useEffect(()=>{c()},[]);const u=[{link:t+"/create-complaint/complaint-type",i18nKey:o("CS_COMMON_FILE_A_COMPLAINT")},{link:t+"/complaints",i18nKey:o("CS_HOME_MY_COMPLAINTS")}];return l.createElement(r.CitizenHomeCard,{header:o("CS_COMMON_HOME_COMPLAINTS"),links:u,Icon:r.ComplaintIcon})},PGRCard:()=>{const{t:e}=a.useTranslation();if(e("ES_PGR_INBOX"),e("ES_PGR_NEW_COMPLAINT"),!Digit.Utils.pgrAccess())return null;const t=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 9h-2V5h2v6zm0 4h-2v-2h2v2z",fill:"white"}));let n=[{label:e("ES_PGR_NEW_COMPLAINT"),link:"/digit-ui/employee/pgr/complaint/create",role:"CSR"}];n=n.filter(e=>e.role&&Digit.Utils.didEmployeeHasRole(e.role));const o={Icon:l.createElement(t,null),moduleName:e("ES_PGR_HEADER_COMPLAINT"),kpis:[{label:e("TOTAL_PGR"),link:"/digit-ui/employee/pgr/inbox"},{label:e("TOTAL_NEARING_SLA"),link:"/digit-ui/employee/pgr/inbox"}],links:[{label:e("ES_PGR_INBOX"),link:"/digit-ui/employee/pgr/inbox"},...n]};return l.createElement(r.EmployeeModuleCard,o)},PGRComplaintDetails:e=>{var t,i,s,u,d,p,E,C,S,_,v,f,O;let{id:T}=o.useParams();const{t:M}=a.useTranslation(),[h,D]=n.useState(!1),[P,L]=n.useState(null),[b,R]=n.useState(!1),k=Digit.ULBService.getCurrentTenantId(),{isLoading:w,complaintDetails:x,revalidate:F}=Digit.Hooks.pgr.useComplaintDetails({tenantId:k,id:T}),H=Digit.Hooks.useWorkflowDetails({tenantId:k,id:T,moduleCode:"PGR",role:"EMPLOYEE"}),[B,U]=n.useState([]);var G,j;H&&null!=H&&H.data&&(H.data.initialActionState=(null==H||null===(G=H.data)||void 0===G?void 0:G.initialActionState)||m({},null==H||null===(j=H.data)||void 0===j?void 0:j.actionState)||{},H.data.actionState=m({},H.data)),n.useEffect(()=>{if(H){const{data:{timeline:e}={}}=H;if(e){const t=null==e?void 0:e.find(e=>"APPLY"===(null==e?void 0:e.performedAction)),{thumbnailsToShow:n}=t;n&&U(n)}}},[H]);const[V,W]=n.useState(!1),[Y,$]=n.useState(!1),[K,z]=n.useState(!1),[q,X]=n.useState(null),[J,Z]=n.useState(null),[Q,ee]=n.useState(!1),[te,ne]=n.useState(1),[le,oe]=n.useState(!1),ae=c.useQueryClient();n.useEffect(()=>{try{return Promise.resolve(null===(_Digit=Digit)||void 0===_Digit||null===(_Digit$WorkflowServic=_Digit.WorkflowService)||void 0===_Digit$WorkflowServic?void 0:_Digit$WorkflowServic.getByBusinessId(k,T)).then(function(){})}catch(e){Promise.reject(e)}},[x]);const re=function(){try{return Promise.resolve(ae.refetchQueries(["fetchInboxData"])).then(function(){return Promise.resolve(H.revalidate()).then(function(){return Promise.resolve(F()).then(function(){})})})}catch(e){return Promise.reject(e)}};function ie(e){switch(e){case h:D(!h);break;case K:z(!K)}}function se(e,t){L(e)}if(n.useEffect(()=>{!function(){try{const e=function(){if(x)return ee(!0),Promise.resolve(re()).then(function(){ee(!1)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[]),w||H.isLoading||Q)return l.createElement(r.Loader,null);if(H.isError)return l.createElement(l.Fragment,null,H.error);const ce=(e,t,o)=>{var a,i,s,c;const{wfComment:u,thumbnailsToShow:d}=e;function p(e,t,n){var l,o;let a=null===(l=n.thumbs)||void 0===l?void 0:l.findIndex(t=>t===e);se(a>-1&&(null==n||null===(o=n.fullImage)||void 0===o?void 0:o[a])||e)}const E=m({date:null==e||null===(a=e.auditDetails)||void 0===a?void 0:a.lastModified,name:null==e||null===(i=e.assigner)||void 0===i?void 0:i.name,mobileNumber:null==e||null===(s=e.assigner)||void 0===s?void 0:s.mobileNumber},"COMPLAINT_FILED"===e.status&&null!=x&&x.audit?{source:x.audit.source}:{});if("PENDINGFORASSIGNMENT"===e.status&&null!=x&&x.audit){if(o.length-(t+1)==1){const t={date:Digit.DateUtils.ConvertTimestampToDate(x.audit.details.createdTime)};return l.createElement(I,{data:t,comments:null==e?void 0:e.wfComment})}{var C,S;const t={date:Digit.DateUtils.ConvertTimestampToDate(x.audit.details.createdTime)};return l.createElement(n.Fragment,null,null!=e&&e.wfComment?l.createElement("div",null,null==e||null===(C=e.wfComment)||void 0===C?void 0:C.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,M("WF_COMMON_COMMENTS")),l.createElement("p",null,e)))):null,"COMPLAINT_FILED"!==e.status&&(null==d||null===(S=d.thumbs)||void 0===S?void 0:S.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,M("CS_COMMON_ATTACHMENTS")),l.createElement(r.DisplayPhotos,{srcs:d.thumbs,onClick:(e,t)=>p(e,0,d)})):null,null!=t&&t.date?l.createElement(I,{data:t}):null)}}return l.createElement(n.Fragment,null,u?l.createElement("div",null,null==u?void 0:u.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,M("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e)))):null,"COMPLAINT_FILED"!==e.status&&(null==d||null===(c=d.thumbs)||void 0===c?void 0:c.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,M("CS_COMMON_ATTACHMENTS")),l.createElement(r.DisplayPhotos,{srcs:d.thumbs,onClick:(e,t)=>p(e,0,d)})):null,null!=E&&E.date?l.createElement(I,{data:E}):null,"CLOSEDAFTERRESOLUTION"==e.status&&"RATE"==x.workflow.action&&t<=1&&x.audit.rating?l.createElement(g,{text:M("CS_ADDCOMPLAINT_YOU_RATED"),rating:x.audit.rating}):null)};return l.createElement(l.Fragment,null,l.createElement(r.Card,null,l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement(r.CardSubHeader,null,M("CS_HEADER_COMPLAINT_SUMMARY")),l.createElement(r.LinkButton,{label:M("VIEW_TIMELINE"),style:{marginLeft:"auto",color:"#A52A2A"},onClick:()=>{oe(!0);const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"})}})),l.createElement(r.CardLabel,{style:{fontWeight:"700"}},M("CS_COMPLAINT_DETAILS_COMPLAINT_DETAILS")),w?l.createElement(r.Loader,null):l.createElement(r.StatusTable,null,x&&Object.keys(null==x?void 0:x.details).map((e,t,n)=>l.createElement(r.Row,{key:e,label:M(e),text:Array.isArray(null==x?void 0:x.details[e])?null==x?void 0:x.details[e].map(e=>M("object"==typeof e?null==e?void 0:e.code:e)):M(null==x?void 0:x.details[e])||"N/A",last:n.length-1===t})),null),null!=B&&B.thumbs?l.createElement(r.DisplayPhotos,{srcs:null==B?void 0:B.thumbs,onClick:(e,t)=>function(e,t){se(null==B?void 0:B.fullImage[t])}(0,t)}):null,l.createElement(r.BreakLine,null),(null==H?void 0:H.isLoading)&&l.createElement(r.Loader,null),!(null!=H&&H.isLoading)&&l.createElement(l.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(r.CardSubHeader,null,M("CS_COMPLAINT_DETAILS_COMPLAINT_TIMELINE")),null!=H&&null!==(t=H.data)&&void 0!==t&&t.timeline&&1===(null==H||null===(i=H.data)||void 0===i||null===(s=i.timeline)||void 0===s?void 0:s.length)?l.createElement(r.CheckPoint,{isCompleted:!0,label:M("CS_COMMON_"+(null==H||null===(u=H.data)||void 0===u||null===(d=u.timeline[0])||void 0===d?void 0:d.status))}):l.createElement(r.ConnectingCheckPoints,null,(null==H||null===(p=H.data)||void 0===p?void 0:p.timeline)&&(null==H||null===(E=H.data)||void 0===E?void 0:E.timeline.slice(0,V?null==H?void 0:H.data.timeline.length:2).map((e,t,n)=>l.createElement(l.Fragment,{key:t},l.createElement(r.CheckPoint,{keyValue:t,isCompleted:0===t,label:M("CS_COMMON_"+e.status),customChild:ce(e,t,n)}))))),(null==H||null===(C=H.data)||void 0===C||null===(S=C.timeline)||void 0===S?void 0:S.length)>2&&l.createElement(r.LinkButton,{label:M(V?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{W(e=>!e)}})))),h?l.createElement(r.PopUp,null,l.createElement("div",{className:"popup-module"},l.createElement(r.HeaderBar,{main:l.createElement(y,{label:"Complaint Geolocation"}),end:l.createElement(N,{onClick:()=>ie(h)})}),l.createElement("div",{className:"popup-module-main"},l.createElement("img",{src:"https://via.placeholder.com/912x568"})))):null,P?l.createElement(r.ImageViewer,{imageSrc:P,onClose:function(){L(null)}}):null,K?l.createElement(A,{workflowDetails:H,complaintDetails:x,close:ie,popup:K,selectedAction:q,onAssign:function(e,t,n){try{return z(!1),Promise.resolve(Digit.Complaint.assign(x,q,e,t,n,k)).then(function(e){return Z(e),R(!0),ee(!0),Promise.resolve(re()).then(function(){ee(!1),ne(te+1),setTimeout(()=>R(!1),1e4)})})}catch(e){return Promise.reject(e)}},tenantId:k,t:M}):null,b&&l.createElement(r.Toast,{label:M(J?"CS_ACTION_"+q+"_TEXT":"CS_ACTION_ASSIGN_FAILED"),onClose:function(){R(!1)}}),!(null!=H&&H.isLoading)&&(null==H||null===(_=H.data)||void 0===_||null===(v=_.nextActions)||void 0===v?void 0:v.length)>0&&l.createElement(r.ActionBar,null,Y&&null!=H&&null!==(f=H.data)&&void 0!==f&&f.nextActions?l.createElement(r.Menu,{options:null==H||null===(O=H.data)||void 0===O?void 0:O.nextActions.map(e=>e.action),t:M,onSelect:function(e){switch(X(e),e){case"ASSIGN":case"REASSIGN":case"RESOLVE":case"REJECT":case"REOPEN":z(!0),$(!1);break;case"EDIT":let e=window.location.href;t=e.split("complaint")[0]+"modify-application/"+e.split("details/")[1],window.location.href=t;break;default:$(!1)}var t}}):null,l.createElement(r.SubmitBar,{label:M("WF_TAKE_ACTION"),onSubmit:()=>$(!Y)})))},PGRCreateComplaintEmp:e=>{var t,i;let{parentUrl:u}=e;const d=Digit.Hooks.pgr.useTenants(),{t:p}=a.useTranslation(),E=()=>(null==d?void 0:d.filter(e=>e.code===Digit.ULBService.getCurrentTenantId()))||[],C=localStorage.getItem("pgrProperty"),[S,_]=n.useState((null===JSON||void 0===JSON?void 0:JSON.parse(sessionStorage.getItem("complaintType")))||{}),[f,O]=n.useState([]),[T,g]=n.useState((null===JSON||void 0===JSON?void 0:JSON.parse(sessionStorage.getItem("subType")))||{}),[y,N]=n.useState((null===JSON||void 0===JSON?void 0:JSON.parse(sessionStorage.getItem("PriorityLevel")))||{}),[I,A]=n.useState(""),[M,h]=n.useState(sessionStorage.getItem("mobileNumber")||""),[D,P]=n.useState(sessionStorage.getItem("name")||""),[L,b]=n.useState(sessionStorage.getItem("emailId")||""),[R,k]=n.useState(E()[0]?E()[0]:null),[w,x]=n.useState(""),[F,H]=n.useState(""),{data:B}=Digit.Hooks.useBoundaryLocalities(null===(t=E()[0])||void 0===t?void 0:t.code,"admin",{enabled:!!E()[0]},p),[U,G]=n.useState(B),[j,W]=n.useState(null),[Y,$]=n.useState(!1),[K,z]=n.useState(!1),[q,X]=n.useState(null),[J,Z]=n.useState(!1),[Q,ee]=n.useState({}),te=window.Digit.SessionStorage.get("Employee.tenantId"),ne=Digit.Hooks.pgr.useComplaintTypes({stateCode:te}),le=s.useDispatch(),oe=(o.useRouteMatch(),o.useHistory()),ae=Digit.GetServiceDefinitions,re=c.useQueryClient();n.useEffect(()=>{$(!!(null!=S&&S.key&&null!=T&&T.key&&null!=R&&R.code&&null!=j&&j.code&&null!=y&&y.code))},[S,T,y,R,j]),n.useEffect(()=>{G(B)},[B]),n.useEffect(()=>{var e;const t=d.find(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==I)});if((null==t?void 0:t.code)===(null===(e=E()[0])||void 0===e?void 0:e.code)){Z(!1),k(t),W(null);const e=B.filter(e=>e.pincode==I);G(e)}else""===I||null===I?(Z(!1),G(B)):Z(!0)},[I]);const ie=e=>{const{value:t}=e.target;h(t)},se=e=>{const{value:t}=e.target;H(t)},ce=[{head:p("ES_CREATECOMPLAINT_PROVIDE_COMPLAINANT_DETAILS"),body:[{label:p("ES_CREATECOMPLAINT_MOBILE_NUMBER"),isMandatory:!0,type:"text",value:M,onChange:ie,populators:{name:"mobileNumber",onChange:ie,validation:{required:!0,pattern:/^[6-9]\d{9}$/},componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),error:p("CORE_COMMON_MOBILE_ERROR")}},{label:p("ES_CREATECOMPLAINT_COMPLAINT_NAME"),isMandatory:!0,type:"text",value:D,populators:{name:"name",onChange:e=>{const{value:t}=e.target;P(t)},validation:{required:!0,pattern:/^[A-Za-z]/},error:p("CS_ADDCOMPLAINT_NAME_ERROR")}},{label:p("ES_MAIL_ID"),isMandatory:!1,type:"text",value:L,populators:{name:"emailId",onChange:e=>{const{value:t}=e.target;b(t)},validation:{pattern:/[A-Za-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/},error:p("CS_ADDCOMPLAINT_EMAIL_ERROR")}}]},{head:p("CS_COMPLAINT_DETAILS_COMPLAINT_DETAILS"),body:[{label:p("CS_COMPLAINT_DETAILS_COMPLAINT_TYPE"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{option:ne,optionKey:"name",id:"complaintType",selected:S,select:function(e){try{const t=function(){if(e.key!==S.key){const t=function(){if("Others"!==e.key)return g({name:""}),_(e),sessionStorage.setItem("complaintType",JSON.stringify(e)),Promise.resolve(ae.getSubMenu(te,e,p)).then(function(e){O(e)});g({name:""}),_(e),sessionStorage.setItem("complaintType",JSON.stringify(e)),O([{key:"Others",name:p("SERVICEDEFS.OTHERS")}])}();if(t&&t.then)return t.then(function(){})}}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}})},{label:p("CS_COMPLAINT_DETAILS_COMPLAINT_SUBTYPE"),isMandatory:!0,type:"dropdown",menu:m({},f),populators:l.createElement(r.Dropdown,{option:f,optionKey:"name",id:"complaintSubType",selected:T,select:function(e){sessionStorage.setItem("subType",JSON.stringify(e)),g(e)}})},{label:p("CS_COMPLAINT_DETAILS_COMPLAINT_PRIORITY_LEVEL"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{option:[{name:"LOW",code:"LOW",active:!0},{name:"MEDIUM",code:"MEDIUM",active:!0},{name:"HIGH",code:"HIGH",active:!0}],optionKey:"name",id:"priorityLevel",selected:y,select:function(e){try{return sessionStorage.setItem("priorityLevel",JSON.stringify(e)),N(e),Promise.resolve()}catch(e){return Promise.reject(e)}}})},{isEditConnection:!0,isCreateConnection:!0,isModifyConnection:!0,isEditByConfigConnection:!0,isProperty:!(null==T||null===(i=T.key)||void 0===i||!i.includes("Property")),component:"CPTPropertySearchNSummary",key:"cpt",type:"component",body:[{component:"CPTPropertySearchNSummary",withoutLabel:!0,key:"cpt",type:"component",hideInCitizen:!0}]}]},{head:p("CS_ADDCOMPLAINT_LOCATION"),body:[{label:p("CORE_COMMON_PINCODE"),type:"text",populators:{name:"pincode",validation:{pattern:/^[1-9][0-9]{5}$/,validate:()=>!J},error:p("CORE_COMMON_PINCODE_INVALID"),onChange:e=>{const{value:t}=e.target;A(t),t||Z(!1)}}},{label:p("CS_COMPLAINT_DETAILS_CITY"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{isMandatory:!0,selected:R,freeze:!0,option:E(),id:"city",select:function(e){return Promise.resolve()},optionKey:"i18nKey",t:p})},{label:p("CS_CREATECOMPLAINT_MOHALLA"),type:"dropdown",isMandatory:!0,dependency:!(!R||!U),populators:l.createElement(r.Dropdown,{isMandatory:!0,selected:j,optionKey:"i18nkey",id:"locality",option:U,select:function(e){W(e)},t:p})},{label:p("CS_COMPLAINT_DETAILS_LANDMARK"),type:"textarea",populators:{name:"landmark"}}]},{head:p("CS_COMPLAINT_DETAILS_ADDITIONAL_DETAILS"),body:[{label:p("CS_COMPLAINT_DETAILS_ADDITIONAL_DETAILS"),type:"textarea",onChange:se,value:F,populators:{name:"description",onChange:se}}]}];return n.useEffect(()=>{if(console.log("heloo world",C),"undefined"!==C&&null!==C){let e=JSON.parse(C);console.log("stp 1",C),X(e),x(null==e?void 0:e.propertyId)}},[]),n.useEffect(()=>{if(console.log("step 2",C,q,typeof C),"undefined"!==q&&null!==q){var e;let t=q;A((null==t||null===(e=t.address)||void 0===e?void 0:e.pincode)||"");let n=U.filter(e=>{var n,l;return e.code===(null==t||null===(n=t.address)||void 0===n||null===(l=n.locality)||void 0===l?void 0:l.code)});W(null==n?void 0:n[0]),H(null==t?void 0:t.propertyId),console.log("pgrProperty",U,null==t?void 0:t.propertyId,t)}},[w]),l.createElement(V,{heading:p("ES_CREATECOMPLAINT_NEW_COMPLAINT"),config:ce,onSubmit:e=>{Y&&(z(!0),!K&&function(e){try{if(!Y)return Promise.resolve();const t=R.code,n=R.city.name,l=R.city.name,o=R.city.name,a=j.code,r=j.name,i=null==e?void 0:e.landmark,{key:s}=T,c=m({},e,{cityCode:t,city:n,district:l,region:o,localityCode:a,localityName:r,landmark:i,complaintType:s,priorityLevel:y,mobileNumber:null==e?void 0:e.mobileNumber,name:null==e?void 0:e.name,emailId:null==e?void 0:e.emailId});Promise.resolve(le(v(c))).then(function(){return Promise.resolve(re.refetchQueries(["fetchInboxData"])).then(function(){localStorage.removeItem("pgrProperty"),oe.push(u+"/response")})})}catch(e){return Promise.reject(e)}}(e))},isDisabled:!Y&&!K,label:p("CS_ADDCOMPLAINT_ADDITIONAL_DETAILS_SUBMIT_COMPLAINT")})},PGRInbox:()=>{const{t:e}=a.useTranslation(),t=Digit.ULBService.getCurrentTenantId(),{uuid:o}=Digit.UserService.getUser().info,[i,s]=n.useState(0),[c,u]=n.useState(10),[d,p]=n.useState(0),[E,C]=n.useState({filters:{wfFilters:{assignee:[{code:o}]}},search:"",sort:{}});n.useEffect(()=>{try{const e=null==E||null===(_searchParams$filters=E.filters)||void 0===_searchParams$filters||null===(_searchParams$filters2=_searchParams$filters.pgrfilters)||void 0===_searchParams$filters2||null===(_searchParams$filters3=_searchParams$filters2.applicationStatus)||void 0===_searchParams$filters3?void 0:_searchParams$filters3.map(e=>e.code).join(",");return Promise.resolve(Digit.PGRService.count(t,(null==e?void 0:e.length)>0?{applicationStatus:e}:{})).then(function(e){null!=e&&e.count&&p(e.count)})}catch(e){Promise.reject(e)}},[E]);const S=e=>{C(m({},E,{filters:e}))},_=function(e){void 0===e&&(e=""),C(m({},E,{search:e}))};let{data:v,isLoading:f}=Digit.Hooks.pgr.useInboxData(m({},E,{offset:i,limit:c})),O=Digit.Utils.browser.isMobile();return null!==(null==v?void 0:v.length)?O?l.createElement(nt,{data:v,isLoading:f,onFilterChange:S,onSearch:_,searchParams:E}):l.createElement("div",null,l.createElement(r.Header,null,e("ES_COMMON_INBOX")),l.createElement(me,{data:v,isLoading:f,onFilterChange:S,onSearch:_,searchParams:E,onNextPage:()=>{s(e=>e+10)},onPrevPage:()=>{s(e=>e-10)},onPageSizeChange:e=>{u(Number(e.target.value))},currentPage:Math.floor(i/c),totalRecords:d,pageSizeLimit:c})):l.createElement(r.Loader,null)},PGRResponseEmp:e=>{var t,i,c,u,d;const{t:p}=a.useTranslation(),E=(o.useRouteMatch(),s.useSelector(e=>e).pgr),{data:C}=Digit.Hooks.useStore.getInitData(),{tenants:S}=C||{},[_,v]=n.useState(!1);let f=null==E||null===(t=E.complaints)||void 0===t||null===(i=t.response)||void 0===i||null===(c=i.ServiceWrappers)||void 0===c||null===(u=c[0])||void 0===u||null===(d=u.service)||void 0===d?void 0:d.serviceRequestId;const{complaintDetails:O}=Digit.Hooks.pgr.useComplaintDetails({tenantId:Digit.ULBService.getCurrentTenantId(),id:f},{enabled:!!_});return l.createElement(r.Card,null,E.complaints.response&&l.createElement(ot,{response:E}),l.createElement(r.CardText,null,p("ES_COMMON_TRACK_COMPLAINT_TEXT")),l.createElement("div",{className:"abc",style:{display:"flex"}},l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(r.SubmitBar,{label:p("CORE_COMMON_GO_TO_HOME")})),E.complaints.response&&l.createElement(r.SubmitBar,{label:p("PT_DOWNLOAD_ACK_FORM"),onSubmit:e=>{!function(e){try{const t=S.find(e=>e.code===Digit.ULBService.getCurrentTenantId());e.preventDefault(),v(!0),Promise.resolve(k(m({},O),t,p)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}}(e)},style:{marginLeft:"10px"}})))},PGRCreateComplaintCitizen:()=>{const e=Digit.Contexts.ComponentProvider,{t:t}=a.useTranslation(),{pathname:r}=o.useLocation(),i=o.useRouteMatch(),u=o.useHistory(),p=(n.useContext(e),s.useDispatch()),{data:E,isLoading:C}=Digit.Hooks.useStore.getInitData(),{stateInfo:S}=E||{},[_,f,O]=Digit.Hooks.useSessionStorage("PGR_CITIZEN_CREATE_COMPLAINT",{}),T=n.useMemo(()=>W),[g,y]=n.useState(_),[N,I]=n.useState(""),[A,M]=n.useState(!1),[h,D]=n.useState(0),P=c.useQueryClient();n.useEffect(()=>{M(!1)},[]),n.useEffect(()=>{y(_),null===N?b():u.push(i.path+"/"+N)},[_,N]);const L=()=>{const e=r.split("/").pop();let{nextStep:n}=T.routes[e],l=Digit.SessionStorage.get("PGR_CITIZEN_CREATE_COMPLAINT");"sub-type"===n&&"Others"===l.complaintType.key&&(f(m({},_,{complaintType:{key:"Others",name:t("SERVICEDEFS.OTHERS")},subType:{key:"Others",name:t("SERVICEDEFS.OTHERS")}})),n=T.routes[n].nextStep),I(n)},b=()=>{A||(M(!0),R())},R=function(){try{const e=function(){if(null!=g&&g.complaintType){const{city_complaint:e,locality_complaint:t,uploadedImages:n,subType:l,prioritylevel:o,details:a}=g,r=d(g,Y),{code:s,name:c}=e,{code:E,name:C}=t,_=sessionStorage.getItem("propertyid"),f=null==n?void 0:n.map(e=>({documentType:"PHOTO",fileStoreId:e,documentUid:"",additionalDetails:{}})),O=m({},r,{complaintType:l.key,cityCode:s,city:c,prioritylevel:o,description:a,district:c,region:c,localityCode:E,localityName:C,state:S.name,uploadedImages:f,additionalDetails:{propertyid:_}});return Promise.resolve(p(v(O))).then(function(){return Promise.resolve(P.refetchQueries(["complaintsList"])).then(function(){u.push(i.path+"/response")})})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},k=e=>{let t=JSON.parse(sessionStorage.getItem("complaintType"));if(null!=e&&e.subType){let n={complaintType:t};console.log("handleSelect",e,n),f(m({},_,e,n)),L()}else f(m({},_,e)),L()},w=()=>{L()};return C?null:l.createElement(o.Switch,null,Object.keys(T.routes).map((e,n)=>{const{component:a,texts:r,inputs:s}=T.routes[e],c="string"==typeof a?Digit.ComponentRegistryService.getComponent(a):a;return l.createElement(o.Route,{path:i.path+"/"+e,key:n},l.createElement(c,{config:{texts:r,inputs:s},onSelect:k,onSkip:w,value:_,t:t}))}),l.createElement(o.Route,{path:i.path+"/response"},l.createElement(j,{match:i})),l.createElement(o.Route,null,l.createElement(o.Redirect,{to:i.path+"/"+T.indexRoute})))},PGRComplaintsList:e=>{var t,i,s,c;const u=Digit.UserService.getUser(),m=u.mobileNumber||(null==u||null===(t=u.info)||void 0===t?void 0:t.mobileNumber)||(null==u||null===(i=u.info)||void 0===i||null===(s=i.userInfo)||void 0===s?void 0:s.mobileNumber),d=(null===(c=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===c?void 0:c.code)||Digit.ULBService.getCurrentTenantId(),{t:p}=a.useTranslation(),{path:E}=o.useRouteMatch();let{isLoading:C,error:S,data:_,revalidate:v}=Digit.Hooks.pgr.useComplaintsListByMobile(d,m);if(n.useEffect(()=>{v()},[]),C)return l.createElement(l.Fragment,null,l.createElement(r.Header,null,p("CS_HOME_MY_COMPLAINTS")),l.createElement(r.Loader,null));let f,O=null==_?void 0:_.ServiceWrappers;return f=S?l.createElement(r.Card,null,p("CS_COMMON_ERROR_LOADING_RESULTS").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):0===O.length?l.createElement(r.Card,null,p("CS_MYCOMPLAINTS_NO_COMPLAINTS").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):O.map((e,t)=>{let{service:n}=e;return l.createElement($,{key:t,data:n,path:E})}),l.createElement(l.Fragment,null,l.createElement("div",{className:"applications-list-container"},l.createElement(r.Header,null,p("CS_HOME_MY_COMPLAINTS")),f))},PGRComplaintDetailsPage:e=>{var t;let{t:i}=a.useTranslation(),{id:s}=o.useParams(),c=(null===(t=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===t?void 0:t.code)||Digit.ULBService.getCurrentTenantId();const{isLoading:u,isError:m,complaintDetails:d,revalidate:p}=Digit.Hooks.pgr.useComplaintDetails({tenantId:c,id:s}),[E,C]=n.useState({}),[S,_]=n.useState(null),[v,f]=n.useState(""),[O,T]=n.useState(!1),[g,y]=n.useState(null),[N,I]=n.useState(!0),[A,M]=n.useState(!1),[h,D]=n.useState(!1);function P(e,t){_(e)}return n.useEffect(()=>{!function(){try{const e=function(){if(d)return M(!0),Promise.resolve(p()).then(function(){M(!1)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[]),u||A?l.createElement(r.Loader,null):m?l.createElement("h2",null,"Error"):l.createElement(l.Fragment,null,l.createElement("div",{className:"complaint-summary"},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",maxWidth:"960px"}},l.createElement(r.Header,null,i("CS_HEADER_COMPLAINT_SUMMARY")),l.createElement("div",{style:{color:"#A52A2A"}},l.createElement(r.LinkButton,{label:i("VIEW_TIMELINE"),onClick:()=>{const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"}),D(!0)}}))),Object.keys(d).length>0?l.createElement(l.Fragment,null,l.createElement(r.Card,null,l.createElement(r.CardSubHeader,null,i("SERVICEDEFS."+d.audit.serviceCode.toUpperCase())),l.createElement(r.StatusTable,null,Object.keys(d.details).map((e,t,n)=>l.createElement(r.Row,{key:t,label:i(e),text:Array.isArray(d.details[e])?d.details[e].map(e=>i("object"==typeof e?null==e?void 0:e.code:e)):i(d.details[e])||"N/A",last:t===n.length-1}))),null!=E&&E.thumbs?l.createElement(r.DisplayPhotos,{srcs:null==E?void 0:E.thumbs,onClick:(e,t)=>function(e,t){P(null==E?void 0:E.fullImage[t])}(0,t)}):null,S?l.createElement(r.ImageViewer,{imageSrc:S,onClose:function(){_(null)}}):null),l.createElement(r.Card,null,l.createElement("div",{id:"timeline"},(null==d?void 0:d.service)&&l.createElement(Q,{getWorkFlow:e=>{var t;let n=null==e?void 0:e.timeline;if(n&&null!==(t=n[0].timeLineActions)&&void 0!==t&&t.filter(e=>"COMMENT"===e).length?I(!1):I(!0),n){const e=n.find(e=>"APPLY"===(null==e?void 0:e.performedAction)),{thumbnailsToShow:t}=e;C(t)}},complaintDetails:d,id:s,zoomImage:P}))),O&&l.createElement(r.Toast,{error:g,label:i(g?"CS_COMPLAINT_COMMENT_ERROR":"CS_COMPLAINT_COMMENT_SUCCESS"),onClose:()=>T(!1)})," "):l.createElement(r.Loader,null)))},PGRSelectRating:e=>{var t;let{parentRoute:i}=e;const{t:c}=a.useTranslation(),{id:u}=o.useParams(),m=s.useDispatch(),d=o.useHistory();let p=(null===(t=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===t?void 0:t.code)||Digit.ULBService.getCurrentTenantId();const E=Digit.Hooks.pgr.useComplaintDetails({tenantId:p,id:u}).complaintDetails,C=n.useCallback(e=>m(f(e)),[m]),[S,_]=n.useState(!1),v={texts:{header:"CS_COMPLAINT_RATE_HELP_TEXT",submitBarLabel:"CS_COMMONS_NEXT"},inputs:[{type:"rate",maxRating:5,label:c("CS_COMPLAINT_RATE_TEXT"),error:S?l.createElement(r.CardLabelError,null,c("CS_FEEDBACK_ENTER_RATING_ERROR")):null},{type:"checkbox",label:"CS_FEEDBACK_WHAT_WAS_GOOD",checkLabels:[c("CS_FEEDBACK_SERVICES"),c("CS_FEEDBACK_RESOLUTION_TIME"),c("CS_FEEDBACK_QUALITY_OF_WORK"),c("CS_FEEDBACK_OTHERS")]},{type:"textarea",label:c("CS_COMMON_COMMENTS"),name:"comments"}]};return l.createElement(r.RatingCard,{config:v,t:c,onSelect:function(e){E&&e.rating>0?(E.service.rating=e.rating,E.service.additionalDetail=e.CS_FEEDBACK_WHAT_WAS_GOOD.join(","),E.workflow={action:"RATE",comments:e.comments,verificationDocuments:[]},C({service:E.service,workflow:E.workflow}),d.push(i+"/response")):_(!0)}})},PGRResponseCitzen:H,PGREditApplication:()=>{a.useTranslation();let{id:e}=o.useParams(),t=window.location.href.split("application/")[1];const n=Digit.ULBService.getCurrentTenantId();e=t;const{isLoading:r,complaintDetails:i}=Digit.Hooks.pgr.useComplaintDetails({tenantId:n,id:e});return i&&!r?l.createElement(at,{applicationData:null==i?void 0:i.service,details:null==i?void 0:i.details,complaintDetails:i}):null}};exports.PGRReducers=()=>i.combineReducers({complaints:p}),exports.initPGRComponents=()=>{Object.entries(rt).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)})};
9
+ */}var me="function"==typeof Symbol&&Symbol.for,de=me?Symbol.for("react.element"):60103,pe=me?Symbol.for("react.portal"):60106,Ee=me?Symbol.for("react.fragment"):60107,Ce=me?Symbol.for("react.strict_mode"):60108,Se=me?Symbol.for("react.profiler"):60114,_e=me?Symbol.for("react.provider"):60109,ve=me?Symbol.for("react.context"):60110,fe=me?Symbol.for("react.async_mode"):60111,Oe=me?Symbol.for("react.concurrent_mode"):60111,Te=me?Symbol.for("react.forward_ref"):60112,ge=me?Symbol.for("react.suspense"):60113,ye=me?Symbol.for("react.suspense_list"):60120,Ne=me?Symbol.for("react.memo"):60115,Ie=me?Symbol.for("react.lazy"):60116,Ae=me?Symbol.for("react.block"):60121,Me=me?Symbol.for("react.fundamental"):60117,he=me?Symbol.for("react.responder"):60118,Pe=me?Symbol.for("react.scope"):60119;function De(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case de:switch(e=e.type){case fe:case Oe:case Ee:case Se:case Ce:case ge:return e;default:switch(e=e&&e.$$typeof){case ve:case Te:case Ie:case Ne:case _e:return e;default:return t}}case pe:return t}}}function Le(e){return De(e)===Oe}var be={AsyncMode:fe,ConcurrentMode:Oe,ContextConsumer:ve,ContextProvider:_e,Element:de,ForwardRef:Te,Fragment:Ee,Lazy:Ie,Memo:Ne,Portal:pe,Profiler:Se,StrictMode:Ce,Suspense:ge,isAsyncMode:function(e){return Le(e)||De(e)===fe},isConcurrentMode:Le,isContextConsumer:function(e){return De(e)===ve},isContextProvider:function(e){return De(e)===_e},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===de},isForwardRef:function(e){return De(e)===Te},isFragment:function(e){return De(e)===Ee},isLazy:function(e){return De(e)===Ie},isMemo:function(e){return De(e)===Ne},isPortal:function(e){return De(e)===pe},isProfiler:function(e){return De(e)===Se},isStrictMode:function(e){return De(e)===Ce},isSuspense:function(e){return De(e)===ge},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===Ee||e===Oe||e===Se||e===Ce||e===ge||e===ye||"object"==typeof e&&null!==e&&(e.$$typeof===Ie||e.$$typeof===Ne||e.$$typeof===_e||e.$$typeof===ve||e.$$typeof===Te||e.$$typeof===Me||e.$$typeof===he||e.$$typeof===Pe||e.$$typeof===Ae)},typeOf:De},Re=ue(function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,l=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,r=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,E=e?Symbol.for("react.memo"):60115,C=e?Symbol.for("react.lazy"):60116,S=e?Symbol.for("react.block"):60121,_=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,f=e?Symbol.for("react.scope"):60119;function O(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case c:case u:case o:case r:case a:case d:return p;default:var S=p&&p.$$typeof;switch(S){case s:case m:case C:case E:case i:return S;default:return t}}case l:return t}}}var T=u,g=s,y=i,N=n,I=m,A=o,M=C,h=E,P=l,D=r,L=a,b=d,R=!1;function k(e){return O(e)===u}t.AsyncMode=c,t.ConcurrentMode=T,t.ContextConsumer=g,t.ContextProvider=y,t.Element=N,t.ForwardRef=I,t.Fragment=A,t.Lazy=M,t.Memo=h,t.Portal=P,t.Profiler=D,t.StrictMode=L,t.Suspense=b,t.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),k(e)||O(e)===c},t.isConcurrentMode=k,t.isContextConsumer=function(e){return O(e)===s},t.isContextProvider=function(e){return O(e)===i},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return O(e)===m},t.isFragment=function(e){return O(e)===o},t.isLazy=function(e){return O(e)===C},t.isMemo=function(e){return O(e)===E},t.isPortal=function(e){return O(e)===l},t.isProfiler=function(e){return O(e)===r},t.isStrictMode=function(e){return O(e)===a},t.isSuspense=function(e){return O(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===u||e===r||e===a||e===d||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===C||e.$$typeof===E||e.$$typeof===i||e.$$typeof===s||e.$$typeof===m||e.$$typeof===_||e.$$typeof===v||e.$$typeof===f||e.$$typeof===S)},t.typeOf=O}()}),ke=ue(function(e){e.exports="production"===process.env.NODE_ENV?be:Re}),we=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable;function He(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var Be=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(e){l[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},l)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,l,o=He(e),a=1;a<arguments.length;a++){for(var r in n=Object(arguments[a]))xe.call(n,r)&&(o[r]=n[r]);if(we){l=we(n);for(var i=0;i<l.length;i++)Fe.call(n,l[i])&&(o[l[i]]=n[l[i]])}}return o},Ue="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Ge=Function.call.bind(Object.prototype.hasOwnProperty),$e=function(){};if("production"!==process.env.NODE_ENV){var je=Ue,Ve={},We=Ge;$e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function Ye(e,t,n,l,o){if("production"!==process.env.NODE_ENV)for(var a in e)if(We(e,a)){var r;try{if("function"!=typeof e[a]){var i=Error((l||"React class")+": "+n+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw i.name="Invariant Violation",i}r=e[a](t,a,l,n,null,je)}catch(e){r=e}if(!r||r instanceof Error||$e((l||"React class")+": type specification of "+n+" `"+a+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof r+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),r instanceof Error&&!(r.message in Ve)){Ve[r.message]=!0;var s=o?o():"";$e("Failed "+n+" type: "+r.message+(null!=s?s:""))}}}Ye.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(Ve={})};var Ke=Ye,ze=function(){};function qe(){return null}function Xe(){}function Je(){}"production"!==process.env.NODE_ENV&&(ze=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),Je.resetWarningCache=Xe;var Ze=ue(function(e){e.exports="production"!==process.env.NODE_ENV?function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,l={array:i("array"),bigint:i("bigint"),bool:i("boolean"),func:i("function"),number:i("number"),object:i("object"),string:i("string"),symbol:i("symbol"),any:r(qe),arrayOf:function(e){return r(function(t,n,l,o,r){if("function"!=typeof e)return new a("Property `"+r+"` of component `"+l+"` has invalid PropType notation inside arrayOf.");var i=t[n];if(!Array.isArray(i))return new a("Invalid "+o+" `"+r+"` of type `"+u(i)+"` supplied to `"+l+"`, expected an array.");for(var s=0;s<i.length;s++){var c=e(i,s,l,o,r+"["+s+"]",Ue);if(c instanceof Error)return c}return null})},element:r(function(t,n,l,o,r){var i=t[n];return e(i)?null:new a("Invalid "+o+" `"+r+"` of type `"+u(i)+"` supplied to `"+l+"`, expected a single ReactElement.")}),elementType:r(function(e,t,n,l,o){var r=e[t];return ke.isValidElementType(r)?null:new a("Invalid "+l+" `"+o+"` of type `"+u(r)+"` supplied to `"+n+"`, expected a single ReactElement type.")}),instanceOf:function(e){return r(function(t,n,l,o,r){var i;return t[n]instanceof e?null:new a("Invalid "+o+" `"+r+"` of type `"+((i=t[n]).constructor&&i.constructor.name?i.constructor.name:"<<anonymous>>")+"` supplied to `"+l+"`, expected instance of `"+(e.name||"<<anonymous>>")+"`.")})},node:r(function(e,t,n,l,o){return c(e[t])?null:new a("Invalid "+l+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return r(function(t,n,l,o,r){if("function"!=typeof e)return new a("Property `"+r+"` of component `"+l+"` has invalid PropType notation inside objectOf.");var i=t[n],s=u(i);if("object"!==s)return new a("Invalid "+o+" `"+r+"` of type `"+s+"` supplied to `"+l+"`, expected an object.");for(var c in i)if(Ge(i,c)){var m=e(i,c,l,o,r+"."+c,Ue);if(m instanceof Error)return m}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&ze(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),qe;function t(t,n,l,r,i){for(var s=t[n],c=0;c<e.length;c++)if(o(s,e[c]))return null;var u=JSON.stringify(e,function(e,t){return"symbol"===m(t)?String(t):t});return new a("Invalid "+r+" `"+i+"` of value `"+String(s)+"` supplied to `"+l+"`, expected one of "+u+".")}return r(t)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&ze("Invalid argument supplied to oneOfType, expected an instance of array."),qe;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return ze("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+d(n)+" at index "+t+"."),qe}return r(function(t,n,l,o,r){for(var i=[],s=0;s<e.length;s++){var c=(0,e[s])(t,n,l,o,r,Ue);if(null==c)return null;c.data&&Ge(c.data,"expectedType")&&i.push(c.data.expectedType)}return new a("Invalid "+o+" `"+r+"` supplied to `"+l+"`"+(i.length>0?", expected one of type ["+i.join(", ")+"]":"")+".")})},shape:function(e){return r(function(t,n,l,o,r){var i=t[n],c=u(i);if("object"!==c)return new a("Invalid "+o+" `"+r+"` of type `"+c+"` supplied to `"+l+"`, expected `object`.");for(var d in e){var p=e[d];if("function"!=typeof p)return s(l,o,r,d,m(p));var E=p(i,d,l,o,r+"."+d,Ue);if(E)return E}return null})},exact:function(e){return r(function(t,n,l,o,r){var i=t[n],c=u(i);if("object"!==c)return new a("Invalid "+o+" `"+r+"` of type `"+c+"` supplied to `"+l+"`, expected `object`.");var d=Be({},t[n],e);for(var p in d){var E=e[p];if(Ge(e,p)&&"function"!=typeof E)return s(l,o,r,p,m(E));if(!E)return new a("Invalid "+o+" `"+r+"` key `"+p+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var C=E(i,p,l,o,r+"."+p,Ue);if(C)return C}return null})}};function o(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function a(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function r(e){function t(t,n,l,o,r,i,s){if(o=o||"<<anonymous>>",i=i||l,s!==Ue){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}return null==n[l]?t?new a(null===n[l]?"The "+r+" `"+i+"` is marked as required in `"+o+"`, but its value is `null`.":"The "+r+" `"+i+"` is marked as required in `"+o+"`, but its value is `undefined`."):null:e(n,l,o,r,i)}process;var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function i(e){return r(function(t,n,l,o,r,i){var s=t[n];return u(s)!==e?new a("Invalid "+o+" `"+r+"` of type `"+m(s)+"` supplied to `"+l+"`, expected `"+e+"`.",{expectedType:e}):null})}function s(e,t,n,l,o){return new a((e||"React class")+": "+t+" type `"+n+"."+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function c(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(c);if(null===t||e(t))return!0;var l=function(e){var t=e&&(n&&e[n]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!l)return!1;var o,a=l.call(t);if(l!==t.entries){for(;!(o=a.next()).done;)if(!c(o.value))return!1}else for(;!(o=a.next()).done;){var r=o.value;if(r&&!c(r[1]))return!1}return!0;default:return!1}}function u(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function m(e){if(null==e)return""+e;var t=u(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function d(e){var t=m(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return a.prototype=Error.prototype,l.checkPropTypes=Ke,l.resetWarningCache=Ke.resetWarningCache,l.PropTypes=l,l}(ke.isElement):function(){function e(e,t,n,l,o,a){if(a!==Ue){var r=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw r.name="Invariant Violation",r}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Je,resetWarningCache:Xe};return n.PropTypes=n,n}()});const Qe=e=>{let{data:t,onFilterChange:n,onSearch:o,isLoading:i,searchParams:s}=e;const{t:c}=a.useTranslation(),u=null==t?void 0:t.map(e=>{let{locality:t,tenantId:n,serviceRequestId:o,complaintSubType:a,sla:r,status:i,taskOwner:s}=e;return{[c("CS_COMMON_COMPLAINT_NO")]:o,[c("CS_ADDCOMPLAINT_COMPLAINT_SUB_TYPE")]:c("SERVICEDEFS."+a.toUpperCase()),[c("WF_INBOX_HEADER_LOCALITY")]:c(Digit.Utils.locale.getLocalityCode(t,n)),[c("CS_COMPLAINT_DETAILS_CURRENT_STATUS")]:c("CS_COMMON_"+i),[c("WF_INBOX_HEADER_CURRENT_OWNER")]:s,[c("WF_INBOX_HEADER_SLA_DAYS_REMAINING")]:(u=r,l.createElement("span",u<0?{className:"sla-cell-error"}:{className:"sla-cell-success"},u))};var u});let m;return m=i?l.createElement(r.Loader,null):l.createElement(ce,{data:u,onFilterChange:n,serviceRequestIdKey:c("CS_COMMON_COMPLAINT_NO"),onSearch:o,searchParams:s}),l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(te,{isMobile:!0}),m)))};Qe.propTypes={data:Ze.any,onFilterChange:Ze.func,onSearch:Ze.func,isLoading:Ze.bool,searchParams:Ze.any},Qe.defaultProps={onFilterChange:()=>{},searchParams:{}};const et=e=>{let{action:t}=e;const{t:n}=a.useTranslation();return n("REOPEN"===t?"CS_COMMON_COMPLAINT_REOPENED":"CS_COMMON_COMPLAINT_SUBMITTED")},tt=e=>{let{response:n}=e;const{complaints:o}=n;return o&&o.response&&o.response.responseInfo?(sessionStorage.removeItem("type"),sessionStorage.removeItem("pincode"),sessionStorage.removeItem("tenantId"),sessionStorage.removeItem("localityCode"),sessionStorage.removeItem("landmark"),sessionStorage.removeItem("propertyid"),l.createElement(r.Banner,{message:et(o.response.ServiceWrappers[0].workflow),complaintNumber:o.response.ServiceWrappers[0].service.serviceRequestId,successful:!0})):l.createElement(r.Banner,{message:t("CS_COMMON_COMPLAINT_NOT_SUBMITTED"),successful:!1})},nt=e=>{var t,i,u,m,d,p;let{applicationData:E,details:C,complaintDetails:S}=e;S.workflow.action="EDIT",S.workflow.assignes=null,S.workflow.comments=null,S.workflow.verificationDocuments=[],console.log("complaintDetails_inside_edit",S);const{t:v}=a.useTranslation(),[f,O]=(o.useHistory(),n.useState(!0)),T=Digit.Hooks.pgr.useTenants(),g=()=>(null==T?void 0:T.filter(e=>e.code===Digit.ULBService.getCurrentTenantId()))||[],[y,N]=n.useState(""),[I,A]=n.useState({}),[M,h]=n.useState([]),[P,D]=n.useState({}),[L,b]=n.useState({}),[R,k]=n.useState(g()[0]?g()[0]:null),{data:w}=Digit.Hooks.useBoundaryLocalities(null===(t=g()[0])||void 0===t?void 0:t.code,"admin",{enabled:!!g()[0]},v),[x,F]=n.useState(w),[H,B]=n.useState(),[U,G]=n.useState(!1),[j,V]=n.useState(!1),W=window.Digit.SessionStorage.get("Employee.tenantId"),Y=Digit.Hooks.pgr.useComplaintTypes({stateCode:W}),K=s.useDispatch(),z=Digit.GetServiceDefinitions,q=c.useQueryClient(),X=[{name:"LOW",code:"LOW",active:!0},{name:"MEDIUM",code:"MEDIUM",active:!0},{name:"HIGH",code:"HIGH",active:!0}];n.useEffect(()=>{F(w)},[w]),n.useEffect(()=>{var e;const t=T.find(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==y)});if((null==t?void 0:t.code)===(null===(e=g()[0])||void 0===e?void 0:e.code)){V(!1),k(t),B(null);const e=w.filter(e=>e.pincode==y);F(e)}else""===y||null===y?(V(!1),F(w)):V(!0)},[y]),n.useEffect(()=>{null!=Y&&function(e){try{const t=function(){if(e.key!==I.key){const t=function(){if("Others"!==e.key)return D({name:""}),A(e),Promise.resolve(z.getSubMenu(W,e,v)).then(function(t){return h(t),Promise.resolve(z.getSubMenu(W,e,v)).then(function(e){const t=e.filter(e=>e.key.toLocaleLowerCase()==(null==C?void 0:C.CS_ADDCOMPLAINT_COMPLAINT_SUB_TYPE.split("SERVICEDEFS.")[1].toLocaleLowerCase()))[0];D(t)})});{D({name:""}),A(e),h([{key:"Others",name:v("SERVICEDEFS.OTHERS")}]);const t=[{key:"Others",name:v("SERVICEDEFS.OTHERS")}].filter(e=>e.key.toLocaleLowerCase()==(null==C?void 0:C.CS_ADDCOMPLAINT_COMPLAINT_SUB_TYPE.split("SERVICEDEFS.")[1].toLocaleLowerCase()))[0];D(t)}}();if(t&&t.then)return t.then(function(){})}}();Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(Y.filter(e=>e.name.toLocaleLowerCase()==(null==C?void 0:C.CS_ADDCOMPLAINT_COMPLAINT_TYPE.split("SERVICEDEFS.")[1].toLocaleLowerCase()))[0]);const e=X.filter(e=>e.name===(null==E?void 0:E.priority))[0];if(b(e),void 0!==x){const e=x.filter(e=>{var t,n;return e.code===(null==E||null===(t=E.address)||void 0===t||null===(n=t.locality)||void 0===n?void 0:n.code)})[0];B(e)}},[x]);const J=[{head:v("ES_CREATECOMPLAINT_PROVIDE_COMPLAINANT_DETAILS"),body:[{label:v("ES_CREATECOMPLAINT_MOBILE_NUMBER"),isMandatory:!0,type:"text",populators:{name:"mobileNumber",defaultValue:null==E||null===(i=E.citizen)||void 0===i?void 0:i.mobileNumber,disabled:!0,validation:{required:!0,pattern:/^[6-9]\d{9}$/},componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),error:v("CORE_COMMON_MOBILE_ERROR")}},{label:v("ES_CREATECOMPLAINT_COMPLAINT_NAME"),isMandatory:!0,type:"text",populators:{name:"name",defaultValue:null==E||null===(u=E.citizen)||void 0===u?void 0:u.name,disabled:!0,validation:{required:!0,pattern:/^[A-Za-z]/},error:v("CS_ADDCOMPLAINT_NAME_ERROR")}},{label:v("ES_MAIL_ID"),isMandatory:!1,type:"text",populators:{name:"emailId",defaultValue:null==E||null===(m=E.citizen)||void 0===m?void 0:m.emailId,disabled:!0,validation:{pattern:/[A-Za-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/},error:v("CS_ADDCOMPLAINT_EMAIL_ERROR")}}]},{head:v("CS_COMPLAINT_DETAILS_COMPLAINT_DETAILS"),body:[{label:v("CS_COMPLAINT_DETAILS_COMPLAINT_TYPE"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{disable:!0,option:Y,optionKey:"name",id:"complaintType",selected:I})},{label:v("CS_COMPLAINT_DETAILS_COMPLAINT_SUBTYPE"),isMandatory:!0,type:"dropdown",menu:{...M},populators:l.createElement(r.Dropdown,{disable:!0,option:M,optionKey:"name",id:"complaintSubType",selected:P})},{label:v("CS_COMPLAINT_DETAILS_COMPLAINT_PRIORITY_LEVEL"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{option:X,optionKey:"name",id:"priorityLevel",selected:L,select:function(e){try{return b(e),Promise.resolve()}catch(e){return Promise.reject(e)}}})}]},{head:v("CS_ADDCOMPLAINT_LOCATION"),body:[{label:v("CORE_COMMON_PINCODE"),type:"text",populators:{name:"pincode",defaultValue:null==E||null===(d=E.address)||void 0===d?void 0:d.pincode,disabled:!0,validation:{pattern:/^[1-9][0-9]{5}$/,validate:()=>!j},error:v("CORE_COMMON_PINCODE_INVALID")}},{label:v("CS_COMPLAINT_DETAILS_CITY"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{isMandatory:!0,selected:R,freeze:!0,option:g(),id:"city",optionKey:"i18nKey",t:v,disable:!0})},{label:v("CS_CREATECOMPLAINT_MOHALLA"),type:"dropdown",isMandatory:!0,populators:l.createElement(r.Dropdown,{disable:!0,selected:H,optionKey:"i18nkey",id:"locality",option:x,t:v})},{label:v("CS_COMPLAINT_DETAILS_LANDMARK"),type:"textarea",populators:{name:"landmark",value:null==E||null===(p=E.address)||void 0===p?void 0:p.landmark,disabled:!0}}]},{head:v("CS_COMPLAINT_DETAILS_ADDITIONAL_DETAILS"),body:[{label:v("CS_COMPLAINT_DETAILS_ADDITIONAL_DETAILS"),type:"textarea",isDisabled:!0,populators:{name:"description",value:null==E?void 0:E.description,disabled:!0}}]}];return l.createElement($,{heading:v("ES_EDIT_NEW_COMPLAINT"),config:J,onSubmit:function(){try{return delete S.details,S.service.priority=L.code,Promise.resolve(K(_(S))).then(function(){return Promise.resolve(q.refetchQueries(["fetchInboxData"])).then(function(){var e;e=window.location.href.split("modify")[0]+"response",window.location.href=e})})}catch(e){return Promise.reject(e)}},isDisabled:!f&&!U,label:v("CS_UPDATE_COMPLAINT")})},lt=e=>{let{stateCode:t,userType:n,tenants:o}=e;const a=Digit.StoreData.getCurrentLanguage(),{isLoading:i}=Digit.Services.useStore({stateCode:t,moduleCode:"PGR",language:a});return i?l.createElement(r.Loader,null):(Digit.SessionStorage.set("PGR_TENANTS",o),l.createElement("citizen"===n?Z:ee,null))},ot=e=>{let{matchPath:t}=e;const{t:o}=a.useTranslation(),[i,s,c]=Digit.Hooks.useSessionStorage("PGR_CITIZEN_CREATE_COMPLAINT",{});n.useEffect(()=>{c()},[]);const u=[{link:t+"/create-complaint/complaint-type",i18nKey:o("CS_COMMON_FILE_A_COMPLAINT")},{link:t+"/complaints",i18nKey:o("CS_HOME_MY_COMPLAINTS")}];return l.createElement(r.CitizenHomeCard,{header:o("CS_COMMON_HOME_COMPLAINTS"),links:u,Icon:r.ComplaintIcon})},at={PGRModule:lt,PGRLinks:ot,PGRCard:()=>{const{t:e}=a.useTranslation();if(e("ES_PGR_INBOX"),e("ES_PGR_NEW_COMPLAINT"),!Digit.Utils.pgrAccess())return null;const t=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 9h-2V5h2v6zm0 4h-2v-2h2v2z",fill:"white"}));let n=[{label:e("ES_PGR_NEW_COMPLAINT"),link:"/digit-ui/employee/pgr/complaint/create",role:"CSR"}];n=n.filter(e=>e.role&&Digit.Utils.didEmployeeHasRole(e.role));const o={Icon:l.createElement(t,null),moduleName:e("ES_PGR_HEADER_COMPLAINT"),kpis:[{label:e("TOTAL_PGR"),link:"/digit-ui/employee/pgr/inbox"},{label:e("TOTAL_NEARING_SLA"),link:"/digit-ui/employee/pgr/inbox"}],links:[{label:e("ES_PGR_INBOX"),link:"/digit-ui/employee/pgr/inbox"},...n]};return l.createElement(r.EmployeeModuleCard,o)},PGRComplaintDetails:e=>{var t,i,s,u,m,d,p,E,C,S,_,v,f;let{id:I}=o.useParams();const{t:A}=a.useTranslation(),[M,h]=n.useState(!1),[P,D]=n.useState(null),[L,b]=n.useState(!1),R=Digit.ULBService.getCurrentTenantId(),{isLoading:k,complaintDetails:w,revalidate:x}=Digit.Hooks.pgr.useComplaintDetails({tenantId:R,id:I}),F=Digit.Hooks.useWorkflowDetails({tenantId:R,id:I,moduleCode:"PGR",role:"EMPLOYEE"}),[H,B]=n.useState([]);var U,G;F&&null!=F&&F.data&&(F.data.initialActionState=(null==F||null===(U=F.data)||void 0===U?void 0:U.initialActionState)||{...null==F||null===(G=F.data)||void 0===G?void 0:G.actionState}||{},F.data.actionState={...F.data}),n.useEffect(()=>{if(F){const{data:{timeline:e}={}}=F;if(e){const t=null==e?void 0:e.find(e=>"APPLY"===(null==e?void 0:e.performedAction)),{thumbnailsToShow:n}=t;n&&B(n)}}},[F]);const[$,j]=n.useState(!1),[V,W]=n.useState(!1),[Y,K]=n.useState(!1),[z,q]=n.useState(null),[X,J]=n.useState(null),[Z,Q]=n.useState(!1),[ee,te]=n.useState(1),[ne,le]=n.useState(!1),oe=c.useQueryClient();n.useEffect(()=>{try{return Promise.resolve(null===(_Digit=Digit)||void 0===_Digit||null===(_Digit$WorkflowServic=_Digit.WorkflowService)||void 0===_Digit$WorkflowServic?void 0:_Digit$WorkflowServic.getByBusinessId(R,I)).then(function(){})}catch(e){Promise.reject(e)}},[w]);const ae=function(){try{return Promise.resolve(oe.refetchQueries(["fetchInboxData"])).then(function(){return Promise.resolve(F.revalidate()).then(function(){return Promise.resolve(x()).then(function(){})})})}catch(e){return Promise.reject(e)}};function re(e){switch(e){case M:h(!M);break;case Y:K(!Y)}}function ie(e,t){D(e)}if(n.useEffect(()=>{!function(){try{const e=function(){if(w)return Q(!0),Promise.resolve(ae()).then(function(){Q(!1)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[]),k||F.isLoading||Z)return l.createElement(r.Loader,null);if(F.isError)return l.createElement(l.Fragment,null,F.error);const se=(e,t,o)=>{var a,i,s,c;const{wfComment:u,thumbnailsToShow:m}=e;function d(e,t,n){var l,o;let a=null===(l=n.thumbs)||void 0===l?void 0:l.findIndex(t=>t===e);ie(a>-1&&(null==n||null===(o=n.fullImage)||void 0===o?void 0:o[a])||e)}const p={date:null==e||null===(a=e.auditDetails)||void 0===a?void 0:a.lastModified,name:null==e||null===(i=e.assigner)||void 0===i?void 0:i.name,mobileNumber:null==e||null===(s=e.assigner)||void 0===s?void 0:s.mobileNumber,..."COMPLAINT_FILED"===e.status&&null!=w&&w.audit?{source:w.audit.source}:{}};if("PENDINGFORASSIGNMENT"===e.status&&null!=w&&w.audit){if(o.length-(t+1)==1){const t={date:Digit.DateUtils.ConvertTimestampToDate(w.audit.details.createdTime)};return l.createElement(y,{data:t,comments:null==e?void 0:e.wfComment})}{var E,C;const t={date:Digit.DateUtils.ConvertTimestampToDate(w.audit.details.createdTime)};return l.createElement(n.Fragment,null,null!=e&&e.wfComment?l.createElement("div",null,null==e||null===(E=e.wfComment)||void 0===E?void 0:E.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,A("WF_COMMON_COMMENTS")),l.createElement("p",null,e)))):null,"COMPLAINT_FILED"!==e.status&&(null==m||null===(C=m.thumbs)||void 0===C?void 0:C.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,A("CS_COMMON_ATTACHMENTS")),l.createElement(r.DisplayPhotos,{srcs:m.thumbs,onClick:(e,t)=>d(e,0,m)})):null,null!=t&&t.date?l.createElement(y,{data:t}):null)}}return l.createElement(n.Fragment,null,u?l.createElement("div",null,null==u?void 0:u.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,A("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e)))):null,"COMPLAINT_FILED"!==e.status&&(null==m||null===(c=m.thumbs)||void 0===c?void 0:c.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,A("CS_COMMON_ATTACHMENTS")),l.createElement(r.DisplayPhotos,{srcs:m.thumbs,onClick:(e,t)=>d(e,0,m)})):null,null!=p&&p.date?l.createElement(y,{data:p}):null,"CLOSEDAFTERRESOLUTION"==e.status&&"RATE"==w.workflow.action&&t<=1&&w.audit.rating?l.createElement(O,{text:A("CS_ADDCOMPLAINT_YOU_RATED"),rating:w.audit.rating}):null)};return l.createElement(l.Fragment,null,l.createElement(r.Card,null,l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement(r.CardSubHeader,null,A("CS_HEADER_COMPLAINT_SUMMARY")),l.createElement(r.LinkButton,{label:A("VIEW_TIMELINE"),style:{marginLeft:"auto",color:"#A52A2A"},onClick:()=>{le(!0);const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"})}})),l.createElement(r.CardLabel,{style:{fontWeight:"700"}},A("CS_COMPLAINT_DETAILS_COMPLAINT_DETAILS")),k?l.createElement(r.Loader,null):l.createElement(r.StatusTable,null,w&&Object.keys(null==w?void 0:w.details).map((e,t,n)=>l.createElement(r.Row,{key:e,label:A(e),text:Array.isArray(null==w?void 0:w.details[e])?null==w?void 0:w.details[e].map(e=>A("object"==typeof e?null==e?void 0:e.code:e)):A(null==w?void 0:w.details[e])||"N/A",last:n.length-1===t})),null),null!=H&&H.thumbs?l.createElement(r.DisplayPhotos,{srcs:null==H?void 0:H.thumbs,onClick:(e,t)=>function(e,t){ie(null==H?void 0:H.fullImage[t])}(0,t)}):null,l.createElement(r.BreakLine,null),(null==F?void 0:F.isLoading)&&l.createElement(r.Loader,null),!(null!=F&&F.isLoading)&&l.createElement(l.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(r.CardSubHeader,null,A("CS_COMPLAINT_DETAILS_COMPLAINT_TIMELINE")),null!=F&&null!==(t=F.data)&&void 0!==t&&t.timeline&&1===(null==F||null===(i=F.data)||void 0===i||null===(s=i.timeline)||void 0===s?void 0:s.length)?l.createElement(r.CheckPoint,{isCompleted:!0,label:A("CS_COMMON_"+(null==F||null===(u=F.data)||void 0===u||null===(m=u.timeline[0])||void 0===m?void 0:m.status))}):l.createElement(r.ConnectingCheckPoints,null,(null==F||null===(d=F.data)||void 0===d?void 0:d.timeline)&&(null==F||null===(p=F.data)||void 0===p?void 0:p.timeline.slice(0,$?null==F?void 0:F.data.timeline.length:2).map((e,t,n)=>l.createElement(l.Fragment,{key:t},l.createElement(r.CheckPoint,{keyValue:t,isCompleted:0===t,label:A("CS_COMMON_"+e.status),customChild:se(e,t,n)}))))),(null==F||null===(E=F.data)||void 0===E||null===(C=E.timeline)||void 0===C?void 0:C.length)>2&&l.createElement(r.LinkButton,{label:A($?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{j(e=>!e)}})))),M?l.createElement(r.PopUp,null,l.createElement("div",{className:"popup-module"},l.createElement(r.HeaderBar,{main:l.createElement(T,{label:"Complaint Geolocation"}),end:l.createElement(g,{onClick:()=>re(M)})}),l.createElement("div",{className:"popup-module-main"},l.createElement("img",{src:"https://via.placeholder.com/912x568"})))):null,P?l.createElement(r.ImageViewer,{imageSrc:P,onClose:function(){D(null)}}):null,Y?l.createElement(N,{workflowDetails:F,complaintDetails:w,close:re,popup:Y,selectedAction:z,onAssign:function(e,t,n){try{return K(!1),Promise.resolve(Digit.Complaint.assign(w,z,e,t,n,R)).then(function(e){return J(e),b(!0),Q(!0),Promise.resolve(ae()).then(function(){Q(!1),te(ee+1),setTimeout(()=>b(!1),1e4)})})}catch(e){return Promise.reject(e)}},tenantId:R,t:A}):null,L&&l.createElement(r.Toast,{label:A(X?`CS_ACTION_${z}_TEXT`:"CS_ACTION_ASSIGN_FAILED"),onClose:function(){b(!1)}}),!(null!=F&&F.isLoading)&&(null==F||null===(S=F.data)||void 0===S||null===(_=S.nextActions)||void 0===_?void 0:_.length)>0&&l.createElement(r.ActionBar,null,V&&null!=F&&null!==(v=F.data)&&void 0!==v&&v.nextActions?l.createElement(r.Menu,{options:null==F||null===(f=F.data)||void 0===f?void 0:f.nextActions.map(e=>e.action),t:A,onSelect:function(e){switch(q(e),e){case"ASSIGN":case"REASSIGN":case"RESOLVE":case"REJECT":case"REOPEN":K(!0),W(!1);break;case"EDIT":let e=window.location.href;t=e.split("complaint")[0]+"modify-application/"+e.split("details/")[1],window.location.href=t;break;default:W(!1)}var t}}):null,l.createElement(r.SubmitBar,{label:A("WF_TAKE_ACTION"),onSubmit:()=>W(!V)})))},PGRCreateComplaintEmp:e=>{var t,i;let{parentUrl:u}=e;const m=Digit.Hooks.pgr.useTenants(),{t:d}=a.useTranslation(),p=()=>(null==m?void 0:m.filter(e=>e.code===Digit.ULBService.getCurrentTenantId()))||[],E=localStorage.getItem("pgrProperty"),[C,_]=n.useState((null===JSON||void 0===JSON?void 0:JSON.parse(sessionStorage.getItem("complaintType")))||{}),[v,f]=n.useState([]),[O,T]=n.useState((null===JSON||void 0===JSON?void 0:JSON.parse(sessionStorage.getItem("subType")))||{}),[g,y]=n.useState((null===JSON||void 0===JSON?void 0:JSON.parse(sessionStorage.getItem("PriorityLevel")))||{}),[N,I]=n.useState(""),[A,M]=n.useState(sessionStorage.getItem("mobileNumber")||""),[h,P]=n.useState(sessionStorage.getItem("name")||""),[D,L]=n.useState(sessionStorage.getItem("emailId")||""),[b,R]=n.useState(p()[0]?p()[0]:null),[k,w]=n.useState(""),[x,F]=n.useState(""),{data:H}=Digit.Hooks.useBoundaryLocalities(null===(t=p()[0])||void 0===t?void 0:t.code,"admin",{enabled:!!p()[0]},d),[B,U]=n.useState(H),[G,j]=n.useState(null),[V,W]=n.useState(!1),[Y,K]=n.useState(!1),[z,q]=n.useState(null),[X,J]=n.useState(!1),[Z,Q]=n.useState({}),ee=window.Digit.SessionStorage.get("Employee.tenantId"),te=Digit.Hooks.pgr.useComplaintTypes({stateCode:ee}),ne=s.useDispatch(),le=(o.useRouteMatch(),o.useHistory()),oe=Digit.GetServiceDefinitions,ae=c.useQueryClient();n.useEffect(()=>{W(!!(null!=C&&C.key&&null!=O&&O.key&&null!=b&&b.code&&null!=G&&G.code&&null!=g&&g.code))},[C,O,g,b,G]),n.useEffect(()=>{U(H)},[H]),n.useEffect(()=>{var e;const t=m.find(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==N)});if((null==t?void 0:t.code)===(null===(e=p()[0])||void 0===e?void 0:e.code)){J(!1),R(t),j(null);const e=H.filter(e=>e.pincode==N);U(e)}else""===N||null===N?(J(!1),U(H)):J(!0)},[N]);const re=e=>{const{value:t}=e.target;M(t)},ie=e=>{const{value:t}=e.target;F(t)},se=[{head:d("ES_CREATECOMPLAINT_PROVIDE_COMPLAINANT_DETAILS"),body:[{label:d("ES_CREATECOMPLAINT_MOBILE_NUMBER"),isMandatory:!0,type:"text",value:A,onChange:re,populators:{name:"mobileNumber",onChange:re,validation:{required:!0,pattern:/^[6-9]\d{9}$/},componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),error:d("CORE_COMMON_MOBILE_ERROR")}},{label:d("ES_CREATECOMPLAINT_COMPLAINT_NAME"),isMandatory:!0,type:"text",value:h,populators:{name:"name",onChange:e=>{const{value:t}=e.target;P(t)},validation:{required:!0,pattern:/^[A-Za-z]/},error:d("CS_ADDCOMPLAINT_NAME_ERROR")}},{label:d("ES_MAIL_ID"),isMandatory:!1,type:"text",value:D,populators:{name:"emailId",onChange:e=>{const{value:t}=e.target;L(t)},validation:{pattern:/[A-Za-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/},error:d("CS_ADDCOMPLAINT_EMAIL_ERROR")}}]},{head:d("CS_COMPLAINT_DETAILS_COMPLAINT_DETAILS"),body:[{label:d("CS_COMPLAINT_DETAILS_COMPLAINT_TYPE"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{option:te,optionKey:"name",id:"complaintType",selected:C,select:function(e){try{const t=function(){if(e.key!==C.key){const t=function(){if("Others"!==e.key)return T({name:""}),_(e),sessionStorage.setItem("complaintType",JSON.stringify(e)),Promise.resolve(oe.getSubMenu(ee,e,d)).then(function(e){f(e)});T({name:""}),_(e),sessionStorage.setItem("complaintType",JSON.stringify(e)),f([{key:"Others",name:d("SERVICEDEFS.OTHERS")}])}();if(t&&t.then)return t.then(function(){})}}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}})},{label:d("CS_COMPLAINT_DETAILS_COMPLAINT_SUBTYPE"),isMandatory:!0,type:"dropdown",menu:{...v},populators:l.createElement(r.Dropdown,{option:v,optionKey:"name",id:"complaintSubType",selected:O,select:function(e){sessionStorage.setItem("subType",JSON.stringify(e)),T(e)}})},{label:d("CS_COMPLAINT_DETAILS_COMPLAINT_PRIORITY_LEVEL"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{option:[{name:"LOW",code:"LOW",active:!0},{name:"MEDIUM",code:"MEDIUM",active:!0},{name:"HIGH",code:"HIGH",active:!0}],optionKey:"name",id:"priorityLevel",selected:g,select:function(e){try{return sessionStorage.setItem("priorityLevel",JSON.stringify(e)),y(e),Promise.resolve()}catch(e){return Promise.reject(e)}}})},{isEditConnection:!0,isCreateConnection:!0,isModifyConnection:!0,isEditByConfigConnection:!0,isProperty:!(null==O||null===(i=O.key)||void 0===i||!i.includes("Property")),component:"CPTPropertySearchNSummary",key:"cpt",type:"component",body:[{component:"CPTPropertySearchNSummary",withoutLabel:!0,key:"cpt",type:"component",hideInCitizen:!0}]}]},{head:d("CS_ADDCOMPLAINT_LOCATION"),body:[{label:d("CORE_COMMON_PINCODE"),type:"text",populators:{name:"pincode",validation:{pattern:/^[1-9][0-9]{5}$/,validate:()=>!X},error:d("CORE_COMMON_PINCODE_INVALID"),onChange:e=>{const{value:t}=e.target;I(t),t||J(!1)}}},{label:d("CS_COMPLAINT_DETAILS_CITY"),isMandatory:!0,type:"dropdown",populators:l.createElement(r.Dropdown,{isMandatory:!0,selected:b,freeze:!0,option:p(),id:"city",select:function(e){return Promise.resolve()},optionKey:"i18nKey",t:d})},{label:d("CS_CREATECOMPLAINT_MOHALLA"),type:"dropdown",isMandatory:!0,dependency:!(!b||!B),populators:l.createElement(r.Dropdown,{isMandatory:!0,selected:G,optionKey:"i18nkey",id:"locality",option:B,select:function(e){j(e)},t:d})},{label:d("CS_COMPLAINT_DETAILS_LANDMARK"),type:"textarea",populators:{name:"landmark"}}]},{head:d("CS_COMPLAINT_DETAILS_ADDITIONAL_DETAILS"),body:[{label:d("CS_COMPLAINT_DETAILS_ADDITIONAL_DETAILS"),type:"textarea",onChange:ie,value:x,populators:{name:"description",onChange:ie}}]}];return n.useEffect(()=>{if(console.log("heloo world",E),"undefined"!==E&&null!==E){let e=JSON.parse(E);console.log("stp 1",E),q(e),w(null==e?void 0:e.propertyId)}},[]),n.useEffect(()=>{if(console.log("step 2",E,z,typeof E),"undefined"!==z&&null!==z){var e;let t=z;I((null==t||null===(e=t.address)||void 0===e?void 0:e.pincode)||"");let n=B.filter(e=>{var n,l;return e.code===(null==t||null===(n=t.address)||void 0===n||null===(l=n.locality)||void 0===l?void 0:l.code)});j(null==n?void 0:n[0]),F(null==t?void 0:t.propertyId),console.log("pgrProperty",B,null==t?void 0:t.propertyId,t)}},[k]),l.createElement($,{heading:d("ES_CREATECOMPLAINT_NEW_COMPLAINT"),config:se,onSubmit:e=>{V&&(K(!0),!Y&&function(e){try{if(!V)return Promise.resolve();const t=b.code,n=b.city.name,l=b.city.name,o=b.city.name,a=G.code,r=G.name,i=null==e?void 0:e.landmark,{key:s}=O,c=s,m=null==e?void 0:e.mobileNumber,d=null==e?void 0:e.name,p=null==e?void 0:e.emailId,E={...e,cityCode:t,city:n,district:l,region:o,localityCode:a,localityName:r,landmark:i,complaintType:c,priorityLevel:g,mobileNumber:m,name:d,emailId:p};Promise.resolve(ne(S(E))).then(function(){return Promise.resolve(ae.refetchQueries(["fetchInboxData"])).then(function(){localStorage.removeItem("pgrProperty"),le.push(u+"/response")})})}catch(e){return Promise.reject(e)}}(e))},isDisabled:!V&&!Y,label:d("CS_ADDCOMPLAINT_ADDITIONAL_DETAILS_SUBMIT_COMPLAINT")})},PGRInbox:()=>{const{t:e}=a.useTranslation(),t=Digit.ULBService.getCurrentTenantId(),{uuid:o}=Digit.UserService.getUser().info,[i,s]=n.useState(0),[c,u]=n.useState(10),[m,d]=n.useState(0),[p,E]=n.useState({filters:{wfFilters:{assignee:[{code:o}]}},search:"",sort:{}});n.useEffect(()=>{try{const e=null==p||null===(_searchParams$filters=p.filters)||void 0===_searchParams$filters||null===(_searchParams$filters2=_searchParams$filters.pgrfilters)||void 0===_searchParams$filters2||null===(_searchParams$filters3=_searchParams$filters2.applicationStatus)||void 0===_searchParams$filters3?void 0:_searchParams$filters3.map(e=>e.code).join(",");return Promise.resolve(Digit.PGRService.count(t,(null==e?void 0:e.length)>0?{applicationStatus:e}:{})).then(function(e){null!=e&&e.count&&d(e.count)})}catch(e){Promise.reject(e)}},[p]);const C=e=>{E({...p,filters:e})},S=function(e){void 0===e&&(e=""),E({...p,search:e})};let{data:_,isLoading:v}=Digit.Hooks.pgr.useInboxData({...p,offset:i,limit:c}),f=Digit.Utils.browser.isMobile();return null!==(null==_?void 0:_.length)?f?l.createElement(Qe,{data:_,isLoading:v,onFilterChange:C,onSearch:S,searchParams:p}):l.createElement("div",null,l.createElement(r.Header,null,e("ES_COMMON_INBOX")),l.createElement(se,{data:_,isLoading:v,onFilterChange:C,onSearch:S,searchParams:p,onNextPage:()=>{s(e=>e+10)},onPrevPage:()=>{s(e=>e-10)},onPageSizeChange:e=>{u(Number(e.target.value))},currentPage:Math.floor(i/c),totalRecords:m,pageSizeLimit:c})):l.createElement(r.Loader,null)},PGRResponseEmp:e=>{var t,i,c,u,m;const{t:d}=a.useTranslation(),p=(o.useRouteMatch(),s.useSelector(e=>e).pgr),{data:E}=Digit.Hooks.useStore.getInitData(),{tenants:C}=E||{},[S,_]=n.useState(!1);let v=null==p||null===(t=p.complaints)||void 0===t||null===(i=t.response)||void 0===i||null===(c=i.ServiceWrappers)||void 0===c||null===(u=c[0])||void 0===u||null===(m=u.service)||void 0===m?void 0:m.serviceRequestId;const{complaintDetails:f}=Digit.Hooks.pgr.useComplaintDetails({tenantId:Digit.ULBService.getCurrentTenantId(),id:v},{enabled:!!S});return l.createElement(r.Card,null,p.complaints.response&&l.createElement(tt,{response:p}),l.createElement(r.CardText,null,d("ES_COMMON_TRACK_COMPLAINT_TEXT")),l.createElement("div",{className:"abc",style:{display:"flex"}},l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(r.SubmitBar,{label:d("CORE_COMMON_GO_TO_HOME")})),p.complaints.response&&l.createElement(r.SubmitBar,{label:d("PT_DOWNLOAD_ACK_FORM"),onSubmit:e=>{!function(e){try{const t=C.find(e=>e.code===Digit.ULBService.getCurrentTenantId());e.preventDefault(),_(!0),Promise.resolve(b({...f},t,d)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}}(e)},style:{marginLeft:"10px"}})))},PGRCreateComplaintCitizen:()=>{const e=Digit.Contexts.ComponentProvider,{t:t}=a.useTranslation(),{pathname:r}=o.useLocation(),i=o.useRouteMatch(),u=o.useHistory(),m=(n.useContext(e),s.useDispatch()),{data:d,isLoading:p}=Digit.Hooks.useStore.getInitData(),{stateInfo:E}=d||{},[C,_,v]=Digit.Hooks.useSessionStorage("PGR_CITIZEN_CREATE_COMPLAINT",{}),f=n.useMemo(()=>j),[O,T]=n.useState(C),[g,y]=n.useState(""),[N,I]=n.useState(!1),[A,M]=n.useState(0),h=c.useQueryClient();n.useEffect(()=>{I(!1)},[]),n.useEffect(()=>{T(C),null===g?D():u.push(`${i.path}/${g}`)},[C,g]);const P=()=>{const e=r.split("/").pop();let{nextStep:n}=f.routes[e],l=Digit.SessionStorage.get("PGR_CITIZEN_CREATE_COMPLAINT");"sub-type"===n&&"Others"===l.complaintType.key&&(_({...C,complaintType:{key:"Others",name:t("SERVICEDEFS.OTHERS")},subType:{key:"Others",name:t("SERVICEDEFS.OTHERS")}}),n=f.routes[n].nextStep),y(n)},D=()=>{N||(I(!0),L())},L=function(){try{const e=function(){if(null!=O&&O.complaintType){const{city_complaint:e,locality_complaint:t,uploadedImages:n,subType:l,prioritylevel:o,details:a,...r}=O,{code:s,name:c}=e,{code:d,name:p}=t,C=sessionStorage.getItem("propertyid"),_=null==n?void 0:n.map(e=>({documentType:"PHOTO",fileStoreId:e,documentUid:"",additionalDetails:{}})),v={...r,complaintType:l.key,cityCode:s,city:c,prioritylevel:o,description:a,district:c,region:c,localityCode:d,localityName:p,state:E.name,uploadedImages:_,additionalDetails:{propertyid:C}};return Promise.resolve(m(S(v))).then(function(){return Promise.resolve(h.refetchQueries(["complaintsList"])).then(function(){u.push(i.path+"/response")})})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},b=e=>{let t=JSON.parse(sessionStorage.getItem("complaintType"));if(null!=e&&e.subType){let n={complaintType:t};console.log("handleSelect",e,n),_({...C,...e,...n}),P()}else _({...C,...e}),P()},R=()=>{P()};return p?null:l.createElement(o.Switch,null,Object.keys(f.routes).map((e,n)=>{const{component:a,texts:r,inputs:s}=f.routes[e],c="string"==typeof a?Digit.ComponentRegistryService.getComponent(a):a;return l.createElement(o.Route,{path:`${i.path}/${e}`,key:n},l.createElement(c,{config:{texts:r,inputs:s},onSelect:b,onSkip:R,value:C,t:t}))}),l.createElement(o.Route,{path:i.path+"/response"},l.createElement(U,{match:i})),l.createElement(o.Route,null,l.createElement(o.Redirect,{to:`${i.path}/${f.indexRoute}`})))},PGRComplaintsList:e=>{var t,i,s,c;const u=Digit.UserService.getUser(),m=u.mobileNumber||(null==u||null===(t=u.info)||void 0===t?void 0:t.mobileNumber)||(null==u||null===(i=u.info)||void 0===i||null===(s=i.userInfo)||void 0===s?void 0:s.mobileNumber),d=(null===(c=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===c?void 0:c.code)||Digit.ULBService.getCurrentTenantId(),{t:p}=a.useTranslation(),{path:E}=o.useRouteMatch();let{isLoading:C,error:S,data:_,revalidate:v}=Digit.Hooks.pgr.useComplaintsListByMobile(d,m);if(n.useEffect(()=>{v()},[]),C)return l.createElement(l.Fragment,null,l.createElement(r.Header,null,p("CS_HOME_MY_COMPLAINTS")),l.createElement(r.Loader,null));let f,O=null==_?void 0:_.ServiceWrappers;return f=S?l.createElement(r.Card,null,p("CS_COMMON_ERROR_LOADING_RESULTS").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):0===O.length?l.createElement(r.Card,null,p("CS_MYCOMPLAINTS_NO_COMPLAINTS").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):O.map((e,t)=>{let{service:n}=e;return l.createElement(V,{key:t,data:n,path:E})}),l.createElement(l.Fragment,null,l.createElement("div",{className:"applications-list-container"},l.createElement(r.Header,null,p("CS_HOME_MY_COMPLAINTS")),f))},PGRComplaintDetailsPage:e=>{var t;let{t:i}=a.useTranslation(),{id:s}=o.useParams(),c=(null===(t=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===t?void 0:t.code)||Digit.ULBService.getCurrentTenantId();const{isLoading:u,isError:m,complaintDetails:d,revalidate:p}=Digit.Hooks.pgr.useComplaintDetails({tenantId:c,id:s}),[E,C]=n.useState({}),[S,_]=n.useState(null),[v,f]=n.useState(""),[O,T]=n.useState(!1),[g,y]=n.useState(null),[N,I]=n.useState(!0),[A,M]=n.useState(!1),[h,P]=n.useState(!1);function D(e,t){_(e)}return n.useEffect(()=>{!function(){try{const e=function(){if(d)return M(!0),Promise.resolve(p()).then(function(){M(!1)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[]),u||A?l.createElement(r.Loader,null):m?l.createElement("h2",null,"Error"):l.createElement(l.Fragment,null,l.createElement("div",{className:"complaint-summary"},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",maxWidth:"960px"}},l.createElement(r.Header,null,i("CS_HEADER_COMPLAINT_SUMMARY")),l.createElement("div",{style:{color:"#A52A2A"}},l.createElement(r.LinkButton,{label:i("VIEW_TIMELINE"),onClick:()=>{const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"}),P(!0)}}))),Object.keys(d).length>0?l.createElement(l.Fragment,null,l.createElement(r.Card,null,l.createElement(r.CardSubHeader,null,i("SERVICEDEFS."+d.audit.serviceCode.toUpperCase())),l.createElement(r.StatusTable,null,Object.keys(d.details).map((e,t,n)=>l.createElement(r.Row,{key:t,label:i(e),text:Array.isArray(d.details[e])?d.details[e].map(e=>i("object"==typeof e?null==e?void 0:e.code:e)):i(d.details[e])||"N/A",last:t===n.length-1}))),null!=E&&E.thumbs?l.createElement(r.DisplayPhotos,{srcs:null==E?void 0:E.thumbs,onClick:(e,t)=>function(e,t){D(null==E?void 0:E.fullImage[t])}(0,t)}):null,S?l.createElement(r.ImageViewer,{imageSrc:S,onClose:function(){_(null)}}):null),l.createElement(r.Card,null,l.createElement("div",{id:"timeline"},(null==d?void 0:d.service)&&l.createElement(J,{getWorkFlow:e=>{var t;let n=null==e?void 0:e.timeline;if(n&&null!==(t=n[0].timeLineActions)&&void 0!==t&&t.filter(e=>"COMMENT"===e).length?I(!1):I(!0),n){const e=n.find(e=>"APPLY"===(null==e?void 0:e.performedAction)),{thumbnailsToShow:t}=e;C(t)}},complaintDetails:d,id:s,zoomImage:D}))),O&&l.createElement(r.Toast,{error:g,label:i(g?"CS_COMPLAINT_COMMENT_ERROR":"CS_COMPLAINT_COMMENT_SUCCESS"),onClose:()=>T(!1)})," "):l.createElement(r.Loader,null)))},PGRSelectRating:e=>{var t;let{parentRoute:i}=e;const{t:c}=a.useTranslation(),{id:u}=o.useParams(),m=s.useDispatch(),d=o.useHistory();let p=(null===(t=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===t?void 0:t.code)||Digit.ULBService.getCurrentTenantId();const E=Digit.Hooks.pgr.useComplaintDetails({tenantId:p,id:u}).complaintDetails,C=n.useCallback(e=>m(_(e)),[m]),[S,v]=n.useState(!1),f={texts:{header:"CS_COMPLAINT_RATE_HELP_TEXT",submitBarLabel:"CS_COMMONS_NEXT"},inputs:[{type:"rate",maxRating:5,label:c("CS_COMPLAINT_RATE_TEXT"),error:S?l.createElement(r.CardLabelError,null,c("CS_FEEDBACK_ENTER_RATING_ERROR")):null},{type:"checkbox",label:"CS_FEEDBACK_WHAT_WAS_GOOD",checkLabels:[c("CS_FEEDBACK_SERVICES"),c("CS_FEEDBACK_RESOLUTION_TIME"),c("CS_FEEDBACK_QUALITY_OF_WORK"),c("CS_FEEDBACK_OTHERS")]},{type:"textarea",label:c("CS_COMMON_COMMENTS"),name:"comments"}]};return l.createElement(r.RatingCard,{config:f,t:c,onSelect:function(e){E&&e.rating>0?(E.service.rating=e.rating,E.service.additionalDetail=e.CS_FEEDBACK_WHAT_WAS_GOOD.join(","),E.workflow={action:"RATE",comments:e.comments,verificationDocuments:[]},C({service:E.service,workflow:E.workflow}),d.push(i+"/response")):v(!0)}})},PGRResponseCitzen:x,PGREditApplication:()=>{a.useTranslation();let{id:e}=o.useParams(),t=window.location.href.split("application/")[1];const n=Digit.ULBService.getCurrentTenantId();e=t;const{isLoading:r,complaintDetails:i}=Digit.Hooks.pgr.useComplaintDetails({tenantId:n,id:e});return i&&!r?l.createElement(nt,{applicationData:null==i?void 0:i.service,details:null==i?void 0:i.details,complaintDetails:i}):null}};exports.PGRLinks=ot,exports.PGRModule=lt,exports.PGRReducers=()=>i.combineReducers({complaints:m}),exports.initPGRComponents=()=>{Object.entries(at).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)})};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djb25/digit-ui-module-pgr",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.modern.js",