mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop
This commit is contained in:
20
CHANGELOG.md
20
CHANGELOG.md
@@ -2,6 +2,26 @@
|
||||
|
||||
All notable changes to Bigcapital server-side will be in this file.
|
||||
|
||||
## [1.7.0-rc.1] - 24-03-2022
|
||||
|
||||
## Added
|
||||
- Multiply currencies with foreign currencies.
|
||||
- Multiply warehouses to track inventory items.
|
||||
- Multiply branches to track organization transactions.
|
||||
- Transfer orders between warehouses.
|
||||
- Integrate financial reports with multiply branches.
|
||||
- Integrate inventory reports with multiply warehouses.
|
||||
|
||||
## Changes
|
||||
- Optimize style of sale invoice form.
|
||||
- Optimize style of sale receipt form.
|
||||
- Optimize style of credit note form.
|
||||
- Optimize style of payment receive form.
|
||||
- Optimize style of bill form.
|
||||
- Optimize style of payment made form.
|
||||
- Optimize style of manual journal form.
|
||||
- Optimize style of expense form.
|
||||
|
||||
## [1.6.3] - 21-02-2022
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -104,6 +104,14 @@ export const handleDeleteErrors = (errors) => {
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
if (
|
||||
errors.find((error) => error.type === 'ITEM_HAS_ASSOCIATED_TRANSACTIONS')
|
||||
) {
|
||||
AppToaster.show({
|
||||
message: intl.get('item.error.you_could_not_delete_item_has_associated'),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,9 @@ const commonInvalidateQueries = (queryClient) => {
|
||||
|
||||
// Invalidate items associated bills transactions.
|
||||
queryClient.invalidateQueries(t.ITEMS_ASSOCIATED_WITH_BILLS);
|
||||
|
||||
// Invalidate item warehouses.
|
||||
queryClient.invalidateQueries(t.ITEM_WAREHOUSES_LOCATION);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,6 +34,9 @@ const commonInvalidateQueries = (queryClient) => {
|
||||
|
||||
// Invalidate
|
||||
queryClient.invalidateQueries(t.ITEM_ASSOCIATED_WITH_INVOICES);
|
||||
|
||||
// Invalidate item warehouses.
|
||||
queryClient.invalidateQueries(t.ITEM_WAREHOUSES_LOCATION);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,9 @@ const commonInvalidateQueries = (queryClient) => {
|
||||
// Invalidate
|
||||
queryClient.invalidateQueries(t.ITEM_ASSOCIATED_WITH_RECEIPTS);
|
||||
|
||||
// Invalidate item warehouses.
|
||||
queryClient.invalidateQueries(t.ITEM_WAREHOUSES_LOCATION);
|
||||
|
||||
// Invalidate the settings.
|
||||
queryClient.invalidateQueries([t.SETTING, t.SETTING_RECEIPTS]);
|
||||
};
|
||||
|
||||
@@ -12,7 +12,6 @@ const commonInvalidateQueries = (queryClient) => {
|
||||
|
||||
// Invalidate warehouses transfers.
|
||||
queryClient.invalidateQueries(t.WAREHOUSE_TRANSFERS);
|
||||
// queryClient.invalidateQueries(t.WAREHOUSE_TRANSFER);
|
||||
|
||||
queryClient.invalidateQueries(t.DASHBOARD_META);
|
||||
};
|
||||
@@ -105,164 +104,6 @@ export function useWarehouse(id, props, requestProps) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new warehouse transfer.
|
||||
*/
|
||||
export function useCreateWarehouseTransfer(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
(values) => apiRequest.post('warehouses/transfers', values),
|
||||
{
|
||||
onSuccess: (res, values) => {
|
||||
// Common invalidate queries.
|
||||
commonInvalidateQueries(queryClient);
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the given warehouse transfer.
|
||||
*/
|
||||
export function useEditWarehouseTransfer(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
([id, values]) => apiRequest.post(`warehouses/transfers/${id}`, values),
|
||||
{
|
||||
onSuccess: (res, [id, values]) => {
|
||||
// Invalidate specific sale invoice.
|
||||
queryClient.invalidateQueries([t.WAREHOUSE_TRANSFER, id]);
|
||||
|
||||
// Common invalidate queries.
|
||||
commonInvalidateQueries(queryClient);
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the given warehouse Transfer.
|
||||
*/
|
||||
export function useDeleteWarehouseTransfer(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation((id) => apiRequest.delete(`warehouses/transfers/${id}`), {
|
||||
onSuccess: (res, id) => {
|
||||
// Common invalidate queries.
|
||||
commonInvalidateQueries(queryClient);
|
||||
},
|
||||
...props,
|
||||
});
|
||||
}
|
||||
|
||||
const transformWarehousesTransfer = (res) => ({
|
||||
warehousesTransfers: res.data.data,
|
||||
pagination: transformPagination(res.data.pagination),
|
||||
filterMeta: res.data.filter,
|
||||
});
|
||||
|
||||
/**
|
||||
* Retrieve Warehoues list.
|
||||
*/
|
||||
export function useWarehousesTransfers(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.WAREHOUSE_TRANSFERS, query],
|
||||
{ method: 'get', url: 'warehouses/transfers', params: query },
|
||||
{
|
||||
select: transformWarehousesTransfer,
|
||||
defaultData: {
|
||||
warehousesTransfers: [],
|
||||
pagination: {
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
total: 0,
|
||||
},
|
||||
filterMeta: {},
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the warehouse transfer details.
|
||||
* @param {number}
|
||||
*/
|
||||
export function useWarehouseTransfer(id, props, requestProps) {
|
||||
return useRequestQuery(
|
||||
[t.WAREHOUSE_TRANSFER, id],
|
||||
{ method: 'get', url: `warehouses/transfers/${id}`, ...requestProps },
|
||||
{
|
||||
select: (res) => res.data.data,
|
||||
defaultData: {},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} props
|
||||
* @returns
|
||||
*/
|
||||
export function useInitiateWarehouseTransfer(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
(id) => apiRequest.put(`warehouses/transfers/${id}/initiate`),
|
||||
{
|
||||
onSuccess: (res, id) => {
|
||||
queryClient.invalidateQueries([t.WAREHOUSE_TRANSFER, id]);
|
||||
|
||||
// Common invalidate queries.
|
||||
commonInvalidateQueries(queryClient);
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} props
|
||||
* @returns
|
||||
*/
|
||||
export function useTransferredWarehouseTransfer(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
(id) => apiRequest.put(`warehouses/transfers/${id}/transferred`),
|
||||
{
|
||||
onSuccess: (res, id) => {
|
||||
queryClient.invalidateQueries([t.WAREHOUSE_TRANSFER, id]);
|
||||
|
||||
// Common invalidate queries.
|
||||
commonInvalidateQueries(queryClient);
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function useRefreshWarehouseTransfers() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return {
|
||||
refresh: () => {
|
||||
queryClient.invalidateQueries(t.WAREHOUSE_TRANSFERS);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the given warehouse.
|
||||
*/
|
||||
|
||||
172
src/hooks/query/warehousesTransfers.js
Normal file
172
src/hooks/query/warehousesTransfers.js
Normal file
@@ -0,0 +1,172 @@
|
||||
import { useQueryClient, useMutation } from 'react-query';
|
||||
import { transformPagination } from 'utils';
|
||||
import { useRequestQuery } from '../useQueryRequest';
|
||||
import useApiRequest from '../useRequest';
|
||||
import t from './types';
|
||||
|
||||
// Common invalidate queries.
|
||||
const commonInvalidateQueries = (queryClient) => {
|
||||
// Invalidate warehouses transfers.
|
||||
queryClient.invalidateQueries(t.WAREHOUSE_TRANSFERS);
|
||||
|
||||
// Invalidate item warehouses.
|
||||
queryClient.invalidateQueries(t.ITEM_WAREHOUSES_LOCATION);
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a new warehouse transfer.
|
||||
*/
|
||||
export function useCreateWarehouseTransfer(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
(values) => apiRequest.post('warehouses/transfers', values),
|
||||
{
|
||||
onSuccess: (res, values) => {
|
||||
// Common invalidate queries.
|
||||
commonInvalidateQueries(queryClient);
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the given warehouse transfer.
|
||||
*/
|
||||
export function useEditWarehouseTransfer(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
([id, values]) => apiRequest.post(`warehouses/transfers/${id}`, values),
|
||||
{
|
||||
onSuccess: (res, [id, values]) => {
|
||||
// Invalidate specific sale invoice.
|
||||
queryClient.invalidateQueries([t.WAREHOUSE_TRANSFER, id]);
|
||||
|
||||
// Common invalidate queries.
|
||||
commonInvalidateQueries(queryClient);
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the given warehouse Transfer.
|
||||
*/
|
||||
export function useDeleteWarehouseTransfer(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation((id) => apiRequest.delete(`warehouses/transfers/${id}`), {
|
||||
onSuccess: (res, id) => {
|
||||
// Common invalidate queries.
|
||||
commonInvalidateQueries(queryClient);
|
||||
},
|
||||
...props,
|
||||
});
|
||||
}
|
||||
|
||||
const transformWarehousesTransfer = (res) => ({
|
||||
warehousesTransfers: res.data.data,
|
||||
pagination: transformPagination(res.data.pagination),
|
||||
filterMeta: res.data.filter,
|
||||
});
|
||||
|
||||
/**
|
||||
* Retrieve Warehoues list.
|
||||
*/
|
||||
export function useWarehousesTransfers(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.WAREHOUSE_TRANSFERS, query],
|
||||
{ method: 'get', url: 'warehouses/transfers', params: query },
|
||||
{
|
||||
select: transformWarehousesTransfer,
|
||||
defaultData: {
|
||||
warehousesTransfers: [],
|
||||
pagination: {
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
total: 0,
|
||||
},
|
||||
filterMeta: {},
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the warehouse transfer details.
|
||||
* @param {number}
|
||||
*/
|
||||
export function useWarehouseTransfer(id, props, requestProps) {
|
||||
return useRequestQuery(
|
||||
[t.WAREHOUSE_TRANSFER, id],
|
||||
{ method: 'get', url: `warehouses/transfers/${id}`, ...requestProps },
|
||||
{
|
||||
select: (res) => res.data.data,
|
||||
defaultData: {},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} props
|
||||
* @returns
|
||||
*/
|
||||
export function useInitiateWarehouseTransfer(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
(id) => apiRequest.put(`warehouses/transfers/${id}/initiate`),
|
||||
{
|
||||
onSuccess: (res, id) => {
|
||||
queryClient.invalidateQueries([t.WAREHOUSE_TRANSFER, id]);
|
||||
|
||||
// Common invalidate queries.
|
||||
commonInvalidateQueries(queryClient);
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} props
|
||||
* @returns
|
||||
*/
|
||||
export function useTransferredWarehouseTransfer(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
(id) => apiRequest.put(`warehouses/transfers/${id}/transferred`),
|
||||
{
|
||||
onSuccess: (res, id) => {
|
||||
queryClient.invalidateQueries([t.WAREHOUSE_TRANSFER, id]);
|
||||
|
||||
// Common invalidate queries.
|
||||
commonInvalidateQueries(queryClient);
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function useRefreshWarehouseTransfers() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return {
|
||||
refresh: () => {
|
||||
queryClient.invalidateQueries(t.WAREHOUSE_TRANSFERS);
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1795,13 +1795,10 @@
|
||||
"profit_loss_sheet.percentage_of_row": "% التغير الأفقي",
|
||||
"profit_loss_sheet.percentage_of_expense": "% التغير في المصاريف",
|
||||
"profit_loss_sheet.percentage_of_income": "% التغير الإيرادات",
|
||||
|
||||
"report.balance_sheet_comparison.title": "مقارنة الميزانية العمومية",
|
||||
"report.balance_sheet_comparison.desc": "يعرض أصول الشركة والتزاماتها وحقوق المساهمين في نقطة زمنية محددة مقارنة بالسنة الماضية.",
|
||||
|
||||
"report.profit_loss_sheet_comparison.title": "مقارنة قائمة الدخل",
|
||||
"report.profit_loss_sheet_comparison.desc": "يعرض الإيرادات والتكاليف والمصاريف المتكبدة في نقطة محددة ومقارنة بالعام السابق.",
|
||||
|
||||
"warehouse_locations.label": "المخازن",
|
||||
"warehouse_locations.column.warehouse_name": "اسم المخزن",
|
||||
"warehouse_locations.column.quantity": "الكمية",
|
||||
@@ -2007,5 +2004,6 @@
|
||||
"receipt.branch_button.label": "الفرع: {label}",
|
||||
"receipt.warehouse_button.label": "المخزن: {label}",
|
||||
"warehouse_transfer.empty_status.title": "",
|
||||
"warehouse_transfer.empty_status.description": ""
|
||||
"warehouse_transfer.empty_status.description": "",
|
||||
"item.error.you_could_not_delete_item_has_associated": "لا يمكنك حذف العنصر لديه معاملات مرتبطة به "
|
||||
}
|
||||
@@ -1440,6 +1440,7 @@
|
||||
"AP_aging_summary.filter_options.label": "Filter vendors",
|
||||
"item.error.type_cannot_change_with_item_has_transactions": "Cannot change item type to inventory with item has associated transactions.",
|
||||
"item.error.cannot_change_inventory_account": "Cannot change item inventory account while the item has transactions.",
|
||||
"item.error.you_could_not_delete_item_has_associated":"You could not delete item that has associated transactions",
|
||||
"customer.link.customer_details": "Customer details ({amount})",
|
||||
"bad_debt.dialog.written_off_amount": "Written-off amount",
|
||||
"bad_debt.dialog.bad_debt": "Bad debt",
|
||||
|
||||
Reference in New Issue
Block a user