Skip to content

Commit 801d4af

Browse files
committed
updated core and libraries
1 parent c672c16 commit 801d4af

File tree

38 files changed

+626
-257
lines changed

38 files changed

+626
-257
lines changed

react/libraries/README.md

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
1-
# digit-ui-libraries
21

3-
> Made with @egovernments/create-ui-library
2+
3+
# digit-ui-svg-components
44

55
## Install
66

77
```bash
88
npm install --save @egovernments/digit-ui-libraries
99
```
1010

11+
## Limitation
12+
13+
```bash
14+
This Package is more specific to DIGIT-UI's can be used across mission's
15+
```
16+
17+
## Usage
18+
19+
After adding the dependency make sure you have this dependency in
20+
21+
```bash
22+
frontend/micro-ui/web/package.json
23+
```
24+
25+
```json
26+
"@egovernments/digit-ui-libraries":"1.8.0",
27+
```
28+
29+
then navigate to App.js
30+
31+
```bash
32+
frontend/micro-ui/web/src/App.js
33+
```
34+
35+
1136
## Usage
1237

1338
```jsx
@@ -27,6 +52,23 @@ const App = ({ deltaConfig, stateCode, cityCode, moduleCode }) => {
2752
export default App;
2853
```
2954

55+
### Changelog
56+
57+
```bash
58+
1.8.1-beta.1 Republished after merging with Master due to version issues.
59+
1.8.0 Released as part of workbench v1.0
60+
```
61+
62+
### Published from DIGIT Frontend
63+
DIGIT Frontend Repo (https://github.com/egovernments/Digit-Frontend/tree/develop)
64+
65+
### Contributors
66+
67+
[jagankumar-egov] [nipunarora-eGov] [Tulika-eGov] [Ramkrishna-egov] [nabeelmd-eGov] [anil-egov] [vamshikrishnakole-wtt-egov]
68+
3069
## License
3170

32-
MIT © [](https://github.com/)
71+
MIT © [jagankumar-egov](https://github.com/jagankumar-egov)
72+
73+
74+
![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png)

react/libraries/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@egovernments/digit-ui-libraries",
3-
"version": "1.7.10",
3+
"version": "1.8.1-beta.1",
44
"main": "dist/index.js",
55
"module": "dist/index.modern.js",
66
"source": "src/index.js",

react/libraries/src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Enums from "./enums/index";
33
import mergeConfig from "./config/mergeConfig";
44
import { useStore } from "./services/index";
55
import { initI18n } from "./translations/index";
6+
import { Request } from "./services/atoms/Utils/Request";
67

78
import { Storage, PersistantStorage } from "./services/atoms/Utils/Storage";
89
import { UploadServices } from "./services/atoms/UploadServices";
@@ -87,4 +88,4 @@ const initLibraries = () => {
8788
});
8889
};
8990

90-
export { initLibraries, Enums, Hooks, subFormRegistry };
91+
export { initLibraries, Enums, Hooks, subFormRegistry ,Request};

react/libraries/src/services/molecules/Works/Search.js

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import cloneDeep from "lodash/cloneDeep";
22
import _ from "lodash";
33
import { WorksService } from "../../elements/Works";
4+
import HrmsService from "../../elements/HRMS";
45
import { convertEpochToDate } from "../../../utils/pt";
56

67
const createProjectsArray = (t, project, searchParams, headerLocale) => {
@@ -129,7 +130,6 @@ const createProjectsArray = (t, project, searchParams, headerLocale) => {
129130
return totalProjects;
130131
}
131132

132-
133133
export const WorksSearch = {
134134
searchEstimate: async (tenantId="pb.jalandhar", filters = {} ) => {
135135

@@ -147,51 +147,45 @@ export const WorksSearch = {
147147
const response = await WorksService?.loiSearch({tenantId,filters})
148148
return response?.letterOfIndents
149149
},
150-
viewProjectDetailsScreen: async (
151-
t,
152-
tenantId,
153-
searchParams,
154-
filters = { limit: 10, offset: 0, includeAncestors: true, includeDescendants: true },
155-
headerLocale
156-
) => {
150+
viewProjectDetailsScreen: async(t,tenantId, searchParams, filters = {limit : 10, offset : 0, includeAncestors : true, includeDescendants : true}, headerLocale)=> {
157151
const response = await WorksService?.searchProject(tenantId, searchParams, filters);
158152

159-
153+
//Categoring the response into an object of searched project and its sub-projects ( if any )
154+
//searched projects will have basic details, project details and financial details
155+
//subprojects will be shown in a table similar to what create project has
160156
let projectDetails = {
161-
searchedProject: {
162-
basicDetails: {},
163-
details: {
164-
projectDetails: [],
157+
searchedProject : {
158+
basicDetails : {},
159+
details : {
160+
projectDetails : [],
161+
financialDetails : []
162+
}
165163
},
166-
},
167-
};
168-
169-
if (response?.Project) {
170-
let projects = createProjectsArray(t, response?.Project, searchParams, headerLocale);
171-
172-
//searched Project details
173-
projectDetails.searchedProject["basicDetails"] = projects?.searchedProject?.basicDetails;
174-
projectDetails.searchedProject["details"]["projectDetails"] = {
175-
applicationDetails: [
176-
projects?.searchedProject?.headerDetails,
177-
projects?.searchedProject?.projectDetails,
178-
projects?.searchedProject?.locationDetails,
179-
projects?.searchedProject?.documentDetails,
180-
],
181-
}; //rest categories will come here
164+
subProjects : []
182165
}
183-
184-
return {
185-
projectDetails: response?.Project ? projectDetails : [],
186-
response: response?.Project,
187-
processInstancesDetails: [],
188-
applicationData: {},
189-
workflowDetails: [],
190-
applicationData: {},
191-
isNoDataFound: response?.Project?.length === 0,
192-
};
193-
},
194166

167+
//Upon Search, we will get a response of one Project which will be our Searched Projects
168+
//That project will have descendants, which will be the part of Sub-Projects.
169+
170+
let projects = createProjectsArray(t, response?.Projects, searchParams, headerLocale);
171+
//searched Project details
172+
projectDetails.searchedProject['basicDetails'] = projects?.searchedProject?.basicDetails;
173+
projectDetails.searchedProject['details']['projectDetails'] = {applicationDetails : [projects?.searchedProject?.departmentDetails, projects?.searchedProject?.workTypeDetails, projects?.searchedProject?.locationDetails, projects?.searchedProject?.documentDetails]}; //rest categories will come here
174+
projectDetails.searchedProject['details']['financialDetails'] = {applicationDetails : [projects?.searchedProject?.financialDetails]}; //rest categories will come here
175+
176+
if(response?.Projects?.[0]?.descendants) {
177+
projects = createProjectsArray(t, response?.Projects?.[0]?.descendants, searchParams, headerLocale);
178+
//all details of searched project will come here
179+
projectDetails.subProjects?.push(projects?.subProjects);
180+
}
181+
return {
182+
projectDetails : projectDetails,
183+
processInstancesDetails: [],
184+
applicationData: {},
185+
workflowDetails: [],
186+
applicationData:{}
187+
}
188+
},
195189
viewEstimateScreen: async (t, tenantId, estimateNumber) => {
196190

197191

react/libraries/src/utils/date.js

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,40 @@ function getDate(timestamp) {
1717

1818
const monthNames = ["Jan", "Feb", "March", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec"];
1919

20-
export { getDate, monthNames };
20+
/*
21+
Digit.Utils.date.convertDateToEpoch()
22+
* @params dateString date as string
23+
dayStartOrEnd defaults to dayend
24+
25+
//example input format : "2018-10-02"
26+
27+
*/
28+
const convertDateToEpoch = (dateString, dayStartOrEnd = "dayend") => {
29+
try {
30+
const parts = dateString.match(/(\d{4})-(\d{1,2})-(\d{1,2})/);
31+
const DateObj = new Date(Date.UTC(parts[1], parts[2] - 1, parts[3]));
32+
DateObj.setMinutes(DateObj.getMinutes() + DateObj.getTimezoneOffset());
33+
if (dayStartOrEnd === "dayend") {
34+
DateObj.setHours(DateObj.getHours() + 24);
35+
DateObj.setSeconds(DateObj.getSeconds() - 1);
36+
}
37+
return DateObj.getTime();
38+
} catch (e) {
39+
return dateString;
40+
}
41+
};
42+
43+
const convertEpochToDate = (dateEpoch) => {
44+
if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") {
45+
return "NA";
46+
}
47+
const dateFromApi = new Date(dateEpoch);
48+
let month = dateFromApi.getMonth() + 1;
49+
let day = dateFromApi.getDate();
50+
let year = dateFromApi.getFullYear();
51+
month = (month > 9 ? "" : "0") + month;
52+
day = (day > 9 ? "" : "0") + day;
53+
return `${day}/${month}/${year}`;
54+
};
55+
56+
export { getDate, monthNames ,convertDateToEpoch , convertEpochToDate };

react/modules/Project/src/configs/createProjectConfigMUKTA.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ export const createProjectConfigMUKTA = {
3838
"key": "basicDetails_dateOfProposal",
3939
"type": "date",
4040
"disable": false,
41-
"preProcess" : {
42-
"updateDependent" : ["populators.validation.max"]
43-
},
4441
"populators": {
4542
"name": "basicDetails_dateOfProposal",
4643
"validation":{

react/modules/core/README.md

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- TODO: update this -->
1+
22

33
# digit-ui-module-core
44

@@ -61,10 +61,40 @@ with
6161
.filter((opt) => (opt?.hasOwnProperty("active") ? opt.active : true))
6262
6363
```
64+
* Digit.Hooks.Utils.getDefaultLanguage()
65+
66+
```
67+
from 1.8.0 beta version add the following utility method in micro-ui/web/micro-ui-internals/packages/libraries/src/utils/index.js
6468
65-
# Changelog
69+
const getDefaultLanguage = () => {
70+
return `${getLocaleDefault()}_${getLocaleRegion()}`;
71+
};
72+
73+
and add its related functions
74+
75+
```
76+
77+
78+
### Changelog
6679

6780
```bash
81+
1.8.1-beta.6 Resolved duplicacy issue in the Sidebar
82+
1.8.1-beta.5 Fixed Sidebar Path issue
83+
1.8.1-beta.4 Added a null check for homescreen landing issue
84+
1.8.1-beta.3 User profile back button fixes for mobile view
85+
1.8.1-beta.2 User profile Save and change password button fixes for mobile view
86+
1.8.1-beta.1 Republished after merging with Master due to version issues.
87+
1.8.0-beta.16 fixed the hardcoded logout message
88+
1.8.0-beta.15 fixed the sidebar sort order issue
89+
1.8.0-beta.14
90+
1.8.0-beta.13
91+
1.8.0-beta.12
92+
1.8.0-beta.11 republished due to some version issues
93+
1.8.0-beta.10 Constants updated for mgramsewa
94+
1.8.0-beta.9 Updated How It works screen to take header from mdms config and show pdf card only when required
95+
1.8.0-beta.8 redefine addtional component to render only under employee home page
96+
1.8.0-beta.6 added addtional component render for tqm modules
97+
1.8.0 workbench v1.0
6898
1.8.0-beta.5 fix for login screen alignments
6999
1.8.0-beta.4 made the default localisation in globalconfig
70100
1.8.0-beta workbench base version beta release
@@ -91,14 +121,21 @@ with
91121
1.5.28 fixed the route issue for profile screen
92122
```
93123

94-
# Contributors
124+
### Contributors
95125

96126
[jagankumar-egov] [nipunarora-eGov] [Tulika-eGov] [Ramkrishna-egov] [nabeelmd-eGov] [anil-egov] [vamshikrishnakole-wtt-egov]
97127

98-
## Published from DIGIT Core
128+
## Documentation
129+
130+
Documentation Site (https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui)
131+
132+
## Maintainer
133+
134+
- [jagankumar-egov](https://www.github.com/jagankumar-egov)
135+
99136

100-
Digit Dev Repo (<https://github.com/egovernments/Digit-Core/tree/digit-ui-core>)
137+
### Published from DIGIT Frontend
138+
DIGIT Frontend Repo (https://github.com/egovernments/Digit-Frontend/tree/develop)
101139

102-
## License
103140

104-
MIT © [jagankumar-egov](https://github.com/jagankumar-egov)
141+
![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png)

react/modules/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@egovernments/digit-ui-module-core",
3-
"version": "1.7.10",
3+
"version": "1.8.1-beta.6",
44
"license": "MIT",
55
"main": "dist/index.js",
66
"module": "dist/index.modern.js",
@@ -15,7 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@egovernments/digit-ui-components-core": "^0.0.1",
18-
"@egovernments/digit-ui-react-components": "1.7.10",
18+
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
1919
"react": "17.0.2",
2020
"react-dom": "17.0.2",
2121
"react-i18next": "11.16.2",

react/modules/core/src/Module.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { Provider } from "react-redux";
77
import { BrowserRouter as Router } from "react-router-dom";
88
import { DigitApp } from "./App";
99
import SelectOtp from "./pages/citizen/Login/SelectOtp";
10-
10+
import ChangeCity from "./components/ChangeCity";
11+
import ChangeLanguage from "./components/ChangeLanguage";
1112
import { useState } from "react";
1213
import ErrorBoundary from "./components/ErrorBoundaries";
1314
import getStore from "./redux/store";
@@ -110,6 +111,8 @@ export const DigitUI = ({ stateCode, registry, enabledModules, moduleReducers, d
110111

111112
const componentsToRegister = {
112113
SelectOtp,
114+
ChangeCity,
115+
ChangeLanguage
113116
};
114117

115118
export const initCoreComponents = () => {

react/modules/core/src/components/AppModules.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const getTenants = (codes, tenants) => {
99
return tenants.filter((tenant) => codes?.map?.((item) => item.code).includes(tenant.code));
1010
};
1111

12-
export const AppModules = ({ stateCode, userType, modules, appTenants }) => {
12+
export const AppModules = ({ stateCode, userType, modules, appTenants, additionalComponent }) => {
1313
const ComponentProvider = Digit.Contexts.ComponentProvider;
1414
const { path } = useRouteMatch();
1515
const location = useLocation();
@@ -49,7 +49,7 @@ export const AppModules = ({ stateCode, userType, modules, appTenants }) => {
4949
<ChangePassword />
5050
</Route>
5151
<Route>
52-
<AppHome userType={userType} modules={modules} />
52+
<AppHome userType={userType} modules={modules} additionalComponent={additionalComponent} />
5353
</Route>
5454
{/* <Route path={`${path}/user-profile`}> <UserProfile /></Route> */}
5555
</Switch>

0 commit comments

Comments
 (0)