mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
amend.
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
|||||||
useItems,
|
useItems,
|
||||||
useSettingsEstimates,
|
useSettingsEstimates,
|
||||||
useCreateEstimate,
|
useCreateEstimate,
|
||||||
useEditEstimate
|
useEditEstimate,
|
||||||
} from 'hooks/query';
|
} from 'hooks/query';
|
||||||
|
|
||||||
const EstimateFormContext = createContext();
|
const EstimateFormContext = createContext();
|
||||||
@@ -15,14 +15,20 @@ const EstimateFormContext = createContext();
|
|||||||
* Estimate form provider.
|
* Estimate form provider.
|
||||||
*/
|
*/
|
||||||
function EstimateFormProvider({ estimateId, ...props }) {
|
function EstimateFormProvider({ estimateId, ...props }) {
|
||||||
const { data: estimate, isFetching: isEstimateFetching } = useEstimate(
|
const {
|
||||||
estimateId, { enabled: !!estimateId }
|
data: estimate,
|
||||||
);
|
isFetching: isEstimateFetching,
|
||||||
|
} = useEstimate(estimateId, { enabled: !!estimateId });
|
||||||
|
|
||||||
// Filter all sellable items only.
|
// Filter all sellable items only.
|
||||||
const stringifiedFilterRoles = React.useMemo(() => JSON.stringify(
|
const stringifiedFilterRoles = React.useMemo(
|
||||||
[{ "fieldKey": "sellable", "value":true, "condition":"equals"}]
|
() =>
|
||||||
), []);
|
JSON.stringify([
|
||||||
|
{ index: 1, fieldKey: 'sellable', value: true, condition: '&&', comparator: 'equals', },
|
||||||
|
{ index: 2, fieldKey: 'active', value: true, condition: '&&', comparator: 'equals' },
|
||||||
|
]),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
// Handle fetch Items data table or list
|
// Handle fetch Items data table or list
|
||||||
const {
|
const {
|
||||||
@@ -30,7 +36,7 @@ function EstimateFormProvider({ estimateId, ...props }) {
|
|||||||
isFetching: isItemsFetching,
|
isFetching: isItemsFetching,
|
||||||
} = useItems({
|
} = useItems({
|
||||||
page_size: 10000,
|
page_size: 10000,
|
||||||
stringified_filter_roles: stringifiedFilterRoles
|
stringified_filter_roles: stringifiedFilterRoles,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle fetch customers data table or list
|
// Handle fetch customers data table or list
|
||||||
@@ -44,11 +50,11 @@ function EstimateFormProvider({ estimateId, ...props }) {
|
|||||||
|
|
||||||
// Form submit payload.
|
// Form submit payload.
|
||||||
const [submitPayload, setSubmitPayload] = React.useState({});
|
const [submitPayload, setSubmitPayload] = React.useState({});
|
||||||
|
|
||||||
// Create and edit estimate form.
|
// Create and edit estimate form.
|
||||||
const { mutateAsync: createEstimateMutate } = useCreateEstimate();
|
const { mutateAsync: createEstimateMutate } = useCreateEstimate();
|
||||||
const { mutateAsync: editEstimateMutate } = useEditEstimate();
|
const { mutateAsync: editEstimateMutate } = useEditEstimate();
|
||||||
|
|
||||||
const isNewMode = !estimateId;
|
const isNewMode = !estimateId;
|
||||||
|
|
||||||
// Provider payload.
|
// Provider payload.
|
||||||
@@ -66,7 +72,7 @@ function EstimateFormProvider({ estimateId, ...props }) {
|
|||||||
setSubmitPayload,
|
setSubmitPayload,
|
||||||
|
|
||||||
createEstimateMutate,
|
createEstimateMutate,
|
||||||
editEstimateMutate
|
editEstimateMutate,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -39,9 +39,14 @@ function InvoiceFormProvider({ invoiceId, ...props }) {
|
|||||||
: [];
|
: [];
|
||||||
|
|
||||||
// Filter all sellable items only.
|
// Filter all sellable items only.
|
||||||
const stringifiedFilterRoles = React.useMemo(() => JSON.stringify(
|
const stringifiedFilterRoles = React.useMemo(
|
||||||
[{ "fieldKey": "sellable", "value":true, "condition":"equals"}]
|
() =>
|
||||||
), []);
|
JSON.stringify([
|
||||||
|
{ index: 1, fieldKey: 'sellable', value: true, condition: '&&', comparator: 'equals', },
|
||||||
|
{ index: 2, fieldKey: 'active', value: true, condition: '&&', comparator: 'equals' },
|
||||||
|
]),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
// Handle fetching the items table based on the given query.
|
// Handle fetching the items table based on the given query.
|
||||||
const {
|
const {
|
||||||
@@ -49,7 +54,7 @@ function InvoiceFormProvider({ invoiceId, ...props }) {
|
|||||||
isLoading: isItemsLoading,
|
isLoading: isItemsLoading,
|
||||||
} = useItems({
|
} = useItems({
|
||||||
page_size: 10000,
|
page_size: 10000,
|
||||||
stringified_filter_roles: stringifiedFilterRoles
|
stringified_filter_roles: stringifiedFilterRoles,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle fetch customers data table or list
|
// Handle fetch customers data table or list
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
useCustomers,
|
useCustomers,
|
||||||
useItems,
|
useItems,
|
||||||
useCreateReceipt,
|
useCreateReceipt,
|
||||||
useEditReceipt
|
useEditReceipt,
|
||||||
} from 'hooks/query';
|
} from 'hooks/query';
|
||||||
|
|
||||||
const ReceiptFormContext = createContext();
|
const ReceiptFormContext = createContext();
|
||||||
@@ -33,9 +33,14 @@ function ReceiptFormProvider({ receiptId, ...props }) {
|
|||||||
} = useCustomers({ page_size: 10000 });
|
} = useCustomers({ page_size: 10000 });
|
||||||
|
|
||||||
// Filter all sellable items only.
|
// Filter all sellable items only.
|
||||||
const stringifiedFilterRoles = React.useMemo(() => JSON.stringify(
|
const stringifiedFilterRoles = React.useMemo(
|
||||||
[{ "fieldKey": "sellable", "value":true, "condition":"equals"}]
|
() =>
|
||||||
), []);
|
JSON.stringify([
|
||||||
|
{ index: 1, fieldKey: 'sellable', value: true, condition: '&&', comparator: 'equals', },
|
||||||
|
{ index: 2, fieldKey: 'active', value: true, condition: '&&', comparator: 'equals' },
|
||||||
|
]),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
// Handle fetch Items data table or list
|
// Handle fetch Items data table or list
|
||||||
const {
|
const {
|
||||||
@@ -43,7 +48,7 @@ function ReceiptFormProvider({ receiptId, ...props }) {
|
|||||||
isFetching: isItemsLoading,
|
isFetching: isItemsLoading,
|
||||||
} = useItems({
|
} = useItems({
|
||||||
page_size: 10000,
|
page_size: 10000,
|
||||||
stringified_filter_roles: stringifiedFilterRoles
|
stringified_filter_roles: stringifiedFilterRoles,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fetch receipt settings.
|
// Fetch receipt settings.
|
||||||
@@ -73,7 +78,7 @@ function ReceiptFormProvider({ receiptId, ...props }) {
|
|||||||
|
|
||||||
createReceiptMutate,
|
createReceiptMutate,
|
||||||
editReceiptMutate,
|
editReceiptMutate,
|
||||||
setSubmitPayload
|
setSubmitPayload,
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<DashboardInsider
|
<DashboardInsider
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
|
|
||||||
&:not([class*="bp3-intent-"]):not(.bp3-minimal) {
|
&:not([class*="bp3-intent-"]):not(.bp3-minimal) {
|
||||||
color: rgba(255, 255, 255, 0.95);
|
color: rgb(255, 255, 255);
|
||||||
}
|
}
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus,
|
&:focus,
|
||||||
|
|||||||
Reference in New Issue
Block a user