Skip to content

Commit

Permalink
#1335 - show name of report card
Browse files Browse the repository at this point in the history
  • Loading branch information
petmongrels committed Mar 11, 2024
1 parent 986d545 commit 7c3eb58
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class CustomDashboardActions {
const standardReportCardType = reportCard.standardReportCardType;
const viewName = CustomDashboardActions._getViewName(standardReportCardType);
if (!_.isNil(result)) {
setTimeout(() => action.onApprovalItemsResults(result, status, viewName,
standardReportCardType && standardReportCardType.getApprovalStatusForType(), state.ruleInput.ruleInputArray), 0);
setTimeout(() => action.onCustomRecordCardResults(result, status, viewName,
standardReportCardType && standardReportCardType.getApprovalStatusForType(), state.ruleInput.ruleInputArray, reportCard), 0);
}
}
return newState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {CustomDashboardActionNames as Actions} from "../../action/customDashboar
import {SafeAreaView, ScrollView, StyleSheet, Text, TouchableOpacity, View} from "react-native";
import _ from "lodash";
import CustomDashboardTab from "./CustomDashboardTab";
import {DashboardSection} from 'avni-models';
import {DashboardSection} from 'openchs-models';
import TypedTransition from "../../framework/routing/TypedTransition";
import CHSNavigator from "../../utility/CHSNavigator";
import Colors from "../primitives/Colors";
Expand All @@ -29,6 +29,14 @@ import Distances from '../primitives/Distances';
import AppliedFiltersV2 from '../filter/AppliedFiltersV2';
import General from "../../utility/General";

const viewNameMap = {
'ApprovalListingView': ApprovalListingView,
'IndividualSearchResultPaginatedView': IndividualSearchResultPaginatedView,
'IndividualListView': IndividualListView,
'CommentListView': CommentListView,
'ChecklistListingView': ChecklistListingView
};

@Path('/customDashboardView')
class CustomDashboardView extends AbstractComponent {
static styles = StyleSheet.create({
Expand Down Expand Up @@ -154,17 +162,6 @@ class CustomDashboardView extends AbstractComponent {
)
}

getViewByName(viewName) {
const viewNameMap = {
'ApprovalListingView': ApprovalListingView,
'IndividualSearchResultPaginatedView': IndividualSearchResultPaginatedView,
'IndividualListView': IndividualListView,
'CommentListView': CommentListView,
'ChecklistListingView': ChecklistListingView
};
return viewNameMap[viewName]
}

onBackPress() {
this.goBack();
}
Expand All @@ -185,18 +182,18 @@ class CustomDashboardView extends AbstractComponent {
reportFilters: reportFilters
}).to(TaskListView);
},
onApprovalItemsResults: (results, status, viewName, approvalStatus_status, reportFilters) => TypedTransition.from(this).with({
onCustomRecordCardResults: (results, status, viewName, approvalStatus_status, reportFilters, reportCard) => TypedTransition.from(this).with({
reportFilters: reportFilters,
approvalStatus_status: approvalStatus_status,
indicatorActionName: Actions.LOAD_INDICATOR,
headerTitle: status || 'subjectsList',
headerTitle: status || _.truncate(reportCard.name, {'length': 20}),
results: results,
reportCardUUID,
listType: _.lowerCase(status),
backFunction: this.onBackPress.bind(this),
onIndividualSelection: (source, individual) => CHSNavigator.navigateToProgramEnrolmentDashboardView(source, individual.uuid),
onApprovalSelection: (source, entity) => CHSNavigator.navigateToApprovalDetailsView(source, entity),
}).to(this.getViewByName(viewName), true)
}).to(viewNameMap[viewName], true)
}), 0);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
import React from "react";
import {ActivityIndicator, ListView, Modal, SectionList, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
import AbstractComponent from "../../framework/view/AbstractComponent";
import Path from "../../framework/routing/Path";
import Reducers from "../../reducer";
import {MyDashboardActionNames as Actions} from "../../action/mydashboard/MyDashboardActions";
import AppHeader from "../common/AppHeader";
import Colors from '../primitives/Colors';
import CHSContainer from "../common/CHSContainer";
import Distances from '../primitives/Distances'
import IndividualDetails from './IndividualDetails';
import DynamicGlobalStyles from "../primitives/DynamicGlobalStyles";
import Fonts from "../primitives/Fonts";
import General from "../../utility/General";
import SearchResultsHeader from "../individual/SearchResultsHeader";
import _ from 'lodash';
import Separator from "../primitives/Separator";
import CHSNavigator from "../../utility/CHSNavigator";
import IndividualListView from "./IndividualListView";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import Distances from "../primitives/Distances";

@Path('/IndividualListView')
class IndividualListView extends AbstractComponent {

static propTypes = {
results: PropTypes.array.isRequired,
totalSearchResultsCount: PropTypes.number.isRequired,
Expand Down

0 comments on commit 7c3eb58

Please sign in to comment.