@homefile/components-v2 2.23.10 → 2.23.12

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.
Files changed (26) hide show
  1. package/dist/components/folderPanel/displayFiles/GridFile.js +1 -1
  2. package/dist/components/folderPanel/displayFiles/ListFile.js +1 -1
  3. package/dist/components/receipts/receipt/ReceiptDetails.d.ts +3 -1
  4. package/dist/components/receipts/receipt/ReceiptDetails.js +4 -4
  5. package/dist/components/receipts/receipt/ReceiptItem.d.ts +1 -1
  6. package/dist/components/receipts/receipt/ReceiptItem.js +5 -4
  7. package/dist/components/receipts/receipt/ReceiptItems.d.ts +1 -1
  8. package/dist/components/receipts/receipt/ReceiptItems.js +2 -2
  9. package/dist/interfaces/receipts/receipt/ReceiptItem.interface.d.ts +2 -1
  10. package/dist/interfaces/receipts/receipt/ReceiptItems.interface.d.ts +1 -0
  11. package/dist/mocks/folderPanel/DisplayFiles.mock.js +19 -0
  12. package/dist/stories/receipts/receipt/ReceiptDetails.stories.d.ts +2 -0
  13. package/dist/stories/receipts/receipt/ReceiptDetails.stories.js +3 -0
  14. package/dist/stories/receipts/receipt/ReceiptItem.stories.d.ts +1 -0
  15. package/dist/stories/receipts/receipt/ReceiptItem.stories.js +1 -1
  16. package/package.json +1 -1
  17. package/src/components/folderPanel/displayFiles/GridFile.tsx +1 -1
  18. package/src/components/folderPanel/displayFiles/ListFile.tsx +1 -1
  19. package/src/components/receipts/receipt/ReceiptDetails.tsx +18 -4
  20. package/src/components/receipts/receipt/ReceiptItem.tsx +22 -7
  21. package/src/components/receipts/receipt/ReceiptItems.tsx +2 -0
  22. package/src/interfaces/receipts/receipt/ReceiptItem.interface.ts +2 -1
  23. package/src/interfaces/receipts/receipt/ReceiptItems.interface.ts +1 -0
  24. package/src/mocks/folderPanel/DisplayFiles.mock.ts +19 -0
  25. package/src/stories/receipts/receipt/ReceiptDetails.stories.tsx +3 -0
  26. package/src/stories/receipts/receipt/ReceiptItem.stories.tsx +1 -0
@@ -24,5 +24,5 @@ export const GridFile = (_a) => {
24
24
  updatedAt,
25
25
  icon: fileTypes[fileExtension] || DocIcon,
26
26
  };
27
- return (_jsxs(WrapItem, { maxW: "7rem", position: "relative", children: [_jsx(Box, { position: "absolute", top: "0", right: "1", zIndex: "docked", children: _jsx(IconMenuWithMove, { disabled: menu.length < 1 ? true : false, icon: _jsx(MoreHorizontal, { size: 28 }), itemForm: itemForm, menuItems: menu, onMove: () => onMove(itemForm) }) }), _jsx(Button, { variant: "folder", px: "base", pb: "base", pt: "6", onClick: () => onClick(props), children: _jsxs(Stack, { spacing: "1", align: "center", children: [_jsx(Image, { src: (report && report.length > 0) ? DocIcon : fileTypes[fileExtension] || DocIcon, w: "46px", h: "49px", alt: fileExtension, transition: "all 0.2s ease-in-out" }), _jsxs(Box, { children: [_jsx(Text, { isTruncated: true, maxWidth: "5rem", fontSize: "sm", children: title }), _jsx(Text, { variant: "date", children: updatedAt })] })] }) })] }));
27
+ return (_jsxs(WrapItem, { maxW: "7rem", position: "relative", children: [_jsx(Box, { position: "absolute", top: "0", right: "1", zIndex: "docked", children: _jsx(IconMenuWithMove, { disabled: menu.length < 1 ? true : false, icon: _jsx(MoreHorizontal, { size: 28 }), itemForm: itemForm, menuItems: menu, onMove: () => onMove(itemForm) }) }), _jsx(Button, { variant: "folder", px: "base", pb: "base", pt: "6", onClick: () => onClick(props), children: _jsxs(Stack, { spacing: "1", align: "center", children: [_jsx(Image, { src: (report && report.length > 0 && !receipt) ? DocIcon : fileTypes[fileExtension] || DocIcon, w: "46px", h: "49px", alt: fileExtension, transition: "all 0.2s ease-in-out" }), _jsxs(Box, { children: [_jsx(Text, { isTruncated: true, maxWidth: "5rem", fontSize: "sm", children: title }), _jsx(Text, { variant: "date", children: updatedAt })] })] }) })] }));
28
28
  };
