@apptimate/ui 5.9.0 → 6.1.0
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/package.json +4 -1
- package/src/common-components/item-wizard/QuickItemWizard.tsx +86 -0
- package/src/common-components/pickers/UomPicker.tsx +28 -67
- package/src/common-components/print/TemplateRenderer.tsx +609 -0
- package/src/common-components/print/TransactionPrintSelector.tsx +673 -0
- package/src/common-components/transaction/ProductSelectionPanel.tsx +19 -13
- package/src/common-components/transaction/ProductTransactionScreen.tsx +2 -0
- package/src/common-components/transaction/types.ts +2 -0
- package/src/index.tsx +3 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
|
4
4
|
import { cn } from '@apptimate/core-lib';
|
|
5
5
|
import {
|
|
6
|
-
Search, ScanBarcode, X, ShoppingCart, Package, Loader2,
|
|
6
|
+
Search, ScanBarcode, X, ShoppingCart, Package, Loader2, Plus,
|
|
7
7
|
Trash2, ChevronDown, ChevronRight, AlertTriangle, Tag
|
|
8
8
|
} from 'lucide-react';
|
|
9
9
|
import { Badge } from '../../base-components/Badge';
|
|
@@ -24,6 +24,7 @@ interface ProductSelectionPanelProps {
|
|
|
24
24
|
onUpdateLine: (uid: string, updates: Partial<TransactionLineItem>) => void;
|
|
25
25
|
onRemoveLine: (uid: string) => void;
|
|
26
26
|
onToggleExpand: (uid: string) => void;
|
|
27
|
+
onAddNewItem?: (callbacks: { setItemSearch: (value: string) => void }) => void;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export function ProductSelectionPanel({
|
|
@@ -35,6 +36,7 @@ export function ProductSelectionPanel({
|
|
|
35
36
|
onUpdateLine,
|
|
36
37
|
onRemoveLine,
|
|
37
38
|
onToggleExpand,
|
|
39
|
+
onAddNewItem,
|
|
38
40
|
}: ProductSelectionPanelProps) {
|
|
39
41
|
const [searchValue, setSearchValue] = useState('');
|
|
40
42
|
const [searchResults, setSearchResults] = useState<TransactionItem[]>([]);
|
|
@@ -400,18 +402,22 @@ export function ProductSelectionPanel({
|
|
|
400
402
|
</button>
|
|
401
403
|
}
|
|
402
404
|
/>
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
405
|
+
{onAddNewItem && (
|
|
406
|
+
<>
|
|
407
|
+
<div className="w-[1px] h-5 bg-border-subtle mx-1" />
|
|
408
|
+
<button
|
|
409
|
+
type="button"
|
|
410
|
+
onClick={() => onAddNewItem({ setItemSearch: handleSearch })}
|
|
411
|
+
title="Create new item"
|
|
412
|
+
className="flex items-center justify-center outline-none mr-1"
|
|
413
|
+
>
|
|
414
|
+
<Plus
|
|
415
|
+
size={18}
|
|
416
|
+
className="text-foreground-disabled shrink-0 cursor-pointer hover:text-primary transition-colors"
|
|
417
|
+
/>
|
|
418
|
+
</button>
|
|
419
|
+
</>
|
|
420
|
+
)}
|
|
415
421
|
</div>
|
|
416
422
|
</div>
|
|
417
423
|
|
|
@@ -30,6 +30,7 @@ export function ProductTransactionScreen({
|
|
|
30
30
|
renderExtraMeta,
|
|
31
31
|
fetchChequeLeaves,
|
|
32
32
|
initialData,
|
|
33
|
+
onAddNewItem,
|
|
33
34
|
}: ProductTransactionScreenProps) {
|
|
34
35
|
// ── State ──
|
|
35
36
|
const [lineItems, setLineItems] = useState<TransactionLineItem[]>([]);
|
|
@@ -469,6 +470,7 @@ export function ProductTransactionScreen({
|
|
|
469
470
|
onUpdateLine={handleUpdateLine}
|
|
470
471
|
onRemoveLine={handleRemoveLine}
|
|
471
472
|
onToggleExpand={handleToggleExpand}
|
|
473
|
+
onAddNewItem={onAddNewItem}
|
|
472
474
|
/>
|
|
473
475
|
</div>
|
|
474
476
|
|
|
@@ -316,6 +316,8 @@ export interface ProductTransactionScreenProps {
|
|
|
316
316
|
fetchChequeLeaves?: (query: string, page: number) => Promise<{ is_success: boolean; result?: any[] }>;
|
|
317
317
|
/** Initial data for populating the transaction screen (e.g., from a PO) */
|
|
318
318
|
initialData?: any;
|
|
319
|
+
/** Optional callback to create a new item directly from the search bar */
|
|
320
|
+
onAddNewItem?: (callbacks: { setItemSearch: (value: string) => void }) => void;
|
|
319
321
|
}
|
|
320
322
|
|
|
321
323
|
export interface TransactionPayload {
|
package/src/index.tsx
CHANGED
|
@@ -54,6 +54,7 @@ export * from './common-components/pickers/WarehousePicker';
|
|
|
54
54
|
// Item Wizard
|
|
55
55
|
export { default as ItemFormWizard } from './common-components/item-wizard/ItemFormWizard';
|
|
56
56
|
export * from './common-components/item-wizard/ItemFormWizard';
|
|
57
|
+
export * from './common-components/item-wizard/QuickItemWizard';
|
|
57
58
|
export { default as SkuConfigModal } from './common-components/item-wizard/SkuConfigModal';
|
|
58
59
|
export * from './common-components/item-wizard/SkuConfigModal';
|
|
59
60
|
|
|
@@ -76,3 +77,5 @@ export { default as AttendanceTimesheets } from './common-components/attendance-
|
|
|
76
77
|
export * from './common-components/attendance-shifts/AttendanceTimesheets';
|
|
77
78
|
|
|
78
79
|
export * from "./base-components/ChartOfAccountPicker";
|
|
80
|
+
export * from './common-components/print/TemplateRenderer';
|
|
81
|
+
export { default as TransactionPrintSelector } from './common-components/print/TransactionPrintSelector';
|