update order
This commit is contained in:
@@ -74,7 +74,6 @@ export default function OrderBlock({
|
||||
bookingCode: ttoReservation?.booking_code,
|
||||
clinicId: ttoReservation?.clinic_id,
|
||||
medusaLineItemId: ttoReservation?.medusa_cart_line_item_id,
|
||||
id: ttoReservation?.id,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -65,7 +65,7 @@ export default function OrderItemsTable({
|
||||
await logAnalysisResultsNavigateAction(order.medusaOrderId);
|
||||
router.push(`${pathsConfig.app.analysisResults}/${order.id}`);
|
||||
} else {
|
||||
router.push(`${pathsConfig.app.myOrders}/${order.id}`);
|
||||
router.push(`${pathsConfig.app.myOrders}/${order.medusaOrderId}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -107,9 +107,13 @@ export default function OrderItemsTable({
|
||||
/>
|
||||
<TableRow>
|
||||
<TableCell />
|
||||
<TableCell className="flex w-full items-center justify-end p-0 pt-2">
|
||||
<TableCell className="flex w-full items-center justify-end gap-2 p-0 pt-2">
|
||||
<Button size="sm" onClick={openDetailedView}>
|
||||
<Trans i18nKey="analysis-results:view" />
|
||||
<Trans
|
||||
i18nKey={
|
||||
isTtoservice ? 'orders:view' : 'analysis-results:view'
|
||||
}
|
||||
/>
|
||||
</Button>
|
||||
{isTtoservice && order.bookingCode && (
|
||||
<Button
|
||||
@@ -182,7 +186,11 @@ export default function OrderItemsTable({
|
||||
|
||||
<TableCell className="px-6 text-right">
|
||||
<Button size="sm" onClick={openDetailedView}>
|
||||
<Trans i18nKey="analysis-results:view" />
|
||||
<Trans
|
||||
i18nKey={
|
||||
isTtoservice ? 'orders:view' : 'analysis-results:view'
|
||||
}
|
||||
/>
|
||||
</Button>
|
||||
{isCancelOrderAllowed && (
|
||||
<Button
|
||||
|
||||
@@ -1,20 +1,31 @@
|
||||
import { cache } from 'react';
|
||||
|
||||
import { getProductCategories, listProducts } from '@lib/data';
|
||||
import {
|
||||
getProductCategories,
|
||||
listProductTypes,
|
||||
listProducts,
|
||||
} from '@lib/data';
|
||||
|
||||
import { findProductTypeIdByHandle } from '~/lib/utils';
|
||||
|
||||
import { isPaymentRequiredForService } from './actions';
|
||||
import { loadCountryCodes } from './load-analyses';
|
||||
|
||||
async function categoryLoader({ handle }: { handle: string }) {
|
||||
const [response, countryCodes] = await Promise.all([
|
||||
const [response, countryCodes, { productTypes }] = await Promise.all([
|
||||
getProductCategories({
|
||||
handle,
|
||||
limit: 1,
|
||||
}),
|
||||
loadCountryCodes(),
|
||||
listProductTypes(),
|
||||
]);
|
||||
const category = response.product_categories[0];
|
||||
const countryCode = countryCodes[0]!;
|
||||
const ttoServiceTypeId = findProductTypeIdByHandle(
|
||||
productTypes,
|
||||
'tto-service',
|
||||
);
|
||||
|
||||
if (!response.product_categories?.[0]?.id) {
|
||||
return { category: null };
|
||||
@@ -29,6 +40,9 @@ async function categoryLoader({ handle }: { handle: string }) {
|
||||
|
||||
const productsWithNoRequiredPayment = categoryProducts.filter(
|
||||
async (product) => {
|
||||
if (product.type_id !== ttoServiceTypeId) {
|
||||
return false;
|
||||
}
|
||||
if (product.metadata?.serviceIds) {
|
||||
const serviceIds: number[] = JSON.parse(
|
||||
product.metadata.serviceIds as string,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"title": "Tellimused",
|
||||
"description": "Vaata oma tellimusi",
|
||||
"noOrders": "Tellimusi ei leitud",
|
||||
"view": "Vaata tellimust",
|
||||
"table": {
|
||||
"analysisPackage": "Analüüsi pakett",
|
||||
"ttoService": "Broneering",
|
||||
|
||||
Reference in New Issue
Block a user