@homefile/components-v2 2.24.22 → 2.24.24
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/components/receipts/AssignableReceiptCard.js +1 -1
- package/dist/components/receipts/receipt/ReceiptItemAssigned.d.ts +1 -1
- package/dist/components/receipts/receipt/ReceiptItemAssigned.js +5 -4
- package/dist/components/receipts/receipt/ReceiptItems.js +1 -1
- package/dist/hooks/receipts/useDisplayReceipts.d.ts +1 -1
- package/dist/interfaces/receipts/receipt/ReceiptDetails.interface.d.ts +1 -1
- package/dist/stories/receipts/displayReceipts/GridReceipt.stories.d.ts +1 -1
- package/dist/stories/receipts/displayReceipts/ItemReceipt.stories.d.ts +1 -1
- package/dist/stories/receipts/displayReceipts/ListReceipt.stories.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/receipts/AssignableReceiptCard.tsx +1 -1
- package/src/components/receipts/receipt/ReceiptItemAssigned.tsx +22 -7
- package/src/components/receipts/receipt/ReceiptItems.tsx +1 -0
- package/src/interfaces/receipts/receipt/ReceiptDetails.interface.ts +1 -1
|
@@ -6,7 +6,7 @@ import { formatCurrency, formatDateWithAt } from '../../utils';
|
|
|
6
6
|
export const AssignableReceiptCard = ({ isChecked, itemQuantity = 1, onChange, purchaseDate = new Date(), origin = '', total = '0', }) => {
|
|
7
7
|
const date = formatDateWithAt({ date: purchaseDate });
|
|
8
8
|
const totalFormatted = formatCurrency({ value: total });
|
|
9
|
-
const totalItems = itemQuantity > 1
|
|
9
|
+
const totalItems = Number(itemQuantity) > 1
|
|
10
10
|
? `${itemQuantity} ${t('receipts.items')}`
|
|
11
11
|
: `${itemQuantity} ${t('receipts.item')}`;
|
|
12
12
|
return (_jsxs(Flex, { bg: "lightBlue.2", gap: "4", borderTop: "1px solid", borderColor: "lightBlue.2", children: [_jsx(Checkbox, { isChecked: isChecked, onChange: onChange }), _jsx(Stack, { w: "100%", p: "base", bg: isChecked ? 'lightGreen.1' : 'neutral.white', spacing: "1", children: _jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Image, { src: getReceiptOrigin(origin), w: "auto", h: ["40px", "69px"], fit: "contain" }), _jsxs(Stack, { w: "100%", spacing: "1", children: [_jsx(Text, { fontSize: "xxs", children: date }), _jsx(Text, { textTransform: "capitalize", children: `${origin} ${t('receipts.receipt')}` }), _jsxs(Flex, { align: "baseline", justify: "flex-end", gap: "4", children: [_jsx(Text, { fontSize: "xs", fontFamily: "secondary", textTransform: "uppercase", children: totalItems }), _jsx(Text, { children: totalFormatted })] })] })] }) })] }));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ReceiptItemI } from '../../../interfaces';
|
|
2
|
-
export declare const ReceiptItemAssigned: ({ icon, isChecked, itemPrice, onChange, onSelectedChange, onRoomClick, total, quantity, roomId, roomType, sku, title, variant, }: ReceiptItemI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const ReceiptItemAssigned: ({ icon, isChecked, itemPrice, onChange, onSelectedChange, onRoomClick, onEditClick, total, quantity, roomId, roomType, sku, title, variant, }: ReceiptItemI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Flex, Stack } from '@chakra-ui/react';
|
|
2
|
+
import { Flex, Stack, IconButton } from '@chakra-ui/react';
|
|
3
3
|
import { Price } from '../../../assets/images';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { t } from 'i18next';
|
|
5
|
+
import { Overlay, ReceiptItemBody, ReceiptItemContainer, ReceiptItemHeader, ReceiptRoom, Edit } from '../..';
|
|
6
|
+
export const ReceiptItemAssigned = ({ icon = Price, isChecked, itemPrice, onChange, onSelectedChange = () => { }, onRoomClick = () => { }, onEditClick, total, quantity, roomId = '', roomType, sku, title, variant = 'secondary', }) => {
|
|
7
|
+
return (_jsx(ReceiptItemContainer, { isChecked: isChecked, onChange: onChange, children: _jsxs(Flex, { flex: "auto", children: [roomType && (_jsx(ReceiptRoom, { roomType: roomType, roomId: roomId, onClick: onRoomClick })), _jsxs(Stack, { p: "base", bg: "lightGreen.1", spacing: "1", justify: "space-between", position: "relative", flex: "1", children: [!isChecked && (_jsx(Overlay, { position: "absolute", w: "inherit", h: "inherit", bg: "#F0F8F080" })), _jsxs(Flex, { align: "center", justify: "space-between", children: [_jsx(ReceiptItemHeader, { icon: icon, sku: sku, onSelectedChange: onSelectedChange, variant: variant }), onEditClick && (_jsx(IconButton, { variant: "menuIconWithShadow", maxW: "fit-content", "aria-label": t('ariaLabels.edit'), p: "1", icon: _jsx(Edit, {}), onClick: onEditClick }))] }), _jsx(ReceiptItemBody, { isTitleItalic: !isChecked, itemPrice: itemPrice, quantity: quantity, title: title, total: total })] })] }) }));
|
|
7
8
|
};
|
|
@@ -10,6 +10,6 @@ export const ReceiptItems = ({ isSelectDisabled = true, leftOptions = [], onItem
|
|
|
10
10
|
});
|
|
11
11
|
return (_jsxs(Box, { mb: "10rem", children: [_jsxs(Stack, { bg: "lightBlue.2", px: "4", pb: "base", pt: "2", children: [_jsx(Text, { textTransform: "uppercase", variant: "home", children: title }), _jsxs(Flex, { gap: "base", align: "center", children: [_jsx(Checkbox, { onChange: handleSelectAll }), _jsx(DoubleSelects, { isSelectDisabled: isSelectDisabled, leftOptions: leftOptions, rightOptions: rightOptions, onLeftSelectChange: onLeftSelectChange, onRightSelectChange: onRightSelectChange })] })] }), receipts.map((receipt) => {
|
|
12
12
|
const hasRoomType = !!(receipt === null || receipt === void 0 ? void 0 : receipt.roomType);
|
|
13
|
-
return (_jsxs(Box, { children: [!hasRoomType && (_jsx(ReceiptItem, Object.assign({ onChange: () => handleItemSelect(receipt._id), isChecked: isItemSelected(receipt._id), onSelectedChange: onReceiptSelectedChange, onEditClick: () => onEditReceipt === null || onEditReceipt === void 0 ? void 0 : onEditReceipt(receipt._id), selectItems: receiptOptions, variant: variant }, receipt))), hasRoomType && (_jsx(ReceiptItemAssigned, Object.assign({ onChange: () => handleItemSelect(receipt._id), onRoomClick: onRoomClick, isChecked: isItemSelected(receipt._id), onSelectedChange: onReceiptSelectedChange, initialSelectValue: receiptOptions === null || receiptOptions === void 0 ? void 0 : receiptOptions[1], selectItems: receiptOptions, variant: variant }, receipt)))] }, receipt._id));
|
|
13
|
+
return (_jsxs(Box, { children: [!hasRoomType && (_jsx(ReceiptItem, Object.assign({ onChange: () => handleItemSelect(receipt._id), isChecked: isItemSelected(receipt._id), onSelectedChange: onReceiptSelectedChange, onEditClick: () => onEditReceipt === null || onEditReceipt === void 0 ? void 0 : onEditReceipt(receipt._id), selectItems: receiptOptions, variant: variant }, receipt))), hasRoomType && (_jsx(ReceiptItemAssigned, Object.assign({ onChange: () => handleItemSelect(receipt._id), onRoomClick: onRoomClick, isChecked: isItemSelected(receipt._id), onSelectedChange: onReceiptSelectedChange, onEditClick: () => onEditReceipt === null || onEditReceipt === void 0 ? void 0 : onEditReceipt(receipt._id), initialSelectValue: receiptOptions === null || receiptOptions === void 0 ? void 0 : receiptOptions[1], selectItems: receiptOptions, variant: variant }, receipt)))] }, receipt._id));
|
|
14
14
|
})] }));
|
|
15
15
|
};
|
|
@@ -11,7 +11,7 @@ export declare const useDisplayReceipts: ({ receipts }: UseDisplayReceiptsI) =>
|
|
|
11
11
|
cashier?: string;
|
|
12
12
|
createAt?: Date;
|
|
13
13
|
home?: string | null;
|
|
14
|
-
itemQuantity: number;
|
|
14
|
+
itemQuantity: number | string;
|
|
15
15
|
name?: string;
|
|
16
16
|
paymentMethod: string;
|
|
17
17
|
purchaseDate?: Date;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ export const AssignableReceiptCard = ({
|
|
|
15
15
|
const date = formatDateWithAt({ date: purchaseDate })
|
|
16
16
|
const totalFormatted = formatCurrency({ value: total })
|
|
17
17
|
const totalItems =
|
|
18
|
-
itemQuantity > 1
|
|
18
|
+
Number(itemQuantity) > 1
|
|
19
19
|
? `${itemQuantity} ${t('receipts.items')}`
|
|
20
20
|
: `${itemQuantity} ${t('receipts.item')}`
|
|
21
21
|
return (
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { Flex, Stack } from '@chakra-ui/react'
|
|
1
|
+
import { Flex, Stack, IconButton } from '@chakra-ui/react'
|
|
2
2
|
import { ReceiptItemI } from '@/interfaces'
|
|
3
3
|
import { Price } from '@/assets/images'
|
|
4
|
+
import { t } from 'i18next'
|
|
4
5
|
import {
|
|
5
6
|
Overlay,
|
|
6
7
|
ReceiptItemBody,
|
|
7
8
|
ReceiptItemContainer,
|
|
8
9
|
ReceiptItemHeader,
|
|
9
10
|
ReceiptRoom,
|
|
11
|
+
Edit
|
|
10
12
|
} from '@/components'
|
|
11
13
|
|
|
12
14
|
export const ReceiptItemAssigned = ({
|
|
@@ -16,6 +18,7 @@ export const ReceiptItemAssigned = ({
|
|
|
16
18
|
onChange,
|
|
17
19
|
onSelectedChange = () => {},
|
|
18
20
|
onRoomClick = () => {},
|
|
21
|
+
onEditClick,
|
|
19
22
|
total,
|
|
20
23
|
quantity,
|
|
21
24
|
roomId = '',
|
|
@@ -50,12 +53,24 @@ export const ReceiptItemAssigned = ({
|
|
|
50
53
|
bg="#F0F8F080"
|
|
51
54
|
/>
|
|
52
55
|
)}
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
<Flex align="center" justify="space-between">
|
|
57
|
+
<ReceiptItemHeader
|
|
58
|
+
icon={icon}
|
|
59
|
+
sku={sku}
|
|
60
|
+
onSelectedChange={onSelectedChange}
|
|
61
|
+
variant={variant}
|
|
62
|
+
/>
|
|
63
|
+
{onEditClick && (
|
|
64
|
+
<IconButton
|
|
65
|
+
variant="menuIconWithShadow"
|
|
66
|
+
maxW="fit-content"
|
|
67
|
+
aria-label={t('ariaLabels.edit')}
|
|
68
|
+
p="1"
|
|
69
|
+
icon={<Edit />}
|
|
70
|
+
onClick={onEditClick}
|
|
71
|
+
/>
|
|
72
|
+
)}
|
|
73
|
+
</Flex>
|
|
59
74
|
<ReceiptItemBody
|
|
60
75
|
isTitleItalic={!isChecked}
|
|
61
76
|
itemPrice={itemPrice}
|
|
@@ -63,6 +63,7 @@ export const ReceiptItems = ({
|
|
|
63
63
|
onRoomClick={onRoomClick}
|
|
64
64
|
isChecked={isItemSelected(receipt._id)}
|
|
65
65
|
onSelectedChange={onReceiptSelectedChange}
|
|
66
|
+
onEditClick={() => onEditReceipt?.(receipt._id)}
|
|
66
67
|
initialSelectValue={receiptOptions?.[1]}
|
|
67
68
|
selectItems={receiptOptions}
|
|
68
69
|
variant={variant}
|