feat(ManualJournals): Auto-increment.

fix(BillPayment): Validate the opened payment bills.
fix(redux): presist redux state.
fix(useRequestQuery): hook.
This commit is contained in:
a.bouhuolia
2021-03-18 14:23:37 +02:00
parent 4e8bdee97a
commit 9ff8e3159d
79 changed files with 1326 additions and 889 deletions

View File

@@ -35,10 +35,10 @@ function ItemsEntriesTable({
const [cellsLoading, setCellsLoading] = React.useState(null);
// Fetches the item details.
const { data: item, isFetching: isItemFetching } = useItem(
const { data: item, isFetching: isItemFetching, isSuccess: isItemSuccess } = useItem(
rowItem && rowItem.itemId,
{
enabled: !!rowItem,
enabled: !!(rowItem && rowItem.itemId),
},
);
@@ -58,7 +58,7 @@ function ItemsEntriesTable({
// Once the item selected and fetched set the initial details to the table.
useEffect(() => {
if (item && rowItem) {
if (isItemSuccess && item && rowItem) {
const { rowIndex } = rowItem;
const price =
itemType === ITEM_TYPE.PURCHASABLE
@@ -82,7 +82,7 @@ function ItemsEntriesTable({
setRowItem(null);
saveInvoke(onUpdateData, newRows);
}
}, [item, rowItem, rows, itemType, onUpdateData]);
}, [item, rowItem, rows, itemType, onUpdateData, isItemSuccess]);
// Allows to observes `entries` to make table rows outside controlled.
useEffect(() => {

View File

@@ -20,17 +20,18 @@ function ItemFormProvider({ itemId, ...props }) {
const { state } = useLocation();
const duplicateId = state?.action;
// Fetches the accounts list.
const { isFetching: isAccountsLoading, data: accounts } = useAccounts();
const { isLoading: isAccountsLoading, data: accounts } = useAccounts();
// Fetches the items categories list.
const {
isFetching: isItemsCategoriesLoading,
isLoading: isItemsCategoriesLoading,
data: { itemsCategories },
} = useItemsCategories();
// Fetches the given item details.
const { isFetching: isItemLoading, data: item } = useItem(
const { isLoading: isItemLoading, data: item } = useItem(
itemId || duplicateId,
{
enabled: !!itemId || !!duplicateId,

View File

@@ -16,13 +16,13 @@ function PaymentMadesListProvider({ query, ...props }) {
// Fetch accounts resource views and fields.
const {
data: paymentMadesViews,
isFetching: isViewsLoading,
isLoading: isViewsLoading,
} = useResourceViews('bill_payments');
// Fetch the accounts resource fields.
const {
data: paymentMadesFields,
isFetching: isFieldsLoading,
isLoading: isFieldsLoading,
} = useResourceFields('bill_payments');
// Fetch accounts list according to the given custom view id.