Skip to content

Commit

Permalink
Merge pull request #970 from abhijniua/Dev-2.0
Browse files Browse the repository at this point in the history
Resolved issue of documents data, change button, pet drop down and version changed
  • Loading branch information
rahul01987 authored Mar 5, 2024
2 parents b9fb5ac + 3bff69a commit e67511f
Show file tree
Hide file tree
Showing 15 changed files with 147 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@upyog/digit-ui-module-receipts":"1.7.0-beta.3",
"@upyog/digit-ui-module-tl":"1.7.0-beta.7",
"@upyog/digit-ui-module-ws":"^1.7.0-beta.10",
"@upyog-niua/upyog-ui-module-ptr":"1.0.6",
"@upyog-niua/upyog-ui-module-ptr":"1.0.7",
"@upyog/digit-ui-module-commonpt":"1.7.0-beta.4",
"http-proxy-middleware": "^1.0.5",
"react": "17.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@upyog/digit-ui-module-ws": "^1.7.0-beta.10",
"@upyog/digit-ui-module-bills": "^1.7.0-beta.3",
"@upyog/digit-ui-module-commonpt": "1.7.0-beta.4",
"@upyog-niua/upyog-ui-module-ptr":"1.0.6",
"@upyog-niua/upyog-ui-module-ptr":"1.0.7",
"http-proxy-middleware": "^1.0.5",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
6 changes: 4 additions & 2 deletions frontend/micro-ui/web/micro-ui-internals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"packages/modules/commonPt",
"packages/modules/dss",
"packages/modules/pt",
"packages/modules/obps"
"packages/modules/obps",
"packages/modules/ptr"



],
Expand Down Expand Up @@ -63,7 +65,7 @@
"buildD:mcollect": "cd packages/modules/mCollect && yarn build",
"buildD:receipts": "cd packages/modules/receipts && yarn build",
"buildD:tl": "cd packages/modules/tl && yarn build",
"buildD:ptr": "cd packages/modules/ptr && yarn build",
"build:ptr": "cd packages/modules/ptr && yarn build",
"buildD:hrms": "cd packages/modules/hrms && yarn build",
"build:obps": "cd packages/modules/obps && yarn build",
"buildD:engagement": "cd packages/modules/engagement && yarn build",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@upyog-niua/upyog-ui-module-ptr",
"version": "1.0.6",
"author": "Shivank Shukla & Abhijeet Verma",
"version": "1.0.7",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.modern.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { Link } from "react-router-dom";

