Skip to content

Commit

Permalink
Merge pull request #310 from egovernments/SM-3461
Browse files Browse the repository at this point in the history
SM-3461
  • Loading branch information
nipunarora-eGov authored Dec 6, 2023
2 parents 9c5e3e2 + 78fc285 commit b07dbfd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const SelectSWEmploymentDetails = ({ t, config, onSelect, userType, formData, se
setSelectedEmployer(temp);
}
}, [mdmsOptions]);
console.log("selectedEmployer", selectedEmployer)
const requestCriteria = {
url: "/vendor/v1/_search",
params: { tenantId, sortBy: "name", status: "ACTIVE" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ const WorkerDetails = (props) => {
},
},
});
console.log("workedDARA", workerData, isWorkerLoading);
const { data: driverData, isLoading: isLoading, isSuccess: isDsoSuccess, error: dsoError, refetch } = Digit.Hooks.fsm.useDriverDetails(tenantId, { ids: id });

const { data: vendorData, isLoading: isVendorLoading, isSuccess: isVendorSuccess, error: vendorError } = Digit.Hooks.fsm.useDsoSearch(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect,useReducer,Fragment } from "react";
import React, { useEffect, useReducer, Fragment } from "react";
import { Switch, useLocation } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { PrivateRoute, AppContainer, BreadCrumb, BackButton } from "@egovernments/digit-ui-react-components";
Expand All @@ -15,53 +15,48 @@ import TqmAdminNotification from "./TqmAdminNotification";

// import TQMSummary from "../../components/TQMSummary";


const TqmBreadCrumb = ({ location, defaultPath }) => {
const pathVar=location.pathname.replace(defaultPath+'/',"").split("?")?.[0];
const pathVar = location.pathname.replace(defaultPath + "/", "").split("?")?.[0];
const { t } = useTranslation();
const search = useLocation().search;
const fromScreen = new URLSearchParams(search).get("from") || null;

const isInbox = location?.pathname?.includes("inbox");
const isViewTestResults = location?.pathname?.includes("view-test-results");
const isSearchTest = location?.pathname?.includes("search-test-results");
const isaddTest = location?.pathname?.includes("add-test-result");

const crumbs = [
{
path: `/${window?.contextPath}/employee`,
content: t("TQM_BREAD_HOME"),
show: true,
},
{
path: `/${window.contextPath}/employee/tqm/inbox`,
content: t(`TQM_BREAD_INBOX`) ,
show: pathVar.includes("inbox")?true: false,

path: pathVar.includes("inbox") ? "" : `/${window.contextPath}/employee/tqm/inbox`,
content: t(`TQM_BREAD_INBOX`),
show: isInbox || fromScreen === "TQM_BREAD_INBOX" ? true : false,
},
{
path: `/${window.contextPath}/employee/tqm/search-test-results`,
// content: t(`TQM_BREAD_PAST_TESTS`) ,
show: pathVar.includes("search-test-results")?true: false,
content: fromScreen ? `${t(fromScreen)} / ${t("TQM_BREAD_PAST_TESTS")}` : t("TQM_BREAD_PAST_TESTS"),
isBack:fromScreen ? true : false
path: pathVar.includes("search-test-results") ? "" : `/${window.contextPath}/employee/tqm/search-test-results`,
show: isSearchTest || fromScreen === "TQM_BREAD_PAST_TESTS" ? true : false,
content: t("TQM_BREAD_PAST_TESTS"),
},
{
path: `/${window.contextPath}/employee/tqm/add-test-result`,
content: t(`TQM_BREAD_CREATE_TEST`) ,
show: pathVar.includes("add-test-result")?true: false,
path: pathVar.includes("add-test-result") ? "" : `/${window.contextPath}/employee/tqm/add-test-result`,
content: t(`TQM_BREAD_CREATE_TEST`),
show: isaddTest ? true : false,
},
{
path: `/${window.contextPath}/employee/tqm/add-test-result`,
path: pathVar.includes("search-devices") ? "" : `/${window.contextPath}/employee/tqm/add-test-result`,
// content: t(`TQM_BREAD_SENSOR`) ,
show: pathVar.includes("search-devices")?true: false,
show: pathVar.includes("search-devices") ? true : false,
content: fromScreen ? `${t(fromScreen)} / ${t("TQM_BREAD_SENSOR")}` : t("TQM_BREAD_SENSOR"),
isBack:fromScreen ? true: false
},
{
path: `/${window.contextPath}/employee/tqm/search-test-results`,
// content: t(`TQM_BREAD_VIEW_TEST_RESULTS`) ,
show: pathVar.includes("view-test-results")?true: false,
content:fromScreen ? `${t(fromScreen)} / ${t("TQM_BREAD_VIEW_TEST_RESULTS")}` : t("TQM_BREAD_VIEW_TEST_RESULTS"),
isBack:fromScreen ? true: false
path: pathVar.includes("view-test-results") ? "" : `/${window.contextPath}/employee/tqm/view-test-results`,
show: isViewTestResults ? true : false,
content: isViewTestResults ? t("TQM_BREAD_VIEW_TEST_RESULTS") : t("TQM_BREAD_VIEW_TEST_RESULTS"),
},


];
return <BreadCrumb className="workbench-bredcrumb" crumbs={crumbs} spanStyle={{ maxWidth: "min-content" }} />;
};
Expand All @@ -77,14 +72,13 @@ const App = ({ path }) => {
const TQMSummary = Digit?.ComponentRegistryService?.getComponent("TQMSummary");
const SensorScreen = Digit?.ComponentRegistryService?.getComponent("SensorScreen");
let isMobile = window.Digit.Utils.browser.isMobile();

return (
<>

{isUlbAdminLoggedIn && isMobile ? <BackButton>{t('CS_COMMON_BACK')}</BackButton> : !isPlantOperatorLoggedIn ?<TqmBreadCrumb location={location} defaultPath={path} />:null}
{isUlbAdminLoggedIn && isMobile ? <BackButton>{t("CS_COMMON_BACK")}</BackButton> : !isPlantOperatorLoggedIn ? <TqmBreadCrumb location={location} defaultPath={path} /> : null}
{/* {isPlantOperatorLoggedIn && (location.pathname.includes("/response") ? null : <BackButton>{t("CS_COMMON_BACK")}</BackButton>)} */}
{isPlantOperatorLoggedIn && <TqmHeader location={location} defaultPath={path}/>}
{isPlantOperatorLoggedIn && <TqmHeader location={location} defaultPath={path} />}

<Switch>
<AppContainer className="tqm">
<PrivateRoute path={`${path}/landing`} component={() => <TQMLanding />} />
Expand All @@ -98,12 +92,12 @@ const App = ({ path }) => {
<PrivateRoute path={`${path}/response`} component={() => <TqmResponse />} />
<PrivateRoute path={`${path}/view-test-results`} component={() => <TqmViewTestResults />} />
{/* for testing purpose */}
<PrivateRoute path={`${path}/notification`} component={() => <TqmAdminNotification />} />
<PrivateRoute path={`${path}/notification`} component={() => <TqmAdminNotification />} />
<PrivateRoute path={`${path}/summary`} component={() => <TQMSummary />} />
<PrivateRoute path={`${path}/search-devices`} component={() => <SensorScreen />} />
</AppContainer>
</Switch>
</>
</>
);
};

Expand Down

0 comments on commit b07dbfd

Please sign in to comment.