@@ -24,5 +24,5 @@ export const ListFile = (_a) => {
24
24
  updatedAt,
25
25
  icon: fileTypes[fileExtension] || DocIcon,
26
26
  };
27
- return (_jsx(Box, { bg: "neutral.white", w: "100%", transition: "all 0.2s ease-in-out", _hover: { bg: 'lightGreen.1' }, children: _jsxs(Flex, { children: [_jsxs(Flex, { gap: "base", p: "base", as: "button", flex: "1", onClick: () => onClick(props), children: [_jsx(Image, { src: (report && report.length > 0) ? DocIcon : fileTypes[fileExtension] || DocIcon, minW: "32px", h: "auto", alt: fileExtension, transition: "all 0.2s ease-in-out" }), _jsxs(Box, { mt: "-1", children: [_jsx(Text, { variant: "date", textTransform: "uppercase", textAlign: "left", children: fileExtension === '' ? 'Doc' : fileExtension }), _jsx(Text, { textOverflow: "ellipsis", noOfLines: 1, fontSize: "sm", textAlign: "left", children: title })] })] }), _jsxs(Flex, { align: "center", gap: "2", h: "fit-content", p: "1", pr: "base", children: [_jsx(Text, { variant: "date", w: "fit-content", children: updatedAt }), _jsx(IconMenuWithMove, { disabled: menu.length < 1 ? true : false, icon: _jsx(MoreHorizontal, { size: 28 }), itemForm: itemForm, menuItems: menu, onMove: () => onMove(itemForm) })] })] }) }));
27
+ return (_jsx(Box, { bg: "neutral.white", w: "100%", transition: "all 0.2s ease-in-out", _hover: { bg: 'lightGreen.1' }, children: _jsxs(Flex, { children: [_jsxs(Flex, { gap: "base", p: "base", as: "button", flex: "1", onClick: () => onClick(props), children: [_jsx(Image, { src: (report && report.length > 0 && !receipt) ? DocIcon : fileTypes[fileExtension] || DocIcon, minW: "32px", h: "auto", alt: fileExtension, transition: "all 0.2s ease-in-out" }), _jsxs(Box, { mt: "-1", children: [_jsx(Text, { variant: "date", textTransform: "uppercase", textAlign: "left", children: fileExtension === '' ? 'Doc' : fileExtension }), _jsx(Text, { textOverflow: "ellipsis", noOfLines: 1, fontSize: "sm", textAlign: "left", children: title })] })] }), _jsxs(Flex, { align: "center", gap: "2", h: "fit-content", p: "1", pr: "base", children: [_jsx(Text, { variant: "date", w: "fit-content", children: updatedAt }), _jsx(IconMenuWithMove, { disabled: menu.length < 1 ? true : false, icon: _jsx(MoreHorizontal, { size: 28 }), itemForm: itemForm, menuItems: menu, onMove: () => onMove(itemForm) })] })] }) }));
28
28
  };
@@ -1,2 +1,4 @@
1
1
  import { ReceiptDetailsDBI } from '../../../interfaces';