const PTRSearchApplication = ({tenantId, isLoading, t, onSubmit, data, count, setShowToast }) => {

const isMobile = window.Digit.Utils.browser.isMobile();
const { register, control, handleSubmit, setValue, getValues, reset, formState } = useForm({
defaultValues: {
Expand Down Expand Up @@ -34,9 +35,41 @@
i18nKey: "WF_PTR_INWORKFLOW"
},
]

const stateId = Digit.ULBService.getStateId();


const { data: Menu } = Digit.Hooks.ptr.usePTRPetMDMS(stateId, "PetService", "PetType");
// const { data: Breed_Type } = Digit.Hooks.ptr.useBreedTypeMDMS(stateId, "PetService", "BreedType"); // hooks for breed type

let menu = [];


// let breed_type = [];


Menu &&
Menu.map((petone) => {
menu.push({ i18nKey: `PTR_PET_${petone.code}`, code: `${petone.code}`, value: `${petone.name}` });
});

// Breed_Type &&
// Breed_Type.map((breedss) => {
// if (breedss.PetType == menu?.code) {
// breed_type.push({
// i18nKey: `PTR_BREED_TYPE_${breedss.code}`,
// code: `${breedss.code}`,
// value: `${breedss.name}`
// });
// }

// });




const GetCell = (value) => <span className="cell-text">{value}</span>;

const columns = useMemo( () => ([

{
Expand Down Expand Up @@ -124,8 +157,41 @@
</SearchField>
<SearchField>
<label>{t("PTR_SEARCH_PET_TYPE")}</label>
<TextInput name="petType" inputRef={register({})} />
{/* <TextInput name="petType" inputRef={register({})} /> */}
<Controller
control={control}
name="petType"
render={(props) => (
<Dropdown
selected={props.value}
select={props.onChange}
onBlur={props.onBlur}
option={menu}
optionKey="i18nKey"
t={t}
disable={false}
/>
)}
/>
</SearchField>
{/* <SearchField>
<label>{t("PTR_SEARCH_BREED_TYPE")}</label>
<Controller
control={control}
name="breedType"
render={(props) => (
<Dropdown
selected={props.value}
select={props.onChange}
onBlur={props.onBlur}
option={breed_type}
optionKey="i18nKey"
t={t}
disable={false}
/>
)}
/>
</SearchField> */}
<SearchField>
<label>{t("PTR_OWNER_MOBILE_NO")}</label>
<MobileNumber
Expand All @@ -150,29 +216,7 @@
//maxlength={10}
/>
<CardLabelError>{formState?.errors?.["mobileNumber"]?.message}</CardLabelError>
</SearchField>
<SearchField>
<label>{t("PTR_SEARCH_BREED_TYPE")}</label>
<TextInput name="breedType" inputRef={register({})} />
</SearchField>
<SearchField>
<label>{t("PTR_PET_APPLICATION_STATUS")}</label>
<Controller
control={control}
name="status"
render={(props) => (
<Dropdown
selected={props.value}
select={props.onChange}
onBlur={props.onBlur}
option={applicationStatuses}
optionKey="i18nKey"
t={t}
disable={false}
/>
)}
/>
</SearchField>
</SearchField>
<SearchField>
<label>{t("PTR_FROM_DATE")}</label>
<Controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const SearchFields = ({register, control, reset, tenantId, t, formState, setShow
fromDate: "",
toDate: "",
mobileNumber:"",
petType:"",
status: "",
creationReason: "",
offset: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ const PTRCitizenDetails
value={applicantName}
onChange={setOwnerName}
ValidationRequired = {true}
{...{ required: true, pattern: "[A-Za-z]*", type: "text", title: t("Only alphabets are allowed") }}
{...(validation = {
isRequired: true,
pattern: "^[a-zA-Z ]+$",
type: "tel",
title: t("PT_NAME_ERROR_MESSAGE"),
})}


/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,12 @@ const PTRCitizenPet

/>
<div>
{Math.floor(petAge / 12)} {Math.floor(petAge / 12) === 1 ? 'PTR_YEAR' : 'PTR_YEARS'}&nbsp;
{petAge % 12} {petAge % 12 === 1 ? 'PTR_MONTH' : 'PTR_MONTHS'}
</div>
{Math.floor(petAge / 12)}&nbsp;&nbsp;
{Math.floor(petAge / 12) === 1 ? "YEAR" : "YEARS"}
&nbsp;&nbsp;
{petAge % 12}&nbsp;&nbsp;
{petAge % 12 === 1 ? "MONTH" : "MONTHS"}
</div>

<br></br>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,14 @@
control={control}
name={"emailId"}
defaultValue={owner?.emailId}
rules={{ validate: (e) => ((e && /^[^\s@]+@[^\s@]+$/.test(e)) || !e ? true : t("ERR_DEFAULT_INPUT_FIELD_MSG")) }}
rules={{
validate: (value) => {
const normalized = value.trim().toLowerCase();
const emailRegex = /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;

return emailRegex.test(normalized) || 'TL_EMAIL_ID_ERROR_MESSAGE';
}
}}
render={(props) => (
<TextInput
value={props.value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,14 @@ const OwnerForm = (_props) => {

</LabelFieldPair>
<div style={{textAlign: 'center'}}>
{Math.floor(watch('petAge') / 12)}
{Math.floor(watch('petAge') / 12) === 1 ? 'PTR_YEAR' : 'PTR_YEARS'}
&nbsp;
{watch('petAge') % 12}
{watch('petAge') % 12 === 1 ? 'PTR_MONTH' : 'PTR_MONTHS'}
</div>

{Math.floor(watch('petAge') / 12)}&nbsp;
{Math.floor(watch('petAge') / 12) === 1 ? "YEAR" : "YEARS"}
&nbsp;&nbsp;
{watch('petAge') % 12}&nbsp;
{watch('petAge') % 12 === 1 ? "MONTH" : "MONTHS"}

</div>
<br></br>
<CardLabelError style={errorStyle}>{localFormState.touched.petAge ? errors?.petAge?.message : ""}</CardLabelError>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,19 @@ function PTRSelectDocument({

}) {
const filteredDocument = documents?.filter((item) => item?.documentType?.includes(doc?.code))[0];
console.log("filetetetetet",filteredDocument);

const tenantId = Digit.ULBService.getCurrentTenantId();
const [selectedDocument, setSelectedDocument] = useState(
filteredDocument
? { ...filteredDocument, active: filteredDocument?.status === "ACTIVE", code: filteredDocument?.documentType }
? { ...filteredDocument, active: doc?.active === true, code: filteredDocument?.documentType }
: doc?.dropdownData?.length === 1
? doc?.dropdownData[0]
: {}
);

const [file, setFile] = useState(null);
const [uploadedFile, setUploadedFile] = useState(() => filteredDocument?.fileStoreId || null);
const [uploadedFile, setUploadedFile] = useState(() => filteredDocument?.filestoreId || null);

const handlePTRSelectDocument = (value) => setSelectedDocument(value);

Expand Down Expand Up @@ -215,6 +216,3 @@ function PTRSelectDocument({
}

export default PTRSelectProofIdentity;



Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const PTRServiceDoc = ({ t, config, onSelect, userType, formData }) => {
<CardText className={"primaryColor"}>{t("PTR_DOC_REQ_SCREEN_SUB_TEXT")}</CardText>
<CardSubHeader>{t("PTR_DOC_REQ_SCREEN_LABEL")}</CardSubHeader>
<CardText className={"primaryColor"}>{t("PTR_DOC_REQ_SCREEN_LABEL_TEXT")}</CardText>
<CardText style={{color: 'red'}}>{t('PTR_PDF_AND_JPG_BOTH_FORMAT_ACCEPTED_IN_DOCUMENT_UPLOAD')}</CardText>

<div>
{isLoading && <Loader />}
{Array.isArray(docs)
Expand Down
Loading

0 comments on commit e67511f

Please sign in to comment.