update order
This commit is contained in:
@@ -74,7 +74,6 @@ 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,
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -65,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.id}`);
|
router.push(`${pathsConfig.app.myOrders}/${order.medusaOrderId}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -107,9 +107,13 @@ export default function OrderItemsTable({
|
|||||||
/>
|
/>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell />
|
<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}>
|
<Button size="sm" onClick={openDetailedView}>
|
||||||
<Trans i18nKey="analysis-results:view" />
|
<Trans
|
||||||
|
i18nKey={
|
||||||
|
isTtoservice ? 'orders:view' : 'analysis-results:view'
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
{isTtoservice && order.bookingCode && (
|
{isTtoservice && order.bookingCode && (
|
||||||
<Button
|
<Button
|
||||||
@@ -182,7 +186,11 @@ export default function OrderItemsTable({
|
|||||||
|
|
||||||
<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={
|
||||||
|
isTtoservice ? 'orders:view' : 'analysis-results:view'
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
{isCancelOrderAllowed && (
|
{isCancelOrderAllowed && (
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -1,20 +1,31 @@
|
|||||||
import { cache } from 'react';
|
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 { 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 }) {
|
||||||
const [response, countryCodes] = await Promise.all([
|
const [response, countryCodes, { productTypes }] = await Promise.all([
|
||||||
getProductCategories({
|
getProductCategories({
|
||||||
handle,
|
handle,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
}),
|
}),
|
||||||
loadCountryCodes(),
|
loadCountryCodes(),
|
||||||
|
listProductTypes(),
|
||||||
]);
|
]);
|
||||||
const category = response.product_categories[0];
|
const category = response.product_categories[0];
|
||||||
const countryCode = countryCodes[0]!;
|
const countryCode = countryCodes[0]!;
|
||||||
|
const ttoServiceTypeId = findProductTypeIdByHandle(
|
||||||
|
productTypes,
|
||||||
|
'tto-service',
|
||||||
|
);
|
||||||
|
|
||||||
if (!response.product_categories?.[0]?.id) {
|
if (!response.product_categories?.[0]?.id) {
|
||||||
return { category: null };
|
return { category: null };
|
||||||
@@ -29,6 +40,9 @@ async function categoryLoader({ handle }: { handle: string }) {
|
|||||||
|
|
||||||
const productsWithNoRequiredPayment = categoryProducts.filter(
|
const productsWithNoRequiredPayment = categoryProducts.filter(
|
||||||
async (product) => {
|
async (product) => {
|
||||||
|
if (product.type_id !== ttoServiceTypeId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (product.metadata?.serviceIds) {
|
if (product.metadata?.serviceIds) {
|
||||||
const serviceIds: number[] = JSON.parse(
|
const serviceIds: number[] = JSON.parse(
|
||||||
product.metadata.serviceIds as string,
|
product.metadata.serviceIds as string,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"title": "Tellimused",
|
"title": "Tellimused",
|
||||||
"description": "Vaata oma tellimusi",
|
"description": "Vaata oma tellimusi",
|
||||||
"noOrders": "Tellimusi ei leitud",
|
"noOrders": "Tellimusi ei leitud",
|
||||||
|
"view": "Vaata tellimust",
|
||||||
"table": {
|
"table": {
|
||||||
"analysisPackage": "Analüüsi pakett",
|
"analysisPackage": "Analüüsi pakett",
|
||||||
"ttoService": "Broneering",
|
"ttoService": "Broneering",
|
||||||
|
|||||||
Reference in New Issue
Block a user