@mseva/digit-ui-module-challangeneration 1.0.6 → 1.0.8
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.
- package/dist/index.js +687 -623
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +693 -741
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -13150,178 +13150,49 @@ const GroupBills = () => {
|
|
|
13150
13150
|
}), isLoading && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null)));
|
|
13151
13151
|
};
|
|
13152
13152
|
|
|
13153
|
-
const
|
|
13153
|
+
const Loader = _ref => {
|
|
13154
13154
|
let {
|
|
13155
|
-
|
|
13156
|
-
currentStep = 1,
|
|
13157
|
-
nextStep,
|
|
13158
|
-
prevStep,
|
|
13159
|
-
stepsList = []
|
|
13155
|
+
page = false
|
|
13160
13156
|
} = _ref;
|
|
13161
|
-
const {
|
|
13162
|
-
t
|
|
13163
|
-
} = reactI18next.useTranslation();
|
|
13164
|
-
const stepStyle = isActive => ({
|
|
13157
|
+
const baseStyle = {
|
|
13165
13158
|
display: "flex",
|
|
13166
|
-
|
|
13167
|
-
|
|
13168
|
-
flex: 1,
|
|
13169
|
-
color: isActive ? "#3f51b5" : "#ccc",
|
|
13170
|
-
padding: "10px 10px",
|
|
13171
|
-
width: "260px"
|
|
13172
|
-
});
|
|
13173
|
-
const circleStyle = stepNumber => {
|
|
13174
|
-
let backgroundColor;
|
|
13175
|
-
if (stepNumber <= currentStep) {
|
|
13176
|
-
backgroundColor = "#0D43A7";
|
|
13177
|
-
} else {
|
|
13178
|
-
backgroundColor = "#FFFFFF";
|
|
13179
|
-
}
|
|
13180
|
-
return {
|
|
13181
|
-
width: "60px",
|
|
13182
|
-
height: "60px",
|
|
13183
|
-
borderRadius: "50%",
|
|
13184
|
-
backgroundColor,
|
|
13185
|
-
color: stepNumber <= currentStep ? "white" : "black",
|
|
13186
|
-
display: "flex",
|
|
13187
|
-
alignItems: "center",
|
|
13188
|
-
justifyContent: "center",
|
|
13189
|
-
marginBottom: "10px",
|
|
13190
|
-
fontWeight: "normal",
|
|
13191
|
-
fontSize: "18px",
|
|
13192
|
-
border: stepNumber > currentStep ? "1px solid black" : "",
|
|
13193
|
-
position: "relative"
|
|
13194
|
-
};
|
|
13195
|
-
};
|
|
13196
|
-
const labelStyle = {
|
|
13197
|
-
fontSize: "18px",
|
|
13198
|
-
color: "#1E1E1E",
|
|
13199
|
-
fontWeight: "500",
|
|
13200
|
-
fontFamily: "Noto Sans,sans-serif",
|
|
13201
|
-
marginRight: "6px"
|
|
13202
|
-
};
|
|
13203
|
-
const stepNumberStyle = {
|
|
13204
|
-
fontSize: "18px",
|
|
13205
|
-
color: "#263238",
|
|
13206
|
-
fontWeight: "400",
|
|
13207
|
-
fontFamily: "Noto Sans,sans-serif",
|
|
13208
|
-
margin: "0px 6px 0px 0px"
|
|
13159
|
+
justifyContent: "center",
|
|
13160
|
+
alignItems: "center"
|
|
13209
13161
|
};
|
|
13210
|
-
const
|
|
13211
|
-
position: "
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13162
|
+
const pageStyle = _extends({}, baseStyle, {
|
|
13163
|
+
position: "fixed",
|
|
13164
|
+
top: 0,
|
|
13165
|
+
left: 0,
|
|
13166
|
+
width: "100vw",
|
|
13167
|
+
height: "100vh",
|
|
13168
|
+
background: "rgba(255,255,255,0.6)",
|
|
13169
|
+
backdropFilter: "blur(4px)",
|
|
13170
|
+
zIndex: 9999
|
|
13171
|
+
});
|
|
13172
|
+
const moduleStyle = _extends({}, baseStyle, {
|
|
13173
|
+
minHeight: "100px",
|
|
13174
|
+
width: "100%",
|
|
13175
|
+
position: "relative"
|
|
13176
|
+
});
|
|
13177
|
+
const spinnerStyle = {
|
|
13178
|
+
width: "64px",
|
|
13179
|
+
height: "64px",
|
|
13180
|
+
border: "8px solid #1976d2",
|
|
13181
|
+
borderTop: "8px solid transparent",
|
|
13182
|
+
borderRadius: "50%",
|
|
13183
|
+
animation: "spin 1.2s linear infinite"
|
|
13218
13184
|
};
|
|
13219
|
-
const isMobile = window.Digit.Utils.browser.isMobile();
|
|
13220
|
-
const totalSteps = stepsList.length;
|
|
13221
13185
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
13222
|
-
|
|
13223
|
-
style: {
|
|
13224
|
-
width: "100%",
|
|
13225
|
-
display: "flex",
|
|
13226
|
-
flexDirection: "row",
|
|
13227
|
-
alignItems: "top",
|
|
13228
|
-
justifyContent: "flex-start"
|
|
13229
|
-
}
|
|
13230
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
13231
|
-
className: "stepper-navigation-bar",
|
|
13232
|
-
style: {
|
|
13233
|
-
display: "flex",
|
|
13234
|
-
flexDirection: "column",
|
|
13235
|
-
justifyContent: "space-between",
|
|
13236
|
-
height: "50%",
|
|
13237
|
-
marginBottom: "20px"
|
|
13238
|
-
}
|
|
13239
|
-
}, [...Array(totalSteps)].map((_, index) => /*#__PURE__*/React__default.createElement("div", {
|
|
13240
|
-
className: "step-content",
|
|
13241
|
-
key: index,
|
|
13242
|
-
style: stepStyle(index + 1 <= currentStep)
|
|
13186
|
+
style: page ? pageStyle : moduleStyle
|
|
13243
13187
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
display: "flex",
|
|
13247
|
-
flexDirection: "column",
|
|
13248
|
-
alignItems: "flex-end",
|
|
13249
|
-
margin: "10px"
|
|
13250
|
-
}
|
|
13251
|
-
}, index + 1 === totalSteps ? null : /*#__PURE__*/React__default.createElement("div", {
|
|
13252
|
-
className: "step-number",
|
|
13253
|
-
style: stepNumberStyle
|
|
13254
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
13255
|
-
className: "step-label",
|
|
13256
|
-
style: labelStyle
|
|
13257
|
-
}, t(stepsList[index].stepLabel))), /*#__PURE__*/React__default.createElement("div", {
|
|
13258
|
-
className: "step-circle",
|
|
13259
|
-
style: circleStyle(index + 1)
|
|
13260
|
-
}, index + 1, index < totalSteps - 1 && /*#__PURE__*/React__default.createElement("div", {
|
|
13261
|
-
style: lineStyle
|
|
13262
|
-
}))))), /*#__PURE__*/React__default.createElement("div", {
|
|
13263
|
-
className: "stepper-body",
|
|
13264
|
-
style: {
|
|
13265
|
-
width: "100%",
|
|
13266
|
-
marginBottom: "20px"
|
|
13267
|
-
}
|
|
13268
|
-
}, children));
|
|
13188
|
+
style: spinnerStyle
|
|
13189
|
+
}), /*#__PURE__*/React__default.createElement("style", null, "\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "));
|
|
13269
13190
|
};
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
|
|
13273
|
-
|
|
13274
|
-
|
|
13275
|
-
step,
|
|
13276
|
-
setStep
|
|
13277
|
-
} = _ref;
|
|
13278
|
-
const enabledStepsList = stepsList.filter(item => item.isStepEnabled);
|
|
13279
|
-
const {
|
|
13280
|
-
t
|
|
13281
|
-
} = reactI18next.useTranslation();
|
|
13282
|
-
function onGoNext() {
|
|
13283
|
-
if (step < enabledStepsList.length) {
|
|
13284
|
-
nextStep();
|
|
13285
|
-
} else if (step === enabledStepsList.length) {
|
|
13286
|
-
onSubmit();
|
|
13287
|
-
}
|
|
13288
|
-
}
|
|
13289
|
-
function onBackClick() {
|
|
13290
|
-
if (step > 1) {
|
|
13291
|
-
prevStep();
|
|
13292
|
-
}
|
|
13293
|
-
}
|
|
13294
|
-
const nextStep = () => setStep(step + 1);
|
|
13295
|
-
const prevStep = () => setStep(step - 1);
|
|
13296
|
-
const renderStep = () => {
|
|
13297
|
-
var _Digit, _Digit$ComponentRegis;
|
|
13298
|
-
const currStepConfBody = enabledStepsList[step - 1];
|
|
13299
|
-
const {
|
|
13300
|
-
component,
|
|
13301
|
-
key,
|
|
13302
|
-
texts,
|
|
13303
|
-
currStepConfig
|
|
13304
|
-
} = currStepConfBody;
|
|
13305
|
-
const Component = (_Digit = Digit) === null || _Digit === void 0 ? void 0 : (_Digit$ComponentRegis = _Digit.ComponentRegistryService) === null || _Digit$ComponentRegis === void 0 ? void 0 : _Digit$ComponentRegis.getComponent(component);
|
|
13306
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Component, {
|
|
13307
|
-
config: {
|
|
13308
|
-
key,
|
|
13309
|
-
texts,
|
|
13310
|
-
component,
|
|
13311
|
-
currStepNumber: step,
|
|
13312
|
-
currStepConfig
|
|
13313
|
-
},
|
|
13314
|
-
onGoNext: onGoNext,
|
|
13315
|
-
onBackClick: onBackClick,
|
|
13316
|
-
t: t
|
|
13317
|
-
}));
|
|
13318
|
-
};
|
|
13319
|
-
return /*#__PURE__*/React__default.createElement(StepWrapper, {
|
|
13320
|
-
currentStep: step,
|
|
13321
|
-
nextStep: nextStep,
|
|
13322
|
-
prevStep: prevStep,
|
|
13323
|
-
stepsList: enabledStepsList
|
|
13324
|
-
}, renderStep());
|
|
13191
|
+
Loader.propTypes = {
|
|
13192
|
+
page: propTypes.bool
|
|
13193
|
+
};
|
|
13194
|
+
Loader.defaultProps = {
|
|
13195
|
+
page: false
|
|
13325
13196
|
};
|
|
13326
13197
|
|
|
13327
13198
|
const citizenConfig = [{
|
|
@@ -13385,14 +13256,194 @@ const UPDATE_ChallanApplication_FORM = (key, value) => ({
|
|
|
13385
13256
|
value
|
|
13386
13257
|
}
|
|
13387
13258
|
});
|
|
13388
|
-
const SET_ChallanApplication_STEP = step => ({
|
|
13389
|
-
type: SET_Challan_Application_STEPType,
|
|
13390
|
-
payload: step
|
|
13391
|
-
});
|
|
13392
13259
|
const RESET_ChallanAPPLICATION_FORM = () => ({
|
|
13393
13260
|
type: RESET_Challan__APPLICATION_FORMType
|
|
13394
13261
|
});
|
|
13395
13262
|
|
|
13263
|
+
const SelectNDCDocuments = _ref => {
|
|
13264
|
+
var _formData$documents, _data$Challan;
|
|
13265
|
+
let {
|
|
13266
|
+
t,
|
|
13267
|
+
config,
|
|
13268
|
+
onSelect,
|
|
13269
|
+
userType,
|
|
13270
|
+
formData,
|
|
13271
|
+
setError: setFormError,
|
|
13272
|
+
clearErrors: clearFormErrors,
|
|
13273
|
+
formState
|
|
13274
|
+
} = _ref;
|
|
13275
|
+
const tenantId = window.location.href.includes("employee") ? Digit.ULBService.getCurrentPermanentCity() : localStorage.getItem("CITIZEN.CITY");
|
|
13276
|
+
const [documents, setDocuments] = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$documents = formData.documents) === null || _formData$documents === void 0 ? void 0 : _formData$documents.documents) || []);
|
|
13277
|
+
const [error, setError] = React.useState(null);
|
|
13278
|
+
const {
|
|
13279
|
+
data,
|
|
13280
|
+
isLoading
|
|
13281
|
+
} = Digit.Hooks.useCustomMDMS("pb", "Challan", [{
|
|
13282
|
+
name: "Documents"
|
|
13283
|
+
}]);
|
|
13284
|
+
console.log("data===????", data);
|
|
13285
|
+
console.log("formData", formData);
|
|
13286
|
+
const {
|
|
13287
|
+
action = "create"
|
|
13288
|
+
} = Digit.Hooks.useQueryParams();
|
|
13289
|
+
const ndcDocuments = data === null || data === void 0 ? void 0 : (_data$Challan = data.Challan) === null || _data$Challan === void 0 ? void 0 : _data$Challan.Documents;
|
|
13290
|
+
const goNext = () => {
|
|
13291
|
+
onSelect(config.key, {
|
|
13292
|
+
documents,
|
|
13293
|
+
ndcDocumentsLength: ndcDocuments === null || ndcDocuments === void 0 ? void 0 : ndcDocuments.length
|
|
13294
|
+
});
|
|
13295
|
+
};
|
|
13296
|
+
React.useEffect(() => {
|
|
13297
|
+
goNext();
|
|
13298
|
+
}, [documents]);
|
|
13299
|
+
if (isLoading) {
|
|
13300
|
+
return /*#__PURE__*/React__default.createElement(Loader, null);
|
|
13301
|
+
}
|
|
13302
|
+
return /*#__PURE__*/React__default.createElement("div", null, ndcDocuments === null || ndcDocuments === void 0 ? void 0 : ndcDocuments.map((document, index) => {
|
|
13303
|
+
return /*#__PURE__*/React__default.createElement(SelectDocument, {
|
|
13304
|
+
key: index,
|
|
13305
|
+
document: document,
|
|
13306
|
+
action: action,
|
|
13307
|
+
t: t,
|
|
13308
|
+
error: error,
|
|
13309
|
+
setError: setError,
|
|
13310
|
+
setDocuments: setDocuments,
|
|
13311
|
+
documents: documents,
|
|
13312
|
+
setFormError: setFormError,
|
|
13313
|
+
clearFormErrors: clearFormErrors,
|
|
13314
|
+
config: config,
|
|
13315
|
+
formState: formState
|
|
13316
|
+
});
|
|
13317
|
+
}), error && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
|
|
13318
|
+
isDleteBtn: true,
|
|
13319
|
+
label: error,
|
|
13320
|
+
onClose: () => setError(null),
|
|
13321
|
+
error: true
|
|
13322
|
+
}));
|
|
13323
|
+
};
|
|
13324
|
+
function SelectDocument(_ref2) {
|
|
13325
|
+
let {
|
|
13326
|
+
t,
|
|
13327
|
+
document: doc,
|
|
13328
|
+
setDocuments,
|
|
13329
|
+
setError,
|
|
13330
|
+
documents,
|
|
13331
|
+
setFormError,
|
|
13332
|
+
config,
|
|
13333
|
+
formState
|
|
13334
|
+
} = _ref2;
|
|
13335
|
+
const filteredDocument = documents === null || documents === void 0 ? void 0 : documents.filter(item => {
|
|
13336
|
+
var _item$documentType;
|
|
13337
|
+
return item === null || item === void 0 ? void 0 : (_item$documentType = item.documentType) === null || _item$documentType === void 0 ? void 0 : _item$documentType.includes(doc === null || doc === void 0 ? void 0 : doc.code);
|
|
13338
|
+
})[0];
|
|
13339
|
+
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
13340
|
+
const [getLoader, setLoader] = React.useState(false);
|
|
13341
|
+
const [file, setFile] = React.useState(null);
|
|
13342
|
+
const [uploadedFile, setUploadedFile] = React.useState(() => (filteredDocument === null || filteredDocument === void 0 ? void 0 : filteredDocument.fileStoreId) || null);
|
|
13343
|
+
function selectfile(e) {
|
|
13344
|
+
setFile(e.target.files[0]);
|
|
13345
|
+
}
|
|
13346
|
+
React.useEffect(() => {
|
|
13347
|
+
if (filteredDocument !== null && filteredDocument !== void 0 && filteredDocument.fileStoreId && !file) {
|
|
13348
|
+
setUploadedFile(filteredDocument.fileStoreId);
|
|
13349
|
+
}
|
|
13350
|
+
}, [filteredDocument]);
|
|
13351
|
+
React.useEffect(() => {
|
|
13352
|
+
if (uploadedFile) {
|
|
13353
|
+
setDocuments(prev => {
|
|
13354
|
+
const filteredDocumentsByDocumentType = prev === null || prev === void 0 ? void 0 : prev.filter(item => (item === null || item === void 0 ? void 0 : item.documentType) !== (doc === null || doc === void 0 ? void 0 : doc.code));
|
|
13355
|
+
if ((uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.length) === 0 || uploadedFile === null) {
|
|
13356
|
+
return filteredDocumentsByDocumentType;
|
|
13357
|
+
}
|
|
13358
|
+
const filteredDocumentsByFileStoreId = filteredDocumentsByDocumentType === null || filteredDocumentsByDocumentType === void 0 ? void 0 : filteredDocumentsByDocumentType.filter(item => (item === null || item === void 0 ? void 0 : item.fileStoreId) !== uploadedFile);
|
|
13359
|
+
return [...filteredDocumentsByFileStoreId, {
|
|
13360
|
+
documentType: doc === null || doc === void 0 ? void 0 : doc.code,
|
|
13361
|
+
fileStoreId: uploadedFile,
|
|
13362
|
+
documentUid: uploadedFile
|
|
13363
|
+
}];
|
|
13364
|
+
});
|
|
13365
|
+
} else if (uploadedFile === null) {
|
|
13366
|
+
setDocuments(prev => prev.filter(item => (item === null || item === void 0 ? void 0 : item.documentType) !== (doc === null || doc === void 0 ? void 0 : doc.code)));
|
|
13367
|
+
}
|
|
13368
|
+
}, [uploadedFile]);
|
|
13369
|
+
React.useEffect(() => {
|
|
13370
|
+
(function () {
|
|
13371
|
+
try {
|
|
13372
|
+
setError(null);
|
|
13373
|
+
const _temp3 = function () {
|
|
13374
|
+
if (file) {
|
|
13375
|
+
setLoader(true);
|
|
13376
|
+
const _temp2 = function () {
|
|
13377
|
+
if (file.size >= 5242880) {
|
|
13378
|
+
setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
|
|
13379
|
+
setLoader(false);
|
|
13380
|
+
if (!formState.errors[config.key]) setFormError(config.key, {
|
|
13381
|
+
type: doc === null || doc === void 0 ? void 0 : doc.code
|
|
13382
|
+
});
|
|
13383
|
+
} else {
|
|
13384
|
+
const _temp = _catch(function () {
|
|
13385
|
+
setUploadedFile(null);
|
|
13386
|
+
return Promise.resolve(Digit.UploadServices.Filestorage("PT", file, Digit.ULBService.getStateId())).then(function (response) {
|
|
13387
|
+
var _response$data, _response$data$files;
|
|
13388
|
+
setLoader(false);
|
|
13389
|
+
if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
|
|
13390
|
+
var _response$data2, _response$data2$files;
|
|
13391
|
+
setUploadedFile(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$files = _response$data2.files[0]) === null || _response$data2$files === void 0 ? void 0 : _response$data2$files.fileStoreId);
|
|
13392
|
+
} else {
|
|
13393
|
+
setError(t("CS_FILE_UPLOAD_ERROR"));
|
|
13394
|
+
}
|
|
13395
|
+
});
|
|
13396
|
+
}, function () {
|
|
13397
|
+
setLoader(false);
|
|
13398
|
+
setError(t("CS_FILE_UPLOAD_ERROR"));
|
|
13399
|
+
});
|
|
13400
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
13401
|
+
}
|
|
13402
|
+
}();
|
|
13403
|
+
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
13404
|
+
}
|
|
13405
|
+
}();
|
|
13406
|
+
return _temp3 && _temp3.then ? _temp3.then(function () {}) : void 0;
|
|
13407
|
+
} catch (e) {
|
|
13408
|
+
Promise.reject(e);
|
|
13409
|
+
}
|
|
13410
|
+
})();
|
|
13411
|
+
}, [file]);
|
|
13412
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
13413
|
+
style: {
|
|
13414
|
+
marginBottom: "40px"
|
|
13415
|
+
}
|
|
13416
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
|
|
13417
|
+
style: {
|
|
13418
|
+
display: "inline"
|
|
13419
|
+
}
|
|
13420
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
|
|
13421
|
+
style: {
|
|
13422
|
+
marginBottom: "8px",
|
|
13423
|
+
width: "auto"
|
|
13424
|
+
}
|
|
13425
|
+
}, t(doc === null || doc === void 0 ? void 0 : doc.code), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13426
|
+
style: {
|
|
13427
|
+
color: "red"
|
|
13428
|
+
}
|
|
13429
|
+
}, " ", (doc === null || doc === void 0 ? void 0 : doc.required) && " *")), /*#__PURE__*/React__default.createElement("div", {
|
|
13430
|
+
className: "field"
|
|
13431
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
|
|
13432
|
+
id: "tl-doc",
|
|
13433
|
+
onUpload: selectfile,
|
|
13434
|
+
onDelete: () => {
|
|
13435
|
+
setUploadedFile(null);
|
|
13436
|
+
},
|
|
13437
|
+
message: uploadedFile ? "1 " + t("CS_ACTION_FILEUPLOADED") : t("CS_ACTION_NO_FILEUPLOADED"),
|
|
13438
|
+
textStyles: {
|
|
13439
|
+
width: "100%"
|
|
13440
|
+
},
|
|
13441
|
+
accept: "image/*,.pdf"
|
|
13442
|
+
}))), getLoader && /*#__PURE__*/React__default.createElement(Loader, {
|
|
13443
|
+
page: true
|
|
13444
|
+
}));
|
|
13445
|
+
}
|
|
13446
|
+
|
|
13396
13447
|
const createEmployeeConfig = [{
|
|
13397
13448
|
head: "OWNER DETAILS",
|
|
13398
13449
|
stepLabel: "CHALLAN_OFFENDER_DETAILS",
|
|
@@ -13455,36 +13506,380 @@ const ChallanStepperForm = () => {
|
|
|
13455
13506
|
const dispatch = reactRedux.useDispatch();
|
|
13456
13507
|
const [showToast, setShowToast] = React.useState(null);
|
|
13457
13508
|
const formState = reactRedux.useSelector(state => state.challan.ChallanApplicationFormReducer);
|
|
13458
|
-
const
|
|
13459
|
-
const
|
|
13460
|
-
const
|
|
13461
|
-
|
|
13509
|
+
const [loader, setLoader] = React.useState(false);
|
|
13510
|
+
const [documentsData, setDocumentsData] = React.useState({});
|
|
13511
|
+
const handleDocumentsSelect = (key, data) => {
|
|
13512
|
+
setDocumentsData(data);
|
|
13462
13513
|
};
|
|
13514
|
+
const tenantId = window.location.href.includes("employee") ? Digit.ULBService.getCurrentPermanentCity() : localStorage.getItem("CITIZEN.CITY");
|
|
13515
|
+
const {
|
|
13516
|
+
data: categoryData,
|
|
13517
|
+
isLoading: categoryLoading
|
|
13518
|
+
} = Digit.Hooks.useCustomMDMS(tenantId, "Challan", [{
|
|
13519
|
+
name: "Category"
|
|
13520
|
+
}]);
|
|
13521
|
+
const {
|
|
13522
|
+
data: subCategoryData,
|
|
13523
|
+
isLoading: subCategoryLoading
|
|
13524
|
+
} = Digit.Hooks.useCustomMDMS(tenantId, "Challan", [{
|
|
13525
|
+
name: "SubCategory"
|
|
13526
|
+
}]);
|
|
13527
|
+
const {
|
|
13528
|
+
data: OffenceTypeData,
|
|
13529
|
+
isLoading: OffenceTypeLoading
|
|
13530
|
+
} = Digit.Hooks.useCustomMDMS(tenantId, "Challan", [{
|
|
13531
|
+
name: "OffenceType"
|
|
13532
|
+
}]);
|
|
13533
|
+
const {
|
|
13534
|
+
control,
|
|
13535
|
+
handleSubmit,
|
|
13536
|
+
setValue,
|
|
13537
|
+
reset,
|
|
13538
|
+
formState: {
|
|
13539
|
+
errors
|
|
13540
|
+
},
|
|
13541
|
+
getValues
|
|
13542
|
+
} = reactHookForm.useForm({
|
|
13543
|
+
defaultValues: {
|
|
13544
|
+
shouldUnregister: false
|
|
13545
|
+
}
|
|
13546
|
+
});
|
|
13463
13547
|
React.useEffect(() => {
|
|
13464
13548
|
dispatch(RESET_ChallanAPPLICATION_FORM());
|
|
13465
13549
|
}, []);
|
|
13466
|
-
const
|
|
13550
|
+
const onSubmit = data => {
|
|
13551
|
+
console.log("dat==??a", data);
|
|
13552
|
+
console.log("documentsData", documentsData);
|
|
13553
|
+
};
|
|
13554
|
+
const debounce = (func, delay) => {
|
|
13555
|
+
let timer;
|
|
13556
|
+
return function () {
|
|
13557
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13558
|
+
args[_key] = arguments[_key];
|
|
13559
|
+
}
|
|
13560
|
+
clearTimeout(timer);
|
|
13561
|
+
timer = setTimeout(() => func(...args), delay);
|
|
13562
|
+
};
|
|
13563
|
+
};
|
|
13564
|
+
const handleMobileChange = function (value) {
|
|
13565
|
+
try {
|
|
13566
|
+
setLoader(true);
|
|
13567
|
+
console.log("User stopped typing. Final mobile number:", value);
|
|
13568
|
+
const _temp = _catch(function () {
|
|
13569
|
+
return Promise.resolve(Digit.UserService.userSearch(tenantId, {
|
|
13570
|
+
userName: value,
|
|
13571
|
+
mobileNumber: value,
|
|
13572
|
+
userType: "CITIZEN"
|
|
13573
|
+
}, {})).then(function (userData) {
|
|
13574
|
+
var _userData$user$;
|
|
13575
|
+
console.log("userData", userData === null || userData === void 0 ? void 0 : userData.user[0]);
|
|
13576
|
+
setValue("name", userData === null || userData === void 0 ? void 0 : (_userData$user$ = userData.user[0]) === null || _userData$user$ === void 0 ? void 0 : _userData$user$.name);
|
|
13577
|
+
setLoader(false);
|
|
13578
|
+
});
|
|
13579
|
+
}, function () {
|
|
13580
|
+
setLoader(false);
|
|
13581
|
+
});
|
|
13582
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
|
13583
|
+
} catch (e) {
|
|
13584
|
+
return Promise.reject(e);
|
|
13585
|
+
}
|
|
13586
|
+
};
|
|
13587
|
+
const debouncedHandleMobileChange = React__default.useMemo(() => debounce(handleMobileChange, 500), []);
|
|
13467
13588
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
13468
|
-
className: "pageCard"
|
|
13589
|
+
className: "pageCard",
|
|
13590
|
+
style: {
|
|
13591
|
+
display: "flex",
|
|
13592
|
+
flexDirection: "column",
|
|
13593
|
+
justifyContent: "center",
|
|
13594
|
+
alignItems: "center",
|
|
13595
|
+
minHeight: "100vh",
|
|
13596
|
+
background: "#f9f9f9"
|
|
13597
|
+
}
|
|
13598
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
13599
|
+
style: {
|
|
13600
|
+
width: "100%",
|
|
13601
|
+
maxWidth: "600px",
|
|
13602
|
+
background: "#fff",
|
|
13603
|
+
padding: "30px",
|
|
13604
|
+
borderRadius: "12px",
|
|
13605
|
+
boxShadow: "0 4px 15px rgba(0, 0, 0, 0.1)"
|
|
13606
|
+
}
|
|
13469
13607
|
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardHeader, {
|
|
13470
13608
|
styles: {
|
|
13471
13609
|
fontSize: "28px",
|
|
13472
13610
|
fontWeight: "400",
|
|
13473
13611
|
color: "#1C1D1F"
|
|
13474
13612
|
},
|
|
13475
|
-
divider: true
|
|
13476
|
-
}, t("
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13613
|
+
divider: true
|
|
13614
|
+
}, t("CREATE_CHALLAN")), /*#__PURE__*/React__default.createElement("form", {
|
|
13615
|
+
onSubmit: handleSubmit(onSubmit)
|
|
13616
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
13617
|
+
style: {
|
|
13618
|
+
width: "100%"
|
|
13619
|
+
}
|
|
13620
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
13621
|
+
style: {
|
|
13622
|
+
marginBottom: "20px"
|
|
13623
|
+
}
|
|
13624
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("NOC_APPLICANT_MOBILE_NO_LABEL"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13625
|
+
style: {
|
|
13626
|
+
color: "red"
|
|
13627
|
+
}
|
|
13628
|
+
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13629
|
+
control: control,
|
|
13630
|
+
name: "mobileNumber",
|
|
13631
|
+
rules: {
|
|
13632
|
+
required: "Mobile number is required",
|
|
13633
|
+
pattern: {
|
|
13634
|
+
value: /^[6-9]\d{9}$/,
|
|
13635
|
+
message: "Enter a valid 10-digit mobile number"
|
|
13636
|
+
}
|
|
13637
|
+
},
|
|
13638
|
+
render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.MobileNumber, {
|
|
13639
|
+
style: {
|
|
13640
|
+
marginBottom: 0
|
|
13641
|
+
},
|
|
13642
|
+
value: props.value,
|
|
13643
|
+
maxlength: 10,
|
|
13644
|
+
onChange: e => {
|
|
13645
|
+
props.onChange(e);
|
|
13646
|
+
debouncedHandleMobileChange(e);
|
|
13647
|
+
},
|
|
13648
|
+
onBlur: props.onBlur,
|
|
13649
|
+
t: t
|
|
13650
|
+
})
|
|
13651
|
+
}), (errors === null || errors === void 0 ? void 0 : errors.mobileNumber) && /*#__PURE__*/React__default.createElement("p", {
|
|
13652
|
+
style: {
|
|
13653
|
+
color: "red"
|
|
13654
|
+
}
|
|
13655
|
+
}, errors.mobileNumber.message)), /*#__PURE__*/React__default.createElement("div", {
|
|
13656
|
+
style: {
|
|
13657
|
+
marginBottom: "20px"
|
|
13658
|
+
}
|
|
13659
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("BPA_BASIC_DETAILS_APPLICATION_NAME_LABEL"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13660
|
+
style: {
|
|
13661
|
+
color: "red"
|
|
13662
|
+
}
|
|
13663
|
+
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13664
|
+
control: control,
|
|
13665
|
+
name: "name",
|
|
13666
|
+
rules: {
|
|
13667
|
+
required: "Name is required",
|
|
13668
|
+
minLength: {
|
|
13669
|
+
value: 2,
|
|
13670
|
+
message: "Name must be at least 2 characters"
|
|
13671
|
+
}
|
|
13672
|
+
},
|
|
13673
|
+
render: props => {
|
|
13674
|
+
var _errors$name;
|
|
13675
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
|
|
13676
|
+
style: {
|
|
13677
|
+
marginBottom: 0
|
|
13678
|
+
},
|
|
13679
|
+
value: props.value,
|
|
13680
|
+
error: errors === null || errors === void 0 ? void 0 : (_errors$name = errors.name) === null || _errors$name === void 0 ? void 0 : _errors$name.message,
|
|
13681
|
+
onChange: e => {
|
|
13682
|
+
props.onChange(e.target.value);
|
|
13683
|
+
},
|
|
13684
|
+
onBlur: e => {
|
|
13685
|
+
props.onBlur(e);
|
|
13686
|
+
},
|
|
13687
|
+
t: t
|
|
13688
|
+
});
|
|
13689
|
+
}
|
|
13690
|
+
}), (errors === null || errors === void 0 ? void 0 : errors.name) && /*#__PURE__*/React__default.createElement("p", {
|
|
13691
|
+
style: {
|
|
13692
|
+
color: "red"
|
|
13693
|
+
}
|
|
13694
|
+
}, errors.name.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t("CHALLAN_TYPE_OFFENCE"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13695
|
+
style: {
|
|
13696
|
+
color: "red"
|
|
13697
|
+
}
|
|
13698
|
+
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13699
|
+
control: control,
|
|
13700
|
+
name: "offenceType",
|
|
13701
|
+
defaultValue: null,
|
|
13702
|
+
rules: {
|
|
13703
|
+
required: t("CHALLAN_TYPE_OFFENCE_REQUIRED")
|
|
13704
|
+
},
|
|
13705
|
+
render: props => {
|
|
13706
|
+
var _OffenceTypeData$Chal;
|
|
13707
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
|
|
13708
|
+
style: {
|
|
13709
|
+
marginBottom: 0,
|
|
13710
|
+
width: "100%"
|
|
13711
|
+
},
|
|
13712
|
+
className: "form-field",
|
|
13713
|
+
select: props.onChange,
|
|
13714
|
+
selected: props.value,
|
|
13715
|
+
option: OffenceTypeData === null || OffenceTypeData === void 0 ? void 0 : (_OffenceTypeData$Chal = OffenceTypeData.Challan) === null || _OffenceTypeData$Chal === void 0 ? void 0 : _OffenceTypeData$Chal.OffenceType,
|
|
13716
|
+
optionKey: "name",
|
|
13717
|
+
t: t
|
|
13718
|
+
});
|
|
13719
|
+
}
|
|
13720
|
+
}), errors.offenceType && /*#__PURE__*/React__default.createElement("p", {
|
|
13721
|
+
style: {
|
|
13722
|
+
color: "red"
|
|
13723
|
+
}
|
|
13724
|
+
}, errors.offenceType.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
|
|
13725
|
+
style: {
|
|
13726
|
+
marginTop: "20px"
|
|
13727
|
+
}
|
|
13728
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t("CHALLAN_OFFENCE_CATEGORY"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13729
|
+
style: {
|
|
13730
|
+
color: "red"
|
|
13731
|
+
}
|
|
13732
|
+
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13733
|
+
control: control,
|
|
13734
|
+
name: "offenceCategory",
|
|
13735
|
+
defaultValue: null,
|
|
13736
|
+
rules: {
|
|
13737
|
+
required: t("CHALLAN_OFFENCE_CATEGORY_REQUIRED")
|
|
13738
|
+
},
|
|
13739
|
+
render: props => {
|
|
13740
|
+
var _categoryData$Challan;
|
|
13741
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
|
|
13742
|
+
style: {
|
|
13743
|
+
marginBottom: 0,
|
|
13744
|
+
width: "100%"
|
|
13745
|
+
},
|
|
13746
|
+
className: "form-field",
|
|
13747
|
+
select: props.onChange,
|
|
13748
|
+
selected: props.value,
|
|
13749
|
+
option: categoryData === null || categoryData === void 0 ? void 0 : (_categoryData$Challan = categoryData.Challan) === null || _categoryData$Challan === void 0 ? void 0 : _categoryData$Challan.Category,
|
|
13750
|
+
optionKey: "name",
|
|
13751
|
+
t: t
|
|
13752
|
+
});
|
|
13753
|
+
}
|
|
13754
|
+
}), errors.offenceCategory && /*#__PURE__*/React__default.createElement("p", {
|
|
13755
|
+
style: {
|
|
13756
|
+
color: "red"
|
|
13757
|
+
}
|
|
13758
|
+
}, errors.offenceCategory.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
|
|
13759
|
+
style: {
|
|
13760
|
+
marginTop: "20px"
|
|
13761
|
+
}
|
|
13762
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t("CHALLAN_OFFENCE_SUB_CATEGORY"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13763
|
+
style: {
|
|
13764
|
+
color: "red"
|
|
13765
|
+
}
|
|
13766
|
+
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13767
|
+
control: control,
|
|
13768
|
+
name: "offenceSubCategory",
|
|
13769
|
+
defaultValue: null,
|
|
13770
|
+
rules: {
|
|
13771
|
+
required: t("CHALLAN_OFFENCE_SUB_CATEGORY_REQUIRED")
|
|
13772
|
+
},
|
|
13773
|
+
render: props => {
|
|
13774
|
+
var _subCategoryData$Chal;
|
|
13775
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
|
|
13776
|
+
style: {
|
|
13777
|
+
marginBottom: 0,
|
|
13778
|
+
width: "100%"
|
|
13779
|
+
},
|
|
13780
|
+
className: "form-field",
|
|
13781
|
+
select: props.onChange,
|
|
13782
|
+
selected: props.value,
|
|
13783
|
+
option: subCategoryData === null || subCategoryData === void 0 ? void 0 : (_subCategoryData$Chal = subCategoryData.Challan) === null || _subCategoryData$Chal === void 0 ? void 0 : _subCategoryData$Chal.SubCategory,
|
|
13784
|
+
optionKey: "name",
|
|
13785
|
+
t: t
|
|
13786
|
+
});
|
|
13787
|
+
}
|
|
13788
|
+
}), errors.offenceSubCategory && /*#__PURE__*/React__default.createElement("p", {
|
|
13789
|
+
style: {
|
|
13790
|
+
color: "red"
|
|
13791
|
+
}
|
|
13792
|
+
}, errors.offenceSubCategory.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
|
|
13793
|
+
style: {
|
|
13794
|
+
marginTop: "20px"
|
|
13795
|
+
}
|
|
13796
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("DEFAULT_CHALLAN_AMOUNT")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13797
|
+
control: control,
|
|
13798
|
+
name: "challanAmountDefault",
|
|
13799
|
+
render: props => {
|
|
13800
|
+
var _errors$name2;
|
|
13801
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
|
|
13802
|
+
type: "number",
|
|
13803
|
+
style: {
|
|
13804
|
+
marginBottom: 0,
|
|
13805
|
+
width: "100%"
|
|
13806
|
+
},
|
|
13807
|
+
value: props.value,
|
|
13808
|
+
error: errors === null || errors === void 0 ? void 0 : (_errors$name2 = errors.name) === null || _errors$name2 === void 0 ? void 0 : _errors$name2.message,
|
|
13809
|
+
onChange: e => {
|
|
13810
|
+
props.onChange(e.target.value);
|
|
13811
|
+
},
|
|
13812
|
+
onBlur: e => {
|
|
13813
|
+
props.onBlur(e);
|
|
13814
|
+
},
|
|
13815
|
+
t: t
|
|
13816
|
+
});
|
|
13817
|
+
}
|
|
13818
|
+
})), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
|
|
13819
|
+
style: {
|
|
13820
|
+
marginTop: "20px"
|
|
13821
|
+
}
|
|
13822
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("CHALLAN_AMOUNT")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13823
|
+
control: control,
|
|
13824
|
+
name: "challanAmount",
|
|
13825
|
+
render: props => {
|
|
13826
|
+
var _errors$name3;
|
|
13827
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
|
|
13828
|
+
type: "number",
|
|
13829
|
+
style: {
|
|
13830
|
+
marginBottom: 0,
|
|
13831
|
+
width: "100%"
|
|
13832
|
+
},
|
|
13833
|
+
value: props.value,
|
|
13834
|
+
error: errors === null || errors === void 0 ? void 0 : (_errors$name3 = errors.name) === null || _errors$name3 === void 0 ? void 0 : _errors$name3.message,
|
|
13835
|
+
onChange: e => {
|
|
13836
|
+
props.onChange(e.target.value);
|
|
13837
|
+
},
|
|
13838
|
+
onBlur: e => {
|
|
13839
|
+
props.onBlur(e);
|
|
13840
|
+
},
|
|
13841
|
+
t: t
|
|
13842
|
+
});
|
|
13843
|
+
}
|
|
13844
|
+
}))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
|
|
13845
|
+
style: {
|
|
13846
|
+
fontWeight: "bold",
|
|
13847
|
+
paddingTop: "30px",
|
|
13848
|
+
fontSize: "25px"
|
|
13849
|
+
}
|
|
13850
|
+
}, t("CHALLAN_DOCUMENTS"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13851
|
+
style: {
|
|
13852
|
+
color: "red"
|
|
13853
|
+
}
|
|
13854
|
+
}, "*")), /*#__PURE__*/React__default.createElement("div", {
|
|
13855
|
+
style: {
|
|
13856
|
+
marginTop: "20px"
|
|
13857
|
+
}
|
|
13858
|
+
}, /*#__PURE__*/React__default.createElement(SelectNDCDocuments, {
|
|
13859
|
+
t: t,
|
|
13860
|
+
config: {
|
|
13861
|
+
key: "documents"
|
|
13862
|
+
},
|
|
13863
|
+
onSelect: handleDocumentsSelect,
|
|
13864
|
+
userType: "CITIZEN",
|
|
13865
|
+
formData: {
|
|
13866
|
+
documents: documentsData
|
|
13867
|
+
},
|
|
13868
|
+
setError: () => {},
|
|
13869
|
+
clearErrors: () => {},
|
|
13870
|
+
formState: {}
|
|
13871
|
+
})), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
|
|
13872
|
+
label: "Submit",
|
|
13873
|
+
submit: "submit"
|
|
13874
|
+
})))), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
|
|
13482
13875
|
error: showToast.key,
|
|
13483
13876
|
label: t(showToast.label),
|
|
13484
13877
|
onClose: () => {
|
|
13485
13878
|
setShowToast(null);
|
|
13486
13879
|
},
|
|
13487
13880
|
isDleteBtn: "true"
|
|
13881
|
+
}), (loader || categoryLoading || subCategoryLoading || OffenceTypeLoading) && /*#__PURE__*/React__default.createElement(Loader, {
|
|
13882
|
+
page: true
|
|
13488
13883
|
}));
|
|
13489
13884
|
};
|
|
13490
13885
|
|
|
@@ -13539,6 +13934,37 @@ const OffenderDetails = _ref => {
|
|
|
13539
13934
|
style: {
|
|
13540
13935
|
marginBottom: "20px"
|
|
13541
13936
|
}
|
|
13937
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("NOC_APPLICANT_MOBILE_NO_LABEL"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13938
|
+
style: {
|
|
13939
|
+
color: "red"
|
|
13940
|
+
}
|
|
13941
|
+
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13942
|
+
control: control,
|
|
13943
|
+
name: "mobileNumber",
|
|
13944
|
+
rules: {
|
|
13945
|
+
required: "Mobile number is required",
|
|
13946
|
+
pattern: {
|
|
13947
|
+
value: /^[6-9]\d{9}$/,
|
|
13948
|
+
message: "Enter a valid 10-digit mobile number"
|
|
13949
|
+
}
|
|
13950
|
+
},
|
|
13951
|
+
render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.MobileNumber, {
|
|
13952
|
+
style: {
|
|
13953
|
+
marginBottom: 0
|
|
13954
|
+
},
|
|
13955
|
+
value: props.value,
|
|
13956
|
+
onChange: props.onChange,
|
|
13957
|
+
onBlur: props.onBlur,
|
|
13958
|
+
t: t
|
|
13959
|
+
})
|
|
13960
|
+
}), (errors === null || errors === void 0 ? void 0 : errors.mobileNumber) && /*#__PURE__*/React__default.createElement("p", {
|
|
13961
|
+
style: {
|
|
13962
|
+
color: "red"
|
|
13963
|
+
}
|
|
13964
|
+
}, errors.mobileNumber.message)), /*#__PURE__*/React__default.createElement("div", {
|
|
13965
|
+
style: {
|
|
13966
|
+
marginBottom: "20px"
|
|
13967
|
+
}
|
|
13542
13968
|
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("BPA_BASIC_DETAILS_APPLICATION_NAME_LABEL"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13543
13969
|
style: {
|
|
13544
13970
|
color: "red"
|
|
@@ -13578,72 +14004,6 @@ const OffenderDetails = _ref => {
|
|
|
13578
14004
|
style: {
|
|
13579
14005
|
marginBottom: "20px"
|
|
13580
14006
|
}
|
|
13581
|
-
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("NOC_APPLICANT_EMAIL_LABEL"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13582
|
-
style: {
|
|
13583
|
-
color: "red"
|
|
13584
|
-
}
|
|
13585
|
-
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13586
|
-
control: control,
|
|
13587
|
-
name: "emailId",
|
|
13588
|
-
rules: {
|
|
13589
|
-
required: "Email is required",
|
|
13590
|
-
pattern: {
|
|
13591
|
-
value: /^(?!\.)(?!.*\.\.)[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z]{2,})+$/,
|
|
13592
|
-
message: "Invalid email format"
|
|
13593
|
-
}
|
|
13594
|
-
},
|
|
13595
|
-
render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
|
|
13596
|
-
style: {
|
|
13597
|
-
marginBottom: 0
|
|
13598
|
-
},
|
|
13599
|
-
value: props.value,
|
|
13600
|
-
onChange: e => {
|
|
13601
|
-
props.onChange(e.target.value);
|
|
13602
|
-
},
|
|
13603
|
-
onBlur: e => {
|
|
13604
|
-
props.onBlur(e);
|
|
13605
|
-
},
|
|
13606
|
-
t: t
|
|
13607
|
-
})
|
|
13608
|
-
}), (errors === null || errors === void 0 ? void 0 : errors.emailId) && /*#__PURE__*/React__default.createElement("p", {
|
|
13609
|
-
style: {
|
|
13610
|
-
color: "red"
|
|
13611
|
-
}
|
|
13612
|
-
}, errors.emailId.message)), /*#__PURE__*/React__default.createElement("div", {
|
|
13613
|
-
style: {
|
|
13614
|
-
marginBottom: "20px"
|
|
13615
|
-
}
|
|
13616
|
-
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("NOC_APPLICANT_MOBILE_NO_LABEL"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13617
|
-
style: {
|
|
13618
|
-
color: "red"
|
|
13619
|
-
}
|
|
13620
|
-
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13621
|
-
control: control,
|
|
13622
|
-
name: "mobileNumber",
|
|
13623
|
-
rules: {
|
|
13624
|
-
required: "Mobile number is required",
|
|
13625
|
-
pattern: {
|
|
13626
|
-
value: /^[6-9]\d{9}$/,
|
|
13627
|
-
message: "Enter a valid 10-digit mobile number"
|
|
13628
|
-
}
|
|
13629
|
-
},
|
|
13630
|
-
render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.MobileNumber, {
|
|
13631
|
-
style: {
|
|
13632
|
-
marginBottom: 0
|
|
13633
|
-
},
|
|
13634
|
-
value: props.value,
|
|
13635
|
-
onChange: props.onChange,
|
|
13636
|
-
onBlur: props.onBlur,
|
|
13637
|
-
t: t
|
|
13638
|
-
})
|
|
13639
|
-
}), (errors === null || errors === void 0 ? void 0 : errors.mobileNumber) && /*#__PURE__*/React__default.createElement("p", {
|
|
13640
|
-
style: {
|
|
13641
|
-
color: "red"
|
|
13642
|
-
}
|
|
13643
|
-
}, errors.mobileNumber.message)), /*#__PURE__*/React__default.createElement("div", {
|
|
13644
|
-
style: {
|
|
13645
|
-
marginBottom: "20px"
|
|
13646
|
-
}
|
|
13647
14007
|
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("PT_COMMON_COL_ADDRESS"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13648
14008
|
style: {
|
|
13649
14009
|
color: "red"
|
|
@@ -13721,51 +14081,6 @@ const ChallanStepFormOne = _ref => {
|
|
|
13721
14081
|
}));
|
|
13722
14082
|
};
|
|
13723
14083
|
|
|
13724
|
-
const Loader = _ref => {
|
|
13725
|
-
let {
|
|
13726
|
-
page = false
|
|
13727
|
-
} = _ref;
|
|
13728
|
-
const baseStyle = {
|
|
13729
|
-
display: "flex",
|
|
13730
|
-
justifyContent: "center",
|
|
13731
|
-
alignItems: "center"
|
|
13732
|
-
};
|
|
13733
|
-
const pageStyle = _extends({}, baseStyle, {
|
|
13734
|
-
position: "fixed",
|
|
13735
|
-
top: 0,
|
|
13736
|
-
left: 0,
|
|
13737
|
-
width: "100vw",
|
|
13738
|
-
height: "100vh",
|
|
13739
|
-
background: "rgba(255,255,255,0.6)",
|
|
13740
|
-
backdropFilter: "blur(4px)",
|
|
13741
|
-
zIndex: 9999
|
|
13742
|
-
});
|
|
13743
|
-
const moduleStyle = _extends({}, baseStyle, {
|
|
13744
|
-
minHeight: "100px",
|
|
13745
|
-
width: "100%",
|
|
13746
|
-
position: "relative"
|
|
13747
|
-
});
|
|
13748
|
-
const spinnerStyle = {
|
|
13749
|
-
width: "64px",
|
|
13750
|
-
height: "64px",
|
|
13751
|
-
border: "8px solid #1976d2",
|
|
13752
|
-
borderTop: "8px solid transparent",
|
|
13753
|
-
borderRadius: "50%",
|
|
13754
|
-
animation: "spin 1.2s linear infinite"
|
|
13755
|
-
};
|
|
13756
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
13757
|
-
style: page ? pageStyle : moduleStyle
|
|
13758
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
13759
|
-
style: spinnerStyle
|
|
13760
|
-
}), /*#__PURE__*/React__default.createElement("style", null, "\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "));
|
|
13761
|
-
};
|
|
13762
|
-
Loader.propTypes = {
|
|
13763
|
-
page: propTypes.bool
|
|
13764
|
-
};
|
|
13765
|
-
Loader.defaultProps = {
|
|
13766
|
-
page: false
|
|
13767
|
-
};
|
|
13768
|
-
|
|
13769
14084
|
const OffenceDetails = _ref => {
|
|
13770
14085
|
let {
|
|
13771
14086
|
onGoBack,
|
|
@@ -13775,6 +14090,25 @@ const OffenceDetails = _ref => {
|
|
|
13775
14090
|
} = _ref;
|
|
13776
14091
|
const [loader, setLoader] = React.useState(false);
|
|
13777
14092
|
const tenantId = window.location.href.includes("employee") ? Digit.ULBService.getCurrentPermanentCity() : localStorage.getItem("CITIZEN.CITY");
|
|
14093
|
+
const {
|
|
14094
|
+
data: categoryData,
|
|
14095
|
+
isLoading: categoryLoading
|
|
14096
|
+
} = Digit.Hooks.useCustomMDMS(tenantId, "Challan", [{
|
|
14097
|
+
name: "Category"
|
|
14098
|
+
}]);
|
|
14099
|
+
const {
|
|
14100
|
+
data: subCategoryData,
|
|
14101
|
+
isLoading: subCategoryLoading
|
|
14102
|
+
} = Digit.Hooks.useCustomMDMS(tenantId, "Challan", [{
|
|
14103
|
+
name: "SubCategory"
|
|
14104
|
+
}]);
|
|
14105
|
+
const {
|
|
14106
|
+
data: OffenceTypeData,
|
|
14107
|
+
isLoading: OffenceTypeLoading
|
|
14108
|
+
} = Digit.Hooks.useCustomMDMS(tenantId, "Challan", [{
|
|
14109
|
+
name: "OffenceType"
|
|
14110
|
+
}]);
|
|
14111
|
+
console.log("categoryData====", categoryData, subCategoryData, OffenceTypeData);
|
|
13778
14112
|
const {
|
|
13779
14113
|
control,
|
|
13780
14114
|
handleSubmit,
|
|
@@ -13783,222 +14117,132 @@ const OffenceDetails = _ref => {
|
|
|
13783
14117
|
formState: {
|
|
13784
14118
|
errors
|
|
13785
14119
|
},
|
|
13786
|
-
getValues
|
|
13787
|
-
} = reactHookForm.useForm({
|
|
13788
|
-
defaultValues: {
|
|
13789
|
-
shouldUnregister: false
|
|
13790
|
-
}
|
|
13791
|
-
});
|
|
13792
|
-
const onSubmit = data => {
|
|
13793
|
-
goNext(data);
|
|
13794
|
-
};
|
|
13795
|
-
React.useEffect(() => {
|
|
13796
|
-
if (currentStepData !== null && currentStepData !== void 0 && currentStepData.offenceDetails) {
|
|
13797
|
-
var _Object$entries;
|
|
13798
|
-
(_Object$entries = Object.entries(currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.offenceDetails)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.forEach(_ref2 => {
|
|
13799
|
-
let [key, value] = _ref2;
|
|
13800
|
-
setValue(key, value);
|
|
13801
|
-
});
|
|
13802
|
-
}
|
|
13803
|
-
}, [currentStepData, setValue]);
|
|
13804
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("form", {
|
|
13805
|
-
onSubmit: handleSubmit(onSubmit)
|
|
13806
|
-
}, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t("CHALLAN_TYPE_OFFENCE"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13807
|
-
style: {
|
|
13808
|
-
color: "red"
|
|
13809
|
-
}
|
|
13810
|
-
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13811
|
-
control: control,
|
|
13812
|
-
name: "offenceType",
|
|
13813
|
-
defaultValue: null,
|
|
13814
|
-
render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
|
|
13815
|
-
style: {
|
|
13816
|
-
marginBottom: 0
|
|
13817
|
-
},
|
|
13818
|
-
className: "form-field",
|
|
13819
|
-
select: props.onChange,
|
|
13820
|
-
selected: props.value,
|
|
13821
|
-
option: [],
|
|
13822
|
-
optionKey: "name",
|
|
13823
|
-
t: t
|
|
13824
|
-
})
|
|
13825
|
-
}), errors.offenceType && /*#__PURE__*/React__default.createElement("p", {
|
|
13826
|
-
style: {
|
|
13827
|
-
color: "red"
|
|
13828
|
-
}
|
|
13829
|
-
}, errors.offenceType.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
|
|
13830
|
-
style: {
|
|
13831
|
-
marginTop: "20px"
|
|
13832
|
-
}
|
|
13833
|
-
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t("CHALLAN_OFFENCE_CATEGORY"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13834
|
-
style: {
|
|
13835
|
-
color: "red"
|
|
13836
|
-
}
|
|
13837
|
-
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13838
|
-
control: control,
|
|
13839
|
-
name: "offenceCategory",
|
|
13840
|
-
defaultValue: null,
|
|
13841
|
-
render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
|
|
13842
|
-
style: {
|
|
13843
|
-
marginBottom: 0
|
|
13844
|
-
},
|
|
13845
|
-
className: "form-field",
|
|
13846
|
-
select: props.onChange,
|
|
13847
|
-
selected: props.value,
|
|
13848
|
-
option: [],
|
|
13849
|
-
optionKey: "name",
|
|
13850
|
-
t: t
|
|
13851
|
-
})
|
|
13852
|
-
}), errors.offenceCategory && /*#__PURE__*/React__default.createElement("p", {
|
|
13853
|
-
style: {
|
|
13854
|
-
color: "red"
|
|
13855
|
-
}
|
|
13856
|
-
}, errors.offenceCategory.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
|
|
13857
|
-
style: {
|
|
13858
|
-
marginTop: "20px"
|
|
13859
|
-
}
|
|
13860
|
-
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t("CHALLAN_OFFENCE_SUB_CATEGORY"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13861
|
-
style: {
|
|
13862
|
-
color: "red"
|
|
13863
|
-
}
|
|
13864
|
-
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13865
|
-
control: control,
|
|
13866
|
-
name: "offenceSubCategory",
|
|
13867
|
-
defaultValue: null,
|
|
13868
|
-
render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
|
|
13869
|
-
style: {
|
|
13870
|
-
marginBottom: 0
|
|
13871
|
-
},
|
|
13872
|
-
className: "form-field",
|
|
13873
|
-
select: props.onChange,
|
|
13874
|
-
selected: props.value,
|
|
13875
|
-
option: [],
|
|
13876
|
-
optionKey: "name",
|
|
13877
|
-
t: t
|
|
13878
|
-
})
|
|
13879
|
-
}), errors.offenceSubCategory && /*#__PURE__*/React__default.createElement("p", {
|
|
13880
|
-
style: {
|
|
13881
|
-
color: "red"
|
|
14120
|
+
getValues
|
|
14121
|
+
} = reactHookForm.useForm({
|
|
14122
|
+
defaultValues: {
|
|
14123
|
+
shouldUnregister: false
|
|
13882
14124
|
}
|
|
13883
|
-
}
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
|
|
14125
|
+
});
|
|
14126
|
+
const onSubmit = data => {
|
|
14127
|
+
goNext(data);
|
|
14128
|
+
};
|
|
14129
|
+
React.useEffect(() => {
|
|
14130
|
+
if (currentStepData !== null && currentStepData !== void 0 && currentStepData.offenceDetails) {
|
|
14131
|
+
var _Object$entries;
|
|
14132
|
+
(_Object$entries = Object.entries(currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.offenceDetails)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.forEach(_ref2 => {
|
|
14133
|
+
let [key, value] = _ref2;
|
|
14134
|
+
setValue(key, value);
|
|
14135
|
+
});
|
|
13887
14136
|
}
|
|
13888
|
-
},
|
|
14137
|
+
}, [currentStepData, setValue]);
|
|
14138
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("form", {
|
|
14139
|
+
onSubmit: handleSubmit(onSubmit)
|
|
14140
|
+
}, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t("CHALLAN_TYPE_OFFENCE"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13889
14141
|
style: {
|
|
13890
14142
|
color: "red"
|
|
13891
14143
|
}
|
|
13892
14144
|
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13893
14145
|
control: control,
|
|
13894
|
-
name: "
|
|
14146
|
+
name: "offenceType",
|
|
14147
|
+
defaultValue: null,
|
|
13895
14148
|
render: props => {
|
|
13896
|
-
var
|
|
13897
|
-
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.
|
|
14149
|
+
var _OffenceTypeData$Chal;
|
|
14150
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
|
|
13898
14151
|
style: {
|
|
13899
14152
|
marginBottom: 0
|
|
13900
14153
|
},
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
onBlur: e => {
|
|
13907
|
-
props.onBlur(e);
|
|
13908
|
-
},
|
|
14154
|
+
className: "form-field",
|
|
14155
|
+
select: props.onChange,
|
|
14156
|
+
selected: props.value,
|
|
14157
|
+
option: OffenceTypeData === null || OffenceTypeData === void 0 ? void 0 : (_OffenceTypeData$Chal = OffenceTypeData.Challan) === null || _OffenceTypeData$Chal === void 0 ? void 0 : _OffenceTypeData$Chal.OffenceType,
|
|
14158
|
+
optionKey: "name",
|
|
13909
14159
|
t: t
|
|
13910
14160
|
});
|
|
13911
14161
|
}
|
|
13912
|
-
}),
|
|
14162
|
+
}), errors.offenceType && /*#__PURE__*/React__default.createElement("p", {
|
|
13913
14163
|
style: {
|
|
13914
14164
|
color: "red"
|
|
13915
14165
|
}
|
|
13916
|
-
}, errors.
|
|
14166
|
+
}, errors.offenceType.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
|
|
13917
14167
|
style: {
|
|
13918
|
-
width: "50%",
|
|
13919
14168
|
marginTop: "20px"
|
|
13920
14169
|
}
|
|
13921
|
-
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null,
|
|
14170
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t("CHALLAN_OFFENCE_CATEGORY"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13922
14171
|
style: {
|
|
13923
14172
|
color: "red"
|
|
13924
14173
|
}
|
|
13925
14174
|
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13926
14175
|
control: control,
|
|
13927
|
-
name: "
|
|
14176
|
+
name: "offenceCategory",
|
|
14177
|
+
defaultValue: null,
|
|
13928
14178
|
render: props => {
|
|
13929
|
-
var
|
|
13930
|
-
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.
|
|
14179
|
+
var _categoryData$Challan;
|
|
14180
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
|
|
13931
14181
|
style: {
|
|
13932
14182
|
marginBottom: 0
|
|
13933
14183
|
},
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
onBlur: e => {
|
|
13940
|
-
props.onBlur(e);
|
|
13941
|
-
},
|
|
14184
|
+
className: "form-field",
|
|
14185
|
+
select: props.onChange,
|
|
14186
|
+
selected: props.value,
|
|
14187
|
+
option: categoryData === null || categoryData === void 0 ? void 0 : (_categoryData$Challan = categoryData.Challan) === null || _categoryData$Challan === void 0 ? void 0 : _categoryData$Challan.Category,
|
|
14188
|
+
optionKey: "name",
|
|
13942
14189
|
t: t
|
|
13943
14190
|
});
|
|
13944
14191
|
}
|
|
13945
|
-
}),
|
|
14192
|
+
}), errors.offenceCategory && /*#__PURE__*/React__default.createElement("p", {
|
|
13946
14193
|
style: {
|
|
13947
14194
|
color: "red"
|
|
13948
14195
|
}
|
|
13949
|
-
}, errors.
|
|
14196
|
+
}, errors.offenceCategory.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
|
|
13950
14197
|
style: {
|
|
13951
|
-
width: "50%",
|
|
13952
14198
|
marginTop: "20px"
|
|
13953
14199
|
}
|
|
13954
|
-
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null,
|
|
14200
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, t("CHALLAN_OFFENCE_SUB_CATEGORY"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13955
14201
|
style: {
|
|
13956
14202
|
color: "red"
|
|
13957
14203
|
}
|
|
13958
14204
|
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13959
14205
|
control: control,
|
|
13960
|
-
name: "
|
|
14206
|
+
name: "offenceSubCategory",
|
|
14207
|
+
defaultValue: null,
|
|
13961
14208
|
render: props => {
|
|
13962
|
-
var
|
|
13963
|
-
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.
|
|
14209
|
+
var _subCategoryData$Chal;
|
|
14210
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
|
|
13964
14211
|
style: {
|
|
13965
14212
|
marginBottom: 0
|
|
13966
14213
|
},
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
onBlur: e => {
|
|
13973
|
-
props.onBlur(e);
|
|
13974
|
-
},
|
|
14214
|
+
className: "form-field",
|
|
14215
|
+
select: props.onChange,
|
|
14216
|
+
selected: props.value,
|
|
14217
|
+
option: subCategoryData === null || subCategoryData === void 0 ? void 0 : (_subCategoryData$Chal = subCategoryData.Challan) === null || _subCategoryData$Chal === void 0 ? void 0 : _subCategoryData$Chal.SubCategory,
|
|
14218
|
+
optionKey: "name",
|
|
13975
14219
|
t: t
|
|
13976
14220
|
});
|
|
13977
14221
|
}
|
|
13978
|
-
}),
|
|
14222
|
+
}), errors.offenceSubCategory && /*#__PURE__*/React__default.createElement("p", {
|
|
13979
14223
|
style: {
|
|
13980
14224
|
color: "red"
|
|
13981
14225
|
}
|
|
13982
|
-
}, errors.
|
|
14226
|
+
}, errors.offenceSubCategory.message)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
|
|
13983
14227
|
style: {
|
|
13984
14228
|
width: "50%",
|
|
13985
14229
|
marginTop: "20px"
|
|
13986
14230
|
}
|
|
13987
|
-
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("
|
|
14231
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, null, "" + t("CHALLAN_AMOUNT"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
13988
14232
|
style: {
|
|
13989
14233
|
color: "red"
|
|
13990
14234
|
}
|
|
13991
14235
|
}, "*")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
|
|
13992
14236
|
control: control,
|
|
13993
|
-
name: "
|
|
14237
|
+
name: "challanAmount",
|
|
13994
14238
|
render: props => {
|
|
13995
|
-
var _errors$
|
|
14239
|
+
var _errors$name;
|
|
13996
14240
|
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
|
|
13997
14241
|
style: {
|
|
13998
14242
|
marginBottom: 0
|
|
13999
14243
|
},
|
|
14000
14244
|
value: props.value,
|
|
14001
|
-
error: errors === null || errors === void 0 ? void 0 : (_errors$
|
|
14245
|
+
error: errors === null || errors === void 0 ? void 0 : (_errors$name = errors.name) === null || _errors$name === void 0 ? void 0 : _errors$name.message,
|
|
14002
14246
|
onChange: e => {
|
|
14003
14247
|
props.onChange(e.target.value);
|
|
14004
14248
|
},
|
|
@@ -14008,11 +14252,11 @@ const OffenceDetails = _ref => {
|
|
|
14008
14252
|
t: t
|
|
14009
14253
|
});
|
|
14010
14254
|
}
|
|
14011
|
-
}), (errors === null || errors === void 0 ? void 0 : errors.
|
|
14255
|
+
}), (errors === null || errors === void 0 ? void 0 : errors.challanAmount) && /*#__PURE__*/React__default.createElement("p", {
|
|
14012
14256
|
style: {
|
|
14013
14257
|
color: "red"
|
|
14014
14258
|
}
|
|
14015
|
-
}, errors.
|
|
14259
|
+
}, errors.challanAmount.message))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
|
|
14016
14260
|
style: {
|
|
14017
14261
|
background: " white",
|
|
14018
14262
|
color: "black",
|
|
@@ -14024,7 +14268,7 @@ const OffenceDetails = _ref => {
|
|
|
14024
14268
|
}), /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
|
|
14025
14269
|
label: "Next",
|
|
14026
14270
|
submit: "submit"
|
|
14027
|
-
}))), loader && /*#__PURE__*/React__default.createElement(Loader, {
|
|
14271
|
+
}))), (loader || categoryLoading || subCategoryLoading || OffenceTypeLoading) && /*#__PURE__*/React__default.createElement(Loader, {
|
|
14028
14272
|
page: true
|
|
14029
14273
|
}));
|
|
14030
14274
|
};
|
|
@@ -14463,186 +14707,6 @@ const ChallanStepFormFour = _ref => {
|
|
|
14463
14707
|
}));
|
|
14464
14708
|
};
|
|
14465
14709
|
|
|
14466
|
-
const SelectNDCDocuments = _ref => {
|
|
14467
|
-
var _formData$documents, _data$Challan;
|
|
14468
|
-
let {
|
|
14469
|
-
t,
|
|
14470
|
-
config,
|
|
14471
|
-
onSelect,
|
|
14472
|
-
userType,
|
|
14473
|
-
formData,
|
|
14474
|
-
setError: setFormError,
|
|
14475
|
-
clearErrors: clearFormErrors,
|
|
14476
|
-
formState
|
|
14477
|
-
} = _ref;
|
|
14478
|
-
const tenantId = window.location.href.includes("employee") ? Digit.ULBService.getCurrentPermanentCity() : localStorage.getItem("CITIZEN.CITY");
|
|
14479
|
-
const [documents, setDocuments] = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$documents = formData.documents) === null || _formData$documents === void 0 ? void 0 : _formData$documents.documents) || []);
|
|
14480
|
-
const [error, setError] = React.useState(null);
|
|
14481
|
-
const {
|
|
14482
|
-
data,
|
|
14483
|
-
isLoading
|
|
14484
|
-
} = Digit.Hooks.useCustomMDMS("pb", "Challan", [{
|
|
14485
|
-
name: "Documents"
|
|
14486
|
-
}]);
|
|
14487
|
-
console.log("data===????", data);
|
|
14488
|
-
console.log("formData", formData);
|
|
14489
|
-
const {
|
|
14490
|
-
action = "create"
|
|
14491
|
-
} = Digit.Hooks.useQueryParams();
|
|
14492
|
-
const ndcDocuments = data === null || data === void 0 ? void 0 : (_data$Challan = data.Challan) === null || _data$Challan === void 0 ? void 0 : _data$Challan.Documents;
|
|
14493
|
-
const goNext = () => {
|
|
14494
|
-
onSelect(config.key, {
|
|
14495
|
-
documents,
|
|
14496
|
-
ndcDocumentsLength: ndcDocuments === null || ndcDocuments === void 0 ? void 0 : ndcDocuments.length
|
|
14497
|
-
});
|
|
14498
|
-
};
|
|
14499
|
-
React.useEffect(() => {
|
|
14500
|
-
goNext();
|
|
14501
|
-
}, [documents]);
|
|
14502
|
-
if (isLoading) {
|
|
14503
|
-
return /*#__PURE__*/React__default.createElement(Loader, null);
|
|
14504
|
-
}
|
|
14505
|
-
return /*#__PURE__*/React__default.createElement("div", null, ndcDocuments === null || ndcDocuments === void 0 ? void 0 : ndcDocuments.map((document, index) => {
|
|
14506
|
-
return /*#__PURE__*/React__default.createElement(SelectDocument, {
|
|
14507
|
-
key: index,
|
|
14508
|
-
document: document,
|
|
14509
|
-
action: action,
|
|
14510
|
-
t: t,
|
|
14511
|
-
error: error,
|
|
14512
|
-
setError: setError,
|
|
14513
|
-
setDocuments: setDocuments,
|
|
14514
|
-
documents: documents,
|
|
14515
|
-
setFormError: setFormError,
|
|
14516
|
-
clearFormErrors: clearFormErrors,
|
|
14517
|
-
config: config,
|
|
14518
|
-
formState: formState
|
|
14519
|
-
});
|
|
14520
|
-
}), error && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
|
|
14521
|
-
isDleteBtn: true,
|
|
14522
|
-
label: error,
|
|
14523
|
-
onClose: () => setError(null),
|
|
14524
|
-
error: true
|
|
14525
|
-
}));
|
|
14526
|
-
};
|
|
14527
|
-
function SelectDocument(_ref2) {
|
|
14528
|
-
let {
|
|
14529
|
-
t,
|
|
14530
|
-
document: doc,
|
|
14531
|
-
setDocuments,
|
|
14532
|
-
setError,
|
|
14533
|
-
documents,
|
|
14534
|
-
setFormError,
|
|
14535
|
-
config,
|
|
14536
|
-
formState
|
|
14537
|
-
} = _ref2;
|
|
14538
|
-
const filteredDocument = documents === null || documents === void 0 ? void 0 : documents.filter(item => {
|
|
14539
|
-
var _item$documentType;
|
|
14540
|
-
return item === null || item === void 0 ? void 0 : (_item$documentType = item.documentType) === null || _item$documentType === void 0 ? void 0 : _item$documentType.includes(doc === null || doc === void 0 ? void 0 : doc.code);
|
|
14541
|
-
})[0];
|
|
14542
|
-
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
14543
|
-
const [getLoader, setLoader] = React.useState(false);
|
|
14544
|
-
const [file, setFile] = React.useState(null);
|
|
14545
|
-
const [uploadedFile, setUploadedFile] = React.useState(() => (filteredDocument === null || filteredDocument === void 0 ? void 0 : filteredDocument.fileStoreId) || null);
|
|
14546
|
-
function selectfile(e) {
|
|
14547
|
-
setFile(e.target.files[0]);
|
|
14548
|
-
}
|
|
14549
|
-
React.useEffect(() => {
|
|
14550
|
-
if (filteredDocument !== null && filteredDocument !== void 0 && filteredDocument.fileStoreId && !file) {
|
|
14551
|
-
setUploadedFile(filteredDocument.fileStoreId);
|
|
14552
|
-
}
|
|
14553
|
-
}, [filteredDocument]);
|
|
14554
|
-
React.useEffect(() => {
|
|
14555
|
-
if (uploadedFile) {
|
|
14556
|
-
setDocuments(prev => {
|
|
14557
|
-
const filteredDocumentsByDocumentType = prev === null || prev === void 0 ? void 0 : prev.filter(item => (item === null || item === void 0 ? void 0 : item.documentType) !== (doc === null || doc === void 0 ? void 0 : doc.code));
|
|
14558
|
-
if ((uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.length) === 0 || uploadedFile === null) {
|
|
14559
|
-
return filteredDocumentsByDocumentType;
|
|
14560
|
-
}
|
|
14561
|
-
const filteredDocumentsByFileStoreId = filteredDocumentsByDocumentType === null || filteredDocumentsByDocumentType === void 0 ? void 0 : filteredDocumentsByDocumentType.filter(item => (item === null || item === void 0 ? void 0 : item.fileStoreId) !== uploadedFile);
|
|
14562
|
-
return [...filteredDocumentsByFileStoreId, {
|
|
14563
|
-
documentType: doc === null || doc === void 0 ? void 0 : doc.code,
|
|
14564
|
-
fileStoreId: uploadedFile,
|
|
14565
|
-
documentUid: uploadedFile
|
|
14566
|
-
}];
|
|
14567
|
-
});
|
|
14568
|
-
} else if (uploadedFile === null) {
|
|
14569
|
-
setDocuments(prev => prev.filter(item => (item === null || item === void 0 ? void 0 : item.documentType) !== (doc === null || doc === void 0 ? void 0 : doc.code)));
|
|
14570
|
-
}
|
|
14571
|
-
}, [uploadedFile]);
|
|
14572
|
-
React.useEffect(() => {
|
|
14573
|
-
(function () {
|
|
14574
|
-
try {
|
|
14575
|
-
setError(null);
|
|
14576
|
-
const _temp3 = function () {
|
|
14577
|
-
if (file) {
|
|
14578
|
-
setLoader(true);
|
|
14579
|
-
const _temp2 = function () {
|
|
14580
|
-
if (file.size >= 5242880) {
|
|
14581
|
-
setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
|
|
14582
|
-
setLoader(false);
|
|
14583
|
-
if (!formState.errors[config.key]) setFormError(config.key, {
|
|
14584
|
-
type: doc === null || doc === void 0 ? void 0 : doc.code
|
|
14585
|
-
});
|
|
14586
|
-
} else {
|
|
14587
|
-
const _temp = _catch(function () {
|
|
14588
|
-
setUploadedFile(null);
|
|
14589
|
-
return Promise.resolve(Digit.UploadServices.Filestorage("PT", file, Digit.ULBService.getStateId())).then(function (response) {
|
|
14590
|
-
var _response$data, _response$data$files;
|
|
14591
|
-
setLoader(false);
|
|
14592
|
-
if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
|
|
14593
|
-
var _response$data2, _response$data2$files;
|
|
14594
|
-
setUploadedFile(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$files = _response$data2.files[0]) === null || _response$data2$files === void 0 ? void 0 : _response$data2$files.fileStoreId);
|
|
14595
|
-
} else {
|
|
14596
|
-
setError(t("CS_FILE_UPLOAD_ERROR"));
|
|
14597
|
-
}
|
|
14598
|
-
});
|
|
14599
|
-
}, function () {
|
|
14600
|
-
setLoader(false);
|
|
14601
|
-
setError(t("CS_FILE_UPLOAD_ERROR"));
|
|
14602
|
-
});
|
|
14603
|
-
if (_temp && _temp.then) return _temp.then(function () {});
|
|
14604
|
-
}
|
|
14605
|
-
}();
|
|
14606
|
-
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
14607
|
-
}
|
|
14608
|
-
}();
|
|
14609
|
-
return _temp3 && _temp3.then ? _temp3.then(function () {}) : void 0;
|
|
14610
|
-
} catch (e) {
|
|
14611
|
-
Promise.reject(e);
|
|
14612
|
-
}
|
|
14613
|
-
})();
|
|
14614
|
-
}, [file]);
|
|
14615
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
14616
|
-
style: {
|
|
14617
|
-
marginBottom: "40px"
|
|
14618
|
-
}
|
|
14619
|
-
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
|
|
14620
|
-
style: {
|
|
14621
|
-
display: "inline"
|
|
14622
|
-
}
|
|
14623
|
-
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
|
|
14624
|
-
style: {
|
|
14625
|
-
marginBottom: "8px",
|
|
14626
|
-
width: "auto"
|
|
14627
|
-
}
|
|
14628
|
-
}, t(doc === null || doc === void 0 ? void 0 : doc.code), " ", (doc === null || doc === void 0 ? void 0 : doc.required) && " *"), /*#__PURE__*/React__default.createElement("div", {
|
|
14629
|
-
className: "field"
|
|
14630
|
-
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
|
|
14631
|
-
id: "tl-doc",
|
|
14632
|
-
onUpload: selectfile,
|
|
14633
|
-
onDelete: () => {
|
|
14634
|
-
setUploadedFile(null);
|
|
14635
|
-
},
|
|
14636
|
-
message: uploadedFile ? "1 " + t("CS_ACTION_FILEUPLOADED") : t("CS_ACTION_NO_FILEUPLOADED"),
|
|
14637
|
-
textStyles: {
|
|
14638
|
-
width: "100%"
|
|
14639
|
-
},
|
|
14640
|
-
accept: "image/*,.pdf"
|
|
14641
|
-
}))), getLoader && /*#__PURE__*/React__default.createElement(Loader, {
|
|
14642
|
-
page: true
|
|
14643
|
-
}));
|
|
14644
|
-
}
|
|
14645
|
-
|
|
14646
14710
|
const initialState = {
|
|
14647
14711
|
step: 1,
|
|
14648
14712
|
isValid: false,
|