2
- export declare const ReceiptDetails: ({ cashier, itemQuantity, paymentMethod, purchaseDate, tax, store, receiptOrigin, storePhone, total, }: Partial<ReceiptDetailsDBI>) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const ReceiptDetails: ({ name, cashier, itemQuantity, paymentMethod, purchaseDate, tax, store, receiptOrigin, storePhone, total, onEdit, }: Partial<ReceiptDetailsDBI> & {
3
+ onEdit?: () => void;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { t } from 'i18next';
3
- import { Box, Divider, Flex, Image } from '@chakra-ui/react';
3
+ import { Box, Divider, Flex, IconButton, Image, Text } from '@chakra-ui/react';
4
4
  import { formatDate } from '../../../utils';
5
- import { DetailsColumn } from '../..';
5
+ import { DetailsColumn, Edit } from '../..';
6
6
  import { receiptOrigins } from '../../../helpers';
7
- export const ReceiptDetails = ({ cashier = '', itemQuantity, paymentMethod, purchaseDate, tax, store, receiptOrigin = 'homeDepot', storePhone = '', total, }) => {
7
+ export const ReceiptDetails = ({ name, cashier = '', itemQuantity, paymentMethod, purchaseDate, tax, store, receiptOrigin = 'homeDepot', storePhone = '', total, onEdit, }) => {
8
8
  const storeImage = receiptOrigins[receiptOrigin];
9
9
  const leftLabels = t('receipts.columnLeft').split(',');
10
10
  const rightLabels = t('receipts.columnRight').split(',');
@@ -44,5 +44,5 @@ export const ReceiptDetails = ({ cashier = '', itemQuantity, paymentMethod, purc
44
44
  value: paymentMethod,
45
45
  },
46
46
  ];
47
- return (_jsxs(Box, { boxShadow: "md", minW: "108px", bg: "lightBlue.2", borderBottom: "1px solid", borderColor: "lightBlue.2", children: [_jsx(Box, { w: "100%", h: "10px", bg: "lightBlue.2", overflow: "hidden", position: "relative", children: _jsxs("svg", { width: "100%", height: "8", viewBox: "0 0 100 10", preserveAspectRatio: "none", style: { display: 'block', position: 'absolute', bottom: 0, left: 0 }, children: [_jsx("defs", { children: _jsx("pattern", { id: "triangle", width: "4", height: "10", patternUnits: "userSpaceOnUse", children: _jsx("polygon", { points: "0,10 2,0 4,10", fill: "white" }) }) }), _jsx("rect", { width: "100%", height: "10", fill: "url(#triangle)" })] }) }), _jsx(Box, { bg: "neutral.white", px: "2", p: "base", children: _jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Image, { src: storeImage, w: "75px", h: "75px", fit: "cover" }), _jsxs(Flex, { align: "center", gap: "2", flex: "auto", children: [_jsx(DetailsColumn, { details: leftColumn }), _jsx(Divider, { orientation: "vertical", bg: "lightBlue.2", h: "63px", mr: "6" }), _jsx(DetailsColumn, { align: "right", details: rightColumn })] })] }) })] }));
47
+ return (_jsxs(Box, { boxShadow: "md", minW: "108px", bg: "lightBlue.2", borderBottom: "1px solid", borderColor: "lightBlue.2", children: [onEdit && (_jsxs(Flex, { align: "center", justify: "space-between", p: "base", children: [_jsx(Text, { children: name }), _jsx(IconButton, { variant: "menuIconWithShadow", maxW: "fit-content", "aria-label": t('ariaLabels.edit'), p: "1", icon: _jsx(Edit, {}), onClick: onEdit })] })), _jsx(Box, { w: "100%", h: "10px", bg: "lightBlue.2", overflow: "hidden", position: "relative", children: _jsxs("svg", { width: "100%", height: "8", viewBox: "0 0 100 10", preserveAspectRatio: "none", style: { display: 'block', position: 'absolute', bottom: 0, left: 0 }, children: [_jsx("defs", { children: _jsx("pattern", { id: "triangle", width: "4", height: "10", patternUnits: "userSpaceOnUse", children: _jsx("polygon", { points: "0,10 2,0 4,10", fill: "white" }) }) }), _jsx("rect", { width: "100%", height: "10", fill: "url(#triangle)" })] }) }), _jsx(Box, { bg: "neutral.white", px: "2", p: "base", children: _jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Image, { src: storeImage, w: "75px", h: "75px", fit: "cover" }), _jsxs(Flex, { align: "center", gap: "2", flex: "auto", children: [_jsx(DetailsColumn, { details: leftColumn }), _jsx(Divider, { orientation: "vertical", bg: "lightBlue.2", h: "63px", mr: "6" }), _jsx(DetailsColumn, { align: "right", details: rightColumn })] })] }) })] }));
48
48
  };
