Skip to content

Commit

Permalink
MOSIP-32711: Ui fixes in request policy (#410)
Browse files Browse the repository at this point in the history
* MOSIP-32711: Ui fixes in request policy

Signed-off-by: SwethaKrish4 <[email protected]>

* MOSIP-32711: Ui fixes in request policy

Signed-off-by: SwethaKrish4 <[email protected]>

* MOSIP-32711: Ui fixes in request policy

Signed-off-by: SwethaKrish4 <[email protected]>

* MOSIP-32711: Ui fixes in request policy

Signed-off-by: SwethaKrish4 <[email protected]>

---------

Signed-off-by: SwethaKrish4 <[email protected]>
  • Loading branch information
SwethaKrish4 authored Jun 4, 2024
1 parent 76c1f04 commit ee2736f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 68 deletions.
21 changes: 5 additions & 16 deletions pmp-reactjs-ui/src/pages/policies/RequestPolicy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { getPartnerManagerUrl, getPolicyManagerUrl, handleServiceErrors, moveToPolicies } from '../../utils/AppUtils';
import { getPartnerManagerUrl, getPolicyManagerUrl, handleServiceErrors, moveToPolicies, getPartnerTypeDescription } from '../../utils/AppUtils';
import { HttpService } from '../../services/HttpService';
import LoadingIcon from "../common/LoadingIcon";
import ErrorMessage from "../common/ErrorMessage";
Expand Down Expand Up @@ -62,10 +62,6 @@ function RequestPolicy() {

const createPartnerIdDropdownData = (fieldName, dataList) => {
let dataArr = [];
dataArr.push({
fieldCode: "",
fieldValue: ""
});
dataList.forEach(item => {
let alreadyAdded = false;
dataArr.forEach(item1 => {
Expand All @@ -85,11 +81,6 @@ function RequestPolicy() {

const createPoliciesDropdownData = (fieldName, dataList) => {
let dataArr = [];
dataArr.push({
fieldCode: "",
fieldValue: "",
fieldDescription: ""
});
dataList.forEach(item => {
let alreadyAdded = false;
dataArr.forEach(item1 => {
Expand All @@ -113,18 +104,17 @@ function RequestPolicy() {
// Find the selected partner data
const selectedPartner = partnerData.find(item => item.partnerId === selectedValue);
if (selectedPartner) {
setPartnerType(selectedPartner.partnerType);
setPartnerType(getPartnerTypeDescription(selectedPartner.partnerType, t));
setPolicyGroupName(selectedPartner.policyGroupName);
setPolicyName("");
await getListofPolicies(selectedPartner.policyGroupName);
}
};

const onChangePolicyName = (fieldName, selectedValue) => {
setPolicyId(selectedValue);
const selectedPolicy = policiesDropdownData.find(item => item.fieldValue === selectedValue);
if (selectedPolicy) {
setPolicyName(selectedPolicy.fieldCode);
setPolicyId(selectedValue);
}
};

Expand Down Expand Up @@ -232,7 +222,7 @@ function RequestPolicy() {
)}
<div className="flex-col">
<div className="flex items-start space-x-3">
<img src={backArrow} alt="" onClick={() => moveToHome()} className="mt-[1%] cursor-pointer" />
<img src={backArrow} alt="" onClick={() => moveToPolicies(navigate)} className="mt-[1%] cursor-pointer" />
<div className="flex-col">
<h1 className="font-semibold text-xl text-dark-blue">{t('requestPolicy.requestPolicy')}</h1>
<div className="flex space-x-1">
Expand Down Expand Up @@ -289,8 +279,7 @@ function RequestPolicy() {
onDropDownChangeEvent={onChangePolicyName}
fieldNameKey='requestPolicy.policyName*'
placeHolderKey='requestPolicy.selectPolicyName'
selectedDropdownValue={policyName}
searchKey='commons.search'
searchKey='commons.search'
styleSet={styleForSearch}>
</DropdownWithSearchComponent>
</div>
Expand Down
12 changes: 4 additions & 8 deletions pmp-reactjs-ui/src/pages/policies/RequestPolicyConfirmation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { getUserProfile } from '../../services/UserProfileService';
import { isLangRTL } from '../../utils/AppUtils';
import { isLangRTL, moveToPolicies } from '../../utils/AppUtils';

import backArrow from '../../svg/back_arrow.svg';
import successIcon from '../../svg/success_message_icon.svg';
Expand All @@ -17,22 +17,18 @@ function RequestPolicyConfirmation() {
navigate('/partnermanagement')
};

const moveToPolicies = () => {
navigate('/partnermanagement/policies')
};

return (
<div className="ml-32 mr-5 mt-5 w-[100%] h-[100%] font-inter">
<div className="flex-col">
<div className="flex items-start space-x-3">
<img src={backArrow} alt="" className="mt-[1%] cursor-pointer" />
<img src={backArrow} onClick={() => moveToPolicies(navigate)} alt="" className="mt-[1%] cursor-pointer" />
<div className="flex-col">
<h1 className="font-semibold text-xl text-dark-blue">{t('requestPolicy.requestPolicy')}</h1>
<div className="flex space-x-1">
<p onClick={() => moveToHome()} className="font-semibold text-tory-blue text-xs cursor-pointer">
{t('commons.home')} /
</p>
<p onClick={() => moveToPolicies()} className="font-semibold text-tory-blue text-xs cursor-pointer">
<p onClick={() => moveToPolicies(navigate)} className="font-semibold text-tory-blue text-xs cursor-pointer">
{t('requestPolicy.policies')}
</p>
</div>
Expand All @@ -49,7 +45,7 @@ function RequestPolicyConfirmation() {
{t('requestPolicy.policySuccessMsg')}
</p>
<div className="flex space-x-3 mt-12 border justify-center">
<button onClick={() => moveToPolicies()} type="button" className="text-white font-semibold bg-tory-blue rounded-md text-base px-12 py-4">
<button onClick={() => moveToPolicies(navigate)} type="button" className="text-white font-semibold bg-tory-blue rounded-md text-base px-12 py-4">
{t('commons.goBack')}
</button>
<button onClick={() => moveToHome()} type="button" className="text-[#1447b2] font-semibold bg-white border border-[#1447b2] rounded-md text-base px-12 py-4">
Expand Down
44 changes: 0 additions & 44 deletions pmp-reactjs-ui/src/utils/AppUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,50 +126,6 @@ export const isLangRTL = (langCode) => {
}
}

export const createDropdownDataList = (fieldName, dataList, t) => {
let dataArr = [];
dataArr.push({
fieldCode: "",
fieldValue: ""
});
dataList.forEach(item => {
let alreadyAdded = false;
dataArr.forEach(item1 => {
if (item1.fieldValue === item[fieldName]) {
alreadyAdded = true;
}
});
if (!alreadyAdded) {
if (fieldName === "partnerType") {
dataArr.push({
fieldCode: getPartnerTypeDescription(item[fieldName], t),
fieldValue: item[fieldName]
});
} else if (fieldName === "status") {
dataArr.push({
fieldCode: getStatusCode(item[fieldName], t),
fieldValue: item[fieldName]
});
} else {
if (item.descr) {
dataArr.push({
fieldCode: item[fieldName],
fieldValue: item[fieldName],
fieldDescription: item.descr
});
} else {
dataArr.push({
fieldCode: item[fieldName],
fieldValue: item[fieldName]
});
}
}
}
});
return dataArr;

}

export const moveToPolicies = (navigate) => {
navigate('/partnermanagement/policies')
};

0 comments on commit ee2736f

Please sign in to comment.