@deenruv/admin-dashboard 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DeenruvAdminPanel.js +1 -1
- package/dist/DeenruvDeveloperIndicator.js +1 -1
- package/dist/components/CanLeaveRouteDialog.js +1 -1
- package/dist/components/DeleteDialog.js +1 -1
- package/dist/components/GlobalSearch.js +6 -6
- package/dist/components/History/AddEntryForm.js +3 -3
- package/dist/components/History/DeleteEntryDialog.js +1 -1
- package/dist/components/History/EditEntryDialog.js +1 -1
- package/dist/components/History/History.js +1 -1
- package/dist/components/History/ModifyHistoryInfo.js +1 -1
- package/dist/components/History/Timeline.js +4 -4
- package/dist/components/Menu/ActiveAdmins.js +2 -2
- package/dist/components/Menu/ChannelSwitcher.js +1 -1
- package/dist/components/Menu/Navigation.js +4 -4
- package/dist/components/Menu/NavigationFooter.js +3 -3
- package/dist/components/Menu/Notifications.js +1 -1
- package/dist/components/Menu/index.js +5 -5
- package/dist/index.css +182 -92
- package/dist/pages/Custom404.js +1 -1
- package/dist/pages/LoginScreen.js +1 -1
- package/dist/pages/Root.js +2 -2
- package/dist/pages/admins/Detail.js +1 -1
- package/dist/pages/assets/_components/Asset.js +3 -3
- package/dist/pages/assets/_components/AssetListView.js +2 -2
- package/dist/pages/assets/_components/EditAssetDialog.js +5 -5
- package/dist/pages/assets/_components/UploadAssetDialog.js +2 -2
- package/dist/pages/assets/_components/UploadProgress.js +1 -1
- package/dist/pages/channels/Detail.js +1 -1
- package/dist/pages/collections/Detail.js +1 -1
- package/dist/pages/collections/_components/CollectionDetailView.js +1 -1
- package/dist/pages/collections/_components/CollectionProductVariantsDrawer.js +1 -1
- package/dist/pages/collections/_components/CombinationMode.js +1 -1
- package/dist/pages/collections/_components/ContentsTable.js +2 -2
- package/dist/pages/collections/_components/MoveCollectionsToCollections.js +2 -2
- package/dist/pages/collections/_components/MoveEntityToChannels.js +2 -2
- package/dist/pages/collections/_components/PageHeader.js +2 -2
- package/dist/pages/countries/Detail.js +1 -1
- package/dist/pages/customer-groups/Detail.js +1 -1
- package/dist/pages/customers/Detail.js +1 -1
- package/dist/pages/customers/_components/Address.js +1 -1
- package/dist/pages/dashboard/Dashboard.js +1 -1
- package/dist/pages/extensions/Extensions.js +5 -5
- package/dist/pages/facets/Detail.js +1 -1
- package/dist/pages/orders/Detail.js +1 -1
- package/dist/pages/orders/List.js +1 -1
- package/dist/pages/orders/_components/AddPaymentDialog.js +1 -1
- package/dist/pages/orders/_components/AddressCard.js +2 -2
- package/dist/pages/orders/_components/ChangesRegister.js +3 -3
- package/dist/pages/orders/_components/CouponCodesCard.js +1 -1
- package/dist/pages/orders/_components/CustomComponent.js +1 -1
- package/dist/pages/orders/_components/CustomerSelectCard.js +2 -2
- package/dist/pages/orders/_components/FulfillmentModal.js +3 -3
- package/dist/pages/orders/_components/LineItem.js +1 -1
- package/dist/pages/orders/_components/ManualOrderChangeModal.js +2 -2
- package/dist/pages/orders/_components/ModifyingCard.js +1 -1
- package/dist/pages/orders/_components/OrderHistory.js +1 -1
- package/dist/pages/orders/_components/OrderLineActionModal/ActionQuantityPrice.js +2 -2
- package/dist/pages/orders/_components/OrderLineActionModal/index.js +1 -1
- package/dist/pages/orders/_components/PaymentMetadata.js +1 -1
- package/dist/pages/orders/_components/Payments.js +3 -3
- package/dist/pages/orders/_components/PossibleOrderStates.js +2 -2
- package/dist/pages/orders/_components/ProductsCard.js +4 -4
- package/dist/pages/orders/_components/ProductsTable.js +2 -2
- package/dist/pages/orders/_components/PromotionsList.js +1 -1
- package/dist/pages/orders/_components/RealizationCard.js +1 -1
- package/dist/pages/orders/_components/RefundCard.js +1 -1
- package/dist/pages/orders/_components/RefundPaymentCard.js +1 -1
- package/dist/pages/orders/_components/ShippingMethod.js +4 -4
- package/dist/pages/orders/_components/SpecialLineItem.js +1 -1
- package/dist/pages/orders/_components/SurchargeCard.js +1 -1
- package/dist/pages/orders/_components/TaxSummary.js +1 -1
- package/dist/pages/orders/_components/ToRealizationForm.js +1 -1
- package/dist/pages/orders/_components/TopActions.js +4 -4
- package/dist/pages/payment-methods/Detail.js +1 -1
- package/dist/pages/product-variants/List.js +1 -1
- package/dist/pages/products/Detail.js +1 -1
- package/dist/pages/products/_components/ProductDetailSidebar.js +1 -1
- package/dist/pages/products/_components/VariantsTab.js +1 -1
- package/dist/pages/promotions/Detail.js +1 -1
- package/dist/pages/roles/Detail.js +1 -1
- package/dist/pages/roles/_components/PermissionsTable.js +1 -1
- package/dist/pages/sellers/Detail.js +1 -1
- package/dist/pages/shipping-methods/Detail.js +1 -1
- package/dist/pages/status/_components/FilterToolbar.js +1 -1
- package/dist/pages/status/_components/Health.js +4 -4
- package/dist/pages/status/_components/JobResultPopover.js +1 -1
- package/dist/pages/stock-locations/Detail.js +1 -1
- package/dist/pages/tax-categories/Detail.js +1 -1
- package/dist/pages/tax-rates/Detail.js +1 -1
- package/dist/pages/zones/Detail.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +82 -84
|
@@ -5,7 +5,7 @@ import { SortOrder } from '@deenruv/admin-types';
|
|
|
5
5
|
import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable, } from '@tanstack/react-table';
|
|
6
6
|
import { ArrowRight } from 'lucide-react';
|
|
7
7
|
import React, { useMemo, useState } from 'react';
|
|
8
|
-
import { Link } from 'react-router
|
|
8
|
+
import { Link } from 'react-router';
|
|
9
9
|
import { useDebounce } from 'use-debounce';
|
|
10
10
|
export const ContentsTable = ({ collectionId, filter }) => {
|
|
11
11
|
const { objects, Paginate, Search, SortButton } = useDetailListHook({
|
|
@@ -96,7 +96,7 @@ export const ContentsTable = ({ collectionId, filter }) => {
|
|
|
96
96
|
pagination,
|
|
97
97
|
},
|
|
98
98
|
});
|
|
99
|
-
return (_jsxs(_Fragment, { children: [Search, _jsxs(Table, { className: "w-full", ...(!table.getRowModel().rows?.length && { containerClassName: 'flex' }), children: [_jsx(TableHeader, { className: "bg-primary-foreground
|
|
99
|
+
return (_jsxs(_Fragment, { children: [Search, _jsxs(Table, { className: "w-full", ...(!table.getRowModel().rows?.length && { containerClassName: 'flex' }), children: [_jsx(TableHeader, { className: "sticky top-0 bg-primary-foreground", children: table.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { children: headerGroup.headers.map((header) => {
|
|
100
100
|
return (_jsx(TableHead, { children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id));
|
|
101
101
|
}) }, headerGroup.id))) }), _jsx(TableBody, { children: table.getRowModel().rows?.length ? (table.getRowModel().rows.map((row) => (_jsx(_Fragment, { children: _jsx(TableRow, { "data-state": row.getIsSelected() && 'selected', children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id) })))) : (_jsx(EmptyState, { columnsLength: columns.length, filtered: false, title: t(`common:emptyState.default.empty.title`), description: t(`common:emptyState.default.empty.text`) })) })] }), Paginate] }));
|
|
102
102
|
};
|
|
@@ -99,9 +99,9 @@ export const MoveCollectionsToCollections = ({ close, reject, resolve, data: sel
|
|
|
99
99
|
columnFilters,
|
|
100
100
|
},
|
|
101
101
|
});
|
|
102
|
-
return (_jsxs(DialogContent, { className: "flex h-[90dvh] w-[90vw] max-w-full flex-col", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: _jsx("span", { children: t('moveCollectionsToCollections.moveCollections') }) }) }), _jsxs("div", { className: "grid h-full min-h-0
|
|
102
|
+
return (_jsxs(DialogContent, { className: "flex h-[90dvh] w-[90vw] max-w-full flex-col", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: _jsx("span", { children: t('moveCollectionsToCollections.moveCollections') }) }) }), _jsxs("div", { className: "grid h-full min-h-0 grid-cols-[1fr_auto_1fr]", children: [_jsxs("div", { className: "flex h-full min-h-0 flex-col", children: [_jsx("h1", { className: "p-4", children: t('moveCollectionsToCollections.selected') }), _jsxs(Table, { children: [_jsx(TableHeader, { className: "sticky top-0 bg-primary-foreground", children: selectedTable.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { children: headerGroup.headers.map((header) => {
|
|
103
103
|
return (_jsx(TableHead, { children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id));
|
|
104
|
-
}) }, headerGroup.id))) }), _jsx(TableBody, { children: selectedTable.getRowModel().rows.map((row) => (_jsx(TableRow, { "data-state": row.getIsSelected() && 'selected', children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))) })] })] }), _jsx("div", { className: "mx-4 h-full w-px bg-stone-700" }), _jsxs("div", { className: "flex h-full min-h-0 flex-col
|
|
104
|
+
}) }, headerGroup.id))) }), _jsx(TableBody, { children: selectedTable.getRowModel().rows.map((row) => (_jsx(TableRow, { "data-state": row.getIsSelected() && 'selected', children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))) })] })] }), _jsx("div", { className: "mx-4 h-full w-px bg-stone-700" }), _jsxs("div", { className: "flex h-full min-h-0 flex-col", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("h1", { className: "shrink-0 p-4", children: [" ", t('moveCollectionsToCollections.targetCollection')] }), _jsx(Input, { placeholder: t('moveCollectionsToCollections.searchByName'), className: "max-w-48", value: columnFilters[0].value, onChange: (e) => setColumnFilters([{ id: 'name', value: e.target.value }]) }), _jsx(Button, { className: "ml-auto", onClick: moveCollection, children: t('moveCollectionsToCollections.move') })] }), _jsxs(Table, { children: [_jsx(TableHeader, { className: "sticky top-0 bg-primary-foreground", children: allCollectionsTable.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { children: headerGroup.headers.map((header) => {
|
|
105
105
|
return (_jsx(TableHead, { children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id));
|
|
106
106
|
}) }, headerGroup.id))) }), _jsxs(TableBody, { children: [allCollectionsTable.getRowModel().rows.map((row) => (_jsx(TableRow, { "data-state": row.getIsSelected() && 'selected', children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))), ' '] })] })] })] }), ' '] }));
|
|
107
107
|
};
|
|
@@ -107,9 +107,9 @@ export const MoveEntityToChannels = ({ close, reject, resolve, data: selectedCol
|
|
|
107
107
|
const filtered = p.filter((filter) => filter.id !== id);
|
|
108
108
|
return [...filtered, { id, value }];
|
|
109
109
|
});
|
|
110
|
-
return (_jsxs(DialogContent, { className: "flex h-[90dvh] w-[90vw] max-w-full flex-col", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: _jsx("span", { children: t('moveCollectionsToChannels.moveCollections') }) }) }), _jsxs("div", { className: "grid h-full min-h-0
|
|
110
|
+
return (_jsxs(DialogContent, { className: "flex h-[90dvh] w-[90vw] max-w-full flex-col", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: _jsx("span", { children: t('moveCollectionsToChannels.moveCollections') }) }) }), _jsxs("div", { className: "grid h-full min-h-0 grid-cols-[1fr_auto_1fr]", children: [_jsxs("div", { className: "flex h-full min-h-0 flex-col", children: [_jsx("h1", { className: "p-4", children: t('moveCollectionsToChannels.selected') }), _jsxs(Table, { children: [_jsx(TableHeader, { className: "sticky top-0 bg-primary-foreground", children: selectedTable.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { children: headerGroup.headers.map((header) => {
|
|
111
111
|
return (_jsx(TableHead, { children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id));
|
|
112
|
-
}) }, headerGroup.id))) }), _jsx(TableBody, { children: selectedTable.getRowModel().rows.map((row) => (_jsx(TableRow, { "data-state": row.getIsSelected() && 'selected', children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))) })] })] }), _jsx("div", { className: "mx-4 h-full w-px bg-stone-700" }), _jsxs("div", { className: "flex h-full min-h-0 flex-col
|
|
112
|
+
}) }, headerGroup.id))) }), _jsx(TableBody, { children: selectedTable.getRowModel().rows.map((row) => (_jsx(TableRow, { "data-state": row.getIsSelected() && 'selected', children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))) })] })] }), _jsx("div", { className: "mx-4 h-full w-px bg-stone-700" }), _jsxs("div", { className: "flex h-full min-h-0 flex-col", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("h1", { className: "p-4", children: t('moveCollectionsToChannels.availableChannels') }), _jsx(Input, { placeholder: t('moveCollectionsToChannels.searchByCode'), className: "max-w-48", value: columnFilters.find((filter) => filter.id === 'code')?.value ?? '', onChange: (e) => handleInputChange('code', e.target.value) }), _jsx(Input, { placeholder: t('moveCollectionsToChannels.searchByToken'), className: "max-w-48", value: columnFilters.find((filter) => filter.id === 'token')?.value ?? '', onChange: (e) => handleInputChange('token', e.target.value) }), _jsx(Button, { className: "ml-auto", onClick: moveCollectionToChannel, children: t('moveCollectionsToChannels.move') })] }), _jsxs(Table, { children: [_jsx(TableHeader, { className: "sticky top-0 bg-primary-foreground", children: channelsTable.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { children: headerGroup.headers.map((header) => {
|
|
113
113
|
return (_jsx(TableHead, { children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id));
|
|
114
114
|
}) }, headerGroup.id))) }), _jsxs(TableBody, { children: [channelsTable.getRowModel().rows.map((row) => (_jsx(TableRow, { "data-state": row.getIsSelected() && 'selected', children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))), ' '] })] })] })] })] }));
|
|
115
115
|
};
|
|
@@ -3,9 +3,9 @@ import { Routes, Button, Label, Select, SelectContent, SelectItem, SelectTrigger
|
|
|
3
3
|
import { LanguageCode } from '@deenruv/admin-types';
|
|
4
4
|
import { format } from 'date-fns';
|
|
5
5
|
import { ChevronLeft } from 'lucide-react';
|
|
6
|
-
import { useNavigate } from 'react-router
|
|
6
|
+
import { useNavigate } from 'react-router';
|
|
7
7
|
export const PageHeader = ({ collection, editMode, buttonDisabled, onCreate, onEdit, currentTranslationLng, onCurrentLanguageChange, }) => {
|
|
8
8
|
const navigate = useNavigate();
|
|
9
9
|
const { t } = useTranslation('collections');
|
|
10
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx(Button, { variant: "outline", size: "icon", className: "size-7", onClick: () => navigate(Routes.collections.list, { viewTransition: true }), children: _jsx(ChevronLeft, { className: "size-4" }) }), _jsx("h1", { className: "flex-1 shrink-0
|
|
10
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx(Button, { variant: "outline", size: "icon", className: "size-7", onClick: () => navigate(Routes.collections.list, { viewTransition: true }), children: _jsx(ChevronLeft, { className: "size-4" }) }), _jsx("h1", { className: "flex-1 shrink-0 text-xl font-semibold tracking-tight whitespace-nowrap sm:grow-0", children: editMode ? collection?.name : t('create') })] }), _jsxs("div", { className: "ml-auto flex gap-3", children: [_jsxs(Select, { defaultValue: LanguageCode.en, value: currentTranslationLng, onValueChange: onCurrentLanguageChange, children: [_jsx(SelectTrigger, { className: "w-[180px]", children: _jsx(SelectValue, { placeholder: "Theme" }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: LanguageCode.en, children: LanguageCode.en }), _jsx(SelectItem, { value: LanguageCode.pl, children: LanguageCode.pl })] })] }), _jsx(SimpleTooltip, { content: buttonDisabled ? (editMode ? t('noChangesTooltip') : t('buttonDisabledTooltip')) : undefined, children: _jsx(Button, { disabled: buttonDisabled, onClick: editMode ? onEdit : onCreate, children: editMode ? t('edit') : t('create') }) })] })] }), editMode && collection && (_jsxs("div", { className: "flex flex-row flex-wrap gap-x-4 gap-y-2", children: [_jsx(Label, { className: "text-muted-foreground", children: t('baseInfoId', { value: collection.id }) }), _jsx(Label, { className: "text-muted-foreground", children: "|" }), _jsx(Label, { className: "text-muted-foreground", children: t('baseInfoCreated', { value: format(new Date(collection.createdAt), 'dd.MM.yyyy hh:mm') }) }), _jsx(Label, { className: "text-muted-foreground", children: "|" }), _jsx(Label, { className: "text-muted-foreground", children: t('baseInfoUpdated', { value: format(new Date(collection.updatedAt), 'dd.MM.yyyy hh:mm') }) })] }))] }));
|
|
11
11
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useParams } from 'react-router
|
|
2
|
+
import { useParams } from 'react-router';
|
|
3
3
|
import { useValidators, DetailView, createDeenruvForm, getMutation, useMutation, useTranslation, } from '@deenruv/react-ui-devkit';
|
|
4
4
|
import { CountryDetailView } from "./_components/CountryDetailView.js";
|
|
5
5
|
import { useCallback } from 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useParams } from 'react-router
|
|
2
|
+
import { useParams } from 'react-router';
|
|
3
3
|
import { useValidators, DetailView, createDeenruvForm, useMutation } from '@deenruv/react-ui-devkit';
|
|
4
4
|
import { CustomerGroupsDetailView } from './_components/CustomerGroupsDetailView';
|
|
5
5
|
import { typedGql, scalars, $, Permission } from '@deenruv/admin-types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useParams } from 'react-router
|
|
2
|
+
import { useParams } from 'react-router';
|
|
3
3
|
import { useValidators, createDeenruvForm, DetailView, useMutation, useTranslation, } from '@deenruv/react-ui-devkit';
|
|
4
4
|
import { CustomerDetailView } from "./_components/CustomerDetailView";
|
|
5
5
|
import { CustomerDetailSidebar } from "./_components/CustomerDetailSidebar";
|
|
@@ -34,7 +34,7 @@ export const Address = ({ address, customerId, onActionCompleted }) => {
|
|
|
34
34
|
const [deleteAddress] = useMutation(DeleteCustomerAddressMutation);
|
|
35
35
|
const [setAsDefaultBillingAddress] = useMutation(SetAsDefaultBillingAddressMutation);
|
|
36
36
|
const [setAsDefaultShippingAddress] = useMutation(SetAsDefaultShippingAddressMutation);
|
|
37
|
-
return (_jsxs(Card, { className: "
|
|
37
|
+
return (_jsxs(Card, { className: "flex w-56 flex-col justify-between bg-secondary text-primary", children: [_jsxs(CardContent, { className: "mt-4 flex flex-col gap-1", children: [_jsx("h5", { className: "mb-2", children: address.streetLine1 }), _jsx("span", { className: "block text-sm", children: address?.fullName }), _jsxs("span", { className: "block text-sm", children: [address.streetLine1, " ", address?.streetLine2] }), _jsxs("span", { className: "block text-sm", children: [address.city, " ", address.postalCode, " ", address.province, " ", address.country.code] }), _jsxs("span", { className: "block text-sm", children: [address.company, " ", address.phoneNumber && t('addresses.phoneNumberShort', { value: address.phoneNumber })] })] }), _jsxs(CardFooter, { className: "justify-between", children: [_jsxs("div", { className: "flex items-center gap-3", children: [address.defaultBillingAddress && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { children: _jsx(CreditCard, { size: 20 }) }), _jsx(TooltipContent, { children: t('selectAddress.defaultBilling') })] })), address.defaultShippingAddress && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { children: _jsx(Truck, { size: 20 }) }), _jsx(TooltipContent, { children: t('selectAddress.defaultShipping') })] }))] }), _jsxs("div", { className: "flex items-center", children: [_jsx(AddressDialog, { address: address, customerId: customerId, onActionCompleted: onActionCompleted, children: _jsx(Button, { variant: "outline", className: "h-8 px-8", children: t('addresses.edit') }) }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", className: "size-8 p-0", children: [_jsx("span", { className: "sr-only", children: t('selectAddress.more') }), _jsx(MoreHorizontal, { className: "size-4" })] }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { className: "flex items-center gap-2", disabled: address.defaultBillingAddress ?? undefined, onClick: () => setAsDefaultBillingAddress({ addressId: address.id }).then((resp) => {
|
|
38
38
|
if (resp.updateCustomerAddress.id) {
|
|
39
39
|
toast.success(t('selectAddress.addressSuccessSetAsDefaultBillingToast'));
|
|
40
40
|
onActionCompleted();
|
|
@@ -6,5 +6,5 @@ export const Dashboard = () => {
|
|
|
6
6
|
widgets: state.widgets,
|
|
7
7
|
setShowWidget: state.setShowWidget,
|
|
8
8
|
}));
|
|
9
|
-
return (_jsxs("div", { className: "px-4 pb-4
|
|
9
|
+
return (_jsxs("div", { className: "px-4 pt-2 pb-4 md:px-8 md:py-4", children: [_jsx("div", { className: "mb-4 flex justify-end", children: !!widgets.length && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: t('widgets.add') }) }), _jsxs(DropdownMenuContent, { className: "w-42", children: [_jsx(DropdownMenuLabel, { children: t('widgets.title') }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuGroup, { children: widgets.map((widget) => (_jsx(DropdownMenuCheckboxItem, { checked: widget.visible, onCheckedChange: (checked) => setShowWidget(widget.id, checked), children: widget.name }, widget.id))) })] })] })) }), _jsx(DashboardWidgets, {})] }));
|
|
10
10
|
};
|
|
@@ -58,17 +58,17 @@ export const Extensions = () => {
|
|
|
58
58
|
const totalWidgets = plugins.reduce((sum, plugin) => sum + (plugin.widgets?.length || 0), 0);
|
|
59
59
|
const totalComponents = plugins.reduce((sum, plugin) => sum + (plugin.components?.length || 0), 0);
|
|
60
60
|
const categories = ['all', ...new Set(plugins.map((p) => p.category))];
|
|
61
|
-
return (_jsx(PageBlock, { children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsx("div", { className: "flex flex-col gap-2", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-3xl font-bold tracking-tight", children: "Extensions Dashboard" }), _jsx("p", { className: "text-muted-foreground
|
|
61
|
+
return (_jsx(PageBlock, { children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsx("div", { className: "flex flex-col gap-2", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-3xl font-bold tracking-tight", children: "Extensions Dashboard" }), _jsx("p", { className: "mt-1 text-muted-foreground", children: "Manage and monitor your installed plugins" })] }), _jsxs(Button, { children: [_jsx(Download, { className: "mr-2 size-4" }), "Install New Extension"] })] }) }), _jsxs("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-4", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [_jsx(CardTitle, { className: "text-sm font-medium", children: "Total Extensions" }), _jsx(Puzzle, { className: "size-4 text-muted-foreground" })] }), _jsxs(CardContent, { children: [_jsx("div", { className: "text-2xl font-bold", children: totalPlugins }), _jsxs("p", { className: "text-xs text-muted-foreground", children: [activePlugins, " active, ", totalPlugins - activePlugins, " inactive"] })] })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [_jsx(CardTitle, { className: "text-sm font-medium", children: "Total Widgets" }), _jsx(Grid3X3, { className: "size-4 text-muted-foreground" })] }), _jsxs(CardContent, { children: [_jsx("div", { className: "text-2xl font-bold", children: totalWidgets }), _jsxs("p", { className: "text-xs text-muted-foreground", children: ["Across ", plugins.filter((p) => (p.widgets?.length || 0) > 0).length, " extensions"] })] })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [_jsx(CardTitle, { className: "text-sm font-medium", children: "Total Components" }), _jsx(Code2, { className: "size-4 text-muted-foreground" })] }), _jsxs(CardContent, { children: [_jsx("div", { className: "text-2xl font-bold", children: totalComponents }), _jsxs("p", { className: "text-xs text-muted-foreground", children: ["Across ", plugins.filter((p) => (p.components?.length || 0) > 0).length, " extensions"] })] })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [_jsx(CardTitle, { className: "text-sm font-medium", children: "Categories" }), _jsx(LayoutDashboard, { className: "size-4 text-muted-foreground" })] }), _jsxs(CardContent, { children: [_jsx("div", { className: "text-2xl font-bold", children: categories.length - 1 }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Different extension types" })] })] })] }), _jsxs("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("div", { className: "flex flex-1 items-center space-x-2", children: [_jsx(Input, { placeholder: "Search extensions...", className: "max-w-sm", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), startAdornment: _jsx(Search, { className: "size-4 text-muted-foreground" }) }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", className: "ml-auto", children: [_jsx(Filter, { className: "mr-2 size-4" }), "Filter", _jsx(ChevronDown, { className: "ml-2 size-4" })] }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-[200px]", children: [_jsx(DropdownMenuLabel, { children: "Filter by Category" }), _jsx(DropdownMenuSeparator, {}), categories.map((category) => (_jsxs(DropdownMenuItem, { onClick: () => setCategoryFilter(category), className: "flex items-center justify-between", children: [_jsx("span", { className: "capitalize", children: category === 'all' ? 'All Categories' : category }), categoryFilter === category && _jsx(Check, { className: "size-4" })] }, category))), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Filter by Status" }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: () => setStatusFilter('all'), className: "flex items-center justify-between", children: ["All Statuses", statusFilter === 'all' && _jsx(Check, { className: "size-4" })] }), _jsxs(DropdownMenuItem, { onClick: () => setStatusFilter('active'), className: "flex items-center justify-between", children: ["Active", statusFilter === 'active' && _jsx(Check, { className: "size-4" })] }), _jsxs(DropdownMenuItem, { onClick: () => setStatusFilter('inactive'), className: "flex items-center justify-between", children: ["Inactive", statusFilter === 'inactive' && _jsx(Check, { className: "size-4" })] }), _jsxs(DropdownMenuItem, { onClick: () => setStatusFilter('beta'), className: "flex items-center justify-between", children: ["Beta", statusFilter === 'beta' && _jsx(Check, { className: "size-4" })] })] })] })] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Button, { variant: view === 'grid' ? 'default' : 'outline', size: "icon", onClick: () => setView('grid'), className: "size-8", children: _jsx(Grid3X3, { className: "size-4" }) }), _jsx(Button, { variant: view === 'list' ? 'default' : 'outline', size: "icon", onClick: () => setView('list'), className: "size-8", children: _jsx(List, { className: "size-4" }) })] })] }), (categoryFilter !== 'all' || statusFilter !== 'all' || searchTerm) && (_jsxs("div", { className: "flex flex-wrap gap-2", children: [categoryFilter !== 'all' && (_jsxs(Badge, { variant: "secondary", className: "flex items-center gap-1", children: ["Category: ", _jsx("span", { className: "capitalize", children: categoryFilter }), _jsx(Button, { variant: "ghost", size: "icon", className: "ml-1 size-4 p-0", onClick: () => setCategoryFilter('all'), children: _jsx(X, { className: "size-3" }) })] })), statusFilter !== 'all' && (_jsxs(Badge, { variant: "secondary", className: "flex items-center gap-1", children: ["Status: ", _jsx("span", { className: "capitalize", children: statusFilter }), _jsx(Button, { variant: "ghost", size: "icon", className: "ml-1 size-4 p-0", onClick: () => setStatusFilter('all'), children: _jsx(X, { className: "size-3" }) })] })), searchTerm && (_jsxs(Badge, { variant: "secondary", className: "flex items-center gap-1", children: ["Search: ", searchTerm, _jsx(Button, { variant: "ghost", size: "icon", className: "ml-1 size-4 p-0", onClick: () => setSearchTerm(''), children: _jsx(X, { className: "size-3" }) })] })), _jsx(Button, { variant: "ghost", size: "sm", className: "h-6 text-xs", onClick: () => {
|
|
62
62
|
setCategoryFilter('all');
|
|
63
63
|
setStatusFilter('all');
|
|
64
64
|
setSearchTerm('');
|
|
65
|
-
}, children: "Clear all" })] })), filteredPlugins.length === 0 ? (_jsxs("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [_jsx(Info, { className: "text-muted-foreground
|
|
65
|
+
}, children: "Clear all" })] })), filteredPlugins.length === 0 ? (_jsxs("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [_jsx(Info, { className: "size-10 text-muted-foreground" }), _jsx("h3", { className: "mt-4 text-lg font-semibold", children: "No extensions found" }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: "Try adjusting your search or filter criteria" }), _jsx(Button, { variant: "outline", className: "mt-4", onClick: () => {
|
|
66
66
|
setCategoryFilter('all');
|
|
67
67
|
setStatusFilter('all');
|
|
68
68
|
setSearchTerm('');
|
|
69
|
-
}, children: "Reset filters" })] })) : view === 'grid' ? (_jsx("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: filteredPlugins.map((plugin) => (_jsxs(Card, { className: "overflow-hidden", children: [_jsxs(CardHeader, { className: "pb-2", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "bg-primary/10
|
|
69
|
+
}, children: "Reset filters" })] })) : view === 'grid' ? (_jsx("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: filteredPlugins.map((plugin) => (_jsxs(Card, { className: "overflow-hidden", children: [_jsxs(CardHeader, { className: "pb-2", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "rounded-md bg-primary/10 p-2", children: getCategoryIcon(plugin.category) }), _jsx(CardTitle, { className: "text-lg", children: plugin.name })] }), getStatusBadge(plugin.status)] }), _jsx(CardDescription, { className: "mt-2", children: plugin.description })] }), _jsxs(CardContent, { className: "pb-2", children: [_jsxs("div", { className: "grid grid-cols-2 gap-2 text-sm", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-muted-foreground", children: "Version:" }), _jsx("span", { children: plugin.version })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-muted-foreground", children: "Author:" }), _jsx("span", { children: plugin.author })] })] }), _jsx(Separator, { className: "my-3" }), _jsxs("div", { className: "grid grid-cols-4 gap-2 text-center text-sm", children: [_jsxs("div", { children: [_jsx("div", { className: "font-medium", children: plugin.tables?.length }), _jsx("div", { className: "text-xs text-muted-foreground", children: "Tables" })] }), _jsxs("div", { children: [_jsx("div", { className: "font-medium", children: plugin.tabs?.length }), _jsx("div", { className: "text-xs text-muted-foreground", children: "Tabs" })] }), _jsxs("div", { children: [_jsx("div", { className: "font-medium", children: plugin.components?.length }), _jsx("div", { className: "text-xs text-muted-foreground", children: "Components" })] }), _jsxs("div", { children: [_jsx("div", { className: "font-medium", children: plugin.widgets?.length }), _jsx("div", { className: "text-xs text-muted-foreground", children: "Widgets" })] })] })] }), _jsxs(CardFooter, { className: "flex justify-between pt-2", children: [_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", className: "size-8", children: _jsx(Info, { className: "size-4" }) }) }), _jsx(TooltipContent, { children: "View details" })] }) }), _jsx("div", { className: "flex gap-2", children: _jsxs(Switch, { checked: plugin.status === 'active', onCheckedChange: (checked) => {
|
|
70
70
|
changePluginStatus(plugin.name, checked ? 'active' : 'inactive');
|
|
71
|
-
}, className: "h-6 w-11", children: [_jsx("span", { className: "sr-only", children: "Toggle plugin status" }), _jsx("span", { className: "
|
|
71
|
+
}, className: "h-6 w-11", children: [_jsx("span", { className: "sr-only", children: "Toggle plugin status" }), _jsx("span", { className: "absolute top-0 left-0 size-6 rounded-full bg-primary transition-transform duration-200 ease-in-out" })] }) })] })] }, plugin.name))) })) : (_jsxs("div", { className: "rounded-md border", children: [_jsxs("div", { className: "grid grid-cols-12 gap-4 p-4 font-medium", children: [_jsx("div", { className: "col-span-4", children: "Name" }), _jsx("div", { className: "col-span-3", children: "Author" }), _jsx("div", { className: "col-span-1 text-center", children: "Version" }), _jsx("div", { className: "col-span-1 text-center", children: "Status" }), _jsx("div", { className: "col-span-3 text-right", children: "Actions" })] }), _jsx(Separator, {}), filteredPlugins.map((plugin, index) => (_jsxs("div", { children: [_jsxs("div", { className: "grid grid-cols-12 items-center gap-4 p-4", children: [_jsx("div", { className: "col-span-4", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "rounded-md bg-primary/10 p-2", children: getCategoryIcon(plugin.category) }), _jsxs("div", { children: [_jsx("div", { className: "font-medium", children: plugin.name }), _jsx("div", { className: "text-xs text-muted-foreground", children: plugin.description })] })] }) }), _jsx("div", { className: "col-span-3", children: plugin.author }), _jsx("div", { className: "col-span-1 text-center", children: plugin.version }), _jsx("div", { className: "col-span-1 text-center", children: getStatusBadge(plugin.status) }), _jsxs("div", { className: "col-span-3 flex justify-end gap-2", children: [_jsxs(Button, { variant: "outline", size: "sm", children: [_jsx(Settings, { className: "mr-2 size-3" }), "Configure"] }), _jsxs(Switch, { checked: plugin.status === 'active', onCheckedChange: (checked) => {
|
|
72
72
|
changePluginStatus(plugin.name, checked ? 'active' : 'inactive');
|
|
73
|
-
}, className: "h-6 w-11", children: [_jsx("span", { className: "sr-only", children: "Toggle plugin status" }), _jsx("span", { className: "
|
|
73
|
+
}, className: "h-6 w-11", children: [_jsx("span", { className: "sr-only", children: "Toggle plugin status" }), _jsx("span", { className: "absolute top-0 left-0 size-6 rounded-full bg-primary transition-transform duration-200 ease-in-out" })] })] })] }), index < filteredPlugins.length - 1 && _jsx(Separator, {})] }, plugin.name)))] }))] }) }));
|
|
74
74
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useParams } from 'react-router
|
|
2
|
+
import { useParams } from 'react-router';
|
|
3
3
|
import { useValidators, DetailView, createDeenruvForm, getMutation, useMutation, useTranslation, } from '@deenruv/react-ui-devkit';
|
|
4
4
|
import { FacetsDetailView } from "./_components/FacetDetailView.js";
|
|
5
5
|
import { useCallback } from 'react';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import { useParams } from 'react-router
|
|
3
|
+
import { useParams } from 'react-router';
|
|
4
4
|
import { OrderSummary, RealizationCard, CustomerSelectCard, AddressCard, ShippingMethod, TaxSummary, OrderHistory, ProductsCard, TopActions, Payments, SurchargeCard, } from "./_components";
|
|
5
5
|
import { useTranslation, useOrder, ORDER_STATE, EntityCustomFields, LoadingMask, DetailViewMarker, } from '@deenruv/react-ui-devkit';
|
|
6
6
|
import { PromotionsList } from "./_components/PromotionsList.js";
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Permission, SortOrder, typedGql, scalars } from '@deenruv/admin-types';
|
|
3
3
|
import { Routes, apiClient, DetailList, deepMerge, OrderStateBadge, priceFormatter, TableLabel, useQuery, ListLocations, useTranslation, MultipleSelector, useServer, } from '@deenruv/react-ui-devkit';
|
|
4
4
|
import { useCallback } from 'react';
|
|
5
|
-
import { useNavigate } from 'react-router
|
|
5
|
+
import { useNavigate } from 'react-router';
|
|
6
6
|
import { toast } from 'sonner';
|
|
7
7
|
const tableId = 'orders-list-view';
|
|
8
8
|
const { selector } = ListLocations[tableId];
|
|
@@ -46,5 +46,5 @@ export const AddPaymentDialog = ({ order, onSubmit }) => {
|
|
|
46
46
|
onSubmit({ ...form, orderId: order.id, metadata: {} });
|
|
47
47
|
setForm({ method: '', transactionId: '' });
|
|
48
48
|
setOpen(false);
|
|
49
|
-
}, children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "payment-method", children: t('table.paymentMethod') }), _jsxs(Select, { value: form.method, onValueChange: (v) => setForm({ ...form, method: v }), children: [_jsx(SelectTrigger, { id: "payment-method", className: "w-full", children: _jsx(SelectValue, { placeholder: t('selectPaymentMethod') }) }), _jsx(SelectContent, { children: paymentMethodsType.map((method) => (_jsx(SelectItem, { value: method.code, children: method.name }, method.id))) })] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "transaction-id", children: t('filterField.transactionId') }), _jsx(Input, { id: "transaction-id", value: form.transactionId || '', onChange: (e) => setForm({ ...form, transactionId: e.currentTarget.value }), placeholder: t('enterTransactionId') })] }), _jsxs("div", { className: "
|
|
49
|
+
}, children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "payment-method", children: t('table.paymentMethod') }), _jsxs(Select, { value: form.method, onValueChange: (v) => setForm({ ...form, method: v }), children: [_jsx(SelectTrigger, { id: "payment-method", className: "w-full", children: _jsx(SelectValue, { placeholder: t('selectPaymentMethod') }) }), _jsx(SelectContent, { children: paymentMethodsType.map((method) => (_jsx(SelectItem, { value: method.code, children: method.name }, method.id))) })] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "transaction-id", children: t('filterField.transactionId') }), _jsx(Input, { id: "transaction-id", value: form.transactionId || '', onChange: (e) => setForm({ ...form, transactionId: e.currentTarget.value }), placeholder: t('enterTransactionId') })] }), _jsxs("div", { className: "mt-2 rounded-md bg-muted/50 p-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "size-4 text-teal-500 dark:text-teal-400" }), _jsx("span", { className: "text-sm font-medium", children: t('payments.summary') })] }), _jsxs("div", { className: "mt-2 space-y-1", children: [_jsxs("div", { className: "flex justify-between text-sm", children: [_jsxs("span", { className: "text-muted-foreground", children: [t('payments.total'), ":"] }), _jsx("span", { className: "font-medium", children: priceFormatter(order.totalWithTax, order.currencyCode) })] }), _jsxs("div", { className: "flex justify-between text-sm", children: [_jsxs("span", { className: "text-muted-foreground", children: [t('payments.alreadyPaid'), ":"] }), _jsx("span", { className: "font-medium", children: priceFormatter(paidAmount, order.currencyCode) })] }), _jsxs("div", { className: "flex justify-between border-t pt-1 text-sm font-medium", children: [_jsxs("span", { children: [t('payments.toPay'), ":"] }), _jsx("span", { className: "text-teal-600 dark:text-teal-400", children: priceFormatter(paymentAmount, order.currencyCode) })] })] })] }), _jsxs(DialogFooter, { className: "mt-4 gap-2", children: [_jsx(DialogClose, { asChild: true, children: _jsx(Button, { variant: "outline", children: t('payments.cancel') }) }), _jsxs(Button, { type: "submit", disabled: isFormValid.length > 0, className: "gap-2", children: [_jsx(CheckCircle, { className: "size-4" }), t('payments.add')] })] })] })] })] }));
|
|
50
50
|
};
|
|
@@ -229,7 +229,7 @@ export const AddressCard = ({ type }) => {
|
|
|
229
229
|
}, [currentAddress, order, type]);
|
|
230
230
|
const color = isShipping ? 'purple' : 'cyan';
|
|
231
231
|
const iconColor = isShipping ? 'text-purple-500 dark:text-purple-400' : 'text-cyan-500 dark:text-cyan-400';
|
|
232
|
-
return (_jsx(CustomCard, { notCollapsible: true, title: t(isShipping ? 'selectAddress.shippingHeader' : 'selectAddress.billingHeader'), description: t(isShipping ? 'selectAddress.shippingDescription' : 'selectAddress.billingDescription'), icon: isShipping ? _jsx(MapPin, {}) : _jsx(Building, {}), color: currentAddress ? color : 'gray', upperRight: mode !== 'view' && (_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", className: "size-8", children: _jsx(Edit, { size: 16, className: iconColor }) }) }), _jsxs(DialogContent, { className: "flex h-[80vh] max-h-[80vh] min-h-[80vh] flex-col", children: [_jsxs(DialogHeader, { children: [_jsxs(DialogTitle, { className: "flex items-center gap-2 text-xl", children: [isShipping ? (_jsx(MapPin, { className: `size-5 ${iconColor}` })) : (_jsx(Building, { className: `size-5 ${iconColor}` })), t('selectAddress.selectAddress')] }), _jsx(DialogDescription, { className: "text-muted-foreground
|
|
232
|
+
return (_jsx(CustomCard, { notCollapsible: true, title: t(isShipping ? 'selectAddress.shippingHeader' : 'selectAddress.billingHeader'), description: t(isShipping ? 'selectAddress.shippingDescription' : 'selectAddress.billingDescription'), icon: isShipping ? _jsx(MapPin, {}) : _jsx(Building, {}), color: currentAddress ? color : 'gray', upperRight: mode !== 'view' && (_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", className: "size-8", children: _jsx(Edit, { size: 16, className: iconColor }) }) }), _jsxs(DialogContent, { className: "flex h-[80vh] max-h-[80vh] min-h-[80vh] flex-col", children: [_jsxs(DialogHeader, { children: [_jsxs(DialogTitle, { className: "flex items-center gap-2 text-xl", children: [isShipping ? (_jsx(MapPin, { className: `size-5 ${iconColor}` })) : (_jsx(Building, { className: `size-5 ${iconColor}` })), t('selectAddress.selectAddress')] }), _jsx(DialogDescription, { className: "mt-2 text-muted-foreground", children: isShipping
|
|
233
233
|
? order?.customer?.addresses?.length
|
|
234
234
|
? t('selectAddress.selectShippingAddress')
|
|
235
235
|
: t('selectAddress.createShippingAddress')
|
|
@@ -256,5 +256,5 @@ export const AddressCard = ({ type }) => {
|
|
|
256
256
|
: {}),
|
|
257
257
|
}, onInputChange: setState }) }) })] })) : (_jsx(AddressForm, { onInputChange: setState }))] }), _jsxs("div", { className: "mt-4 flex justify-end gap-2", children: [_jsx(Button, { variant: "outline", onClick: () => setOpen(false), disabled: submitting, children: t('common.cancel', 'Cancel') }), _jsx(Button, { className: "gap-2", disabled: submitting || (!!order?.customer?.addresses?.length && tab === 'select' && !selectedAddress), onClick: submitAddress, children: submitting ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "size-4 animate-spin" }), t('common.submitting')] })) : (_jsxs(_Fragment, { children: [_jsx(Check, { className: "size-4" }), !order?.customer?.addresses?.length
|
|
258
258
|
? 'Create'
|
|
259
|
-
: t(tab === 'select' ? 'selectAddress.selectAddress' : 'selectAddress.editAddress')] })) })] })] })] })), children: _jsx("div", { className: "border-border bg-muted/50
|
|
259
|
+
: t(tab === 'select' ? 'selectAddress.selectAddress' : 'selectAddress.editAddress')] })) })] })] })] })), children: _jsx("div", { className: "rounded-lg border border-border bg-muted/50 p-3", children: _jsx("div", { className: "flex items-start gap-3", children: !currentAddress ? (_jsxs(_Fragment, { children: [_jsx("div", { className: `mt-0.5 flex size-8 items-center justify-center rounded-full ${isShipping ? 'bg-purple-100 dark:bg-purple-900/30' : 'bg-cyan-100 dark:bg-cyan-900/30'}`, children: isShipping ? (_jsx(MapPin, { className: `size-4 ${iconColor}` })) : (_jsx(Building, { className: `size-4 ${iconColor}` })) }), _jsxs("div", { className: "flex-1", children: [_jsx("p", { className: "text-sm text-muted-foreground italic", children: t(isShipping ? 'selectAddress.noShippingAddress' : 'selectAddress.noBillingAddress') }), mode !== 'view' && (_jsxs(Button, { variant: "outline", size: "sm", className: "mt-2 gap-2", onClick: () => setOpen(true), children: [_jsx(Edit, { className: "size-3.5" }), t('selectAddress.addAddress', 'Add Address')] }))] })] })) : (_jsx(_Fragment, { children: _jsx("div", { className: "flex-1", children: _jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: `max-h-4 min-h-4 max-w-4 min-w-4 ${iconColor}` }), _jsx("p", { className: "text-sm font-medium", children: currentAddress?.fullName })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(MapPin, { className: `max-h-4 min-h-4 max-w-4 min-w-4 ${iconColor}` }), _jsxs("p", { className: "text-sm", children: [currentAddress.streetLine1, " ", currentAddress?.streetLine2] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Globe, { className: `max-h-4 min-h-4 max-w-4 min-w-4 ${iconColor}` }), _jsxs("p", { className: "text-sm", children: [currentAddress.city, " ", currentAddress.postalCode, " ", currentAddress.province, ' ', currentAddress.country] })] }), _jsx("div", { className: "mt-1 flex items-center justify-between border-t border-border pt-1", children: _jsxs("div", { className: "flex items-center gap-2", children: [currentAddress.company && (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Building, { className: "size-4 text-muted-foreground" }), _jsx("span", { className: "text-sm text-muted-foreground", children: currentAddress.company })] })), currentAddress.phoneNumber && (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Phone, { className: "size-4 text-muted-foreground" }), _jsx("span", { className: "text-sm text-muted-foreground", children: t('selectAddress.phoneNumberShort', { value: currentAddress.phoneNumber }) })] }))] }) })] }) }) })) }) }) }));
|
|
260
260
|
};
|
|
@@ -27,7 +27,7 @@ export const ChangesRegister = ({ changes }) => {
|
|
|
27
27
|
return (_jsxs("span", { className: "flex items-center gap-1", children: [icon, formatPrice(value)] }));
|
|
28
28
|
}, [order]);
|
|
29
29
|
if (!changes) {
|
|
30
|
-
return (_jsx(Card, { className: "border-muted", children: _jsxs(CardContent, { className: "flex flex-col items-center justify-center py-16 text-center", children: [_jsx("div", { className: "mb-4", children: _jsx(Loader, { className: "size-10 animate-spin text-orange-500" }) }), _jsx("h3", { className: "mb-2 text-xl font-medium", children: t('changes.loading.title') }), _jsx("p", { className: "text-muted-foreground
|
|
30
|
+
return (_jsx(Card, { className: "border-muted", children: _jsxs(CardContent, { className: "flex flex-col items-center justify-center py-16 text-center", children: [_jsx("div", { className: "mb-4", children: _jsx(Loader, { className: "size-10 animate-spin text-orange-500" }) }), _jsx("h3", { className: "mb-2 text-xl font-medium", children: t('changes.loading.title') }), _jsx("p", { className: "max-w-md text-muted-foreground", children: t('changes.loading.description') })] }) }));
|
|
31
31
|
}
|
|
32
32
|
if (Object.values(Object.fromEntries(Object.entries(changes).filter(([key]) => key !== 'rest'))).every((item) => !item.length)) {
|
|
33
33
|
return (_jsxs(Card, { className: "border-l-4 border-l-gray-300 dark:border-l-gray-600", children: [_jsx(CardHeader, { children: _jsxs(CardTitle, { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "size-5 text-gray-500" }), t('changes.emptyState.noChanges', 'No Changes')] }) }), _jsx(CardContent, { children: _jsx("p", { className: "text-muted-foreground", children: t('changes.emptyState.noChangesDescription', 'No modifications have been made to this order.') }) })] }));
|
|
@@ -63,6 +63,6 @@ export const ChangesRegister = ({ changes }) => {
|
|
|
63
63
|
})
|
|
64
64
|
.filter(Boolean) })] }) }) })] })), changes.surcharges.length > 0 && (_jsxs(Card, { className: "border-l-4 border-l-blue-500 shadow-sm dark:border-l-blue-400", children: [_jsx(CardHeader, { children: _jsxs(CardTitle, { className: "flex items-center gap-2", children: [_jsx(Plus, { className: "size-5 text-blue-500 dark:text-blue-400" }), t('changes.surcharges', 'Added Surcharges')] }) }), _jsx(CardContent, { children: _jsx(ScrollArea, { className: "max-h-[300px]", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t('changes.description', 'Description') }), _jsx(TableHead, { children: t('changes.sku', 'SKU') }), _jsx(TableHead, { children: t('changes.price', 'Price') }), _jsx(TableHead, { children: t('changes.priceWithTax', 'Price with Tax') })] }) }), _jsx(TableBody, { children: changes.surcharges.map((surcharge, index) => {
|
|
65
65
|
const item = (surcharge.value || {});
|
|
66
|
-
return (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "size-4 text-blue-500 dark:text-blue-400" }), String(item.description || '') || t('changes.unnamedSurcharge', 'Unnamed Surcharge')] }) }), _jsx(TableCell, { children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Tag, { className: "text-muted-foreground
|
|
67
|
-
}) })] }) }) })] })), changes.billingAddress.length > 0 && (_jsxs(Card, { className: "border-l-4 border-l-purple-500 shadow-sm dark:border-l-purple-400", children: [_jsx(CardHeader, { children: _jsxs(CardTitle, { className: "flex items-center gap-2", children: [_jsx(Building, { className: "size-5 text-purple-500 dark:text-purple-400" }), t('changes.billingAddress')] }) }), _jsx(CardContent, { children: _jsx(ChangesRegisterTable, { changes: changes.billingAddress }) })] })), changes.shippingAddress.length > 0 && (_jsxs(Card, { className: "border-l-4 border-l-indigo-500 shadow-sm dark:border-l-indigo-400", children: [_jsx(CardHeader, { children: _jsxs(CardTitle, { className: "flex items-center gap-2", children: [_jsx(Pin, { className: "size-5 text-indigo-500 dark:text-indigo-400" }), t('changes.shippingAddress')] }) }), _jsx(CardContent, { children: _jsx(ChangesRegisterTable, { changes: changes.shippingAddress }) })] })), changes.shippingMethod.length > 0 && (_jsxs(Card, { className: "border-l-4 border-l-orange-500 shadow-sm dark:border-l-orange-400", children: [_jsx(CardHeader, { children: _jsxs(CardTitle, { className: "flex items-center gap-2", children: [_jsx(Component, { className: "size-5 text-orange-500 dark:text-orange-400" }), t('changes.shippingMethod')] }) }), _jsx(CardContent, { children: _jsx(ChangesRegisterTable, { changes: changes.shippingMethod }) })] }))] })) : (_jsx(Card, { className: "border-muted", children: _jsxs(CardContent, { className: "flex flex-col items-center justify-center py-16 text-center", children: [_jsx("div", { className: "mb-4", children: _jsx(Loader, { className: "size-10 animate-spin text-orange-500" }) }), _jsx("h3", { className: "mb-2 text-xl font-medium", children: "Checking for Changes" }), _jsx("p", { className: "text-muted-foreground
|
|
66
|
+
return (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "size-4 text-blue-500 dark:text-blue-400" }), String(item.description || '') || t('changes.unnamedSurcharge', 'Unnamed Surcharge')] }) }), _jsx(TableCell, { children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Tag, { className: "size-4 text-muted-foreground" }), _jsx("code", { className: "rounded bg-muted px-1 py-0.5 font-mono text-xs", children: String(item.sku || '') || '—' })] }) }), _jsx(TableCell, { children: PriceJSX(Number(item.price)) }), _jsx(TableCell, { className: "font-medium text-blue-600 dark:text-blue-400", children: PriceJSX(Number(item.priceWithTax)) })] }, index));
|
|
67
|
+
}) })] }) }) })] })), changes.billingAddress.length > 0 && (_jsxs(Card, { className: "border-l-4 border-l-purple-500 shadow-sm dark:border-l-purple-400", children: [_jsx(CardHeader, { children: _jsxs(CardTitle, { className: "flex items-center gap-2", children: [_jsx(Building, { className: "size-5 text-purple-500 dark:text-purple-400" }), t('changes.billingAddress')] }) }), _jsx(CardContent, { children: _jsx(ChangesRegisterTable, { changes: changes.billingAddress }) })] })), changes.shippingAddress.length > 0 && (_jsxs(Card, { className: "border-l-4 border-l-indigo-500 shadow-sm dark:border-l-indigo-400", children: [_jsx(CardHeader, { children: _jsxs(CardTitle, { className: "flex items-center gap-2", children: [_jsx(Pin, { className: "size-5 text-indigo-500 dark:text-indigo-400" }), t('changes.shippingAddress')] }) }), _jsx(CardContent, { children: _jsx(ChangesRegisterTable, { changes: changes.shippingAddress }) })] })), changes.shippingMethod.length > 0 && (_jsxs(Card, { className: "border-l-4 border-l-orange-500 shadow-sm dark:border-l-orange-400", children: [_jsx(CardHeader, { children: _jsxs(CardTitle, { className: "flex items-center gap-2", children: [_jsx(Component, { className: "size-5 text-orange-500 dark:text-orange-400" }), t('changes.shippingMethod')] }) }), _jsx(CardContent, { children: _jsx(ChangesRegisterTable, { changes: changes.shippingMethod }) })] }))] })) : (_jsx(Card, { className: "border-muted", children: _jsxs(CardContent, { className: "flex flex-col items-center justify-center py-16 text-center", children: [_jsx("div", { className: "mb-4", children: _jsx(Loader, { className: "size-10 animate-spin text-orange-500" }) }), _jsx("h3", { className: "mb-2 text-xl font-medium", children: "Checking for Changes" }), _jsx("p", { className: "max-w-md text-muted-foreground", children: "Order changes are being checked. This may take a moment..." })] }) }));
|
|
68
68
|
};
|
|
@@ -81,5 +81,5 @@ export const CouponCodesCard = () => {
|
|
|
81
81
|
description: i.name,
|
|
82
82
|
})))
|
|
83
83
|
.finally(() => setIsSearching(false));
|
|
84
|
-
}, delay: 500 }), _jsx("div", { className: "
|
|
84
|
+
}, delay: 500 }), _jsx("div", { className: "absolute top-2.5 right-3 text-muted-foreground", children: isSearching ? (_jsx("div", { className: "size-4 animate-spin rounded-full border-2 border-current border-t-transparent" })) : (_jsx(Search, { className: "size-4" })) })] }), currentValue.length === 0 && (_jsx("div", { className: "flex h-[240px] pt-12", children: _jsx(EmptyState, { columnsLength: 2, title: t('couponCodes.noCoupons', 'No coupon codes applied'), color: "purple", icon: _jsx(Ticket, {}), small: true }) }))] }));
|
|
85
85
|
};
|
|
@@ -17,5 +17,5 @@ export const CustomComponent = ({ onVariantAdd, orderLine, }) => {
|
|
|
17
17
|
setIsSubmitting(false);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
return (_jsxs("div", { className: "flex h-full flex-col rounded-md border", children: [_jsx("div", { className: "h-full grow space-y-4 overflow-y-auto p-4", children: _jsx(EntityCustomFields, { entityName: "orderLine", hideButton: true, initialValues: { customFields: {} }, onChange: setCustomFields, additionalData: { product: orderLine.product, variant: orderLine } }) }), _jsx("div", { className: "bg-muted/30
|
|
20
|
+
return (_jsxs("div", { className: "flex h-full flex-col rounded-md border", children: [_jsx("div", { className: "h-full grow space-y-4 overflow-y-auto p-4", children: _jsx(EntityCustomFields, { entityName: "orderLine", hideButton: true, initialValues: { customFields: {} }, onChange: setCustomFields, additionalData: { product: orderLine.product, variant: orderLine } }) }), _jsx("div", { className: "border-t bg-muted/30 p-4", children: _jsx("div", { className: "flex flex-col items-start justify-end gap-4 sm:flex-row sm:items-center", children: _jsx(Button, { onClick: onSubmit, disabled: isSubmitting, className: "min-w-[120px] self-end sm:self-auto", children: isSubmitting ? (_jsxs("span", { className: "flex items-center gap-2", children: [_jsx("span", { className: "size-4 animate-spin rounded-full border-2 border-current border-r-transparent" }), t('common:processing')] })) : (t('create.add')) }) }) })] }));
|
|
21
21
|
};
|
|
@@ -109,9 +109,9 @@ export const CustomerSelectCard = () => {
|
|
|
109
109
|
if (!order)
|
|
110
110
|
return null;
|
|
111
111
|
return (_jsx(CustomCard, { notCollapsible: true, color: order?.customer ? 'indigo' : 'gray', description: t('create.selectCustomer.description', 'Choose an existing customer or create a new one for this order'), title: t('create.selectCustomer.select', 'Customer Information'), icon: _jsx(User, {}), upperRight: mode !== 'view' &&
|
|
112
|
-
mode !== 'update' && (_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", className: "size-8", children: _jsx(Edit, { size: 16, className: "text-indigo-500 dark:text-indigo-400" }) }) }), _jsxs(DialogContent, { className: "min-w-max", children: [_jsxs(DialogHeader, { children: [_jsxs(DialogTitle, { className: "flex items-center gap-2 text-xl", children: [_jsx(User, { className: "size-5 text-indigo-500 dark:text-indigo-400" }), t('create.selectCustomer.label', 'Select Customer')] }), _jsx(DialogDescription, { className: "text-muted-foreground
|
|
112
|
+
mode !== 'update' && (_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", className: "size-8", children: _jsx(Edit, { size: 16, className: "text-indigo-500 dark:text-indigo-400" }) }) }), _jsxs(DialogContent, { className: "min-w-max", children: [_jsxs(DialogHeader, { children: [_jsxs(DialogTitle, { className: "flex items-center gap-2 text-xl", children: [_jsx(User, { className: "size-5 text-indigo-500 dark:text-indigo-400" }), t('create.selectCustomer.label', 'Select Customer')] }), _jsx(DialogDescription, { className: "mt-2 text-muted-foreground", children: t('create.selectCustomer.description', 'Choose an existing customer or create a new one for this order') })] }), _jsxs(Tabs, { value: tab, onValueChange: (e) => setTab(e), children: [_jsxs(TabsList, { className: "my-4 grid w-full grid-cols-2", children: [_jsx(TabsTrigger, { className: "w-full", value: "select", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Search, { className: "size-4" }), t('create.selectCustomer.selectTab', 'Find Customer')] }) }), _jsx(TabsTrigger, { className: "w-full", value: "create", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(UserPlus, { className: "size-4" }), t('create.selectCustomer.createTab', 'Create New')] }) })] }), _jsx(TabsContent, { className: "focus-visible:ring-transparent", value: "select", children: _jsx(CustomerSearch, { selectedCustomer: selected, onSelect: (selected) => setSelected(selected) }) }), _jsx(TabsContent, { value: "create", className: "h-fit max-h-[calc(80vh-230px)] overflow-y-auto pt-2", children: _jsxs("div", { className: "space-y-4 px-1", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "title", className: "text-sm font-medium", children: t('create.selectCustomer.titleLabel', 'Title') }), _jsx(Input, { id: "title", name: "title", placeholder: t('create.selectCustomer.titlePlaceholder', 'Mr., Mrs., Dr., etc.'), value: state.title?.value ?? undefined, onChange: (e) => setField('title', e.target.value), errors: state.title?.errors })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs(Label, { htmlFor: "firstName", className: "text-sm font-medium", children: [t('create.selectCustomer.firstNameLabel', 'First Name'), ' ', _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx(Input, { id: "firstName", name: "firstName", placeholder: t('create.selectCustomer.firstNamePlaceholder', 'Enter first name'), value: state.firstName?.value, onChange: (e) => setField('firstName', e.target.value), className: cn(state.firstName?.errors?.length && 'border-red-300'), required: true, errors: state.firstName?.errors })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs(Label, { htmlFor: "lastName", className: "text-sm font-medium", children: [t('create.selectCustomer.lastNameLabel', 'Last Name'), ' ', _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx(Input, { id: "lastName", name: "lastName", placeholder: t('create.selectCustomer.lastNamePlaceholder', 'Enter last name'), value: state.lastName?.value, onChange: (e) => setField('lastName', e.target.value), className: cn(state.lastName?.errors?.length && 'border-red-300'), required: true, errors: state.lastName?.errors })] })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs(Label, { htmlFor: "email", className: "text-sm font-medium", children: [t('create.selectCustomer.emailLabel', 'Email Address'), " ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx(Input, { id: "email", name: "emailAddress", type: "email", placeholder: t('create.selectCustomer.emailPlaceholder', 'Enter email address'), value: state.emailAddress?.value, onChange: (e) => setField('emailAddress', e.target.value), className: cn(state.emailAddress?.errors?.length && 'border-red-300'), required: true, errors: state.emailAddress?.errors })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs(Label, { htmlFor: "phone", className: "text-sm font-medium", children: [t('create.selectCustomer.phoneNumberLabel', 'Phone Number'), ' ', _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx(Input, { id: "phone", name: "phoneNumber", placeholder: t('create.selectCustomer.phonePlaceholder', 'Enter phone number'), value: state.phoneNumber?.value ?? undefined, onChange: (e) => setField('phoneNumber', e.target.value), className: cn(state.phoneNumber?.errors?.length && 'border-red-300'), required: true, errors: state.phoneNumber?.errors })] }), _jsx(EntityCustomFields, { id: selected?.id, entityName: "customer", hideButton: true, initialValues: selected && 'customFields' in selected
|
|
113
113
|
? { customFields: selected.customFields }
|
|
114
114
|
: { customFields: {} }, onChange: (customFields, translations) => {
|
|
115
115
|
setField('customFields', customFields);
|
|
116
|
-
}, additionalData: {} })] }) })] }), _jsxs(DialogFooter, { className: "gap-2", children: [_jsx(Button, { variant: "outline", onClick: () => setOpen(false), disabled: isSubmitting, children: t('common.cancel', 'Cancel') }), _jsx(Button, { disabled: (tab === 'select' && !selected) || isSubmitting, className: "gap-2", onClick: validateAndSubmitIfCorrect, children: isSubmitting ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "size-4 animate-spin" }), t('common.processing', 'Processing...')] })) : (_jsxs(_Fragment, { children: [_jsx(Check, { className: "size-4" }), t(tab === 'create' ? 'create.selectCustomer.create' : 'create.selectCustomer.selectButton')] })) })] })] })] })), children: _jsx("div", { className: "border-border bg-muted/50
|
|
116
|
+
}, additionalData: {} })] }) })] }), _jsxs(DialogFooter, { className: "gap-2", children: [_jsx(Button, { variant: "outline", onClick: () => setOpen(false), disabled: isSubmitting, children: t('common.cancel', 'Cancel') }), _jsx(Button, { disabled: (tab === 'select' && !selected) || isSubmitting, className: "gap-2", onClick: validateAndSubmitIfCorrect, children: isSubmitting ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "size-4 animate-spin" }), t('common.processing', 'Processing...')] })) : (_jsxs(_Fragment, { children: [_jsx(Check, { className: "size-4" }), t(tab === 'create' ? 'create.selectCustomer.create' : 'create.selectCustomer.selectButton')] })) })] })] })] })), children: _jsx("div", { className: "rounded-lg border border-border bg-muted/50 p-3", children: _jsx("div", { className: "flex items-start gap-3", children: !order?.customer ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "mt-0.5 flex size-8 items-center justify-center rounded-full bg-secondary", children: _jsx(AlertCircle, { className: "size-4 text-green-500 dark:text-green-600" }) }), _jsxs("div", { className: "flex-1", children: [_jsx("p", { className: "text-sm text-muted-foreground italic", children: t('create.selectCustomer.noCustomer', 'No customer assigned to this order') }), mode !== 'view' && (_jsxs(Button, { variant: "outline", size: "sm", className: "mt-2 gap-2", onClick: () => setOpen(true), children: [_jsx(UserPlus, { className: "size-3.5" }), t('create.selectCustomer.addCustomer', 'Add Customer')] }))] })] })) : (_jsx(_Fragment, { children: _jsx("div", { className: "flex-1", children: _jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("p", { className: "text-sm font-medium", children: [order.customer.title && `${order.customer.title} `, order.customer.firstName, " ", order.customer.lastName] }), _jsx("span", { className: "rounded-full bg-indigo-100 px-2 py-0.5 text-xs text-indigo-800 dark:bg-indigo-900/50 dark:text-indigo-300", children: t('create.selectCustomer.customer', 'Customer') })] }), _jsxs("div", { className: "flex items-center gap-2 text-sm", children: [_jsx(Mail, { className: "size-3.5 text-indigo-500 dark:text-indigo-400" }), _jsx("span", { children: order.customer.emailAddress })] }), order.customer.phoneNumber && (_jsxs("div", { className: "flex items-center gap-2 text-sm", children: [_jsx(Phone, { className: "size-3.5 text-indigo-500 dark:text-indigo-400" }), _jsx("span", { children: order.customer.phoneNumber })] }))] }) }) })) }) }) }));
|
|
117
117
|
};
|
|
@@ -50,7 +50,7 @@ export const FulfillmentModal = ({ order, onSubmitted, disabled }) => {
|
|
|
50
50
|
setIsSubmitting(false);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
return (_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, children: _jsxs(Button, { disabled: disabled, size: "sm", className: "gap-2", children: [_jsx(Package, { className: "size-4" }), t('fulfillment.completeOrderButton', 'Fulfill Order')] }) }), _jsxs(DialogContent, { className: "flex h-[80vh] max-w-[80vw] flex-col gap-0 overflow-hidden p-0", children: [_jsxs(DialogHeader, { className: "border-b px-6 py-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Truck, { className: "text-primary
|
|
53
|
+
return (_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, children: _jsxs(Button, { disabled: disabled, size: "sm", className: "gap-2", children: [_jsx(Package, { className: "size-4" }), t('fulfillment.completeOrderButton', 'Fulfill Order')] }) }), _jsxs(DialogContent, { className: "flex h-[80vh] max-w-[80vw] flex-col gap-0 overflow-hidden p-0", children: [_jsxs(DialogHeader, { className: "border-b px-6 py-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Truck, { className: "size-5 text-primary" }), _jsx(DialogTitle, { children: t('fulfillment.completeDialogTitle', 'Complete Order Fulfillment') })] }), _jsx(DialogDescription, { children: t('fulfillment.completeDialogDescription', 'Prepare items for shipping and complete the fulfillment process') })] }), _jsxs("div", { className: "flex size-full flex-col overflow-hidden md:flex-row", children: [_jsxs("div", { className: "flex size-full flex-col border-r p-6 md:w-1/2", children: [_jsxs("div", { className: "mb-4 flex items-center gap-2", children: [_jsx(Box, { className: "size-5 text-blue-500 dark:text-blue-400" }), _jsx("h3", { className: "text-lg font-medium", children: t('fulfillment.itemsToFulfill', 'Items to Fulfill') })] }), _jsx(ScrollArea, { className: "h-[calc(100%-3rem)] w-full rounded-md border", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { noHover: true, className: "bg-muted/50", children: [_jsx(TableHead, { className: "py-3", children: t('fulfillment.product', 'Product') }), _jsx(TableHead, { className: "py-3", children: t('fulfillment.sku', 'SKU') }), _jsx(TableHead, { className: "py-3", children: t('fulfillment.fulfilled', 'Quantity') })] }) }), _jsx(TableBody, { className: "w-full", children: order?.lines.length ? (order.lines.map((line) => {
|
|
54
54
|
const onStock = line.productVariant.stockLevels.reduce((acc, stock) => acc + stock.stockOnHand, 0);
|
|
55
55
|
const stateLine = state.lines?.value?.find((l) => l.orderLineId === line.id);
|
|
56
56
|
const isLowStock = onStock < line.quantity;
|
|
@@ -67,8 +67,8 @@ export const FulfillmentModal = ({ order, onSubmitted, disabled }) => {
|
|
|
67
67
|
value[index].quantity = Number.parseInt(e.target.value);
|
|
68
68
|
setField('lines', value);
|
|
69
69
|
}
|
|
70
|
-
}, endAdornment: _jsxs("span", { className: "text-sm", children: ["/ ", line.quantity] }) }) }), _jsx("div", { className: "flex items-center gap-1", children: isLowStock ? (_jsxs("div", { className: "flex items-center gap-1 text-amber-500", children: [_jsx(AlertCircle, { className: "size-4" }), _jsx("p", { className: "text-xs font-medium", children: t('fulfillment.lowStock', 'Low stock') })] })) : (_jsxs("div", { className: "flex items-center gap-1 text-green-500", children: [_jsx(CheckCircle2, { className: "size-4" }), _jsx("p", { className: "text-xs font-medium", children: t('fulfillment.inStock', 'In stock') })] })) }), _jsxs("p", { className: "text-muted-foreground
|
|
71
|
-
})) : (_jsx(TableRow, { noHover: true, children: _jsx(TableCell, { colSpan: 4, className: "
|
|
70
|
+
}, endAdornment: _jsxs("span", { className: "text-sm", children: ["/ ", line.quantity] }) }) }), _jsx("div", { className: "flex items-center gap-1", children: isLowStock ? (_jsxs("div", { className: "flex items-center gap-1 text-amber-500", children: [_jsx(AlertCircle, { className: "size-4" }), _jsx("p", { className: "text-xs font-medium", children: t('fulfillment.lowStock', 'Low stock') })] })) : (_jsxs("div", { className: "flex items-center gap-1 text-green-500", children: [_jsx(CheckCircle2, { className: "size-4" }), _jsx("p", { className: "text-xs font-medium", children: t('fulfillment.inStock', 'In stock') })] })) }), _jsxs("p", { className: "text-xs text-muted-foreground", children: ["(", t('fulfillment.onStockValue', { value: onStock }), ")"] })] }) }) }) }, line.id));
|
|
71
|
+
})) : (_jsx(TableRow, { noHover: true, children: _jsx(TableCell, { colSpan: 4, className: "py-6 text-center text-muted-foreground", children: _jsxs("div", { className: "flex flex-col items-center justify-center gap-2", children: [_jsx("div", { className: "rounded-full bg-blue-100 p-3 dark:bg-blue-900/30", children: _jsx(Box, { className: "size-6 text-blue-500 dark:text-blue-400" }) }), _jsx("p", { children: t('fulfillment.emptyState', 'No items to fulfill') }), _jsx("p", { className: "text-xs text-muted-foreground", children: t('fulfillment.emptyStateHint', 'Add products to the order before fulfillment') })] }) }) })) })] }) })] }), _jsx(ScrollArea, { className: "flex h-full md:w-1/2", children: _jsx("div", { className: "flex size-full flex-col p-6", children: _jsxs("form", { onSubmit: handleSubmit, className: "flex h-full flex-col gap-6", children: [_jsxs(CustomCard, { title: t('fulfillment.shippingAddress', 'Shipping Address'), color: "blue", icon: _jsx(MapPin, {}), children: [_jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "size-4 text-muted-foreground" }), _jsx("p", { className: "text-xs font-medium text-muted-foreground", children: t('fullName', 'Full Name') })] }), _jsx("p", { className: "text-sm font-medium", children: order.shippingAddress?.fullName || '—' })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Building, { className: "size-4 text-muted-foreground" }), _jsx("p", { className: "text-xs font-medium text-muted-foreground", children: t('company', 'Company') })] }), _jsx("p", { className: "text-sm font-medium", children: order.shippingAddress?.company || '—' })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(MapPin, { className: "size-4 text-muted-foreground" }), _jsx("p", { className: "text-xs font-medium text-muted-foreground", children: t('street1', 'Street Address') })] }), _jsx("p", { className: "text-sm font-medium", children: order.shippingAddress?.streetLine1 || '—' })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-xs font-medium text-muted-foreground", children: t('street2', 'Street Address 2') }), _jsx("p", { className: "text-sm font-medium", children: order.shippingAddress?.streetLine2 || '—' })] })] }), _jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-xs font-medium text-muted-foreground", children: t('city', 'City') }), _jsx("p", { className: "text-sm font-medium", children: order.shippingAddress?.city || '—' })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-xs font-medium text-muted-foreground", children: t('postalCode', 'Postal Code') }), _jsx("p", { className: "text-sm font-medium", children: order.shippingAddress?.postalCode || '—' })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-xs font-medium text-muted-foreground", children: t('country', 'Country') }), _jsx("p", { className: "text-sm font-medium", children: order.shippingAddress?.country || '—' })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "size-4 text-muted-foreground" }), _jsx("p", { className: "text-xs font-medium text-muted-foreground", children: t('phoneNumber', 'Phone Number') })] }), _jsx("p", { className: "text-sm font-medium", children: order.shippingAddress?.phoneNumber || '—' })] })] })] }), _jsxs("div", { className: "mt-4 border-t pt-4", children: [_jsx("p", { className: "mb-2 text-xs font-medium text-muted-foreground", children: t('fulfillment.shippingMethod', 'Shipping Method') }), order.shippingLines.map((line) => (_jsxs("div", { className: "flex items-center justify-between rounded-md bg-muted/50 p-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Truck, { className: "size-4 text-blue-500 dark:text-blue-400" }), _jsx("span", { className: "font-medium", children: line.shippingMethod.name })] }), _jsx(Badge, { variant: "outline", className: "font-mono", children: priceFormatter(line.priceWithTax, order.currencyCode) })] }, line.id)))] })] }), _jsx(CustomCard, { color: "green", title: t('fulfillment.fulfillmentOptions', 'Fulfillment Options'), icon: _jsx(Package, {}), bottomRight: _jsx(Button, { type: "submit", className: "w-full gap-2", disabled: isSubmitting, children: isSubmitting ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "size-4 animate-spin" }), t('fulfillment.processing', 'Processing...')] })) : (_jsxs(_Fragment, { children: [_jsx(CheckCircle2, { className: "size-4" }), t('fulfillment.fulfill', 'Complete Fulfillment')] })) }), children: _jsx(ArgumentFieldsComponent, { actions: filteredFulfillmentHandlers, args: state.handler?.value.arguments?.length
|
|
72
72
|
? state.handler.value.arguments
|
|
73
73
|
: state.handler?.initialValue?.arguments?.length
|
|
74
74
|
? state.handler.initialValue.arguments
|
|
@@ -3,5 +3,5 @@ import { TableRow, TableCell, Button } from '@deenruv/react-ui-devkit';
|
|
|
3
3
|
import { Minus, Plus, Package } from 'lucide-react';
|
|
4
4
|
export const LineItem = ({ noBorder, noHover, children, variant, adjustLineItem }) => {
|
|
5
5
|
const imageUrl = variant?.featuredAsset?.preview || variant?.product?.featuredAsset?.preview;
|
|
6
|
-
return (_jsxs(TableRow, { noHover: noHover, noBorder: noBorder, className: "group transition-colors", children: [_jsx(TableCell, { className: "py-3", children: _jsxs("div", { className: "flex items-center gap-3", children: [imageUrl ? (_jsx("img", { alt: `${variant?.product.name} image`, className: "aspect-square size-12 rounded-md border bg-white object-cover shadow-sm", height: "48", width: "48", src: imageUrl || '/placeholder.svg' })) : (_jsx("div", { className: "
|
|
6
|
+
return (_jsxs(TableRow, { noHover: noHover, noBorder: noBorder, className: "group transition-colors", children: [_jsx(TableCell, { className: "py-3", children: _jsxs("div", { className: "flex items-center gap-3", children: [imageUrl ? (_jsx("img", { alt: `${variant?.product.name} image`, className: "aspect-square size-12 rounded-md border bg-white object-cover shadow-sm", height: "48", width: "48", src: imageUrl || '/placeholder.svg' })) : (_jsx("div", { className: "flex size-12 items-center justify-center rounded-md border bg-muted/30", children: _jsx(Package, { className: "size-6 text-muted-foreground" }) })), _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { className: "line-clamp-1 text-sm font-medium md:text-base", children: variant?.product.name }), variant?.name && variant.name !== variant?.product.name && (_jsx("span", { className: "line-clamp-1 text-xs text-muted-foreground", children: variant.name }))] })] }) }), _jsx(TableCell, { className: "font-mono text-sm text-muted-foreground", children: variant?.sku }), variant?.quantity ? (_jsx(TableCell, { children: adjustLineItem ? (_jsx("div", { className: "flex items-center", children: _jsxs("div", { className: "inline-flex items-center rounded-md border bg-background shadow-sm", children: [_jsx(Button, { variant: "ghost", size: "sm", type: "button", onClick: () => adjustLineItem(Math.max(1, (variant.quantity || 1) - 1)), className: "h-8 rounded-r-none border-r px-2 hover:bg-muted", "aria-label": "Decrease quantity", children: _jsx(Minus, { className: "size-3.5" }) }), _jsx("span", { className: "px-3 py-1 text-sm font-medium tabular-nums", children: variant?.quantity }), _jsx(Button, { variant: "ghost", size: "sm", type: "button", onClick: () => adjustLineItem((variant.quantity || 0) + 1), className: "h-8 rounded-l-none border-l px-2 hover:bg-muted", "aria-label": "Increase quantity", children: _jsx(Plus, { className: "size-3.5" }) })] }) })) : (_jsx("span", { className: "inline-flex min-w-8 items-center justify-center rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary", children: variant?.quantity })) })) : null, children] }));
|
|
7
7
|
};
|
|
@@ -4,7 +4,7 @@ import { Button, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger,
|
|
|
4
4
|
import { toast } from 'sonner';
|
|
5
5
|
export const ManualOrderChangeModal = ({ currentPossibilities, wantedState, order, open, setOpen, onConfirm }) => {
|
|
6
6
|
const [components, setComponents] = useState([]);
|
|
7
|
-
const beforeSubmit = useRef();
|
|
7
|
+
const beforeSubmit = useRef(undefined);
|
|
8
8
|
const { getModalComponents } = usePluginStore();
|
|
9
9
|
const { t } = useTranslation('orders');
|
|
10
10
|
const [value, setValue] = useState(() => {
|
|
@@ -43,5 +43,5 @@ export const ManualOrderChangeModal = ({ currentPossibilities, wantedState, orde
|
|
|
43
43
|
setComponents([]);
|
|
44
44
|
};
|
|
45
45
|
}, [value]);
|
|
46
|
-
return (_jsx(Dialog, { open: open, modal: open, onOpenChange: (state) => setOpen({ state }), children: _jsxs(DialogContent, { className: "
|
|
46
|
+
return (_jsx(Dialog, { open: open, modal: open, onOpenChange: (state) => setOpen({ state }), children: _jsxs(DialogContent, { className: "max-w-[50vw] min-w-fit", children: [_jsx(DialogHeader, { children: _jsxs(DialogTitle, { className: "flex items-center gap-2", children: [t('changeStatus.header'), _jsx(OrderStateBadge, { state: order.state })] }) }), _jsx(DialogDescription, { children: t('changeStatus.description') }), _jsxs(Select, { name: "orderState", value: value, onValueChange: (e) => setValue(e), children: [_jsx(SelectTrigger, { className: "w-[180px]", children: _jsx(SelectValue, { placeholder: "Status.." }) }), _jsx(SelectContent, { children: _jsx(SelectGroup, { children: [currentPossibilities.name, ...currentPossibilities.to].map((state) => (_jsx(SelectItem, { value: state, disabled: state === order.state, children: state }, state))) }) })] }), components, _jsx(Button, { className: "ml-auto w-min", onClick: submit, children: t('changeStatus.button') })] }) }));
|
|
47
47
|
};
|
|
@@ -59,7 +59,7 @@ export const ModifyingCard = ({ onNoteModified, onOptionsChange, changes }) => {
|
|
|
59
59
|
setIsSubmitting(false);
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
return (_jsx("form", { className: "h-full max-h-[calc(100vh-200px)]", children: _jsxs(Card, { className: "flex h-full flex-col border-l-4 border-l-blue-500 shadow-sm transition-shadow duration-200 hover:shadow dark:border-l-blue-400", children: [_jsx(CardHeader, { className: "pb-4", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileEdit, { className: "size-5 text-blue-500 dark:text-blue-400" }), _jsxs("div", { children: [_jsx(CardTitle, { children: t('orderModification', 'Order Modification') }), _jsx(CardDescription, { className: "mt-1", children: t('orderModificationDescription', 'Modify order details and apply changes') })] })] }) }), _jsxs(CardContent, { className: "flex-1 space-y-6 overflow-y-auto", children: [_jsxs("div", { className: "space-y-3", children: [_jsxs(Label, { htmlFor: "note", className: "text-sm font-medium", children: [t('note', 'Modification Note'), " ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsxs("div", { className: "relative", children: [_jsx(Textarea, { id: "note", placeholder: t('notePlaceholder', 'Enter a note explaining the reason for these modifications...'), value: state.note?.value ?? '', onChange: (e) => setField('note', e.target.value), className: "min-h-[60px] resize-y" }), !state.note?.value && (_jsx("div", { className: "absolute
|
|
62
|
+
return (_jsx("form", { className: "h-full max-h-[calc(100vh-200px)]", children: _jsxs(Card, { className: "flex h-full flex-col border-l-4 border-l-blue-500 shadow-sm transition-shadow duration-200 hover:shadow dark:border-l-blue-400", children: [_jsx(CardHeader, { className: "pb-4", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileEdit, { className: "size-5 text-blue-500 dark:text-blue-400" }), _jsxs("div", { children: [_jsx(CardTitle, { children: t('orderModification', 'Order Modification') }), _jsx(CardDescription, { className: "mt-1", children: t('orderModificationDescription', 'Modify order details and apply changes') })] })] }) }), _jsxs(CardContent, { className: "flex-1 space-y-6 overflow-y-auto", children: [_jsxs("div", { className: "space-y-3", children: [_jsxs(Label, { htmlFor: "note", className: "text-sm font-medium", children: [t('note', 'Modification Note'), " ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsxs("div", { className: "relative", children: [_jsx(Textarea, { id: "note", placeholder: t('notePlaceholder', 'Enter a note explaining the reason for these modifications...'), value: state.note?.value ?? '', onChange: (e) => setField('note', e.target.value), className: "min-h-[60px] resize-y" }), !state.note?.value && (_jsx("div", { className: "absolute top-3 right-3 text-amber-500", children: _jsx(AlertCircle, { className: "size-4" }) }))] }), _jsx("p", { className: "text-xs text-muted-foreground", children: t('noteRequired', 'A note is required to explain why these changes are being made') })] }), _jsx(Separator, {}), _jsxs("div", { className: "space-y-3", children: [_jsx("h3", { className: "text-sm font-medium text-muted-foreground", children: t('modificationOptions', 'Modification Options') }), _jsxs("div", { className: "flex flex-col space-y-4", children: [_jsxs("div", { className: "space-y-4 rounded-md border border-border bg-muted/20 p-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex size-8 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30", children: _jsx(RefreshCw, { className: "size-4 text-blue-500 dark:text-blue-400" }) }), _jsx("h4", { className: "font-medium", children: t('processingOptions', 'Processing Options') })] }), _jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Checkbox, { id: "recalculateShipping", checked: state.options?.value?.recalculateShipping ?? false, onCheckedChange: (e) => {
|
|
63
63
|
const optionsObj = {
|
|
64
64
|
freezePromotions: state?.options?.value?.freezePromotions || false,
|
|
65
65
|
recalculateShipping: !!e,
|