"fix: update party order details route variable naming and test case ID"
This commit is contained in:
@@ -14,7 +14,7 @@ type Props = {
|
||||
customer?: IOrderCustomer;
|
||||
};
|
||||
|
||||
export function OrderDetailsCustomer({ customer }: Props) {
|
||||
export function PartyOrderDetailsCustomer({ customer }: Props) {
|
||||
return (
|
||||
<>
|
||||
<CardHeader
|
||||
|
@@ -13,7 +13,7 @@ type Props = {
|
||||
delivery?: IOrderDelivery;
|
||||
};
|
||||
|
||||
export function OrderDetailsDelivery({ delivery }: Props) {
|
||||
export function PartyOrderDetailsDelivery({ delivery }: Props) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<>
|
||||
|
@@ -20,7 +20,7 @@ type Props = {
|
||||
history?: IOrderHistory;
|
||||
};
|
||||
|
||||
export function OrderDetailsHistory({ history }: Props) {
|
||||
export function PartyOrderDetailsHistory({ history }: Props) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const renderSummary = () => (
|
||||
|
@@ -22,7 +22,7 @@ type Props = CardProps & {
|
||||
items?: IOrderProductItem[];
|
||||
};
|
||||
|
||||
export function OrderDetailsItems({
|
||||
export function PartyOrderDetailsItems({
|
||||
sx,
|
||||
taxes,
|
||||
shipping,
|
||||
|
@@ -10,7 +10,7 @@ type Props = {
|
||||
payment?: IOrderPayment;
|
||||
};
|
||||
|
||||
export function OrderDetailsPayment({ payment }: Props) {
|
||||
export function PartyOrderDetailsPayment({ payment }: Props) {
|
||||
return (
|
||||
<>
|
||||
<CardHeader
|
||||
|
@@ -11,7 +11,7 @@ type Props = {
|
||||
shippingAddress?: IOrderShippingAddress;
|
||||
};
|
||||
|
||||
export function OrderDetailsShipping({ shippingAddress }: Props) {
|
||||
export function PartyOrderDetailsShipping({ shippingAddress }: Props) {
|
||||
return (
|
||||
<>
|
||||
<CardHeader
|
||||
|
@@ -27,7 +27,7 @@ type Props = {
|
||||
statusOptions: { value: string; label: string }[];
|
||||
};
|
||||
|
||||
export function OrderDetailsToolbar({
|
||||
export function PartyOrderDetailsToolbar({
|
||||
status,
|
||||
backHref,
|
||||
createdAt,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
// src/sections/order/view/order-details-view.tsx
|
||||
|
||||
//
|
||||
import Box from '@mui/material/Box';
|
||||
import Card from '@mui/material/Card';
|
||||
import Divider from '@mui/material/Divider';
|
||||
@@ -13,32 +13,32 @@ import { DashboardContent } from 'src/layouts/dashboard';
|
||||
import { useTranslate } from 'src/locales';
|
||||
import { paths } from 'src/routes/paths';
|
||||
import type { IPartyOrderItem } from 'src/types/party-order';
|
||||
import { OrderDetailsCustomer } from '../party-order-details-customer';
|
||||
import { OrderDetailsDelivery } from '../party-order-details-delivery';
|
||||
import { OrderDetailsHistory } from '../party-order-details-history';
|
||||
import { OrderDetailsItems } from '../party-order-details-items';
|
||||
import { OrderDetailsPayment } from '../party-order-details-payment';
|
||||
import { OrderDetailsShipping } from '../party-order-details-shipping';
|
||||
import { OrderDetailsToolbar } from '../party-order-details-toolbar';
|
||||
import { PartyOrderDetailsCustomer } from '../party-order-details-customer';
|
||||
import { PartyOrderDetailsDelivery } from '../party-order-details-delivery';
|
||||
import { PartyOrderDetailsHistory } from '../party-order-details-history';
|
||||
import { PartyOrderDetailsItems } from '../party-order-details-items';
|
||||
import { PartyOrderDetailsPayment } from '../party-order-details-payment';
|
||||
import { PartyOrderDetailsShipping } from '../party-order-details-shipping';
|
||||
import { PartyOrderDetailsToolbar } from '../party-order-details-toolbar';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
type Props = {
|
||||
order: IPartyOrderItem;
|
||||
partyOrder: IPartyOrderItem;
|
||||
};
|
||||
|
||||
export function OrderDetailsView({ order }: Props) {
|
||||
export function PartyOrderDetailsView({ partyOrder }: Props) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [status, setStatus] = useState(order.status);
|
||||
const [status, setStatus] = useState(partyOrder.status);
|
||||
|
||||
const handleChangeStatus = useCallback(
|
||||
async (newValue: string) => {
|
||||
setStatus(newValue);
|
||||
// change order status
|
||||
try {
|
||||
if (order?.id) {
|
||||
await changeStatus(order.id, newValue);
|
||||
if (partyOrder?.id) {
|
||||
await changeStatus(partyOrder.id, newValue);
|
||||
|
||||
toast.success('order status updated');
|
||||
}
|
||||
@@ -47,16 +47,16 @@ export function OrderDetailsView({ order }: Props) {
|
||||
toast.warning('error during update order status');
|
||||
}
|
||||
},
|
||||
[order.id]
|
||||
[partyOrder.id]
|
||||
);
|
||||
|
||||
return (
|
||||
<DashboardContent>
|
||||
<OrderDetailsToolbar
|
||||
<PartyOrderDetailsToolbar
|
||||
status={status}
|
||||
createdAt={order?.createdAt}
|
||||
orderNumber={order?.orderNumber}
|
||||
backHref={paths.dashboard.order.root}
|
||||
createdAt={partyOrder?.createdAt}
|
||||
orderNumber={partyOrder?.orderNumber}
|
||||
backHref={paths.dashboard.partyOrder.root}
|
||||
onChangeStatus={handleChangeStatus}
|
||||
statusOptions={ORDER_STATUS_OPTIONS}
|
||||
/>
|
||||
@@ -71,31 +71,31 @@ export function OrderDetailsView({ order }: Props) {
|
||||
flexDirection: { xs: 'column-reverse', md: 'column' },
|
||||
}}
|
||||
>
|
||||
<OrderDetailsItems
|
||||
items={order?.items}
|
||||
taxes={order?.taxes}
|
||||
shipping={order?.shipping}
|
||||
discount={order?.discount}
|
||||
subtotal={order?.subtotal}
|
||||
totalAmount={order?.totalAmount}
|
||||
<PartyOrderDetailsItems
|
||||
items={partyOrder?.items}
|
||||
taxes={partyOrder?.taxes}
|
||||
shipping={partyOrder?.shipping}
|
||||
discount={partyOrder?.discount}
|
||||
subtotal={partyOrder?.subtotal}
|
||||
totalAmount={partyOrder?.totalAmount}
|
||||
/>
|
||||
|
||||
<OrderDetailsHistory history={order?.history} />
|
||||
<PartyOrderDetailsHistory history={partyOrder?.history} />
|
||||
</Box>
|
||||
</Grid>
|
||||
|
||||
<Grid size={{ xs: 12, md: 4 }}>
|
||||
<Card>
|
||||
<OrderDetailsCustomer customer={order?.customer} />
|
||||
<PartyOrderDetailsCustomer customer={partyOrder?.customer} />
|
||||
|
||||
<Divider sx={{ borderStyle: 'dashed' }} />
|
||||
<OrderDetailsDelivery delivery={order?.delivery} />
|
||||
<PartyOrderDetailsDelivery delivery={partyOrder?.delivery} />
|
||||
|
||||
<Divider sx={{ borderStyle: 'dashed' }} />
|
||||
<OrderDetailsShipping shippingAddress={order?.shippingAddress} />
|
||||
<PartyOrderDetailsShipping shippingAddress={partyOrder?.shippingAddress} />
|
||||
|
||||
<Divider sx={{ borderStyle: 'dashed' }} />
|
||||
<OrderDetailsPayment payment={order?.payment} />
|
||||
<PartyOrderDetailsPayment payment={partyOrder?.payment} />
|
||||
</Card>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
@@ -283,7 +283,7 @@ export function PartyOrderListView() {
|
||||
selected={table.selected.includes(row.id)}
|
||||
onSelectRow={() => table.onSelectRow(row.id)}
|
||||
onDeleteRow={() => handleDeleteRow(row.id)}
|
||||
detailsHref={paths.dashboard.order.details(row.id)}
|
||||
detailsHref={paths.dashboard.partyOrder.details(row.id)}
|
||||
/>
|
||||
))}
|
||||
|
||||
|
Reference in New Issue
Block a user