"chore: update frontend dev script to include lint checks and add ESLint config file"
This commit is contained in:
@@ -37,19 +37,22 @@ export function InvoiceDetails({ invoice }: Props) {
|
||||
const { t } = useTranslation();
|
||||
const [currentStatus, setCurrentStatus] = useState(invoice?.status);
|
||||
|
||||
const handleChangeStatus = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
// setCurrentStatus(event.target.value);
|
||||
const handleChangeStatus = useCallback(
|
||||
(event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
||||
// setCurrentStatus(event.target.value);
|
||||
|
||||
try {
|
||||
changeStatus(invoice.id, event.target.value);
|
||||
setCurrentStatus(event.target.value);
|
||||
try {
|
||||
changeStatus(invoice.id, event.target.value);
|
||||
setCurrentStatus(event.target.value);
|
||||
|
||||
toast.success('status changed!');
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
toast.warning('error during changing status');
|
||||
}
|
||||
}, []);
|
||||
toast.success('status changed!');
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
toast.warning('error during changing status');
|
||||
}
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const renderFooter = () => (
|
||||
<Box
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import type { IInvoiceItem } from 'src/types/invoice';
|
||||
import type { IInvoiceItem, IInvoiceItemItem } from 'src/types/invoice';
|
||||
|
||||
import { sumBy } from 'es-toolkit';
|
||||
import { useEffect, useCallback } from 'react';
|
||||
@@ -22,7 +22,7 @@ import { InvoiceTotalSummary } from './invoice-total-summary';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export const defaultItem: Omit<IInvoiceItem, 'id'> = {
|
||||
export const defaultItem: Omit<IInvoiceItemItem, 'id'> = {
|
||||
title: '',
|
||||
description: '',
|
||||
service: INVOICE_SERVICE_OPTIONS[0].name,
|
||||
@@ -50,7 +50,7 @@ export function InvoiceNewEditDetails() {
|
||||
const discount = getValues('discount');
|
||||
const shipping = getValues('shipping');
|
||||
|
||||
const subtotal = sumBy(items, (item: IInvoiceItem) => item.quantity * item.price);
|
||||
const subtotal = sumBy(items, (item: IInvoiceItemItem) => item.quantity * item.price);
|
||||
const subtotalWithTax = subtotal + subtotal * (taxes / 100);
|
||||
const totalAmount = subtotalWithTax - discount - shipping;
|
||||
|
||||
|
@@ -81,6 +81,8 @@ export function InvoiceNewEditForm({ currentInvoice }: Props) {
|
||||
const loadingSend = useBoolean();
|
||||
|
||||
const defaultValues: NewInvoiceSchemaType = {
|
||||
id: '',
|
||||
sent: 0,
|
||||
invoiceNumber: 'INV-1990',
|
||||
createDate: today(),
|
||||
dueDate: null,
|
||||
@@ -129,6 +131,8 @@ export function InvoiceNewEditForm({ currentInvoice }: Props) {
|
||||
|
||||
try {
|
||||
if (currentInvoice) {
|
||||
data.dueDate = '2029-01-01';
|
||||
|
||||
await saveInvoice(currentInvoice.id, data);
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ type Props = {
|
||||
invoice?: IInvoiceItem;
|
||||
currentStatus: string;
|
||||
statusOptions: { value: string; label: string }[];
|
||||
onChangeStatus: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
||||
onChangeStatus: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
||||
};
|
||||
|
||||
export function InvoiceToolbar({ invoice, currentStatus, statusOptions, onChangeStatus }: Props) {
|
||||
|
Reference in New Issue
Block a user