Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #870 from egovernments/ISTE-282-bkp
Browse files Browse the repository at this point in the history
ISTE-282
  • Loading branch information
pradeepkumarcm-egov authored Aug 1, 2024
2 parents 0c33d77 + 67cf72b commit 591c6fa
Show file tree
Hide file tree
Showing 15 changed files with 440 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,15 @@ class NewConsumerBillState extends State<NewConsumerBill> {
houseHoldProvider.isfirstdemand)
getLabelText(
i18.common.CORE_ADVANCE_ADJUSTED,

double.parse(CommonProvider
.getAdvanceAdjustedAmount(
widget
.demandList)) == 0 ? "₹ ${houseHoldProvider.aggDemandItems?.remainingAdvance}" :
double.parse(CommonProvider
.getAdvanceAdjustedAmount(
widget
.demandList)) <=
.demandList)) <
0
? "₹ ${double.parse(CommonProvider.getAdvanceAdjustedAmount(widget.demandList))}"
: '- ₹${double.parse(CommonProvider.getAdvanceAdjustedAmount(widget.demandList))}',
Expand Down
2 changes: 2 additions & 0 deletions frontend/mgramseva/lib/model/demand/demand_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ class AggragateDemandDetails {
double? currentMonthPenalty;
@JsonKey(name: "currentmonthTotalDue")
double? currentmonthTotalDue;
@JsonKey(name: "currentmonthRoundOff")
double? currentmonthRoundOff;
@JsonKey(name: "totalAreas")
double? totalAreas;
@JsonKey(name: "totalAreasWithPenalty")
Expand Down
3 changes: 3 additions & 0 deletions frontend/mgramseva/lib/model/demand/demand_list.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@ var Digit = window.Digit || {};


function anonymizeHalfString(input) {
// Calculate the midpoint of the string
const midpoint = Math.ceil(input.length / 2);

// Replace the first 50% of the string with asterisks
const anonymized = "*".repeat(midpoint) + input.substring(midpoint);
// Initialize an empty string to store the anonymized output
let anonymized = "";
// Loop through each character in the input string
for (let i = 0; i < input.length; i++) {
// Check if the index (i) is even (0, 2, 4, ...)
if (i % 2 === 0) {
// Append the original character (keep it)
anonymized += input[i];
} else {
// Append an asterisk to mask the alternate character
anonymized += "*";
}
}

return anonymized;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,47 @@
}
}

.dropdown-user .dropbtn{
color: white;
font-size: 1rem;
margin: 10px;
background-color: #efefef00;
}
.dropdown-user {
position: relative; /* Make the dropdown relative to its container */
display: inline-block;
}

.dropdown-user-overlay {
position: absolute; /* Position the overlay absolutely relative to the dropdown */
top: 100%; /* Position the overlay below the button */
left: 0; /* Align the overlay to the left of the button */
background-color: #f1f1f1; /* Set background color */
min-width: 160px; /* Set minimum width */
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); /* Add shadow */
z-index: 1; /* Set z-index to display on top of other elements */
display: none; /* Hide by default */
}

.dropdown-user-content {
padding: 0; /* Remove default padding from ul */
list-style: none; /* Remove default list style */
}

.dropdown-user-content li {
border-bottom: solid 1px !important;
border-color: black !important;
padding: 12px 12px; /* Add padding to list items */
}
.dropdown-user-link {
text-decoration: none !important; /* Remove underline from links inside list items */
}

.dropdown-user:hover .dropdown-user-overlay {
display: block; /* Show overlay on hover */
}


.RightMostTopBarOptions {
@apply flex;
.EventNotificationWrapper {
Expand All @@ -369,6 +410,9 @@
fill: theme(colors.white);
}
}
display: flex;
justify-content: center;
align-items: center;
}

@media (min-width: 640px) {
Expand Down Expand Up @@ -477,8 +521,24 @@
.hamburger-span {
display: none;
}
.city{
height: 48px !important;
width: 48px !important;
padding: 0px !important;
}

}

}

.hambuger-back-wrapper .city{
object-fit: scale-down !important;
border-radius: 5px !important;
padding: 1px 15px !important;
}



}