@@ -1,2 +1,2 @@
1
1
  import { ReceiptItemI } from '../../../interfaces';
2
- export declare const ReceiptItem: ({ icon, isChecked, itemPrice, onChange, onSelectedChange, total, quantity, sku, title, }: ReceiptItemI) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const ReceiptItem: ({ icon, isChecked, itemPrice, onChange, onSelectedChange, onEditClick, total, quantity, sku, title, }: 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 { Stack } from '@chakra-ui/react';
2
+ import { t } from 'i18next';
3
+ import { Flex, IconButton, Stack } from '@chakra-ui/react';
3
4
  import { Price } from '../../../assets/images';
4
- import { ReceiptItemBody, ReceiptItemContainer, ReceiptItemHeader, } from '../..';
5
- export const ReceiptItem = ({ icon = Price, isChecked, itemPrice, onChange, onSelectedChange = () => { }, total, quantity, sku, title, }) => {
6
- return (_jsx(ReceiptItemContainer, { isChecked: isChecked, onChange: onChange, children: _jsxs(Stack, { w: "100%", p: "base", bg: isChecked ? 'lightGreen.1' : 'neutral.white', spacing: "1", justify: "space-between", children: [_jsx(ReceiptItemHeader, { icon: icon, sku: sku, onSelectedChange: onSelectedChange, variant: "tertiary" }), _jsx(ReceiptItemBody, { itemPrice: itemPrice, quantity: quantity, title: title, total: total })] }) }));
5
+ import { Edit, ReceiptItemBody, ReceiptItemContainer, ReceiptItemHeader, } from '../..';
6
+ export const ReceiptItem = ({ icon = Price, isChecked, itemPrice, onChange, onSelectedChange = () => { }, onEditClick, total, quantity, sku, title, }) => {
7
+ return (_jsx(ReceiptItemContainer, { isChecked: isChecked, onChange: onChange, children: _jsxs(Stack, { w: "100%", p: "base", bg: isChecked ? 'lightGreen.1' : 'neutral.white', spacing: "1", justify: "space-between", children: [_jsxs(Flex, { align: "center", justify: "space-between", children: [_jsx(ReceiptItemHeader, { icon: icon, sku: sku, onSelectedChange: onSelectedChange, variant: "tertiary" }), onEditClick && (_jsx(IconButton, { variant: "menuIconWithShadow", maxW: "fit-content", "aria-label": t('ariaLabels.edit'), p: "1", icon: _jsx(Edit, {}), onClick: onEditClick }))] }), _jsx(ReceiptItemBody, { itemPrice: itemPrice, quantity: quantity, title: title, total: total })] }) }));
7
8
  };
@@ -1,2 +1,2 @@
1
1
  import { ReceiptItemsI } from '../../../interfaces';
2
- export declare const ReceiptItems: ({ isSelectDisabled, leftOptions, onItemSelectedChange, onLeftSelectChange, onReceiptSelectedChange, onRightSelectChange, onRoomClick, receipts, receiptOptions, rightOptions, title, variant, }: ReceiptItemsI) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const ReceiptItems: ({ isSelectDisabled, leftOptions, onItemSelectedChange, onLeftSelectChange, onReceiptSelectedChange, onRightSelectChange, onRoomClick, onEditReceipt, receipts, receiptOptions, rightOptions, title, variant, }: ReceiptItemsI) => import("react/jsx-runtime").JSX.Element;
@@ -3,13 +3,13 @@ import { t } from 'i18next';
3
3
  import { Flex, Checkbox, Text, Stack, Box } from '@chakra-ui/react';
4
4
  import { DoubleSelects, ReceiptItem, ReceiptItemAssigned } from '../..';
5
5
  import { useAssignableList } from '../../../hooks';
6
- export const ReceiptItems = ({ isSelectDisabled = true, leftOptions = [], onItemSelectedChange, onLeftSelectChange = () => null, onReceiptSelectedChange, onRightSelectChange = () => null, onRoomClick = () => null, receipts, receiptOptions, rightOptions = [], title = t('receipts.assign'), variant = 'secondary', }) => {
6
+ export const ReceiptItems = ({ isSelectDisabled = true, leftOptions = [], onItemSelectedChange, onLeftSelectChange = () => null, onReceiptSelectedChange, onRightSelectChange = () => null, onRoomClick = () => null, onEditReceipt, receipts, receiptOptions, rightOptions = [], title = t('receipts.assign'), variant = 'secondary', }) => {
7
7
  const { handleItemSelect, handleSelectAll, isItemSelected } = useAssignableList({
8
8
  onItemSelectedChange,
9
9
  items: receipts,
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, 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, initialSelectValue: receiptOptions === null || receiptOptions === void 0 ? void 0 : receiptOptions[1], selectItems: receiptOptions, variant: variant }, receipt)))] }, receipt._id));
14
14
  })] }));
