fix tto order tables
This commit is contained in:
@@ -66,14 +66,16 @@ async function OrdersPage() {
|
|||||||
({ medusa_order_id }) => medusa_order_id === medusaOrder.id,
|
({ medusa_order_id }) => medusa_order_id === medusaOrder.id,
|
||||||
);
|
);
|
||||||
|
|
||||||
const ttoReservation = ttoOrders.find(({ id }) => {
|
const orderIds = new Set(
|
||||||
const connectedOnlineReservationId =
|
(medusaOrder?.items ?? [])
|
||||||
medusaOrder?.items &&
|
.map((i) => i?.metadata?.connectedOnlineReservationId)
|
||||||
medusaOrder.items.find(
|
.filter(Boolean)
|
||||||
({ metadata }) => !!metadata?.connectedOnlineReservationId,
|
.map(String),
|
||||||
)?.metadata?.connectedOnlineReservationId;
|
);
|
||||||
return id === connectedOnlineReservationId;
|
|
||||||
});
|
const ttoReservation = ttoOrders.find((o) =>
|
||||||
|
orderIds.has(String(o.id)),
|
||||||
|
);
|
||||||
|
|
||||||
const medusaOrderItems = medusaOrder.items || [];
|
const medusaOrderItems = medusaOrder.items || [];
|
||||||
const medusaOrderItemsAnalysisPackages = medusaOrderItems.filter(
|
const medusaOrderItemsAnalysisPackages = medusaOrderItems.filter(
|
||||||
@@ -105,7 +107,6 @@ async function OrdersPage() {
|
|||||||
medusaOrderId={medusaOrder.id}
|
medusaOrderId={medusaOrder.id}
|
||||||
analysisOrder={analysisOrder}
|
analysisOrder={analysisOrder}
|
||||||
ttoReservation={ttoReservation}
|
ttoReservation={ttoReservation}
|
||||||
medusaOrderStatus={medusaOrder.status}
|
|
||||||
itemsAnalysisPackage={medusaOrderItemsAnalysisPackages}
|
itemsAnalysisPackage={medusaOrderItemsAnalysisPackages}
|
||||||
itemsTtoService={medusaOrderItemsTtoServices}
|
itemsTtoService={medusaOrderItemsTtoServices}
|
||||||
itemsOther={medusaOrderItemsOther}
|
itemsOther={medusaOrderItemsOther}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { Label } from '@medusajs/ui';
|
import { Label } from '@medusajs/ui';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
import { RadioGroup, RadioGroupItem } from '@kit/ui/radio-group';
|
import { RadioGroup, RadioGroupItem } from '@kit/ui/radio-group';
|
||||||
import { Card } from '@kit/ui/shadcn/card';
|
import { Card } from '@kit/ui/shadcn/card';
|
||||||
@@ -8,7 +7,6 @@ import { Trans } from '@kit/ui/trans';
|
|||||||
import { useBooking } from './booking.provider';
|
import { useBooking } from './booking.provider';
|
||||||
|
|
||||||
const LocationSelector = () => {
|
const LocationSelector = () => {
|
||||||
const { t } = useTranslation();
|
|
||||||
const { selectedLocationId, setSelectedLocationId, locations } = useBooking();
|
const { selectedLocationId, setSelectedLocationId, locations } = useBooking();
|
||||||
|
|
||||||
const onLocationSelect = (locationId: number | string | null) => {
|
const onLocationSelect = (locationId: number | string | null) => {
|
||||||
@@ -16,6 +14,15 @@ const LocationSelector = () => {
|
|||||||
setSelectedLocationId(Number(locationId));
|
setSelectedLocationId(Number(locationId));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uniqueLocations = locations?.filter((item, index, self) => {
|
||||||
|
return (
|
||||||
|
index ===
|
||||||
|
self.findIndex(
|
||||||
|
(loc) => loc.sync_id === item.sync_id && loc.name === item.name,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="mb-4 p-4">
|
<Card className="mb-4 p-4">
|
||||||
<h5 className="text-semibold mb-2">
|
<h5 className="text-semibold mb-2">
|
||||||
@@ -26,20 +33,23 @@ const LocationSelector = () => {
|
|||||||
className="mb-2 flex flex-col"
|
className="mb-2 flex flex-col"
|
||||||
onValueChange={(val) => onLocationSelect(val)}
|
onValueChange={(val) => onLocationSelect(val)}
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2">
|
{/* <div className="flex items-center gap-2">
|
||||||
<RadioGroupItem
|
<RadioGroupItem
|
||||||
value={'all'}
|
value="all"
|
||||||
id={'all'}
|
id="all"
|
||||||
checked={selectedLocationId === null}
|
checked={selectedLocationId === null}
|
||||||
/>
|
/>
|
||||||
<Label htmlFor={'all'}>{t('booking:showAllLocations')}</Label>
|
<Label htmlFor="all">{t('booking:showAllLocations')}</Label>
|
||||||
</div>
|
</div> */}
|
||||||
{locations?.map((location) => (
|
{uniqueLocations?.map((location, index) => (
|
||||||
<div key={location.sync_id} className="flex items-center gap-2">
|
<div key={location.sync_id} className="flex items-center gap-2">
|
||||||
<RadioGroupItem
|
<RadioGroupItem
|
||||||
value={location.sync_id.toString()}
|
value={location.sync_id.toString()}
|
||||||
id={location.sync_id.toString()}
|
id={location.sync_id.toString()}
|
||||||
checked={selectedLocationId === location.sync_id}
|
checked={
|
||||||
|
selectedLocationId === location.sync_id ||
|
||||||
|
(index === 0 && selectedLocationId === null)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Label htmlFor={location.sync_id.toString()}>
|
<Label htmlFor={location.sync_id.toString()}>
|
||||||
{location.name}
|
{location.name}
|
||||||
|
|||||||
@@ -18,19 +18,19 @@ const MobileCartItems = ({
|
|||||||
productColumnLabelKey: string;
|
productColumnLabelKey: string;
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
i18n: { language },
|
i18n: { language, t },
|
||||||
} = useTranslation();
|
} = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table className="border-separate rounded-lg border p-2">
|
<Table className="border-separate rounded-lg border p-2">
|
||||||
<TableBody>
|
<TableBody>
|
||||||
<MobileTableRow
|
<MobileTableRow
|
||||||
titleKey={productColumnLabelKey}
|
title={t(productColumnLabelKey)}
|
||||||
value={item.product_title}
|
value={item.product_title}
|
||||||
/>
|
/>
|
||||||
<MobileTableRow titleKey="cart:table.time" value={item.quantity} />
|
<MobileTableRow title={t('cart:table.time')} value={item.quantity} />
|
||||||
<MobileTableRow
|
<MobileTableRow
|
||||||
titleKey="cart:table.price"
|
title={t('cart:table.price')}
|
||||||
value={formatCurrency({
|
value={formatCurrency({
|
||||||
value: item.unit_price,
|
value: item.unit_price,
|
||||||
currencyCode,
|
currencyCode,
|
||||||
@@ -38,7 +38,7 @@ const MobileCartItems = ({
|
|||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<MobileTableRow
|
<MobileTableRow
|
||||||
titleKey="cart:table.total"
|
title={t('cart:table.total')}
|
||||||
value={
|
value={
|
||||||
item.total &&
|
item.total &&
|
||||||
formatCurrency({
|
formatCurrency({
|
||||||
|
|||||||
@@ -25,27 +25,30 @@ const MobileCartServiceItems = ({
|
|||||||
setEditingItem: (item: EnrichedCartItem | null) => void;
|
setEditingItem: (item: EnrichedCartItem | null) => void;
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
i18n: { language },
|
i18n: { language, t },
|
||||||
} = useTranslation();
|
} = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table className="border-separate rounded-lg border p-2">
|
<Table className="border-separate rounded-lg border p-2">
|
||||||
<TableBody>
|
<TableBody>
|
||||||
<MobileTableRow
|
<MobileTableRow
|
||||||
titleKey={productColumnLabelKey}
|
title={t(productColumnLabelKey)}
|
||||||
value={item.product_title}
|
value={item.product_title}
|
||||||
/>
|
/>
|
||||||
<MobileTableRow
|
<MobileTableRow
|
||||||
titleKey="cart:table.time"
|
title={t('cart:table.time')}
|
||||||
value={formatDateAndTime(item.reservation.startTime.toString())}
|
value={formatDateAndTime(item.reservation.startTime.toString())}
|
||||||
/>
|
/>
|
||||||
<MobileTableRow
|
<MobileTableRow
|
||||||
titleKey="cart:table.location"
|
title={t('cart:table.location')}
|
||||||
value={item.reservation.location?.address ?? '-'}
|
value={item.reservation.location?.address ?? '-'}
|
||||||
/>
|
/>
|
||||||
<MobileTableRow titleKey="cart:table.quantity" value={item.quantity} />
|
|
||||||
<MobileTableRow
|
<MobileTableRow
|
||||||
titleKey="cart:table.price"
|
title={t('cart:table.quantity')}
|
||||||
|
value={item.quantity}
|
||||||
|
/>
|
||||||
|
<MobileTableRow
|
||||||
|
title={t('cart:table.price')}
|
||||||
value={formatCurrency({
|
value={formatCurrency({
|
||||||
value: item.unit_price,
|
value: item.unit_price,
|
||||||
currencyCode,
|
currencyCode,
|
||||||
@@ -53,7 +56,7 @@ const MobileCartServiceItems = ({
|
|||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<MobileTableRow
|
<MobileTableRow
|
||||||
titleKey="cart:table.total"
|
title={t('cart:table.total')}
|
||||||
value={
|
value={
|
||||||
item.total &&
|
item.total &&
|
||||||
formatCurrency({
|
formatCurrency({
|
||||||
|
|||||||
@@ -1,19 +1,16 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Trans } from '@kit/ui/makerkit/trans';
|
|
||||||
import { TableCell, TableHead, TableRow } from '@kit/ui/shadcn/table';
|
import { TableCell, TableHead, TableRow } from '@kit/ui/shadcn/table';
|
||||||
|
|
||||||
const MobleTableRow = ({
|
const MobleTableRow = ({
|
||||||
titleKey,
|
title,
|
||||||
value,
|
value,
|
||||||
}: {
|
}: {
|
||||||
titleKey?: string;
|
title?: string;
|
||||||
value?: string | number;
|
value?: string | number;
|
||||||
}) => (
|
}) => (
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableHead className="h-2 font-bold">
|
<TableHead className="h-2 font-bold">{title}</TableHead>
|
||||||
<Trans i18nKey={titleKey} />
|
|
||||||
</TableHead>
|
|
||||||
|
|
||||||
<TableCell className="p-0 text-right">
|
<TableCell className="p-0 text-right">
|
||||||
<p className="txt-medium-plus text-ui-fg-base">{value}</p>
|
<p className="txt-medium-plus text-ui-fg-base">{value}</p>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ export default function OrderBlock({
|
|||||||
analysisOrder,
|
analysisOrder,
|
||||||
ttoLocation,
|
ttoLocation,
|
||||||
ttoReservation,
|
ttoReservation,
|
||||||
medusaOrderStatus,
|
|
||||||
itemsAnalysisPackage,
|
itemsAnalysisPackage,
|
||||||
itemsTtoService,
|
itemsTtoService,
|
||||||
itemsOther,
|
itemsOther,
|
||||||
@@ -22,7 +21,6 @@ export default function OrderBlock({
|
|||||||
analysisOrder?: AnalysisOrder;
|
analysisOrder?: AnalysisOrder;
|
||||||
ttoLocation?: { name: string };
|
ttoLocation?: { name: string };
|
||||||
ttoReservation?: TTOOrder;
|
ttoReservation?: TTOOrder;
|
||||||
medusaOrderStatus: string;
|
|
||||||
itemsAnalysisPackage: StoreOrderLineItem[];
|
itemsAnalysisPackage: StoreOrderLineItem[];
|
||||||
itemsTtoService: StoreOrderLineItem[];
|
itemsTtoService: StoreOrderLineItem[];
|
||||||
itemsOther: StoreOrderLineItem[];
|
itemsOther: StoreOrderLineItem[];
|
||||||
@@ -76,6 +74,7 @@ export default function OrderBlock({
|
|||||||
bookingCode: ttoReservation?.booking_code,
|
bookingCode: ttoReservation?.booking_code,
|
||||||
clinicId: ttoReservation?.clinic_id,
|
clinicId: ttoReservation?.clinic_id,
|
||||||
medusaLineItemId: ttoReservation?.medusa_cart_line_item_id,
|
medusaLineItemId: ttoReservation?.medusa_cart_line_item_id,
|
||||||
|
id: ttoReservation?.id,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
import { redirect, useRouter } from 'next/navigation';
|
import { redirect, useRouter } from 'next/navigation';
|
||||||
|
|
||||||
import ConfirmationModal from '@/packages/shared/src/components/confirmation-modal';
|
import ConfirmationModal from '@/packages/shared/src/components/confirmation-modal';
|
||||||
import { StoreOrderLineItem } from '@medusajs/types';
|
import { StoreOrderLineItem } from '@medusajs/types';
|
||||||
import { formatDate } from 'date-fns';
|
import { formatDate } from 'date-fns';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { pathsConfig } from '@kit/shared/config';
|
import { pathsConfig } from '@kit/shared/config';
|
||||||
import { Button } from '@kit/ui/button';
|
import { Button } from '@kit/ui/button';
|
||||||
@@ -41,6 +42,9 @@ export default function OrderItemsTable({
|
|||||||
type?: OrderItemType;
|
type?: OrderItemType;
|
||||||
isPackage?: boolean;
|
isPackage?: boolean;
|
||||||
}) {
|
}) {
|
||||||
|
const {
|
||||||
|
i18n: { t },
|
||||||
|
} = useTranslation();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [isConfirmOpen, setIsConfirmOpen] = useState(false);
|
const [isConfirmOpen, setIsConfirmOpen] = useState(false);
|
||||||
const isCancelOrderAllowed =
|
const isCancelOrderAllowed =
|
||||||
@@ -61,7 +65,7 @@ export default function OrderItemsTable({
|
|||||||
await logAnalysisResultsNavigateAction(order.medusaOrderId);
|
await logAnalysisResultsNavigateAction(order.medusaOrderId);
|
||||||
router.push(`${pathsConfig.app.analysisResults}/${order.id}`);
|
router.push(`${pathsConfig.app.analysisResults}/${order.id}`);
|
||||||
} else {
|
} else {
|
||||||
router.push(`${pathsConfig.app.myOrders}/${order.medusaOrderId}`);
|
router.push(`${pathsConfig.app.myOrders}/${order.id}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -74,27 +78,31 @@ export default function OrderItemsTable({
|
|||||||
(a.created_at ?? '') > (b.created_at ?? '') ? -1 : 1,
|
(a.created_at ?? '') > (b.created_at ?? '') ? -1 : 1,
|
||||||
)
|
)
|
||||||
.map((orderItem) => (
|
.map((orderItem) => (
|
||||||
<div key={`${orderItem.id}-mobile`}>
|
<React.Fragment key={`${orderItem.id}-mobile`}>
|
||||||
<MobileTableRow
|
<MobileTableRow
|
||||||
titleKey={title}
|
title={t(title)}
|
||||||
value={orderItem.product_title || ''}
|
value={orderItem.product_title || ''}
|
||||||
/>
|
/>
|
||||||
<MobileTableRow
|
<MobileTableRow
|
||||||
titleKey="orders:table.createdAt"
|
title={t('orders:table.createdAt')}
|
||||||
value={formatDate(orderItem.created_at, 'dd.MM.yyyy HH:mm')}
|
value={formatDate(orderItem.created_at, 'dd.MM.yyyy HH:mm')}
|
||||||
/>
|
/>
|
||||||
{order.location && (
|
{order.location && (
|
||||||
<MobileTableRow
|
<MobileTableRow
|
||||||
titleKey="orders:table.location"
|
title={t('orders:table.location')}
|
||||||
value={order.location}
|
value={order.location}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<MobileTableRow
|
<MobileTableRow
|
||||||
titleKey="orders:table.status"
|
title={t('orders:table.status')}
|
||||||
value={
|
value={
|
||||||
isPackage
|
isPackage
|
||||||
? `orders:status.analysisPackageOrder.${order?.status ?? 'CONFIRMED'}`
|
? t(
|
||||||
: `orders:status.${type}.${order?.status ?? 'CONFIRMED'}`
|
`orders:status.analysisPackageOrder.${order?.status ?? 'CONFIRMED'}`,
|
||||||
|
)
|
||||||
|
: t(
|
||||||
|
`orders:status.${type}.${order?.status ?? 'CONFIRMED'}`,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
@@ -114,7 +122,7 @@ export default function OrderItemsTable({
|
|||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</div>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
@@ -172,23 +180,24 @@ export default function OrderItemsTable({
|
|||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|
||||||
<TableCell className="px-6 text-right">
|
<TableCell className="px-6 text-right">
|
||||||
<Button size="sm" onClick={openDetailedView}>
|
<Button size="sm" onClick={openDetailedView}>
|
||||||
<Trans i18nKey="analysis-results:view" />
|
<Trans i18nKey="analysis-results:view" />
|
||||||
</Button>
|
|
||||||
{isCancelOrderAllowed && (
|
|
||||||
<Button
|
|
||||||
size="sm"
|
|
||||||
className="bg-warning/90 hover:bg-warning mt-2 w-full"
|
|
||||||
onClick={() => setIsConfirmOpen(true)}
|
|
||||||
>
|
|
||||||
<Trans i18nKey="analysis-results:cancel" />
|
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
{isCancelOrderAllowed && (
|
||||||
</TableCell>
|
<Button
|
||||||
</TableRow>
|
size="sm"
|
||||||
))}
|
className="bg-warning/90 hover:bg-warning mt-2 w-full"
|
||||||
</TableBody>
|
onClick={() => setIsConfirmOpen(true)}
|
||||||
|
>
|
||||||
|
<Trans i18nKey="analysis-results:cancel" />
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
{isCancelOrderAllowed && (
|
{isCancelOrderAllowed && (
|
||||||
<ConfirmationModal
|
<ConfirmationModal
|
||||||
isOpen={isConfirmOpen}
|
isOpen={isConfirmOpen}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
'use server';
|
'use server';
|
||||||
|
|
||||||
|
import { getSupabaseServerClient } from '@/packages/supabase/src/clients/server-client';
|
||||||
import { updateLineItem } from '@lib/data/cart';
|
import { updateLineItem } from '@lib/data/cart';
|
||||||
import { StoreProductVariant } from '@medusajs/types';
|
import { StoreProductVariant } from '@medusajs/types';
|
||||||
|
|
||||||
@@ -89,3 +90,22 @@ export async function cancelTtoBooking(
|
|||||||
console.error('Error cancelling booking: ', error);
|
console.error('Error cancelling booking: ', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function isPaymentRequiredForService(serviceId: number) {
|
||||||
|
const supabaseClient = getSupabaseServerClient();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { data } = await supabaseClient
|
||||||
|
.schema('medreport')
|
||||||
|
.from('connected_online_services')
|
||||||
|
.select('requires_payment')
|
||||||
|
.eq('id', serviceId)
|
||||||
|
.is('requires_payment', true)
|
||||||
|
.maybeSingle();
|
||||||
|
|
||||||
|
return !!data;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error checking payment requirement: ', error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,10 +10,7 @@ import { z } from 'zod';
|
|||||||
import { getLogger } from '@kit/shared/logger';
|
import { getLogger } from '@kit/shared/logger';
|
||||||
|
|
||||||
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
||||||
import {
|
import { bookAppointment } from '~/lib/services/connected-online.service';
|
||||||
bookAppointment,
|
|
||||||
getConfirmedService,
|
|
||||||
} from '~/lib/services/connected-online.service';
|
|
||||||
import { sendOrderToMedipost } from '~/lib/services/medipost/medipostPrivateMessage.service';
|
import { sendOrderToMedipost } from '~/lib/services/medipost/medipostPrivateMessage.service';
|
||||||
import { handleNavigateToPayment } from '~/lib/services/medusaCart.service';
|
import { handleNavigateToPayment } from '~/lib/services/medusaCart.service';
|
||||||
import { getOrderedAnalysisIds } from '~/lib/services/medusaOrder.service';
|
import { getOrderedAnalysisIds } from '~/lib/services/medusaOrder.service';
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { cache } from 'react';
|
|||||||
|
|
||||||
import { getProductCategories, listProducts } from '@lib/data';
|
import { getProductCategories, listProducts } from '@lib/data';
|
||||||
|
|
||||||
|
import { isPaymentRequiredForService } from './actions';
|
||||||
import { loadCountryCodes } from './load-analyses';
|
import { loadCountryCodes } from './load-analyses';
|
||||||
|
|
||||||
async function categoryLoader({ handle }: { handle: string }) {
|
async function categoryLoader({ handle }: { handle: string }) {
|
||||||
@@ -26,6 +27,24 @@ async function categoryLoader({ handle }: { handle: string }) {
|
|||||||
queryParams: { limit: 100, category_id: response.product_categories[0].id },
|
queryParams: { limit: 100, category_id: response.product_categories[0].id },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const productsWithNoRequiredPayment = categoryProducts.filter(
|
||||||
|
async (product) => {
|
||||||
|
if (product.metadata?.serviceIds) {
|
||||||
|
const serviceIds: number[] = JSON.parse(
|
||||||
|
product.metadata.serviceIds as string,
|
||||||
|
);
|
||||||
|
for (const serviceId of serviceIds) {
|
||||||
|
const requiresPayment = await isPaymentRequiredForService(serviceId);
|
||||||
|
if (requiresPayment) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
category: {
|
category: {
|
||||||
color:
|
color:
|
||||||
@@ -36,7 +55,7 @@ async function categoryLoader({ handle }: { handle: string }) {
|
|||||||
handle: category?.handle || '',
|
handle: category?.handle || '',
|
||||||
name: category?.name || '',
|
name: category?.name || '',
|
||||||
countryCode,
|
countryCode,
|
||||||
products: categoryProducts,
|
products: productsWithNoRequiredPayment,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ export async function getTtoLocation(syncId?: number | null) {
|
|||||||
.from('connected_online_locations')
|
.from('connected_online_locations')
|
||||||
.select('name')
|
.select('name')
|
||||||
.eq('sync_id', syncId)
|
.eq('sync_id', syncId)
|
||||||
|
.limit(1)
|
||||||
.single();
|
.single();
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import { redirect } from 'next/navigation';
|
|||||||
|
|
||||||
import { sdk } from '@lib/config';
|
import { sdk } from '@lib/config';
|
||||||
import medusaError from '@lib/util/medusa-error';
|
import medusaError from '@lib/util/medusa-error';
|
||||||
import type { HttpTypes, StoreCart } from '@medusajs/types';
|
import type { HttpTypes, StoreCart, StoreCartPromotion } from '@medusajs/types';
|
||||||
|
|
||||||
|
import { getLogger } from '@kit/shared/logger';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getAuthHeaders,
|
getAuthHeaders,
|
||||||
|
|||||||
@@ -25,7 +25,8 @@
|
|||||||
"FULL_ANALYSIS_RESPONSE": "Kõik tulemused käes",
|
"FULL_ANALYSIS_RESPONSE": "Kõik tulemused käes",
|
||||||
"COMPLETED": "Kinnitatud",
|
"COMPLETED": "Kinnitatud",
|
||||||
"REJECTED": "Tagastatud",
|
"REJECTED": "Tagastatud",
|
||||||
"CANCELLED": "Tühistatud"
|
"CANCELLED": "Tühistatud",
|
||||||
|
"CONFIRMED": "Kinnitatud"
|
||||||
},
|
},
|
||||||
"analysisPackageOrder": {
|
"analysisPackageOrder": {
|
||||||
"QUEUED": "Esitatud",
|
"QUEUED": "Esitatud",
|
||||||
|
|||||||
Reference in New Issue
Block a user