Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 app/src/hooks/domain/usePermissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function usePermissions() {
&& isDefined(countryId)
&& !!userMe?.is_admin_for_countries?.includes(countryId)
);
const isRegionAdmin = (regionId: number | undefined) => (
const isRegionAdmin = (regionId: number | null | undefined) => (
!isGuestUser
&& isDefined(regionId)
&& !!userMe?.is_admin_for_regions?.includes(regionId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ function ConfigureLocalUnitsModal(props: Props) {
const isNewManageLocalUnit = useMemo(() => {
if (isDefined(manageLocalUnitsValues)
&& isDefined(manageLocalUnitsValues.id)) {
return true;
return false;
}
return false;
return true;
}, [manageLocalUnitsValues]);

const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
"namespace": "localUnitImportModal",
"strings": {
"modalHeading": "Import Local Units for {countryName}",
"modalDescription": "Please select a local unit type and upload the CSV file",
"modalDescription": "Please select a local unit type and upload the xlsx file",
"modalImportPendingDescription": "Your file is currently being processed. You can close this modal and check the result from the upload history",
"closeButtonLabel": "Close",
"localUnitTypeInputLabel": "Local unit type",
"uploadFileSectionTitle": "Upload CSV file",
"uploadFileSectionDescription": "Please make sure to select a supported file format (csv) with size less than 10MB",
"uploadFileSectionTitle": "Upload xlsx file",
"uploadFileSectionDescription": "Please make sure to select a supported file format (xlsx) with size less than 10MB",
"selectFileButtonLabel": "Select a file",
"cancelUploadButtonLabel": "Cancel",
"startUploadButtonLabel": "Upload",
"contentStructureDescription": "The contents in the CSV should follow the structure provided in {templateLink}.",
"contentStructureDescription": "The contents in the xlsx should follow the structure provided in {templateLink}.",
"templateLinkLabel": "this template",
"noPermissionBothDescription": "You don't have permission and this unit is not externally managed.",
"noPermissionErrorDescription": "You do not have the permission to upload local unit data",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function LocalUnitBulkUploadModal(props: Props) {
{isNotDefined(bulkUploadFile) && (
<RawFileInput
name="file"
accept=".csv"
accept=".xlsx"
onChange={setBulkUploadFile}
variant="secondary"
disabled={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"localUnitViewDentist": "Dentist",
"localUnitViewNursingAid": "Nursing aid",
"localUnitViewMidwife": "Midwife",
"localUnitViewPharmacists": "Pharmacists",

Check warning on line 58 in app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitView/i18n.json

View workflow job for this annotation

GitHub Actions / Lint JS

Unused key 'localUnitViewPharmacists' found

Check warning on line 58 in app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitView/i18n.json

View workflow job for this annotation

GitHub Actions / Build GO Web App

Unused key 'localUnitViewPharmacists' found
"localUnitViewOtherProfiles": "Other profiles",
"localUnitViewRemovedOtherProfiles": "Removed Other profiles",
"localUnitViewOtherMedicalHeal": "Other medical heal",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,18 @@ function LocalUnitView(props: Props) {
value={newValue?.health?.midwife}
/>
</DiffWrapper>
<DiffWrapper
hideOnPristine
value={newValue?.health?.pharmacists}
previousValue={oldValue?.health?.pharmacists}
diffViewEnabled
>
<TextOutput
strongValue
label={strings.localUnitViewMidwife}
value={newValue?.health?.pharmacists}
/>
</DiffWrapper>
{isDefined(changedOtherProfiles) && changedOtherProfiles.length > 0 && (
<>
<span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"dentist": "Dentist",
"nursingAid": "Nursing aid",
"midwife": "Midwife",
"pharmacists": "Pharmacists",
"otherMedicalHeal": "Other medical heal",
"commentsNS": "Comments by the NS",
"addOtherProfilesButtonLabel": "Add Other Profiles",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ const schema: LocalUnitsFormSchema = {
],
},
focal_point_position: {
required: true,
validations: [lengthSmallerThanCondition(50)],
},
focal_point_phone_number: {
Expand Down Expand Up @@ -213,7 +214,6 @@ const schema: LocalUnitsFormSchema = {
validations: [
positiveIntegerCondition,
],
required: true,
},
general_practitioner: {
validations: [
Expand Down Expand Up @@ -250,6 +250,11 @@ const schema: LocalUnitsFormSchema = {
positiveIntegerCondition,
],
},
pharmacists: {
validations: [
positiveIntegerCondition,
],
},
other_medical_heal: {},
other_profiles: {
keySelector: (item) => item.client_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ function LocalUnitsTableActions(props: Props) {
isLocalUnitRegionValidatorByType,
isSuperUser,
isGuestUser,
isCountryAdmin,
isRegionAdmin,
} = usePermissions();

const isLocked = status !== VALIDATED;
Expand All @@ -73,14 +75,11 @@ function LocalUnitsTableActions(props: Props) {
&& isDefined(manageResponse)
&& !!manageResponse[localUnitType]?.enabled);

const hasPermission = isAuthenticated
&& !isExternallyManaged
&& (isSuperUser
|| isLocalUnitGlobalValidatorByType(localUnitType)
|| isLocalUnitCountryValidatorByType(countryDetails?.id, localUnitType)
|| isLocalUnitRegionValidatorByType(countryDetails?.region, localUnitType));
const hasAddEditLocalUnitPermission = isCountryAdmin(countryDetails?.id)
|| isRegionAdmin(countryDetails?.region);

const hasValidatePermission = isAuthenticated
&& !isExternallyManaged
&& (isSuperUser
|| isLocalUnitGlobalValidatorByType(localUnitType)
|| isLocalUnitCountryValidatorByType(countryDetails?.id, localUnitType)
Expand Down Expand Up @@ -165,7 +164,8 @@ function LocalUnitsTableActions(props: Props) {
>
{strings.localUnitActionsView}
</DropdownMenuItem>
{(hasPermission && !isBulkUploadLocalUnit) && (
{((hasValidatePermission || hasAddEditLocalUnitPermission)
&& !isBulkUploadLocalUnit) && (
<DropdownMenuItem
type="button"
name={undefined}
Expand All @@ -174,7 +174,9 @@ function LocalUnitsTableActions(props: Props) {
{strings.localUnitActionsDelete}
</DropdownMenuItem>
)}
{!isLocked && (hasPermission && !isBulkUploadLocalUnit) && (
{!isLocked && ((
hasValidatePermission || hasAddEditLocalUnitPermission
) && !isBulkUploadLocalUnit) && (
<DropdownMenuItem
type="button"
name={localUnitId}
Expand All @@ -190,7 +192,7 @@ function LocalUnitsTableActions(props: Props) {
<LocalUnitValidateButton
onClick={handleValidateLocalUnitClick}
status={status}
hasValidatePermission={hasPermission}
hasValidatePermission={hasValidatePermission}
/>
)}
</TableActions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function LocalUnitsTable(props: Props) {
const {
isSuperUser,
isCountryAdmin,
isRegionAdmin,
isLocalUnitGlobalValidator,
isLocalUnitRegionValidator,
isLocalUnitCountryValidator,
Expand All @@ -71,6 +72,7 @@ function LocalUnitsTable(props: Props) {
|| isLocalUnitRegionValidator(countryResponse?.region ?? undefined);

const hasAddEditLocalUnitPermission = isCountryAdmin(countryResponse?.id)
|| isRegionAdmin(countryResponse?.region)
|| hasPermission;

const {
Expand Down
106 changes: 106 additions & 0 deletions translationMigrations/000054-1761919700888.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"parent": "000053-1761568674475.json",
"actions": [
{
"action": "add",
"key": "addOtherProfilesButtonLabel",
"namespace": "countryNsOverviewContextAndStructure",
"value": "Add Other Profiles"
},
{
"action": "add",
"key": "localUnitViewPharmacists",
"namespace": "countryNsOverviewContextAndStructure",
"value": "Pharmacists"
},
{
"action": "add",
"key": "localUnitViewRemovedOtherProfiles",
"namespace": "countryNsOverviewContextAndStructure",
"value": "Removed Other profiles"
},
{
"action": "add",
"key": "otherProfileNumberOutputLabel",
"namespace": "countryNsOverviewContextAndStructure",
"value": "Number"
},
{
"action": "add",
"key": "otherProfileOutputLabel",
"namespace": "countryNsOverviewContextAndStructure",
"value": "Other Profiles"
},
{
"action": "add",
"key": "otherProfilePositionOutputLabel",
"namespace": "countryNsOverviewContextAndStructure",
"value": "Position"
},
{
"action": "add",
"key": "otherProfilesNumberLabel",
"namespace": "countryNsOverviewContextAndStructure",
"value": "Number"
},
{
"action": "add",
"key": "otherProfilesPositionLabel",
"namespace": "countryNsOverviewContextAndStructure",
"value": "Position"
},
{
"action": "add",
"key": "otherProfilesRemoveLabel",
"namespace": "countryNsOverviewContextAndStructure",
"value": "Remove"
},
{
"action": "add",
"key": "otherTrainingFacilities",
"namespace": "countryNsOverviewContextAndStructure",
"value": "Other training facilities"
},
{
"action": "add",
"key": "pharmacists",
"namespace": "countryNsOverviewContextAndStructure",
"value": "Pharmacists"
},
{
"action": "add",
"key": "qualifiersTitle",
"namespace": "countryNsOverviewContextAndStructure",
"value": "Qualifiers"
},
{
"action": "remove",
"key": "otherProfiles",
"namespace": "countryNsOverviewContextAndStructure"
},
{
"action": "update",
"key": "contentStructureDescription",
"namespace": "localUnitImportModal",
"newValue": "The contents in the xlsx should follow the structure provided in {templateLink}."
},
{
"action": "update",
"key": "modalDescription",
"namespace": "localUnitImportModal",
"newValue": "Please select a local unit type and upload the xlsx file"
},
{
"action": "update",
"key": "uploadFileSectionDescription",
"namespace": "localUnitImportModal",
"newValue": "Please make sure to select a supported file format (xlsx) with size less than 10MB"
},
{
"action": "update",
"key": "uploadFileSectionTitle",
"namespace": "localUnitImportModal",
"newValue": "Upload xlsx file"
}
]
}
Loading