Skip to content

Commit

Permalink
Need to fix the availability viewer.
Browse files Browse the repository at this point in the history
  • Loading branch information
buchananwill committed Apr 2, 2024
1 parent f100685 commit 369f029
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/api/dtos/OrganizationDtoSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { z } from 'zod';
export const OrganizationDtoSchema = z.object({
id: z.number(),
name: z.string(),
organizationType: OrganizationTypeDtoSchema,
type: OrganizationTypeDtoSchema,
});
export type OrganizationDto = z.infer<typeof OrganizationDtoSchema>;
9 changes: 9 additions & 0 deletions app/api/dtos/ProviderRoleAvailabilityDtoSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { CycleSubspanDtoSchema } from './CycleSubspanDtoSchema';
import { z } from 'zod';
export const ProviderRoleAvailabilityDtoSchema = z.object({
id: z.number(),
providerRoleId: z.number(),
cycleSubspanDto: CycleSubspanDtoSchema,
availabilityCode: z.number(),
});
export type ProviderRoleAvailabilityDto = z.infer<typeof ProviderRoleAvailabilityDtoSchema>;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ export const ProviderRoleTypeWorkTaskTypeSuitabilityDtoSchema = z.object({
id: z.number(),
rating: z.number(),
partyId: z.number(),
workTaskType: z.string(),
providerRoleTypeId: z.number(),
providerRoleTypeName: z.string(),
workTaskTypeId: z.number(),
workTaskTypeName: z.string(),
});
export type ProviderRoleTypeWorkTaskTypeSuitabilityDto = z.infer<typeof ProviderRoleTypeWorkTaskTypeSuitabilityDtoSchema>;
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ProviderRoleTypeWorkTaskTypeSuitabilityDto } from '../../api/dtos/Provi

export const AssetSuitabilityListSelectiveContext =
createSelectiveContext<AssetRoleWorkTaskSuitabilityDto[]>();
export const WorkTaskCompetencyListSelectiveContext =
export const ProviderRoleTypeWorkTaskTypeSuitabilityListSelectiveContext =
createSelectiveContext<ProviderRoleTypeWorkTaskTypeSuitabilityDto[]>();
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';
import { PropsWithChildren } from 'react';
import GenericSelectiveContextManager from '../../selective-context/components/base/generic-selective-context-manager';
import { WorkTaskCompetencyListSelectiveContext } from './selective-context-creators';
import { ProviderRoleTypeWorkTaskTypeSuitabilityListSelectiveContext } from './selective-context-creators';
import { getSelectiveContextControllerHook } from '../../selective-context/hooks/curriedHooks/get-selective-context-controller-hook';
import getSelectiveContextListenerHook from '../../selective-context/hooks/curriedHooks/get-selective-context-listener-hook';
import getSelectiveContextDispatchHook from '../../selective-context/hooks/curriedHooks/get-selective-context-dispatch-hook';
Expand All @@ -10,15 +10,23 @@ export default function WorkTaskCompetencyListSelectiveContextProvider({
children
}: PropsWithChildren) {
return (
<GenericSelectiveContextManager {...WorkTaskCompetencyListSelectiveContext}>
<GenericSelectiveContextManager
{...ProviderRoleTypeWorkTaskTypeSuitabilityListSelectiveContext}
>
{children}
</GenericSelectiveContextManager>
);
}

export const useWorkTaskCompetencyListController =
getSelectiveContextControllerHook(WorkTaskCompetencyListSelectiveContext);
getSelectiveContextControllerHook(
ProviderRoleTypeWorkTaskTypeSuitabilityListSelectiveContext
);
export const useWorkTaskCompetencyListDispatch =
getSelectiveContextDispatchHook(WorkTaskCompetencyListSelectiveContext);
getSelectiveContextDispatchHook(
ProviderRoleTypeWorkTaskTypeSuitabilityListSelectiveContext
);
export const useWorkTaskCompetencyListListener =
getSelectiveContextListenerHook(WorkTaskCompetencyListSelectiveContext);
getSelectiveContextListenerHook(
ProviderRoleTypeWorkTaskTypeSuitabilityListSelectiveContext
);
5 changes: 4 additions & 1 deletion app/generic/components/tables/big-table-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export default function BigTableCard({
children?: React.ReactNode;
}) {
return (
<Card className="flex-shrink-0 flex-grow max-w-5xl max-h-min h-min overflow-x-auto px-2 py-0">
<Card
className="flex-shrink-0 flex-grow max-w-5xl max-h-min h-min overflow-x-auto px-2 py-0"
shadow={'sm'}
>
<div className="m-2 p-2 min-w-max max-h-min overflow-visible">
{children}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { IdStringFromNumberAccessor } from '../../../premises/classroom-suitabil
import { getCurriedProducer } from './get-curried-producer';
import { UnsavedProviderRoleChanges } from './provider-role-string-map-context-creator';
import { useSelectiveContextListenerReadAll } from '../../../selective-context/components/base/generic-selective-context-creator';
import { WorkTaskCompetencyListSelectiveContext } from '../../../contexts/selective-context/selective-context-creators';
import { ProviderRoleTypeWorkTaskTypeSuitabilityListSelectiveContext } from '../../../contexts/selective-context/selective-context-creators';
import { ProviderRoleTypeWorkTaskTypeSuitabilityDto } from '../../../api/dtos/ProviderRoleTypeWorkTaskTypeSuitabilityDtoSchema';

const skillProducer = getCurriedProducer<
Expand All @@ -28,7 +28,7 @@ export default function ProviderRoleSkillEditContextProvider({
children: ReactNode;
}) {
const selectiveContextReadAll = useSelectiveContextListenerReadAll(
WorkTaskCompetencyListSelectiveContext
ProviderRoleTypeWorkTaskTypeSuitabilityListSelectiveContext
);

const confirmRatingValue = useConfirmRatingValueFunction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ProviderRoleDto } from '../../../api/dtos/ProviderRoleDtoSchema';
import { WriteableStringMapContextProvider } from '../../../contexts/string-map-context/writeable-string-map-context-provider';
import { StringMap } from '../../../contexts/string-map-context/string-map-reducer';
import { PropsWithChildren, useCallback } from 'react';
import { WorkTaskCompetencyListSelectiveContext } from '../../../contexts/selective-context/selective-context-creators';
import { ProviderRoleTypeWorkTaskTypeSuitabilityListSelectiveContext } from '../../../contexts/selective-context/selective-context-creators';
import {
patchWorkTaskSuitabilities,
updateTeachers
Expand All @@ -24,7 +24,7 @@ export default function ProviderRoleStringMapContextProvider({
children
}: { providerRoleStringMap: StringMap<ProviderRoleDto> } & PropsWithChildren) {
const selectiveContextReadAll = useSelectiveContextListenerReadAll(
WorkTaskCompetencyListSelectiveContext
ProviderRoleTypeWorkTaskTypeSuitabilityListSelectiveContext
);

const commitServerAction = useCallback(
Expand Down

0 comments on commit 369f029

Please sign in to comment.