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

DUCE-10 :: added country code and validation for MOZ and ET #1246

Open
wants to merge 37 commits into
base: d1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a09bf63
added country code and validation for MOZ and ET
hridya-egov Aug 8, 2024
6169016
mobile number dropdown for citizen login working
hridya-egov Aug 8, 2024
f8c13ee
css alignment for mobile field fixed
hridya-egov Aug 8, 2024
3d267fb
Merge branch 'develop' of https://github.com/egovernments/DIGIT-Front…
hridya-egov Aug 8, 2024
805a6e1
location dropwdown fixed, otp and continue button on locationselectio…
hridya-egov Aug 13, 2024
dfe83a6
Merge branch 'develop' of https://github.com/egovernments/DIGIT-Front…
hridya-egov Aug 13, 2024
0f00245
continue button and upload file for the complaint detail screen fixed
hridya-egov Aug 13, 2024
6c3bd3c
to fix css issues,changed the import for components
hridya-egov Aug 19, 2024
50a873e
changed the action to apply
hridya-egov Aug 20, 2024
a00cef5
removed user object and added citizen object
hridya-egov Aug 20, 2024
269a0ee
fixed some css related
jagankumar-egov Aug 22, 2024
8493573
updated to latest css
jagankumar-egov Aug 22, 2024
a493ed7
dropdown for mobile number and pattern validation
hridya-egov Aug 22, 2024
9e0eb39
enabled core ui build (#1316)
jagankumar-egov Aug 22, 2024
103e68f
updated the pattern for country code and changed the pattern validati…
hridya-egov Aug 22, 2024
efd0acc
resolved conflct
hridya-egov Aug 22, 2024
fa88a4f
Merge pull request #1317 from egovernments/hrms
jagankumar-egov Aug 22, 2024
87e1d51
Merge branch 'develop' of https://github.com/egovernments/DIGIT-Front…
hridya-egov Aug 22, 2024
3adcd14
updated the changes
hridya-egov Aug 22, 2024
01cda32
Merge branch 'pgr_updates' of https://github.com/egovernments/DIGIT-F…
hridya-egov Aug 22, 2024
ac9cd07
clean up module compilation
jagankumar-egov Aug 22, 2024
81bc5d2
added dashboard card
jagankumar-egov Aug 22, 2024
f62bf72
"@egovernments/digit-ui-module-utilities":"1.0.1-beta.39",
jagankumar-egov Aug 22, 2024
087e561
fix on utilities
jagankumar-egov Aug 22, 2024
bf54d6c
build fix
jagankumar-egov Aug 23, 2024
a13b44b
updated css versions
jagankumar-egov Aug 23, 2024
210eb0e
added new icons (#1323)
Swathi-eGov Aug 23, 2024
96c798f
SN itegration with tenant in URL (#1322)
nabeelmd-eGov Aug 23, 2024
9a0be96
Merge branch 'develop' of https://github.com/egovernments/DIGIT-Front…
hridya-egov Aug 23, 2024
7e0c537
reverted back the usertype changes and enabled submit button
hridya-egov Aug 23, 2024
ff57cd0
reverted back the usertype changes and enabled submit button
hridya-egov Aug 23, 2024
1a03164
mobile code dropdown for hrms inbox
hridya-egov Aug 23, 2024
a4a03ba
updates in countrycode validation
hridya-egov Aug 23, 2024
7a17f04
hrms changes updated
jagankumar-egov Aug 26, 2024
f66b9be
updated some package versions
jagankumar-egov Aug 26, 2024
a0f315c
updated the pattern for et
hridya-egov Aug 26, 2024
b36dbe3
reverted the core ui changes
jagankumar-egov Aug 26, 2024
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
11 changes: 10 additions & 1 deletion micro-ui/web/micro-ui-internals/example/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,20 @@
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<script src="%REACT_APP_GLOBAL%"></script>

<!-- Adding custom style directly in the HTML -->

<style>
.custom-margin-bottom .citizen-card-input--front {
margin-bottom: 0 !important;
}
</style>


</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>

</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ export const Complaint = {
uploadedImages,
mobileNumber,
name,
user,
}) => {
const tenantId = Digit.ULBService.getCurrentTenantId();
const defaultData = {
service: {
tenantId: cityCode,
active :true,
serviceCode: complaintType,
description: description,
additionalDetail: {},
Expand All @@ -36,15 +38,18 @@ export const Complaint = {
},
geoLocation: {},
},
user: user,
},
workflow: {
action: "APPLY",
verificationDocuments: uploadedImages,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this we shouldnt comment @hridya-egov

// action: "APPLY",
// verificationDocuments: uploadedImages,
action: "CREATE", assignes: [], hrmsAssignes: [], comments: ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check here

},
};


if (Digit.SessionStorage.get("user_type") === "employee") {
defaultData.service.citizen = {
defaultData.service.user = {
name: name,
type: "CITIZEN",
mobileNumber: mobileNumber,
Expand All @@ -59,6 +64,7 @@ export const Complaint = {
tenantId: tenantId,
};
}

const response = await Digit.PGRService.create(defaultData, cityCode);
return response;
},
Expand All @@ -79,8 +85,7 @@ export const Complaint = {
: null;

if (!uploadedDocument) complaintDetails.workflow.verificationDocuments = [];

//TODO: get tenant id

const response = await Digit.PGRService.update(complaintDetails, tenantId);
return response;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
BackButton,
CitizenHomeCard,
CitizenInfoLabel,
Loader,
Expand Down Expand Up @@ -94,8 +93,8 @@ const CitizenHome = ({
<div className="citizen-all-services-wrapper">
{location.pathname.includes(
"sanitation-ui/citizen/all-services"
) ? null : (
<BackButton />
// ) ? null : (
// <BackButton />
)}
<div className="citizenAllServiceGrid">
{moduleArray
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const LanguageSelection = () => {
const texts = useMemo(
() => ({
header: t("CS_COMMON_CHOOSE_LANGUAGE"),
submitBarLabel: t("CORE_COMMON_CONTINUE"),
submitBarLabel: t("CORE_COMMON_CONTINUE"),
}),
[t]
);
Expand Down Expand Up @@ -41,6 +41,13 @@ const LanguageSelection = () => {
<CardHeader>{t("CS_COMMON_CHOOSE_LANGUAGE")}</CardHeader>
<RadioButtons {...RadioButtonProps} />
</PageBasedInput>
<style>
{`
.digit-submit-bar-container {
display: none;
}
`}
</style>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { BackButton, CardHeader, CardLabelError, PageBasedInput, SearchOnRadioButtons } from "@egovernments/digit-ui-components";
import { CardHeader, CardLabelError, PageBasedInput, SearchOnRadioButtons } from "@egovernments/digit-ui-components";
import React, { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { useHistory, useLocation } from "react-router-dom";

const LocationSelection = () => {
const LocationSelection = () => {
const { t } = useTranslation();
const history = useHistory();
const location = useLocation();
Expand Down Expand Up @@ -51,12 +51,19 @@ const LocationSelection = () => {
<loader />
) : (
<div className="selection-card-wrapper">
<BackButton />
{/* <BackButton /> */}
<PageBasedInput texts={texts} onSubmit={onSubmit} className="location-selection-container">
<CardHeader>{t("CS_COMMON_CHOOSE_LOCATION")}</CardHeader>
<SearchOnRadioButtons {...RadioButtonProps} placeholder={t("COMMON_TABLE_SEARCH")} />
{showError ? <CardLabelError>{t("CS_COMMON_LOCATION_SELECTION_ERROR")}</CardLabelError> : null}
</PageBasedInput>
<style>
{`
.digit-submit-bar-container {
display: none;
}
`}
</style>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const PGRConstants = {
INDIA: {
countryCode: '+91',
regex: /^[6-9]\d{9}$/,
},
MOZ: {
countryCode: '+258',
regex: /^[0-9]\d{8}$/,
},
ET: {
countryCode: '+251',
regex: /^[0-9]\d{9}$/,
},


};
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
import { FormStep } from "@egovernments/digit-ui-components";
import React from "react";
import React, { useState } from "react";
import { PGRConstants } from "./PGRConstants";

const SelectMobileNumber = ({ t, onSelect, showRegisterLink, mobileNumber, onMobileChange, config, canSubmit }) => {
const [selectedCountryCode, setSelectedCountryCode] = useState(PGRConstants.INDIA.countryCode);

const countryOptions = Object.values(PGRConstants).map(({ countryCode }, index) => (
<option key={index} value={countryCode}>
{countryCode}
</option>
));

const getPhonePattern = (selectedCountryCode) => {
return Object.values(PGRConstants).find(e => e.countryCode === selectedCountryCode)?.regex;
};

const validation = {
required: true,
pattern: getPhonePattern(selectedCountryCode),
};

return (
<div className="custom-margin-bottom">
<FormStep
isDisabled={!(mobileNumber.length === 10 && canSubmit)}
onSelect={onSelect}
config={config}
t={t}
componentInFront="+91"
componentInFront={
<select value={selectedCountryCode} onChange={(e) => setSelectedCountryCode(e.target.value)}>
{countryOptions}
</select>
}
onChange={onMobileChange}
value={mobileNumber}
validation={validation}
></FormStep>
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CardText, CardLabelError, FormStep, OTPInput } from "@egovernments/digit-ui-components";
import { CardLabelError, CardText, FormStep, OTPInput } from "@egovernments/digit-ui-react-components";
import React, { Fragment, useState } from "react";
import useInterval from "../../../hooks/useInterval";

Expand Down Expand Up @@ -48,4 +48,4 @@ const SelectOtp = ({ config, otp, onOtpChange, onResend, onSelect, t, error, use
);
};

export default SelectOtp;
export default SelectOtp;
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { AppContainer, BackButton ,Toast} from "@egovernments/digit-ui-components";
import React, { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Route, Switch, useHistory, useLocation, useRouteMatch } from "react-router-dom";
import { loginSteps } from "./config";
import { useTranslation } from "react-i18next";
import { Route, Switch, useHistory, useLocation, useRouteMatch } from "react-router-dom";
import { loginSteps } from "./config";
import SelectMobileNumber from "./SelectMobileNumber";
import SelectName from "./SelectName";
import SelectOtp from "./SelectOtp";
import SelectName from "./SelectName";
import SelectOtp from "./SelectOtp";

const TYPE_REGISTER = { type: "register" };
const TYPE_LOGIN = { type: "login" };
Expand All @@ -31,20 +31,20 @@ const getFromLocation = (state, searchParams) => {
};

const Login = ({ stateCode, isUserRegistered = true }) => {
const { t } = useTranslation();
const location = useLocation();
const { path, url } = useRouteMatch();
const { t } = useTranslation();
const location = useLocation();
const { path, url } = useRouteMatch();
const history = useHistory();
const [user, setUser] = useState(null);
const [error, setError] = useState(null);
const [isOtpValid, setIsOtpValid] = useState(true);
const [tokens, setTokens] = useState(null);
const [params, setParmas] = useState(isUserRegistered ? {} : location?.state?.data);
const [errorTO, setErrorTO] = useState(null);
const searchParams = Digit.Hooks.useQueryParams();
const [isOtpValid, setIsOtpValid] = useState(true);
const [tokens, setTokens] = useState(null);
const [params, setParmas] = useState(isUserRegistered ? {} : location?.state?.data);
const [errorTO, setErrorTO] = useState(null);
const searchParams = Digit.Hooks.useQueryParams();
const [canSubmitName, setCanSubmitName] = useState(false);
const [canSubmitOtp, setCanSubmitOtp] = useState(true);
const [canSubmitNo, setCanSubmitNo] = useState(true);
const [canSubmitOtp, setCanSubmitOtp] = useState(true);
const [canSubmitNo, setCanSubmitNo] = useState(true);

useEffect(() => {
let errorTimeout;
Expand Down Expand Up @@ -230,10 +230,11 @@ const Login = ({ stateCode, isUserRegistered = true }) => {
};

return (
<div className="citizen-form-wrapper">
<Switch>
<AppContainer>
<BackButton />
<div className="citizen-form-wrapper">
<Switch>
<AppContainer>
{/* <BackButton /> */}
<div>
<Route path={`${path}`} exact>
<SelectMobileNumber
onSelect={selectMobileNumber}
Expand All @@ -245,25 +246,30 @@ const Login = ({ stateCode, isUserRegistered = true }) => {
t={t}
/>
</Route>
<Route path={`${path}/otp`}>
<SelectOtp
</div>,
<div>
<Route path={`${path}/otp`}>
<SelectOtp
config={{ ...stepItems[1], texts: { ...stepItems[1].texts, cardText: `${stepItems[1].texts.cardText} ${params.mobileNumber || ""}` } }}
onOtpChange={handleOtpChange}
onResend={resendOtp}
onSelect={selectOtp}
otp={params.otp}
error={isOtpValid}
canSubmit={canSubmitOtp}
t={t}
/>
</Route>
otp={params.otp}
error={isOtpValid}
canSubmit={canSubmitOtp}
t={t}
/>
</Route>
</div>,
<div>
<Route path={`${path}/name`}>
<SelectName config={stepItems[2]} onSelect={selectName} t={t} isDisabled={canSubmitName} />
<SelectName onSelect={selectName} t={t} isDisabled={canSubmitName} />
</Route>
{error && <Toast type={"error"} label={error} onClose={() => setError(null)} />}
</div>,
{error && <Toast type={"error"} label={error} onClose={() => setError(null)} />}
</AppContainer>
</Switch>
</div>
</Switch>
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const PGRConstants = {
INDIA: {
countryCode: '+91',
regex: /^[6-9]\d{9}$/,
},
MOZ: {
countryCode: '+258',
regex: /^[0-9]\d{8}$/,
},
ET: {
countryCode: '+251',
regex: /^[0-9]\d{9}$/,
},


};
Loading