15
15
  };
@@ -1,4 +1,4 @@
1
- import { SelectItemI } from "../..";
1
+ import { SelectItemI } from '../..';
2
2
  export interface ReceiptItemFeaturesI {
3
3
  description: string;
4
4
  icon?: string;
@@ -15,6 +15,7 @@ export type VariantTypes = 'secondary' | 'tertiary';
15
15
  export interface ReceiptItemI extends ReceiptItemFeaturesI {
16
16
  isChecked?: boolean;
17
17
  initialSelectValue?: string;
18
+ onEditClick?: () => void;
18
19
  onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
19
20
  onSelectedChange?: (value: string | SelectItemI) => void;
20
21
  onRoomClick?: (roomId: string) => void;
@@ -4,6 +4,7 @@ export interface ReceiptItemsI extends DoubleSelectsI {
4
4
  onItemSelectedChange: (_ids: string[]) => void;
5
5
  onReceiptSelectedChange?: (value: string | SelectItemI) => void;
6
6
  onRoomClick?: (roomId: string) => void;
7
+ onEditReceipt?: (receiptId: string) => void;
7
8
  receiptOptions?: string[];
8
9
  receipts: ReceiptItemFeaturesI[];
9
10
  title?: string;
@@ -34,6 +34,25 @@ export const DisplayFilesMock = [
34
34
  // }
35
35
  // ]
36
36
  },
37
+ {
38
+ description: "",
39
+ files: [],
40
+ receipt: "67e4223068ad365a5fdcfd83",
41
+ report: [{
42
+ comments: "",
43
+ description: "",
44
+ id: "774d6dd6-fd68-418a-97de-afe33b994349",
45
+ name: "Brand/Manufacturer",
46
+ type: "string",
47
+ value: "1 PAULINA SING 3CA3E PAULINA P2FD KITCHEN FAUCET BLK"
48
+ }],
49
+ room: "67900d966051bc06e4007707",
50
+ title: "1 PAULINA SING 3CA3E PAULINA P2FD KITCHEN FAUCET BLK",
51
+ type: "6347bc119d9b327c383a6d01",
52
+ updatedAt: "2025-06-20T15:41:39.212Z",
53
+ user: "62cefa1292d0bad2cc740c86",
54
+ _id: "67e424b968ad365a5fdcfd86"
55
+ }
37
56
  // {
38
57
  // _id: '2',
39
58
  // imageUrl: faker.image.urlPicsumPhotos(),
@@ -12,6 +12,8 @@ export declare const ReceiptDetailsComponent: {
12
12
  tax: string;
13
13
  store: string;
14
14
  storePhone: string;
15
+ name: string;
15
16
  total: string;
17
+ onEdit: import("@storybook/addon-actions").HandlerFunction;
16
18
  };
17
19
  };
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { action } from '@storybook/addon-actions';
2
3
  import { Box } from '@chakra-ui/react';
3
4
  import { ReceiptDetails } from '../../../components';
4
5
  export default {
@@ -16,5 +17,7 @@ ReceiptDetailsComponent.args = {
16
17
  tax: '0.5',
17
18
  store: '8418',
18
19
  storePhone: '1234567890',
20
+ name: 'Home Depot',
19
21
  total: '41.65',
22
+ onEdit: action('onEdit'),
20
23
  };
@@ -6,6 +6,7 @@ export declare const ReceiptItemComponent: {
6
6
  (args: ReceiptItemI): import("react/jsx-runtime").JSX.Element;
7
7
  args: {
8
8
  onChange: import("@storybook/addon-actions").HandlerFunction;
9
+ onEditClick: import("@storybook/addon-actions").HandlerFunction;
9
10
  description: string;
10
11
  icon?: string;
11
12
  itemPrice: string;
@@ -10,4 +10,4 @@ export default {
10
10
  export const ReceiptItemComponent = (args) => {
11
11
  return (_jsx(Box, { width: ['full', '30rem'], p: "base", children: _jsx(ReceiptItem, Object.assign({}, args)) }));
12
12
  };
13
- ReceiptItemComponent.args = Object.assign(Object.assign({}, receiptList[0]), { onChange: action('onChange') });
13
+ ReceiptItemComponent.args = Object.assign(Object.assign({}, receiptList[0]), { onChange: action('onChange'), onEditClick: action('onEditClick') });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.23.10",
3
+ "version": "2.23.12",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -41,7 +41,7 @@ export const GridFile = ({
41
41
  >
42
42
  <Stack spacing="1" align="center">
43
43
  <Image
44
- src={(report && report.length > 0) ? DocIcon : fileTypes[fileExtension] || DocIcon}
44
+ src={(report && report.length > 0 && !receipt) ? DocIcon : fileTypes[fileExtension] || DocIcon}
45
45
  w="46px"
46
46
  h="49px"
47
47
  alt={fileExtension}
@@ -37,7 +37,7 @@ export const ListFile = ({
37
37
  onClick={() => onClick(props)}
38
38
  >
39
39
  <Image
40
- src={(report && report.length > 0) ? DocIcon : fileTypes[fileExtension] || DocIcon}
40
+ src={(report && report.length > 0 && !receipt) ? DocIcon : fileTypes[fileExtension] || DocIcon}
41
41
  minW="32px"
42
42
  h="auto"
43
43
  alt={fileExtension}
@@ -1,12 +1,12 @@
1
1
  import { t } from 'i18next'
2
- import { Box, Divider, Flex, Image } from '@chakra-ui/react'
3
- import { ReceiptBg } from '@/assets/images'
2
+ import { Box, Divider, Flex, IconButton, Image, Text } from '@chakra-ui/react'
4
3
  import { formatDate } from '@/utils'
5
- import { DetailsColumn } from '@/components'
4
+ import { DetailsColumn, Edit } from '@/components'
6
5
  import { ColumnDetailsType, ReceiptDetailsDBI } from '@/interfaces'
7
6
  import { receiptOrigins } from '@/helpers'
8
7
 
9
8
  export const ReceiptDetails = ({
9
+ name,
10
10
  cashier = '',
11
11
  itemQuantity,
12
12
  paymentMethod,
@@ -16,7 +16,8 @@ export const ReceiptDetails = ({
16
16
  receiptOrigin = 'homeDepot',
17
17
  storePhone = '',
18
18
  total,
19
- }: Partial<ReceiptDetailsDBI>) => {
19
+ onEdit,
20
+ }: Partial<ReceiptDetailsDBI> & { onEdit?: () => void }) => {
20
21
  const storeImage = receiptOrigins[receiptOrigin]
21
22
  const leftLabels = t('receipts.columnLeft').split(',')
22
23
  const rightLabels = t('receipts.columnRight').split(',')
@@ -65,6 +66,19 @@ export const ReceiptDetails = ({
65
66
  borderBottom="1px solid"
66
67
  borderColor="lightBlue.2"
67
68
  >
69
+ {onEdit && (
70
+ <Flex align="center" justify="space-between" p="base">
71
+ <Text>{name}</Text>
72
+ <IconButton
73
+ variant="menuIconWithShadow"
74
+ maxW="fit-content"
75
+ aria-label={t('ariaLabels.edit')}
76
+ p="1"
77
+ icon={<Edit />}
78
+ onClick={onEdit}
79
+ />
80
+ </Flex>
81
+ )}
68
82
  <Box
69
83
  w="100%"
70
84
  h="10px"
@@ -1,7 +1,9 @@
1
- import { Stack } from '@chakra-ui/react'
1
+ import { t } from 'i18next'
2
+ import { Flex, IconButton, Stack } from '@chakra-ui/react'
2
3
  import { ReceiptItemI } from '@/interfaces'
3
4
  import { Price } from '@/assets/images'
4
5
  import {
6
+ Edit,
5
7
  ReceiptItemBody,
6
8
  ReceiptItemContainer,
7
9
  ReceiptItemHeader,
@@ -13,6 +15,7 @@ export const ReceiptItem = ({
13
15
  itemPrice,
14
16
  onChange,
15
17
  onSelectedChange = () => {},
18
+ onEditClick,
16
19
  total,
17
20
  quantity,
18
21
  sku,
@@ -27,12 +30,24 @@ export const ReceiptItem = ({
27
30
  spacing="1"
28
31
  justify="space-between"
29
32
  >
30
- <ReceiptItemHeader
31
- icon={icon}
32
- sku={sku}
33
- onSelectedChange={onSelectedChange}
34
- variant="tertiary"
35
- />
33
+ <Flex align="center" justify="space-between">
34
+ <ReceiptItemHeader
35
+ icon={icon}
36
+ sku={sku}
37
+ onSelectedChange={onSelectedChange}
38
+ variant="tertiary"
39
+ />
40
+ {onEditClick && (
41
+ <IconButton
42
+ variant="menuIconWithShadow"
43
+ maxW="fit-content"
44
+ aria-label={t('ariaLabels.edit')}
45
+ p="1"
46
+ icon={<Edit />}
47
+ onClick={onEditClick}
48
+ />
49
+ )}
50
+ </Flex>
36
51
  <ReceiptItemBody
37
52
  itemPrice={itemPrice}
38
53
  quantity={quantity}
@@ -12,6 +12,7 @@ export const ReceiptItems = ({
12
12
  onReceiptSelectedChange,
13
13
  onRightSelectChange = () => null,
14
14
  onRoomClick = () => null,
15
+ onEditReceipt,
15
16
  receipts,
16
17
  receiptOptions,
17
18
  rightOptions = [],
@@ -50,6 +51,7 @@ export const ReceiptItems = ({
50
51
  onChange={() => handleItemSelect(receipt._id)}
51
52
  isChecked={isItemSelected(receipt._id)}
52
53
  onSelectedChange={onReceiptSelectedChange}
54
+ onEditClick={() => onEditReceipt?.(receipt._id)}
53
55
  selectItems={receiptOptions}
54
56
  variant={variant}
55
57
  {...receipt}
@@ -1,4 +1,4 @@
1
- import { SelectItemI } from "@/interfaces"
1
+ import { SelectItemI } from '@/interfaces'
2
2
 
3
3
  export interface ReceiptItemFeaturesI {
4
4
  description: string
@@ -18,6 +18,7 @@ export type VariantTypes = 'secondary' | 'tertiary'
18
18
  export interface ReceiptItemI extends ReceiptItemFeaturesI {
19
19
  isChecked?: boolean
20
20
  initialSelectValue?: string
21
+ onEditClick?: () => void
21
22
  onChange: (event: React.ChangeEvent<HTMLInputElement>) => void
22
23
  onSelectedChange?: (value: string | SelectItemI) => void
23
24
  onRoomClick?: (roomId: string) => void
@@ -5,6 +5,7 @@ export interface ReceiptItemsI extends DoubleSelectsI {
5
5
  onItemSelectedChange: (_ids: string[]) => void
6
6
  onReceiptSelectedChange?: (value: string | SelectItemI) => void
7
7
  onRoomClick?: (roomId: string) => void
8
+ onEditReceipt?: (receiptId: string) => void
8
9
  receiptOptions?: string[]
9
10
  receipts: ReceiptItemFeaturesI[]
10
11
  title?: string
@@ -36,6 +36,25 @@ export const DisplayFilesMock: FileInfoI[] = [
36
36
  // }
37
37
  // ]
38
38
  },
39
+ {
40
+ description: "",
41
+ files: [],
42
+ receipt: "67e4223068ad365a5fdcfd83",
43
+ report: [{
44
+ comments: "",
45
+ description: "",
46
+ id: "774d6dd6-fd68-418a-97de-afe33b994349",
47
+ name:"Brand/Manufacturer",
48
+ type: "string",
49
+ value: "1 PAULINA SING 3CA3E PAULINA P2FD KITCHEN FAUCET BLK"
50
+ }],
51
+ room: "67900d966051bc06e4007707",
52
+ title: "1 PAULINA SING 3CA3E PAULINA P2FD KITCHEN FAUCET BLK",
53
+ type: "6347bc119d9b327c383a6d01",
54
+ updatedAt: "2025-06-20T15:41:39.212Z",
55
+ user: "62cefa1292d0bad2cc740c86",
56
+ _id: "67e424b968ad365a5fdcfd86"
57
+ }
39
58
  // {
40
59
  // _id: '2',
41
60
  // imageUrl: faker.image.urlPicsumPhotos(),
@@ -1,4 +1,5 @@
1
1
  import { Meta } from '@storybook/react'
2
+ import { action } from '@storybook/addon-actions'
2
3
  import { Box } from '@chakra-ui/react'
3
4
  import { ReceiptDetails } from '@/components'
4
5
  import { ReceiptDetailsDBI } from '@/interfaces'
@@ -24,5 +25,7 @@ ReceiptDetailsComponent.args = {
24
25
  tax: '0.5',
25
26
  store: '8418',
26
27
  storePhone: '1234567890',
28
+ name: 'Home Depot',
27
29
  total: '41.65',
30
+ onEdit: action('onEdit'),
28
31
  }
@@ -21,4 +21,5 @@ export const ReceiptItemComponent = (args: ReceiptItemI) => {
21
21
  ReceiptItemComponent.args = {
22
22
  ...receiptList[0],
23
23
  onChange: action('onChange'),
24
+ onEditClick: action('onEditClick'),
24
25
  }