Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated versions #24

Open
wants to merge 3 commits into
base: develop-react
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion react/components-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
],
"dependencies": {
"@egovernments/digit-ui-css": "1.2.176",
"@egovernments/digit-ui-libraries": "1.7.10",
"@egovernments/digit-ui-libraries": "1.8.1-beta.1",

"@egovernments/digit-ui-svg-components": "0.0.8",
"@googlemaps/js-api-loader": "1.13.10",
Expand Down
2 changes: 1 addition & 1 deletion react/components-core/src/atoms/BodyContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";

const BodyContainer = (props) => {
return (
<div className={`digit-body ${props?.className ? props?.className : ""}`} style={props?.style}>
<div className={`body-container ${props?.className ? props?.className : ""}`} style={props?.style}>
{props.children}
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions react/components-core/src/hoc/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ const Modal = ({
style={popupModuleActionBarStyles}
>
{actionCancelLabel ? (
<Button variation="digit-action-cancel" theme="border" label={actionCancelLabel} onClick={actionCancelOnSubmit} style={style} />
<Button textStyles={{width:"100%"}} variation="digit-action-cancel" theme="border" label={actionCancelLabel} onClick={actionCancelOnSubmit} style={style} />
) : null}
{!hideSubmit ? (
<Button label={actionSaveLabel} onClick={actionSaveOnSubmit} formId={formId} isDisabled={isDisabled} style={style} />
<Button textStyles={{width:"100%"}} label={actionSaveLabel} onClick={actionSaveOnSubmit} formId={formId} isDisabled={isDisabled} style={style} />
) : null}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions react/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"start": "react-scripts start"
},
"devDependencies": {
"@egovernments/digit-ui-libraries": "1.7.10",
"@egovernments/digit-ui-module-core": "1.7.10",
"@egovernments/digit-ui-libraries": "1.8.1-beta.1",
"@egovernments/digit-ui-module-core": "1.8.1-beta.6",
"@egovernments/digit-ui-module-common": "1.7.10",
"@egovernments/digit-ui-module-sample": "0.0.1",
"@egovernments/digit-ui-module-project": "0.3.4",
"@egovernments/digit-ui-react-components": "1.7.10",
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
"@egovernments/digit-ui-svg-components": "0.0.8",
"@egovernments/digit-ui-components-core": "0.0.1",
"http-proxy-middleware": "^1.0.5",
Expand Down
48 changes: 45 additions & 3 deletions react/libraries/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
# digit-ui-libraries

> Made with @egovernments/create-ui-library

# digit-ui-svg-components

## Install

```bash
npm install --save @egovernments/digit-ui-libraries
```

## Limitation

```bash
This Package is more specific to DIGIT-UI's can be used across mission's
```

## Usage

After adding the dependency make sure you have this dependency in

```bash
frontend/micro-ui/web/package.json
```

```json
"@egovernments/digit-ui-libraries":"1.8.0",
```

then navigate to App.js

```bash
frontend/micro-ui/web/src/App.js
```


## Usage

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

### Changelog

```bash
1.8.1-beta.1 Republished after merging with Master due to version issues.
1.8.0 Released as part of workbench v1.0
```

### Published from DIGIT Frontend
DIGIT Frontend Repo (https://github.com/egovernments/Digit-Frontend/tree/develop)

### Contributors

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

## License

MIT © [](https://github.com/)
MIT © [jagankumar-egov](https://github.com/jagankumar-egov)


![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png)
2 changes: 1 addition & 1 deletion react/libraries/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-libraries",
"version": "1.7.10",
"version": "1.8.1-beta.1",
"main": "dist/index.js",
"module": "dist/index.modern.js",
"source": "src/index.js",
Expand Down
3 changes: 2 additions & 1 deletion react/libraries/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Enums from "./enums/index";
import mergeConfig from "./config/mergeConfig";
import { useStore } from "./services/index";
import { initI18n } from "./translations/index";
import { Request } from "./services/atoms/Utils/Request";

import { Storage, PersistantStorage } from "./services/atoms/Utils/Storage";
import { UploadServices } from "./services/atoms/UploadServices";
Expand Down Expand Up @@ -87,4 +88,4 @@ const initLibraries = () => {
});
};

export { initLibraries, Enums, Hooks, subFormRegistry };
export { initLibraries, Enums, Hooks, subFormRegistry ,Request};
74 changes: 34 additions & 40 deletions react/libraries/src/services/molecules/Works/Search.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import cloneDeep from "lodash/cloneDeep";
import _ from "lodash";
import { WorksService } from "../../elements/Works";
import HrmsService from "../../elements/HRMS";
import { convertEpochToDate } from "../../../utils/pt";

const createProjectsArray = (t, project, searchParams, headerLocale) => {
Expand Down Expand Up @@ -129,7 +130,6 @@ const createProjectsArray = (t, project, searchParams, headerLocale) => {
return totalProjects;
}


export const WorksSearch = {
searchEstimate: async (tenantId="pb.jalandhar", filters = {} ) => {

Expand All @@ -147,51 +147,45 @@ export const WorksSearch = {
const response = await WorksService?.loiSearch({tenantId,filters})
return response?.letterOfIndents
},
viewProjectDetailsScreen: async (
t,
tenantId,
searchParams,
filters = { limit: 10, offset: 0, includeAncestors: true, includeDescendants: true },
headerLocale
) => {
viewProjectDetailsScreen: async(t,tenantId, searchParams, filters = {limit : 10, offset : 0, includeAncestors : true, includeDescendants : true}, headerLocale)=> {
const response = await WorksService?.searchProject(tenantId, searchParams, filters);


//Categoring the response into an object of searched project and its sub-projects ( if any )
//searched projects will have basic details, project details and financial details
//subprojects will be shown in a table similar to what create project has
let projectDetails = {
searchedProject: {
basicDetails: {},
details: {
projectDetails: [],
searchedProject : {
basicDetails : {},
details : {
projectDetails : [],
financialDetails : []
}
},
},
};

if (response?.Project) {
let projects = createProjectsArray(t, response?.Project, searchParams, headerLocale);

//searched Project details
projectDetails.searchedProject["basicDetails"] = projects?.searchedProject?.basicDetails;
projectDetails.searchedProject["details"]["projectDetails"] = {
applicationDetails: [
projects?.searchedProject?.headerDetails,
projects?.searchedProject?.projectDetails,
projects?.searchedProject?.locationDetails,
projects?.searchedProject?.documentDetails,
],
}; //rest categories will come here
subProjects : []
}

return {
projectDetails: response?.Project ? projectDetails : [],
response: response?.Project,
processInstancesDetails: [],
applicationData: {},
workflowDetails: [],
applicationData: {},
isNoDataFound: response?.Project?.length === 0,
};
},

//Upon Search, we will get a response of one Project which will be our Searched Projects
//That project will have descendants, which will be the part of Sub-Projects.

let projects = createProjectsArray(t, response?.Projects, searchParams, headerLocale);
//searched Project details
projectDetails.searchedProject['basicDetails'] = projects?.searchedProject?.basicDetails;
projectDetails.searchedProject['details']['projectDetails'] = {applicationDetails : [projects?.searchedProject?.departmentDetails, projects?.searchedProject?.workTypeDetails, projects?.searchedProject?.locationDetails, projects?.searchedProject?.documentDetails]}; //rest categories will come here
projectDetails.searchedProject['details']['financialDetails'] = {applicationDetails : [projects?.searchedProject?.financialDetails]}; //rest categories will come here

if(response?.Projects?.[0]?.descendants) {
projects = createProjectsArray(t, response?.Projects?.[0]?.descendants, searchParams, headerLocale);
//all details of searched project will come here
projectDetails.subProjects?.push(projects?.subProjects);
}
return {
projectDetails : projectDetails,
processInstancesDetails: [],
applicationData: {},
workflowDetails: [],
applicationData:{}
}
},
viewEstimateScreen: async (t, tenantId, estimateNumber) => {


Expand Down
38 changes: 37 additions & 1 deletion react/libraries/src/utils/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,40 @@ function getDate(timestamp) {

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

export { getDate, monthNames };
/*
Digit.Utils.date.convertDateToEpoch()
* @params dateString date as string
dayStartOrEnd defaults to dayend

//example input format : "2018-10-02"

*/
const convertDateToEpoch = (dateString, dayStartOrEnd = "dayend") => {
try {
const parts = dateString.match(/(\d{4})-(\d{1,2})-(\d{1,2})/);
const DateObj = new Date(Date.UTC(parts[1], parts[2] - 1, parts[3]));
DateObj.setMinutes(DateObj.getMinutes() + DateObj.getTimezoneOffset());
if (dayStartOrEnd === "dayend") {
DateObj.setHours(DateObj.getHours() + 24);
DateObj.setSeconds(DateObj.getSeconds() - 1);
}
return DateObj.getTime();
} catch (e) {
return dateString;
}
};

const convertEpochToDate = (dateEpoch) => {
if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") {
return "NA";
}
const dateFromApi = new Date(dateEpoch);
let month = dateFromApi.getMonth() + 1;
let day = dateFromApi.getDate();
let year = dateFromApi.getFullYear();
month = (month > 9 ? "" : "0") + month;
day = (day > 9 ? "" : "0") + day;
return `${day}/${month}/${year}`;
};

export { getDate, monthNames ,convertDateToEpoch , convertEpochToDate };
2 changes: 1 addition & 1 deletion react/modules/Project/src/Module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CitizenInfoLabel, Loader } from "@egovernments/digit-ui-react-components";
import { CitizenInfoLabel, Loader } from "@egovernments/digit-ui-components-core";
import React, { useEffect } from "react";
import { useRouteMatch } from "react-router-dom";
import ProjectCard from "./components/ProjectCard";
Expand Down
3 changes: 2 additions & 1 deletion react/modules/Project/src/components/ProjectCard.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { EmployeeModuleCard, PTIcon } from "@egovernments/digit-ui-react-components";
import { EmployeeModuleCard } from "@egovernments/digit-ui-react-components";
import {PTIcon } from "@egovernments/digit-ui-components-core";

const ProjectCard = () => {
const { t } = useTranslation();
Expand Down
4 changes: 2 additions & 2 deletions react/modules/Project/src/components/SelectGeoLocation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Fragment, useState } from "react";
import {LocationSearch, Modal} from "@egovernments/digit-ui-react-components";
import { CardLabel, LabelFieldPair, TextInput} from "@egovernments/digit-ui-components-core";
import {LocationSearch} from "@egovernments/digit-ui-react-components";
import { CardLabel, LabelFieldPair, TextInput, Modal} from "@egovernments/digit-ui-components-core";
import { useTranslation } from "react-i18next";

const SelectGeoLocation = ({ onSelect, config, formData }) => {
Expand Down
Loading