Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into OH2-385_code_improvement
  • Loading branch information
SilverD3 committed Oct 8, 2024
2 parents d6c79ea + 43bf482 commit fb9e27f
Show file tree
Hide file tree
Showing 30 changed files with 1,120 additions and 1,079 deletions.
1,041 changes: 516 additions & 525 deletions api/oh.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("Add Ward Activity specs", () => {
});

it("should fail to create a new ward", () => {
cy.byId("code").type("FAIL");
cy.byId("code").type("FL");
cy.byId("description").type("Children ward");
cy.byId("email").type("[email protected]");
cy.byId("telephone").type("698123234");
Expand Down
11 changes: 8 additions & 3 deletions src/components/accessories/admin/wards/wardForm/WardForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React, {
} from "react";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router";
import { FIELD_VALIDATION } from "types";
import { number, object, string } from "yup";
import checkIcon from "../../../../../assets/check-icon.png";
import warningIcon from "../../../../../assets/warning-icon.png";
Expand Down Expand Up @@ -49,8 +50,8 @@ const WardForm: FC<IWardProps> = ({
const errorMessage = useMemo(
() =>
(creationMode
? wardStore.create.error?.message
: wardStore.update.error?.message) ?? t("common.somethingwrong"),
? t(wardStore.create.error?.message)
: t(wardStore.update.error?.message)) ?? t("common.somethingwrong"),
[
creationMode,
t,
Expand All @@ -62,7 +63,9 @@ const WardForm: FC<IWardProps> = ({
const initialValues = getFromFields(fields, "value");

const validationSchema = object({
code: string().required(t("common.required")),
code: string()
.max(3, t("validations.maxLength", { max: 3 }))
.required(t("common.required")),
description: string().required(t("common.required")),
email: string().email(t("validations.email")),
beds: number().min(0, t("validations.min", { min: 0 })),
Expand Down Expand Up @@ -133,6 +136,7 @@ const WardForm: FC<IWardProps> = ({
onBlur={formik.handleBlur}
type="text"
disabled={isLoading || !creationMode}
required={FIELD_VALIDATION.REQUIRED}
/>
</div>
<div className="wardForm__item halfWidth">
Expand All @@ -145,6 +149,7 @@ const WardForm: FC<IWardProps> = ({
onBlur={formik.handleBlur}
type="text"
disabled={isLoading}
required={FIELD_VALIDATION.REQUIRED}
/>
</div>
</div>
Expand Down
11 changes: 9 additions & 2 deletions src/components/accessories/admin/wards/wardTable/WardTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useTranslation } from "react-i18next";
import checkIcon from "../../../../../assets/check-icon.png";
import { WardDTO } from "../../../../../generated";
import { scrollToElement } from "../../../../../libraries/uiUtils/scrollToElement";
import { deleteWardReset } from "../../../../../state/ward";
import { deleteWardReset, getWards } from "../../../../../state/ward";
import ConfirmationDialog from "../../../confirmationDialog/ConfirmationDialog";
import InfoBox from "../../../infoBox/InfoBox";
import { TFilterField } from "../../../table/filter/types";
Expand Down Expand Up @@ -72,7 +72,14 @@ export const WardTable: FunctionComponent<IOwnProps> = ({
if (deleteWard.status === "FAIL") {
scrollToElement(infoBoxRef.current);
}
}, [deleteWard.status]);

if (
deleteWard.status === "SUCCESS" ||
deleteWard.status === "SUCCESS_EMPTY"
) {
dispatch(getWards());
}
}, [deleteWard.status, dispatch]);

const formatDataToDisplay = (data: WardDTO[]) => {
return data.map((item) => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/accessories/table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ import {
import { TOrder } from "../../../libraries/sortUtils/types";
import Button from "../button/Button";
import ConfirmationDialog from "../confirmationDialog/ConfirmationDialog";
import TableBodyRow from "./TableBodyRow";
import { FilterButton } from "./filter/FilterButton";
import { TFilterValues } from "./filter/types";
import "./styles.scss";
import TableBodyRow from "./TableBodyRow";
import { IProps, TActions } from "./types";

const Table: FunctionComponent<IProps> = ({
Expand Down Expand Up @@ -400,7 +400,7 @@ const Table: FunctionComponent<IProps> = ({
field={filterField}
onChange={(value) =>
setFilters((previous) => ({
...filters,
...previous,
[filterField.key]: value,
}))
}
Expand Down
5 changes: 5 additions & 0 deletions src/components/accessories/table/filter/FilterButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ export const FilterButton = ({ field, onChange }: IOwnProps) => {

useEffect(() => {
formik.submitForm();
const submit = setTimeout(() => {
formik.submitForm();
}, 250);

return () => clearInterval(submit);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [formik.values]);

Expand Down
252 changes: 127 additions & 125 deletions src/generated/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,129 +1,131 @@
.gitignore
apis/AdmissionTypesApi.ts
apis/AdmissionsApi.ts
apis/AgeTypesApi.ts
apis/BillsApi.ts
apis/DeliveryResultTypeApi.ts
apis/DeliveryTypeApi.ts
apis/DischargeTypeApi.ts
apis/DiseaseTypesApi.ts
apis/DiseasesApi.ts
apis/ExamRowsApi.ts
apis/ExamTypesApi.ts
apis/ExaminationsApi.ts
apis/ExamsApi.ts
apis/HospitalsApi.ts
apis/LaboratoriesApi.ts
apis/LoginApi.ts
apis/MalnutritionsApi.ts
apis/MedicalStockMovementTypeApi.ts
apis/MedicalStockWardApi.ts
apis/MedicalTypesApi.ts
apis/MedicalsApi.ts
apis/OpdsApi.ts
apis/OperationsApi.ts
apis/OperationsTypesApi.ts
apis/OthersPriceApi.ts
apis/PatientConsensusApi.ts
apis/PatientVaccinesApi.ts
apis/PatientsApi.ts
apis/PermissionsApi.ts
apis/PregnantTreatmentTypesApi.ts
apis/PriceListsApi.ts
apis/ReportsApi.ts
apis/SMSApi.ts
apis/StockMovementsApi.ts
apis/SuppliersApi.ts
apis/TherapiesApi.ts
apis/UsersApi.ts
apis/VaccineTypeApi.ts
apis/VaccinesApi.ts
apis/VisitApi.ts
apis/WardsApi.ts
apis/index.ts
apis\AdmissionTypesApi.ts
apis\AdmissionsApi.ts
apis\AgeTypesApi.ts
apis\BillsApi.ts
apis\DeliveryResultTypeApi.ts
apis\DeliveryTypeApi.ts
apis\DischargeTypeApi.ts
apis\DiseaseTypesApi.ts
apis\DiseasesApi.ts
apis\ExamRowsApi.ts
apis\ExamTypesApi.ts
apis\ExaminationsApi.ts
apis\ExamsApi.ts
apis\HospitalsApi.ts
apis\LaboratoriesApi.ts
apis\LoginApi.ts
apis\MalnutritionsApi.ts
apis\MedicalStockMovementTypeApi.ts
apis\MedicalStockWardApi.ts
apis\MedicalTypesApi.ts
apis\MedicalsApi.ts
apis\OpdsApi.ts
apis\OperationsApi.ts
apis\OperationsTypesApi.ts
apis\OthersPriceApi.ts
apis\PatientConsensusApi.ts
apis\PatientVaccinesApi.ts
apis\PatientsApi.ts
apis\PermissionsApi.ts
apis\PregnantTreatmentTypesApi.ts
apis\PriceListsApi.ts
apis\ReportsApi.ts
apis\SMSApi.ts
apis\StockMovementsApi.ts
apis\SuppliersApi.ts
apis\TherapiesApi.ts
apis\UserGroupsApi.ts
apis\UserSettingsApi.ts
apis\UsersApi.ts
apis\VaccineTypeApi.ts
apis\VaccinesApi.ts
apis\VisitApi.ts
apis\WardsApi.ts
apis\index.ts
index.ts
models/AdmissionDTO.ts
models/AdmissionTypeDTO.ts
models/AdmittedPatientDTO.ts
models/AgeType.ts
models/AgeTypeDTO.ts
models/BillDTO.ts
models/BillItemsDTO.ts
models/BillPaymentsDTO.ts
models/DeliveryResultTypeDTO.ts
models/DeliveryTypeDTO.ts
models/DischargeTypeDTO.ts
models/DiseaseDTO.ts
models/DiseaseTypeDTO.ts
models/ExamDTO.ts
models/ExamRowDTO.ts
models/ExamTypeDTO.ts
models/FullBillDTO.ts
models/HospitalDTO.ts
models/LabWithRowsDTO.ts
models/LaboratoryDTO.ts
models/LitePermissionDTO.ts
models/LoginRequest.ts
models/LoginResponse.ts
models/LotDTO.ts
models/MalnutritionDTO.ts
models/MedicalDTO.ts
models/MedicalTypeDTO.ts
models/MedicalWardDTO.ts
models/MedicalWardIdDTO.ts
models/MovementDTO.ts
models/MovementTypeDTO.ts
models/MovementWardDTO.ts
models/OpdDTO.ts
models/OpdWithOperationRowDTO.ts
models/OperationDTO.ts
models/OperationRowDTO.ts
models/OperationTypeDTO.ts
models/PageAdmissionDTO.ts
models/PageInfoDTO.ts
models/PageLabWithRowsDTO.ts
models/PageOpdDTO.ts
models/PagePatientDTO.ts
models/PagePatientExaminationDTO.ts
models/Patient.ts
models/PatientConsensus.ts
models/PatientConsensusDTO.ts
models/PatientDTO.ts
models/PatientExaminationDTO.ts
models/PatientProfilePhoto.ts
models/PatientProfilePhotoPhotoAsImage.ts
models/PatientProfilePhotoPhotoAsImageGraphics.ts
models/PatientProfilePhotoPhotoAsImageGraphicsClip.ts
models/PatientProfilePhotoPhotoAsImageGraphicsClipBounds.ts
models/PatientProfilePhotoPhotoAsImageGraphicsClipBoundsBounds2D.ts
models/PatientProfilePhotoPhotoAsImageGraphicsClipBoundsLocation.ts
models/PatientProfilePhotoPhotoAsImageGraphicsClipBoundsSize.ts
models/PatientProfilePhotoPhotoAsImageGraphicsColor.ts
models/PatientProfilePhotoPhotoAsImageGraphicsColorColorSpace.ts
models/PatientProfilePhotoPhotoAsImageGraphicsFont.ts
models/PatientProfilePhotoPhotoAsImageGraphicsFontMetrics.ts
models/PatientProfilePhotoPhotoAsImageGraphicsFontMetricsFontRenderContext.ts
models/PatientProfilePhotoPhotoAsImageGraphicsFontTransform.ts
models/PatientVaccineDTO.ts
models/PermissionDTO.ts
models/PregnantTreatmentTypeDTO.ts
models/PriceDTO.ts
models/PriceList.ts
models/PriceListDTO.ts
models/PricesOthersDTO.ts
models/SmsDTO.ts
models/SupplierDTO.ts
models/TherapyDTO.ts
models/TherapyRow.ts
models/TherapyRowDTO.ts
models/UserDTO.ts
models/UserGroupDTO.ts
models/UserProfileDTO.ts
models/UserSettingDTO.ts
models/VaccineDTO.ts
models/VaccineTypeDTO.ts
models/VisitDTO.ts
models/WardDTO.ts
models/index.ts
models\AdmissionDTO.ts
models\AdmissionTypeDTO.ts
models\AdmittedPatientDTO.ts
models\AgeType.ts
models\AgeTypeDTO.ts
models\BillDTO.ts
models\BillItemsDTO.ts
models\BillPaymentsDTO.ts
models\DeliveryResultTypeDTO.ts
models\DeliveryTypeDTO.ts
models\DischargeTypeDTO.ts
models\DiseaseDTO.ts
models\DiseaseTypeDTO.ts
models\ExamDTO.ts
models\ExamRowDTO.ts
models\ExamTypeDTO.ts
models\FullBillDTO.ts
models\HospitalDTO.ts
models\LabWithRowsDTO.ts
models\LaboratoryDTO.ts
models\LoginRequest.ts
models\LoginResponse.ts
models\LotDTO.ts
models\MalnutritionDTO.ts
models\MedicalDTO.ts
models\MedicalTypeDTO.ts
models\MedicalWardDTO.ts
models\MedicalWardIdDTO.ts
models\MovementDTO.ts
models\MovementTypeDTO.ts
models\MovementWardDTO.ts
models\OpdDTO.ts
models\OpdWithOperationRowDTO.ts
models\OperationDTO.ts
models\OperationRowDTO.ts
models\OperationTypeDTO.ts
models\PageAdmissionDTO.ts
models\PageInfoDTO.ts
models\PageLabWithRowsDTO.ts
models\PageOpdDTO.ts
models\PagePatientDTO.ts
models\PagePatientExaminationDTO.ts
models\Patient.ts
models\PatientConsensus.ts
models\PatientConsensusDTO.ts
models\PatientDTO.ts
models\PatientExaminationDTO.ts
models\PatientProfilePhoto.ts
models\PatientProfilePhotoPhotoAsImage.ts
models\PatientProfilePhotoPhotoAsImageGraphics.ts
models\PatientProfilePhotoPhotoAsImageGraphicsClip.ts
models\PatientProfilePhotoPhotoAsImageGraphicsClipBounds.ts
models\PatientProfilePhotoPhotoAsImageGraphicsClipBoundsBounds2D.ts
models\PatientProfilePhotoPhotoAsImageGraphicsClipBoundsLocation.ts
models\PatientProfilePhotoPhotoAsImageGraphicsClipBoundsSize.ts
models\PatientProfilePhotoPhotoAsImageGraphicsColor.ts
models\PatientProfilePhotoPhotoAsImageGraphicsColorColorSpace.ts
models\PatientProfilePhotoPhotoAsImageGraphicsFont.ts
models\PatientProfilePhotoPhotoAsImageGraphicsFontMetrics.ts
models\PatientProfilePhotoPhotoAsImageGraphicsFontMetricsFontRenderContext.ts
models\PatientProfilePhotoPhotoAsImageGraphicsFontTransform.ts
models\PatientVaccineDTO.ts
models\PermissionDTO.ts
models\PregnantTreatmentTypeDTO.ts
models\PriceDTO.ts
models\PriceList.ts
models\PriceListDTO.ts
models\PricesOthersDTO.ts
models\SmsDTO.ts
models\SupplierDTO.ts
models\TherapyDTO.ts
models\TherapyRow.ts
models\TherapyRowDTO.ts
models\TokenRefreshRequest.ts
models\UserDTO.ts
models\UserGroupDTO.ts
models\UserProfileDTO.ts
models\UserSettingDTO.ts
models\VaccineDTO.ts
models\VaccineTypeDTO.ts
models\VisitDTO.ts
models\WardDTO.ts
models\index.ts
runtime.ts
tsconfig.json
Loading

0 comments on commit fb9e27f

Please sign in to comment.