@homefile/components-v2 2.24.20 → 2.24.22
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/assets/locales/en/index.json +1 -1
- package/dist/components/forms/dynamicForm/fields/CurrencyField.js +1 -1
- package/dist/components/forms/dynamicForm/fields/NumberField.js +1 -1
- package/dist/components/forms/dynamicForm/fields/TextField.js +1 -1
- package/dist/components/receipts/receipt/PdfButton.js +3 -1
- package/dist/components/receipts/receipt/ReceiptDetails.d.ts +2 -1
- package/dist/components/receipts/receipt/ReceiptDetails.js +3 -3
- package/dist/stories/receipts/receipt/ReceiptDetails.stories.d.ts +1 -0
- package/dist/stories/receipts/receipt/ReceiptDetails.stories.js +1 -0
- package/package.json +1 -1
- package/src/assets/locales/en/index.json +1 -1
- package/src/components/forms/dynamicForm/fields/CurrencyField.tsx +3 -3
- package/src/components/forms/dynamicForm/fields/NumberField.tsx +1 -1
- package/src/components/forms/dynamicForm/fields/TextField.tsx +1 -1
- package/src/components/receipts/receipt/PdfButton.tsx +1 -1
- package/src/components/receipts/receipt/ReceiptDetails.tsx +10 -2
- package/src/stories/receipts/receipt/ReceiptDetails.stories.tsx +1 -0
|
@@ -834,7 +834,7 @@
|
|
|
834
834
|
"totalReceipts": "Total Receipts Received",
|
|
835
835
|
"totalItems": "Total Items Identified",
|
|
836
836
|
"totalItemsAdded": "Total Items Added",
|
|
837
|
-
"viewPdf": "View receipt
|
|
837
|
+
"viewPdf": "View receipt File",
|
|
838
838
|
"whereItsAt": "Where it's at"
|
|
839
839
|
},
|
|
840
840
|
"registration": {
|
|
@@ -5,7 +5,7 @@ import { Flex, Input } from '@chakra-ui/react';
|
|
|
5
5
|
import { FormIcon, LabeledField } from '../../..';
|
|
6
6
|
export const CurrencyField = ({ label, id, icon, placeholder, value, }) => {
|
|
7
7
|
const { control } = useFormContext();
|
|
8
|
-
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", children: [_jsx(FormIcon, { icon: icon }), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field }) => {
|
|
8
|
+
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", w: "full", children: [_jsx(FormIcon, { icon: icon }), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field }) => {
|
|
9
9
|
return (_jsx(LabeledField, { label: label, children: _jsx(NumericFormat, Object.assign({}, field, { customInput: Input, thousandSeparator: true, decimalScale: 2, fixedDecimalScale: true, prefix: "$", placeholder: placeholder, textAlign: "right", _placeholder: { color: 'gray.2' }, onValueChange: ({ floatValue }) => {
|
|
10
10
|
field.onChange(floatValue);
|
|
11
11
|
} })) }));
|
|
@@ -5,7 +5,7 @@ import { FieldDescription, LabeledField } from '../../..';
|
|
|
5
5
|
export const NumberField = ({ description, icon, id, label, placeholder, value, }) => {
|
|
6
6
|
const { control } = useFormContext();
|
|
7
7
|
const hasDescriptionAndIcon = Boolean(description) && Boolean(icon);
|
|
8
|
-
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", children: [hasDescriptionAndIcon && (_jsx(FieldDescription, { description: description, icon: icon })), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
8
|
+
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", w: "full", children: [hasDescriptionAndIcon && (_jsx(FieldDescription, { description: description, icon: icon })), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
9
9
|
return (_jsx(LabeledField, { label: label, children: _jsx(Input, { onChange: (e) => {
|
|
10
10
|
const value = e.target.valueAsNumber;
|
|
11
11
|
const isNumber = !isNaN(value);
|
|
@@ -4,7 +4,7 @@ import { Flex } from '@chakra-ui/react';
|
|
|
4
4
|
import { FormIcon, TextInput } from '../../..';
|
|
5
5
|
export const TextField = ({ id, icon, placeholder = '', label, type = 'text', showIcon = false, value, }) => {
|
|
6
6
|
const { control } = useFormContext();
|
|
7
|
-
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", children: [showIcon && icon && _jsx(FormIcon, { icon: icon }), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
7
|
+
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", w: "full", children: [showIcon && icon && _jsx(FormIcon, { icon: icon }), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
8
8
|
return (_jsx(TextInput, { handleChange: onChange, placeholder: placeholder, type: type, value: value, label: label }));
|
|
9
9
|
} })] }));
|
|
10
10
|
};
|
|
@@ -3,5 +3,7 @@ import { t } from 'i18next';
|
|
|
3
3
|
import { Text, Image, Flex } from '@chakra-ui/react';
|
|
4
4
|
import { PdfIcon } from '../../../assets/images';
|
|
5
5
|
export const PdfButton = ({ onClick }) => {
|
|
6
|
-
return (_jsxs(Flex, { align: "center", gap: "base", as: "button", minW: "fit-content", bg: "neutral.white",
|
|
6
|
+
return (_jsxs(Flex, { align: "center", gap: "base", as: "button", minW: "fit-content", bg: "neutral.white",
|
|
7
|
+
// pr="base"
|
|
8
|
+
onClick: onClick, children: [_jsx(Text, { variant: "home", color: "blue.2", fontWeight: "medium", textTransform: "capitalize", children: t('receipts.viewPdf') }), _jsx(Image, { src: PdfIcon, h: "23px", w: "auto" })] }));
|
|
7
9
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReceiptDetailsDBI } from '../../../interfaces';
|
|
2
|
-
export declare const ReceiptDetails: ({ name, cashier, itemQuantity, paymentMethod, purchaseDate, tax, store, origin, storePhone, total, onEdit, }: Partial<ReceiptDetailsDBI> & {
|
|
2
|
+
export declare const ReceiptDetails: ({ name, cashier, itemQuantity, paymentMethod, purchaseDate, tax, store, origin, storePhone, total, onEdit, onFileClick }: Partial<ReceiptDetailsDBI> & {
|
|
3
3
|
onEdit?: () => void;
|
|
4
|
+
onFileClick?: () => void;
|
|
4
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { t } from 'i18next';
|
|
3
3
|
import { Box, Divider, Flex, IconButton, Image, Text } from '@chakra-ui/react';
|
|
4
4
|
import { formatDate } from '../../../utils';
|
|
5
|
-
import { DetailsColumn, Edit } from '../..';
|
|
5
|
+
import { DetailsColumn, Edit, PdfButton } from '../..';
|
|
6
6
|
import { getReceiptOrigin } from '../../../helpers';
|
|
7
|
-
export const ReceiptDetails = ({ name, cashier = '', itemQuantity, paymentMethod, purchaseDate, tax, store, origin = "", storePhone = '', total, onEdit, }) => {
|
|
7
|
+
export const ReceiptDetails = ({ name, cashier = '', itemQuantity, paymentMethod, purchaseDate, tax, store, origin = "", storePhone = '', total, onEdit, onFileClick }) => {
|
|
8
8
|
const storeImage = getReceiptOrigin(origin);
|
|
9
9
|
const leftLabels = t('receipts.columnLeft').split(',');
|
|
10
10
|
const rightLabels = t('receipts.columnRight').split(',');
|
|
@@ -44,5 +44,5 @@ export const ReceiptDetails = ({ name, cashier = '', itemQuantity, paymentMethod
|
|
|
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: [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)" })] }) }),
|
|
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)" })] }) }), _jsxs(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 })] })] }), _jsx(Flex, { justifyContent: 'flex-end', pt: '.5rem', children: onFileClick && (_jsx(PdfButton, { onClick: onFileClick })) })] })] }));
|
|
48
48
|
};
|
package/package.json
CHANGED
|
@@ -834,7 +834,7 @@
|
|
|
834
834
|
"totalReceipts": "Total Receipts Received",
|
|
835
835
|
"totalItems": "Total Items Identified",
|
|
836
836
|
"totalItemsAdded": "Total Items Added",
|
|
837
|
-
"viewPdf": "View receipt
|
|
837
|
+
"viewPdf": "View receipt File",
|
|
838
838
|
"whereItsAt": "Where it's at"
|
|
839
839
|
},
|
|
840
840
|
"registration": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Controller, useFormContext } from 'react-hook-form'
|
|
2
|
-
import {NumericFormat} from 'react-number-format'
|
|
2
|
+
import { NumericFormat } from 'react-number-format'
|
|
3
3
|
import { Flex, Input } from '@chakra-ui/react'
|
|
4
4
|
import { TextFieldI } from '@/interfaces'
|
|
5
5
|
import { FormIcon, LabeledField } from '@/components'
|
|
@@ -14,13 +14,13 @@ export const CurrencyField = ({
|
|
|
14
14
|
const { control } = useFormContext()
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<Flex align="center" gap="base" flex="auto">
|
|
17
|
+
<Flex align="center" gap="base" flex="auto" w="full">
|
|
18
18
|
<FormIcon icon={icon} />
|
|
19
19
|
<Controller
|
|
20
20
|
control={control}
|
|
21
21
|
name={id}
|
|
22
22
|
defaultValue={value}
|
|
23
|
-
render={({ field}) => {
|
|
23
|
+
render={({ field }) => {
|
|
24
24
|
return (
|
|
25
25
|
<LabeledField label={label}>
|
|
26
26
|
<NumericFormat
|
|
@@ -14,7 +14,7 @@ export const NumberField = ({
|
|
|
14
14
|
const { control } = useFormContext()
|
|
15
15
|
const hasDescriptionAndIcon = Boolean(description) && Boolean(icon)
|
|
16
16
|
return (
|
|
17
|
-
<Flex align="center" gap="base" flex="auto">
|
|
17
|
+
<Flex align="center" gap="base" flex="auto" w="full">
|
|
18
18
|
{hasDescriptionAndIcon && (
|
|
19
19
|
<FieldDescription description={description} icon={icon} />
|
|
20
20
|
)}
|
|
@@ -14,7 +14,7 @@ export const TextField = ({
|
|
|
14
14
|
}: TextFieldI) => {
|
|
15
15
|
const { control } = useFormContext()
|
|
16
16
|
return (
|
|
17
|
-
<Flex align="center" gap="base" flex="auto">
|
|
17
|
+
<Flex align="center" gap="base" flex="auto" w="full">
|
|
18
18
|
{showIcon && icon && <FormIcon icon={icon} />}
|
|
19
19
|
<Controller
|
|
20
20
|
control={control}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t } from 'i18next'
|
|
2
2
|
import { Box, Divider, Flex, IconButton, Image, Text } from '@chakra-ui/react'
|
|
3
3
|
import { formatDate } from '@/utils'
|
|
4
|
-
import { DetailsColumn, Edit } from '@/components'
|
|
4
|
+
import { DetailsColumn, Edit, PdfButton } from '@/components'
|
|
5
5
|
import { ColumnDetailsType, ReceiptDetailsDBI } from '@/interfaces'
|
|
6
6
|
import { getReceiptOrigin } from '@/helpers'
|
|
7
7
|
|
|
@@ -17,7 +17,8 @@ export const ReceiptDetails = ({
|
|
|
17
17
|
storePhone = '',
|
|
18
18
|
total,
|
|
19
19
|
onEdit,
|
|
20
|
-
|
|
20
|
+
onFileClick
|
|
21
|
+
}: Partial<ReceiptDetailsDBI> & { onEdit?: () => void, onFileClick?: () => void }) => {
|
|
21
22
|
const storeImage = getReceiptOrigin(origin)
|
|
22
23
|
const leftLabels = t('receipts.columnLeft').split(',')
|
|
23
24
|
const rightLabels = t('receipts.columnRight').split(',')
|
|
@@ -115,6 +116,13 @@ export const ReceiptDetails = ({
|
|
|
115
116
|
<DetailsColumn align="right" details={rightColumn} />
|
|
116
117
|
</Flex>
|
|
117
118
|
</Flex>
|
|
119
|
+
<Flex justifyContent={'flex-end'} pt={'.5rem'}>
|
|
120
|
+
{
|
|
121
|
+
onFileClick && (
|
|
122
|
+
<PdfButton onClick={onFileClick}/>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
</Flex>
|
|
118
126
|
</Box>
|
|
119
127
|
</Box>
|
|
120
128
|
)
|