fix build
This commit is contained in:
parent
0698242257
commit
ebe8ee5437
@ -1,6 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { ScheduleTimeContext } from '../context';
|
||||
import { type OrderTimeRange } from '../types';
|
||||
import { formatTime } from '@repo/graphql/utils/datetime-format';
|
||||
import { Input } from '@repo/ui/components/ui/input';
|
||||
import { cn } from '@repo/ui/lib/utils';
|
||||
@ -11,11 +12,9 @@ type EditableTimeRangeProps = {
|
||||
readonly onSubmit: (event: FormEvent) => void;
|
||||
};
|
||||
|
||||
type TimeRangeProps = {
|
||||
type TimeRangeProps = OrderTimeRange & {
|
||||
readonly className?: string;
|
||||
readonly delimiter?: boolean;
|
||||
readonly time_end: string;
|
||||
readonly time_start: string;
|
||||
};
|
||||
|
||||
export function EditableTimeRangeForm({
|
||||
@ -62,9 +61,9 @@ export function ReadonlyTimeRange({
|
||||
}: Readonly<TimeRangeProps>) {
|
||||
return (
|
||||
<div className={cn('flex flex-row items-center gap-2 text-lg font-bold', className)}>
|
||||
<span className="tracking-wider">{formatTime(time_start).user()}</span>
|
||||
<span className="tracking-wider">{time_start ? formatTime(time_start).user() : 'xx:xx'}</span>
|
||||
{delimiter && ' - '}
|
||||
<span className="tracking-wider">{formatTime(time_end).user()}</span>
|
||||
<span className="tracking-wider">{time_end ? formatTime(time_end).user() : 'xx:xx'}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,5 +2,6 @@ import type * as GQL from '@repo/graphql/types';
|
||||
|
||||
export type OrderClient = NonNullable<GQL.GetOrderQuery['order']>['client'];
|
||||
export type OrderComponentProps = Pick<GQL.OrderFieldsFragment, 'documentId'>;
|
||||
export type OrderTimeRange = Pick<GQL.OrderFieldsFragment, 'time_end' | 'time_start'>;
|
||||
export type Slot = NonNullable<GQL.GetSlotQuery['slot']>;
|
||||
export type SlotComponentProps = Pick<GQL.SlotFieldsFragment, 'documentId'>;
|
||||
|
||||
@ -12,6 +12,7 @@ import { type VariablesOf } from '@graphql-typed-document-node/core';
|
||||
const ERRORS = {
|
||||
INVALID_CLIENT: 'Invalid client',
|
||||
INVALID_MASTER: 'Invalid master',
|
||||
INVALID_SERVICE_DURATION: 'Invalid service duration',
|
||||
MISSING_CLIENT: 'Missing client id',
|
||||
MISSING_SERVICE_ID: 'Missing service id',
|
||||
MISSING_SERVICES: 'Missing services',
|
||||
@ -63,6 +64,9 @@ export class OrdersService extends BaseService {
|
||||
const { service } = await servicesService.getService({
|
||||
documentId: variables.input.services[0],
|
||||
});
|
||||
|
||||
if (!service?.duration) throw new Error(ERRORS.INVALID_SERVICE_DURATION);
|
||||
|
||||
const endTime = sumTime(variables.input.time_start, service?.duration);
|
||||
const { mutate } = await getClientWithToken();
|
||||
const mutationResult = await mutate({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user