Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(app): update UI and fix bugs for credit hours and assignment restrictions #3055

Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

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

87 changes: 56 additions & 31 deletions src/features/persons/assignment_group/index.tsx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @FussuChalice, could you please move the added logic inside the hooks for this component? Thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, of course. No problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inside the hooks

What do you mean by this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FussuChalice, I mean to move theme inside useAssignmentGroup.tsx file. Thanks.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import AssignmentsCheckList from '@components/assignments_checklist';
import Checkbox from '@components/checkbox';
import { AssignmentGroupType } from './index.types';
import useAssignmentGroup from './useAssignmentGroup';
import Tooltip from '@components/tooltip';
import { useAppTranslation } from '@hooks/index';

const AssignmentGroup = ({
header,
Expand All @@ -18,39 +20,62 @@ const AssignmentGroup = ({
const { checkAssignmentDisabled, checkGroupDisabled } =
useAssignmentGroup(male);

const { t } = useAppTranslation();

const isMinistryDisabled: boolean =
id == 'ministry' && checkAssignmentDisabled(items[0].code);

const isDisabledByGender: boolean = !male && id != 'applyFieldMinistryPart';

const getTooltipTitle = (): string => {
if (isMinistryDisabled) {
return t('tr_onlyAvailableForPioneers');
} else if (isDisabledByGender) {
return t('tr_appliesOnlyToBrothers');
}

return '';
};

return (
<AssignmentsCheckList
header={header}
color={color}
disabled={disqualified || checkGroupDisabled(id)}
onChange={(checked) => onHeaderChange(checked, id)}
readOnly={readOnly}
<Tooltip
followCursor
title={getTooltipTitle()}
show={isMinistryDisabled || isDisabledByGender}
>
{items.map((assignment) => (
<Checkbox
key={assignment.code}
readOnly={readOnly}
label={assignment.name}
checked={
checkAssignmentDisabled(assignment.code)
? false
: checkedItems.includes(assignment.code)
}
onChange={(_, checked) => onItemChange(checked, assignment.code)}
className="body-small-regular"
disabled={disqualified || checkAssignmentDisabled(assignment.code)}
sx={
assignment.borderTop
? {
borderTop: '1px solid var(--accent-200)',
marginTop: '4px',
paddingTop: '8px',
}
: {}
}
/>
))}
</AssignmentsCheckList>
<AssignmentsCheckList
header={header}
color={color}
disabled={disqualified || checkGroupDisabled(id) || isMinistryDisabled}
onChange={(checked) => onHeaderChange(checked, id)}
readOnly={readOnly}
>
{items.map((assignment) => (
<Checkbox
key={assignment.code}
readOnly={readOnly}
label={assignment.name}
checked={
checkAssignmentDisabled(assignment.code)
? false
: checkedItems.includes(assignment.code)
}
onChange={(_, checked) => onItemChange(checked, assignment.code)}
className="body-small-regular"
disabled={disqualified || checkAssignmentDisabled(assignment.code)}
sx={
assignment.borderTop
? {
borderTop: '1px solid var(--accent-200)',
marginTop: '4px',
paddingTop: '8px',
}
: {}
}
/>
))}
</AssignmentsCheckList>
</Tooltip>
);
};

Expand Down
3 changes: 2 additions & 1 deletion src/locales/en/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,6 @@
"tr_noNotifications": "No notifications yet",
"tr_noNotificationsDesc": "Important notifications will be displayed here.",
"tr_userRoleChanged": "Access changed",
"tr_userRoleChangedDesc": "Your access in Organized has been changed recently. Log in to your account again for the changes to take effect."
"tr_userRoleChangedDesc": "Your access in Organized has been changed recently. Log in to your account again for the changes to take effect.",
"tr_appliesOnlyToBrothers": "Applies only to brothers"
}
5 changes: 3 additions & 2 deletions src/locales/en/ministry.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"tr_pioneers": "Pioneers",
"tr_reminderPublisherReport": "Submit your monthly field service report",
"tr_reminderPublisherReportDesc": "It should be submitted to the secretary no later than the 6th day of the month.",
"tr_reminderBranchReport": "The Congregation Field Service and Meeting Attendance (S-1) report hasn’t been submitted yet",
"tr_reminderBranchReportDesc": "It should be submitted to the branch office no later than the 20th day of the month."
"tr_reminderBranchReport": "The Congregation Field Service and Meeting Attendance (S-1) report is not yet ready",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FussuChalice: one last change please: could you update your local file in this line? It has been changed but it seems like yours is still the old one and this will overwrite the last update if not changed. Thanks.

"tr_reminderBranchReportDesc": "It should be submitted to the branch office no later than the 20th day of the month.",
"tr_onlyAvailableForPioneers": "Only available for pioneers"
}
Loading