@screen dt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ const initRequestBody = (tenantId) => ({
],
},
});
const initRequestBodyWithOutTenent = (tenantId) => ({
MdmsCriteria: {
tenantId,
moduleDetails: [
{
moduleName: "common-masters",
masterDetails: [{ name: "Department" }, { name: "Designation" }, { name: "StateInfo" }, { name: "wfSlaConfig" }, { name: "uiHomePage" }],
},
{
moduleName: "DIGIT-UI",
masterDetails: [{ name: "ApiCachingSettings" }],
},
],
},
});

const getCriteria = (tenantId, moduleDetails) => {
return {
Expand Down Expand Up @@ -1478,6 +1493,14 @@ export const MdmsService = {
useCache: true,
params: { tenantId: stateCode },
}),
initWithOutTenent: (stateCode) =>
ServiceRequest({
serviceName: "mdmsInit",
url: Urls.MDMS,
data: initRequestBodyWithOutTenent(stateCode),
useCache: true,
params: { tenantId: stateCode },
}),
call: (tenantId, details) => {
return new Promise((resolve, reject) =>
debouncedCall(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ export const StoreService = {
return await Promise.all(allBoundries);
},
digitInitData: async (stateCode, enabledModules) => {
const { MdmsRes } = await MdmsService.init(stateCode);
const { MdmsRes } = await MdmsService.init(stateCode);
const stateInfo = MdmsRes["common-masters"]?.StateInfo?.[0] || {};
const uiHomePage = MdmsRes["common-masters"]?.uiHomePage?.[0] || {};

const localities = {};
const revenue_localities = {};
const initData = {
Expand All @@ -80,22 +81,12 @@ export const StoreService = {

initData.selectedLanguage =
Digit.SessionStorage.get("locale") || initData?.languages[2] ? initData?.languages[2]?.value : initData?.languages[1]?.value;

ApiCacheService.saveSetting(MdmsRes["DIGIT-UI"]?.ApiCachingSettings);

const moduleTenants = initData?.modules
.map((module) => module.tenants)
.flat()
.reduce((unique, ele) => (unique.find((item) => item.code === ele.code) ? unique : [...unique, ele]), []);
initData.tenants = MdmsRes?.tenant?.tenants
// ?.filter((x) => x.pgrEnabled)
initData.tenants = MdmsRes?.tenant?.tenants
.map((tenant) => ({
i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`,
...tenant,
}));
// .filter((item) => !!moduleTenants.find((mt) => mt.code === item.code))
// .map((tenant) => ({ i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`, ...tenant }));

await LocalizationService.getLocale({
modules: [`rainmaker-common`],
locale: initData.selectedLanguage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,24 @@ const stringReplaceAll = (str = "", searcher = "", replaceWith = "") => {
return str;
};



const ChangeCity = (prop) => {
const [dropDownData, setDropDownData] = useState({
label: `TENANT_TENANTS_${stringReplaceAll(Digit.SessionStorage.get("Employee.tenantId"), ".", "_")?.toUpperCase()}`,
value: Digit.SessionStorage.get("Employee.tenantId"),
});
const [selectCityData, setSelectCityData] = useState([]);
const [selectedCity, setSelectedCity] = useState([]); //selectedCities?.[0]?.value
const history = useHistory();
const isDropdown = prop.dropdown || false;
let selectedCities = [];
const uuids = [prop.userDetails?.info?.uuid];
const { data: userData, isUserDataLoading } = Digit.Hooks.useUserSearch(Digit.ULBService.getStateId(), { uuid: uuids }, {});
// setSelectedCity(userData?.data?.user[0]?.roles)


const { data: data = {}, isLoading } =
const uuids = [prop.userDetails?.info?.uuid];
const { data: userData, isUserDataLoading } = Digit.Hooks.useUserSearch(Digit.ULBService.getStateId(), { uuid: uuids }, {});
const { data: mdmsData = {}, isLoading: isMdmsLoading } =
Digit.Hooks.hrms.useHrmsMDMS(Digit.ULBService.getCurrentTenantId(), "egov-hrms", "HRMSRolesandDesignation") || {};

const handleChangeCity = (city) => {
const loggedInData = Digit.SessionStorage.get("citizen.userRequestObject");
const filteredRoles = Digit.SessionStorage.get("citizen.userRequestObject")?.info?.roles?.filter((role) => role.tenantId === city.value);
const filteredRoles = loggedInData?.info?.roles?.filter((role) => role.tenantId === city.value);
if (filteredRoles?.length > 0) {
loggedInData.info.roles = filteredRoles;
loggedInData.info.tenantId = city?.value;
Expand All @@ -50,47 +44,47 @@ const ChangeCity = (prop) => {
};

useEffect(() => {
const userloggedValues = Digit.SessionStorage.get("citizen.userRequestObject");
let teantsArray = [],filteredArray = [];
userData?.user[0].roles?.forEach((role) => teantsArray.push(role.tenantId));
let unique = teantsArray.filter((item, i, ar) => ar.indexOf(item) === i);
unique?.forEach((uniCode) => {
const tenantId = Digit.SessionStorage.get("Employee.tenantId");

if (!tenantId || !mdmsData?.MdmsRes?.["tenant"]["tenants"] || isUserDataLoading || isMdmsLoading) {
return;
}

const tenantIds = userData?.user[0].roles?.map((role) => role.tenantId);

const filteredArray = mdmsData.MdmsRes["tenant"]["tenants"].filter((item) => {
if (item.code !== "pb") { // Exclude "pb" tenants
return tenantIds.includes(item.code);
} else {
return item.code === tenantId; // Include "pb" tenants matching tenantId
}
}).map((item) => ({
label: item.code !== "pb"
? `${prop?.t(Digit.Utils.locale.convertToLocale(item?.divisionCode, "EGOV_LOCATION_DIVISION"))} - ${prop?.t(
`TENANT_TENANTS_${stringReplaceAll(item.code, ".", "_")?.toUpperCase()}`
)}`
: `TENANT_TENANTS_${stringReplaceAll(item.code, ".", "_")?.toUpperCase()}`,
value: item.code,
}));

data?.MdmsRes?.["tenant"]["tenants"]?.map((items) => {
if (items?.code !== "pb" && items?.code === uniCode) {
filteredArray.push({
label: `${prop?.t(Digit.Utils.locale.convertToLocale(items?.divisionCode, "EGOV_LOCATION_DIVISION"))} - ${prop?.t(
`TENANT_TENANTS_${stringReplaceAll(uniCode, ".", "_")?.toUpperCase()}`
)}`,
value: uniCode,
});
} else if (items?.code === "pb" && items?.code === uniCode) {
filteredArray.push({
label: `TENANT_TENANTS_${stringReplaceAll(uniCode, ".", "_")?.toUpperCase()}`,
value: uniCode,
});
}
});
});
selectedCities = filteredArray?.filter((select) => select.value == Digit.SessionStorage.get("Employee.tenantId"));
setSelectCityData(filteredArray);
selectedCities = filteredArray.filter((select) => select.value === tenantId);

}, [dropDownData, data?.MdmsRes]);
}, [dropDownData, mdmsData?.MdmsRes, userData, isUserDataLoading, isMdmsLoading]);

return (
<div style={prop?.mobileView ? { color: "#767676" } : {}}>
<Dropdown
t={prop?.t}
style={{ width: "150px" }}
option={selectCityData}
option={selectCityData.length > 0 ? selectCityData : [{ label: "Loading...", value: "" }]}
selected={dropDownData}
optionKey={"label"}
select={handleChangeCity}
optionCardStyles={{ overflow: "revert", display: "table" }}
/>
</div>
);

};

export default ChangeCity;
export default ChangeCity;
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const HRMSCard = () => {
{
label: t("HR_SEARCH_USER"),
link: `/${window?.contextPath}/employee/hrms/search-user`,
roles:["DIV_ADMIN","STATE_ADMIN"]
},
{
label: t("HR_HOME_SEARCH_RESULTS_HEADING"),
Expand Down
Loading

0 comments on commit 591c6fa

Please sign in to comment.