mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
Merge branch 'master' of https://github.com/abouolia/Ratteb
This commit is contained in:
@@ -12,7 +12,14 @@ import {
|
|||||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { Icon, DataTable, Money, LoadingIndicator, Choose } from 'components';
|
import {
|
||||||
|
Icon,
|
||||||
|
DataTable,
|
||||||
|
Money,
|
||||||
|
LoadingIndicator,
|
||||||
|
Choose,
|
||||||
|
If,
|
||||||
|
} from 'components';
|
||||||
import ItemsEmptyStatus from './ItemsEmptyStatus';
|
import ItemsEmptyStatus from './ItemsEmptyStatus';
|
||||||
import { useIsValuePassed } from 'hooks';
|
import { useIsValuePassed } from 'hooks';
|
||||||
import { CLASSES } from 'common/classes';
|
import { CLASSES } from 'common/classes';
|
||||||
@@ -36,6 +43,8 @@ function ItemsDataTable({
|
|||||||
// props
|
// props
|
||||||
onEditItem,
|
onEditItem,
|
||||||
onDeleteItem,
|
onDeleteItem,
|
||||||
|
onInactiveItem,
|
||||||
|
onActivateItem,
|
||||||
onSelectedRowsChange,
|
onSelectedRowsChange,
|
||||||
}) {
|
}) {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
@@ -83,6 +92,20 @@ function ItemsDataTable({
|
|||||||
text={formatMessage({ id: 'edit_item' })}
|
text={formatMessage({ id: 'edit_item' })}
|
||||||
onClick={handleEditItem(item)}
|
onClick={handleEditItem(item)}
|
||||||
/>
|
/>
|
||||||
|
<If condition={item.active}>
|
||||||
|
<MenuItem
|
||||||
|
text={formatMessage({ id: 'inactivate_item' })}
|
||||||
|
icon={<Icon icon="pause-16" iconSize={16} />}
|
||||||
|
onClick={() => onInactiveItem(item)}
|
||||||
|
/>
|
||||||
|
</If>
|
||||||
|
<If condition={!item.active}>
|
||||||
|
<MenuItem
|
||||||
|
text={formatMessage({ id: 'activate_item' })}
|
||||||
|
icon={<Icon icon="play-16" iconSize={16} />}
|
||||||
|
onClick={() => onActivateItem(item)}
|
||||||
|
/>
|
||||||
|
</If>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={formatMessage({ id: 'delete_item' })}
|
text={formatMessage({ id: 'delete_item' })}
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
@@ -91,7 +114,13 @@ function ItemsDataTable({
|
|||||||
/>
|
/>
|
||||||
</Menu>
|
</Menu>
|
||||||
),
|
),
|
||||||
[handleEditItem, handleDeleteItem, formatMessage],
|
[
|
||||||
|
handleEditItem,
|
||||||
|
handleDeleteItem,
|
||||||
|
onInactiveItem,
|
||||||
|
onActivateItem,
|
||||||
|
formatMessage,
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleRowContextMenu = useCallback(
|
const handleRowContextMenu = useCallback(
|
||||||
@@ -196,6 +225,12 @@ function ItemsDataTable({
|
|||||||
[onSelectedRowsChange],
|
[onSelectedRowsChange],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const rowClassNames = (row) => {
|
||||||
|
return {
|
||||||
|
inactive: !row.original.active,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const showEmptyStatus = [
|
const showEmptyStatus = [
|
||||||
itemsCurrentPage.length === 0,
|
itemsCurrentPage.length === 0,
|
||||||
itemsCurrentViewId === -1,
|
itemsCurrentViewId === -1,
|
||||||
@@ -221,6 +256,7 @@ function ItemsDataTable({
|
|||||||
rowContextMenu={handleRowContextMenu}
|
rowContextMenu={handleRowContextMenu}
|
||||||
expandable={false}
|
expandable={false}
|
||||||
sticky={true}
|
sticky={true}
|
||||||
|
rowClassNames={rowClassNames}
|
||||||
pagination={true}
|
pagination={true}
|
||||||
pagesCount={itemsPagination.pagesCount}
|
pagesCount={itemsPagination.pagesCount}
|
||||||
autoResetSortBy={false}
|
autoResetSortBy={false}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect, useCallback, useState, useMemo } from 'react';
|
import React, { useEffect, useCallback, useState, useMemo } from 'react';
|
||||||
import { Route, Switch, useHistory } from 'react-router-dom';
|
import { Route, Switch, useHistory } from 'react-router-dom';
|
||||||
import { Intent, Alert } from '@blueprintjs/core';
|
import { Intent, Alert } from '@blueprintjs/core';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery, queryCache } from 'react-query';
|
||||||
import {
|
import {
|
||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
FormattedHTMLMessage,
|
FormattedHTMLMessage,
|
||||||
@@ -38,10 +38,14 @@ function ItemsList({
|
|||||||
// #withItemsActions
|
// #withItemsActions
|
||||||
requestDeleteItem,
|
requestDeleteItem,
|
||||||
requestFetchItems,
|
requestFetchItems,
|
||||||
|
requestInactiveItem,
|
||||||
|
requestActivateItem,
|
||||||
addItemsTableQueries,
|
addItemsTableQueries,
|
||||||
requestDeleteBulkItems,
|
requestDeleteBulkItems,
|
||||||
}) {
|
}) {
|
||||||
const [deleteItem, setDeleteItem] = useState(false);
|
const [deleteItem, setDeleteItem] = useState(false);
|
||||||
|
const [inactiveItem, setInactiveItem] = useState(false);
|
||||||
|
const [activateItem, setActivateItem] = useState(false);
|
||||||
const [selectedRows, setSelectedRows] = useState([]);
|
const [selectedRows, setSelectedRows] = useState([]);
|
||||||
const [bulkDelete, setBulkDelete] = useState(false);
|
const [bulkDelete, setBulkDelete] = useState(false);
|
||||||
|
|
||||||
@@ -65,9 +69,8 @@ function ItemsList({
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Handle fetching the items table based on the given query.
|
// Handle fetching the items table based on the given query.
|
||||||
const fetchItems = useQuery(
|
const fetchItems = useQuery(['items-table', itemsTableQuery], (key, _query) =>
|
||||||
['items-table', itemsTableQuery],
|
requestFetchItems({ ..._query }),
|
||||||
(key, _query) => requestFetchItems({ ..._query }),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Handle click delete item.
|
// Handle click delete item.
|
||||||
@@ -92,7 +95,8 @@ function ItemsList({
|
|||||||
|
|
||||||
// handle confirm delete item.
|
// handle confirm delete item.
|
||||||
const handleConfirmDeleteItem = useCallback(() => {
|
const handleConfirmDeleteItem = useCallback(() => {
|
||||||
requestDeleteItem(deleteItem.id).then(() => {
|
requestDeleteItem(deleteItem.id)
|
||||||
|
.then(() => {
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
message: formatMessage({
|
message: formatMessage({
|
||||||
id: 'the_item_has_been_successfully_deleted',
|
id: 'the_item_has_been_successfully_deleted',
|
||||||
@@ -100,8 +104,13 @@ function ItemsList({
|
|||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
setDeleteItem(false);
|
setDeleteItem(false);
|
||||||
}).catch(({ errors }) => {
|
})
|
||||||
if (errors.find(error => error.type === 'ITEM_HAS_ASSOCIATED_TRANSACTINS')) {
|
.catch(({ errors }) => {
|
||||||
|
if (
|
||||||
|
errors.find(
|
||||||
|
(error) => error.type === 'ITEM_HAS_ASSOCIATED_TRANSACTINS',
|
||||||
|
)
|
||||||
|
) {
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
message: formatMessage({
|
message: formatMessage({
|
||||||
id: 'the_item_has_associated_transactions',
|
id: 'the_item_has_associated_transactions',
|
||||||
@@ -113,12 +122,9 @@ function ItemsList({
|
|||||||
});
|
});
|
||||||
}, [requestDeleteItem, deleteItem, formatMessage]);
|
}, [requestDeleteItem, deleteItem, formatMessage]);
|
||||||
|
|
||||||
const handleFetchData = useCallback(
|
const handleFetchData = useCallback(({ pageIndex, pageSize, sortBy }) => {}, [
|
||||||
({ pageIndex, pageSize, sortBy }) => {
|
addItemsTableQueries,
|
||||||
|
]);
|
||||||
},
|
|
||||||
[addItemsTableQueries],
|
|
||||||
);
|
|
||||||
|
|
||||||
// Handle filter change to re-fetch the items.
|
// Handle filter change to re-fetch the items.
|
||||||
const handleFilterChanged = useCallback(
|
const handleFilterChanged = useCallback(
|
||||||
@@ -174,6 +180,62 @@ function ItemsList({
|
|||||||
setBulkDelete(false);
|
setBulkDelete(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// Handle cancel/confirm item inactive.
|
||||||
|
const handleInactiveItem = useCallback((item) => {
|
||||||
|
setInactiveItem(item);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Handle cancel inactive item alert.
|
||||||
|
const handleCancelInactiveItem = useCallback(() => {
|
||||||
|
setInactiveItem(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Handle confirm item Inactive.
|
||||||
|
const handleConfirmItemInactive = useCallback(() => {
|
||||||
|
requestInactiveItem(inactiveItem.id)
|
||||||
|
.then(() => {
|
||||||
|
setInactiveItem(false);
|
||||||
|
AppToaster.show({
|
||||||
|
message: formatMessage({
|
||||||
|
id: 'the_item_has_been_successfully_inactivated',
|
||||||
|
}),
|
||||||
|
intent: Intent.SUCCESS,
|
||||||
|
});
|
||||||
|
queryCache.invalidateQueries('items-table');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
setInactiveItem(false);
|
||||||
|
});
|
||||||
|
}, [inactiveItem, requestInactiveItem, formatMessage]);
|
||||||
|
|
||||||
|
// Handle activate item click.
|
||||||
|
const handleActivateItem = useCallback((item) => {
|
||||||
|
setActivateItem(item);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle activate item alert cancel.
|
||||||
|
const handleCancelActivateItem = useCallback(() => {
|
||||||
|
setActivateItem(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle activate item confirm.
|
||||||
|
const handleConfirmItemActivate = useCallback(() => {
|
||||||
|
requestActivateItem(activateItem.id)
|
||||||
|
.then(() => {
|
||||||
|
setActivateItem(false);
|
||||||
|
AppToaster.show({
|
||||||
|
message: formatMessage({
|
||||||
|
id: 'the_item_has_been_successfully_activated',
|
||||||
|
}),
|
||||||
|
intent: Intent.SUCCESS,
|
||||||
|
});
|
||||||
|
queryCache.invalidateQueries('items-table');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
setActivateItem(false);
|
||||||
|
});
|
||||||
|
}, [activateItem, requestActivateItem, formatMessage]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardInsider
|
<DashboardInsider
|
||||||
loading={fetchResourceViews.isFetching || fetchResourceFields.isFetching}
|
loading={fetchResourceViews.isFetching || fetchResourceFields.isFetching}
|
||||||
@@ -196,6 +258,8 @@ function ItemsList({
|
|||||||
<ItemsDataTable
|
<ItemsDataTable
|
||||||
onDeleteItem={handleDeleteItem}
|
onDeleteItem={handleDeleteItem}
|
||||||
onEditItem={handleEditItem}
|
onEditItem={handleEditItem}
|
||||||
|
onInactiveItem={handleInactiveItem}
|
||||||
|
onActivateItem={handleActivateItem}
|
||||||
onSelectedRowsChange={handleSelectedRowsChange}
|
onSelectedRowsChange={handleSelectedRowsChange}
|
||||||
/>
|
/>
|
||||||
<Alert
|
<Alert
|
||||||
@@ -231,6 +295,30 @@ function ItemsList({
|
|||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
</Alert>
|
</Alert>
|
||||||
|
<Alert
|
||||||
|
cancelButtonText={<T id={'cancel'} />}
|
||||||
|
confirmButtonText={<T id={'inactivate'} />}
|
||||||
|
intent={Intent.WARNING}
|
||||||
|
isOpen={inactiveItem}
|
||||||
|
onCancel={handleCancelInactiveItem}
|
||||||
|
onConfirm={handleConfirmItemInactive}
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
<T id={'are_sure_to_inactive_this_item'} />
|
||||||
|
</p>
|
||||||
|
</Alert>
|
||||||
|
<Alert
|
||||||
|
cancelButtonText={<T id={'cancel'} />}
|
||||||
|
confirmButtonText={<T id={'activate'} />}
|
||||||
|
intent={Intent.WARNING}
|
||||||
|
isOpen={activateItem}
|
||||||
|
onCancel={handleCancelActivateItem}
|
||||||
|
onConfirm={handleConfirmItemActivate}
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
<T id={'are_sure_to_activate_this_item'} />
|
||||||
|
</p>
|
||||||
|
</Alert>
|
||||||
</Route>
|
</Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
</DashboardPageContent>
|
</DashboardPageContent>
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import {
|
|||||||
submitItem,
|
submitItem,
|
||||||
editItem,
|
editItem,
|
||||||
deleteBulkItems,
|
deleteBulkItems,
|
||||||
|
activateItem,
|
||||||
|
inactiveItem,
|
||||||
} from 'store/items/items.actions';
|
} from 'store/items/items.actions';
|
||||||
import t from 'store/types';
|
import t from 'store/types';
|
||||||
|
|
||||||
@@ -16,6 +18,8 @@ export const mapDispatchToProps = (dispatch) => ({
|
|||||||
requestDeleteBulkItems: (ids) => dispatch(deleteBulkItems({ ids })),
|
requestDeleteBulkItems: (ids) => dispatch(deleteBulkItems({ ids })),
|
||||||
requestSubmitItem: (form) => dispatch(submitItem({ form })),
|
requestSubmitItem: (form) => dispatch(submitItem({ form })),
|
||||||
requestEditItem: (id, form) => dispatch(editItem({ id, form })),
|
requestEditItem: (id, form) => dispatch(editItem({ id, form })),
|
||||||
|
requestInactiveItem: (id) => dispatch(inactiveItem({ id })),
|
||||||
|
requestActivateItem: (id) => dispatch(activateItem({ id })),
|
||||||
addBulkActionItem: (id) =>
|
addBulkActionItem: (id) =>
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.ITEM_BULK_ACTION_ADD,
|
type: t.ITEM_BULK_ACTION_ADD,
|
||||||
|
|||||||
@@ -185,26 +185,19 @@ function BillsDataTable({
|
|||||||
width: 140,
|
width: 140,
|
||||||
className: 'amount',
|
className: 'amount',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: 'reference_no',
|
|
||||||
Header: formatMessage({ id: 'reference_no' }),
|
|
||||||
accessor: 'reference_no',
|
|
||||||
width: 140,
|
|
||||||
className: 'reference_no',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'status',
|
id: 'status',
|
||||||
Header: formatMessage({ id: 'status' }),
|
Header: formatMessage({ id: 'status' }),
|
||||||
accessor: (row) => (
|
accessor: (row) => (
|
||||||
<Choose>
|
<Choose>
|
||||||
<Choose.When condition={row.is_open}>
|
<Choose.When condition={row.is_open}>
|
||||||
<Tag minimal={true}>
|
<Tag minimal={true} intent={Intent.SUCCESS}>
|
||||||
<T id={'opened'} />
|
<T id={'opened'} />
|
||||||
</Tag>
|
</Tag>
|
||||||
</Choose.When>
|
</Choose.When>
|
||||||
|
|
||||||
<Choose.Otherwise>
|
<Choose.Otherwise>
|
||||||
<Tag minimal={true} intent={Intent.WARNING}>
|
<Tag minimal={true}>
|
||||||
<T id={'draft'} />
|
<T id={'draft'} />
|
||||||
</Tag>
|
</Tag>
|
||||||
</Choose.Otherwise>
|
</Choose.Otherwise>
|
||||||
@@ -213,6 +206,13 @@ function BillsDataTable({
|
|||||||
width: 140,
|
width: 140,
|
||||||
className: 'status',
|
className: 'status',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'reference_no',
|
||||||
|
Header: formatMessage({ id: 'reference_no' }),
|
||||||
|
accessor: 'reference_no',
|
||||||
|
width: 140,
|
||||||
|
className: 'reference_no',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'actions',
|
id: 'actions',
|
||||||
Header: '',
|
Header: '',
|
||||||
|
|||||||
@@ -25,38 +25,38 @@ export default function EstimateFloatingActions({
|
|||||||
onCancelClick,
|
onCancelClick,
|
||||||
onClearClick,
|
onClearClick,
|
||||||
estimateId,
|
estimateId,
|
||||||
estimatePublished,
|
isDelivered,
|
||||||
}) {
|
}) {
|
||||||
const { resetForm, submitForm } = useFormikContext();
|
const { resetForm, submitForm } = useFormikContext();
|
||||||
|
|
||||||
const handleSubmitPublishBtnClick = (event) => {
|
const handleSubmitDeliverBtnClick = (event) => {
|
||||||
saveInvoke(onSubmitClick, event, {
|
saveInvoke(onSubmitClick, event, {
|
||||||
redirect: true,
|
redirect: true,
|
||||||
publish: true,
|
deliver: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmitPublishAndNewBtnClick = (event) => {
|
const handleSubmitDeliverAndNewBtnClick = (event) => {
|
||||||
submitForm();
|
submitForm();
|
||||||
saveInvoke(onSubmitClick, event, {
|
saveInvoke(onSubmitClick, event, {
|
||||||
redirect: false,
|
redirect: false,
|
||||||
publish: true,
|
deliver: true,
|
||||||
resetForm: true,
|
resetForm: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmitPublishContinueEditingBtnClick = (event) => {
|
const handleSubmitDeliverContinueEditingBtnClick = (event) => {
|
||||||
submitForm();
|
submitForm();
|
||||||
saveInvoke(onSubmitClick, event, {
|
saveInvoke(onSubmitClick, event, {
|
||||||
redirect: false,
|
redirect: false,
|
||||||
publish: true,
|
deliver: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmitDraftBtnClick = (event) => {
|
const handleSubmitDraftBtnClick = (event) => {
|
||||||
saveInvoke(onSubmitClick, event, {
|
saveInvoke(onSubmitClick, event, {
|
||||||
redirect: true,
|
redirect: true,
|
||||||
publish: false,
|
deliver: false,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ export default function EstimateFloatingActions({
|
|||||||
submitForm();
|
submitForm();
|
||||||
saveInvoke(onSubmitClick, event, {
|
saveInvoke(onSubmitClick, event, {
|
||||||
redirect: false,
|
redirect: false,
|
||||||
publish: false,
|
deliver: false,
|
||||||
resetForm: true,
|
resetForm: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -73,7 +73,7 @@ export default function EstimateFloatingActions({
|
|||||||
submitForm();
|
submitForm();
|
||||||
saveInvoke(onSubmitClick, event, {
|
saveInvoke(onSubmitClick, event, {
|
||||||
redirect: false,
|
redirect: false,
|
||||||
publish: false,
|
deliver: false,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -88,26 +88,26 @@ export default function EstimateFloatingActions({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(CLASSES.PAGE_FORM_FLOATING_ACTIONS)}>
|
<div className={classNames(CLASSES.PAGE_FORM_FLOATING_ACTIONS)}>
|
||||||
{/* ----------- Save And Publish ----------- */}
|
{/* ----------- Save And Deliver ----------- */}
|
||||||
<If condition={!estimateId || !estimatePublished}>
|
<If condition={!estimateId || !isDelivered}>
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<Button
|
<Button
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
intent={Intent.PRIMARY}
|
intent={Intent.PRIMARY}
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={handleSubmitPublishBtnClick}
|
onClick={handleSubmitDeliverBtnClick}
|
||||||
text={<T id={'save_publish'} />}
|
text={<T id={'save_and_deliver'} />}
|
||||||
/>
|
/>
|
||||||
<Popover
|
<Popover
|
||||||
content={
|
content={
|
||||||
<Menu>
|
<Menu>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={<T id={'publish_and_new'} />}
|
text={<T id={'publish_and_new'} />}
|
||||||
onClick={handleSubmitPublishAndNewBtnClick}
|
onClick={handleSubmitDeliverAndNewBtnClick}
|
||||||
/>
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={<T id={'publish_continue_editing'} />}
|
text={<T id={'publish_continue_editing'} />}
|
||||||
onClick={handleSubmitPublishContinueEditingBtnClick}
|
onClick={handleSubmitDeliverContinueEditingBtnClick}
|
||||||
/>
|
/>
|
||||||
</Menu>
|
</Menu>
|
||||||
}
|
}
|
||||||
@@ -156,13 +156,13 @@ export default function EstimateFloatingActions({
|
|||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</If>
|
</If>
|
||||||
{/* ----------- Save and New ----------- */}
|
{/* ----------- Save and New ----------- */}
|
||||||
<If condition={estimateId && estimatePublished}>
|
<If condition={estimateId && isDelivered}>
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<Button
|
<Button
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
intent={Intent.PRIMARY}
|
intent={Intent.PRIMARY}
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={handleSubmitPublishBtnClick}
|
onClick={handleSubmitDeliverBtnClick}
|
||||||
text={<T id={'save'} />}
|
text={<T id={'save'} />}
|
||||||
/>
|
/>
|
||||||
<Popover
|
<Popover
|
||||||
@@ -170,7 +170,7 @@ export default function EstimateFloatingActions({
|
|||||||
<Menu>
|
<Menu>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={<T id={'save_and_new'} />}
|
text={<T id={'save_and_new'} />}
|
||||||
onClick={handleSubmitPublishAndNewBtnClick}
|
onClick={handleSubmitDeliverAndNewBtnClick}
|
||||||
/>
|
/>
|
||||||
</Menu>
|
</Menu>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ const defaultInitialValues = {
|
|||||||
estimate_date: moment(new Date()).format('YYYY-MM-DD'),
|
estimate_date: moment(new Date()).format('YYYY-MM-DD'),
|
||||||
expiration_date: moment(new Date()).format('YYYY-MM-DD'),
|
expiration_date: moment(new Date()).format('YYYY-MM-DD'),
|
||||||
estimate_number: '',
|
estimate_number: '',
|
||||||
|
delivered: '',
|
||||||
reference: '',
|
reference: '',
|
||||||
note: '',
|
note: '',
|
||||||
terms_conditions: '',
|
terms_conditions: '',
|
||||||
@@ -181,6 +182,7 @@ const EstimateForm = ({
|
|||||||
}
|
}
|
||||||
const form = {
|
const form = {
|
||||||
...values,
|
...values,
|
||||||
|
delivered: submitPayload.deliver,
|
||||||
// Exclude all entries properties that out of request schema.
|
// Exclude all entries properties that out of request schema.
|
||||||
entries: entries.map((entry) => ({
|
entries: entries.map((entry) => ({
|
||||||
...pick(entry, Object.keys(defaultEstimate)),
|
...pick(entry, Object.keys(defaultEstimate)),
|
||||||
@@ -256,7 +258,7 @@ const EstimateForm = ({
|
|||||||
initialValues={initialValues}
|
initialValues={initialValues}
|
||||||
onSubmit={handleFormSubmit}
|
onSubmit={handleFormSubmit}
|
||||||
>
|
>
|
||||||
{({ isSubmitting }) => (
|
{({ isSubmitting ,values }) => (
|
||||||
<Form>
|
<Form>
|
||||||
<EstimateFormHeader
|
<EstimateFormHeader
|
||||||
onEstimateNumberChanged={handleEstimateNumberChange}
|
onEstimateNumberChanged={handleEstimateNumberChange}
|
||||||
@@ -269,7 +271,7 @@ const EstimateForm = ({
|
|||||||
estimateId={estimateId}
|
estimateId={estimateId}
|
||||||
onSubmitClick={handleSubmitClick}
|
onSubmitClick={handleSubmitClick}
|
||||||
onCancelClick={handleCancelClick}
|
onCancelClick={handleCancelClick}
|
||||||
estimatePublished={true}
|
isDelivered={values.delivered}
|
||||||
/>
|
/>
|
||||||
</Form>
|
</Form>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ const Schema = Yup.object().shape({
|
|||||||
.min(1)
|
.min(1)
|
||||||
.max(DATATYPES_LENGTH.TEXT)
|
.max(DATATYPES_LENGTH.TEXT)
|
||||||
.label(formatMessage({ id: 'note' })),
|
.label(formatMessage({ id: 'note' })),
|
||||||
|
delivered: Yup.boolean().required(),
|
||||||
entries: Yup.array().of(
|
entries: Yup.array().of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
quantity: Yup.number()
|
quantity: Yup.number()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { useEffect, useCallback, useMemo, useState } from 'react';
|
import React, { useEffect, useCallback, useMemo, useState } from 'react';
|
||||||
import { Route, Switch, useHistory } from 'react-router-dom';
|
import { Route, Switch, useHistory } from 'react-router-dom';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery, queryCache } from 'react-query';
|
||||||
import { Alert, Intent } from '@blueprintjs/core';
|
import { Alert, Intent } from '@blueprintjs/core';
|
||||||
|
|
||||||
import AppToaster from 'components/AppToaster';
|
import AppToaster from 'components/AppToaster';
|
||||||
@@ -35,11 +35,18 @@ function EstimateList({
|
|||||||
//#withEistimateActions
|
//#withEistimateActions
|
||||||
requestFetchEstimatesTable,
|
requestFetchEstimatesTable,
|
||||||
requestDeleteEstimate,
|
requestDeleteEstimate,
|
||||||
|
requestDeliverdEstimate,
|
||||||
|
requestApproveEstimate,
|
||||||
|
requestRejectEstimate,
|
||||||
addEstimatesTableQueries,
|
addEstimatesTableQueries,
|
||||||
}) {
|
}) {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
const [deleteEstimate, setDeleteEstimate] = useState(false);
|
const [deleteEstimate, setDeleteEstimate] = useState(false);
|
||||||
|
const [deliverEstimate, setDeliverEstimate] = useState(false);
|
||||||
|
const [approveEstimate, setApproveEstimate] = useState(false);
|
||||||
|
const [rejectEstimate, setRejectEstimate] = useState(false);
|
||||||
|
|
||||||
const [selectedRows, setSelectedRows] = useState([]);
|
const [selectedRows, setSelectedRows] = useState([]);
|
||||||
|
|
||||||
// const fetchResourceViews = useQuery(
|
// const fetchResourceViews = useQuery(
|
||||||
@@ -86,6 +93,88 @@ function EstimateList({
|
|||||||
});
|
});
|
||||||
}, [deleteEstimate, requestDeleteEstimate, formatMessage]);
|
}, [deleteEstimate, requestDeleteEstimate, formatMessage]);
|
||||||
|
|
||||||
|
// Handle cancel/confirm estimate deliver.
|
||||||
|
const handleDeliverEstimate = useCallback((estimate) => {
|
||||||
|
setDeliverEstimate(estimate);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Handle cancel deliver estimate alert.
|
||||||
|
const handleCancelDeliverEstimate = useCallback(() => {
|
||||||
|
setDeliverEstimate(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Handle confirm estimate deliver.
|
||||||
|
const handleConfirmEstimateDeliver = useCallback(() => {
|
||||||
|
requestDeliverdEstimate(deliverEstimate.id)
|
||||||
|
.then(() => {
|
||||||
|
setDeliverEstimate(false);
|
||||||
|
AppToaster.show({
|
||||||
|
message: formatMessage({
|
||||||
|
id: 'the_estimate_has_been_successfully_delivered',
|
||||||
|
}),
|
||||||
|
intent: Intent.SUCCESS,
|
||||||
|
});
|
||||||
|
queryCache.invalidateQueries('estimates-table');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
// setDeliverEstimate(false);
|
||||||
|
});
|
||||||
|
}, [deliverEstimate, requestDeliverdEstimate, formatMessage]);
|
||||||
|
|
||||||
|
// Handle cancel/confirm estimate approve.
|
||||||
|
const handleApproveEstimate = useCallback((estimate) => {
|
||||||
|
setApproveEstimate(estimate);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Handle cancel approve estimate alert.
|
||||||
|
const handleCancelApproveEstimate = useCallback(() => {
|
||||||
|
setApproveEstimate(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Handle confirm estimate approve.
|
||||||
|
const handleConfirmEstimateApprove = useCallback(() => {
|
||||||
|
requestApproveEstimate(approveEstimate.id)
|
||||||
|
.then(() => {
|
||||||
|
setApproveEstimate(false);
|
||||||
|
AppToaster.show({
|
||||||
|
message: formatMessage({
|
||||||
|
id: 'the_estimate_has_been_successfully_approved',
|
||||||
|
}),
|
||||||
|
intent: Intent.SUCCESS,
|
||||||
|
});
|
||||||
|
queryCache.invalidateQueries('estimates-table');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
// setApproveEstimate(false);
|
||||||
|
});
|
||||||
|
}, [approveEstimate, requestApproveEstimate, formatMessage]);
|
||||||
|
|
||||||
|
// Handle cancel/confirm estimate reject.
|
||||||
|
const handleRejectEstimate = useCallback((estimate) => {
|
||||||
|
setRejectEstimate(estimate);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Handle cancel reject estimate alert.
|
||||||
|
const handleCancelRejectEstimate = useCallback(() => {
|
||||||
|
setRejectEstimate(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Handle confirm estimate reject.
|
||||||
|
const handleConfirmEstimateReject = useCallback(() => {
|
||||||
|
requestRejectEstimate(rejectEstimate.id)
|
||||||
|
.then(() => {
|
||||||
|
setRejectEstimate(false);
|
||||||
|
AppToaster.show({
|
||||||
|
message: formatMessage({
|
||||||
|
id: 'the_estimate_has_been_successfully_rejected',
|
||||||
|
}),
|
||||||
|
intent: Intent.SUCCESS,
|
||||||
|
});
|
||||||
|
queryCache.invalidateQueries('estimates-table');
|
||||||
|
})
|
||||||
|
.catch((error) => {});
|
||||||
|
}, [rejectEstimate, requestRejectEstimate, formatMessage]);
|
||||||
|
|
||||||
// Handle filter change to re-fetch data-table.
|
// Handle filter change to re-fetch data-table.
|
||||||
const handleFilterChanged = useCallback(() => {}, [fetchEstimate]);
|
const handleFilterChanged = useCallback(() => {}, [fetchEstimate]);
|
||||||
|
|
||||||
@@ -127,6 +216,9 @@ function EstimateList({
|
|||||||
<EstimatesDataTable
|
<EstimatesDataTable
|
||||||
onDeleteEstimate={handleDeleteEstimate}
|
onDeleteEstimate={handleDeleteEstimate}
|
||||||
onEditEstimate={handleEditEstimate}
|
onEditEstimate={handleEditEstimate}
|
||||||
|
onDeliverEstimate={handleDeliverEstimate}
|
||||||
|
onApproveEstimate={handleApproveEstimate}
|
||||||
|
onRejectEstimate={handleRejectEstimate}
|
||||||
onSelectedRowsChange={handleSelectedRowsChange}
|
onSelectedRowsChange={handleSelectedRowsChange}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
@@ -145,6 +237,42 @@ function EstimateList({
|
|||||||
<T id={'once_delete_this_estimate_you_will_able_to_restore_it'} />
|
<T id={'once_delete_this_estimate_you_will_able_to_restore_it'} />
|
||||||
</p>
|
</p>
|
||||||
</Alert>
|
</Alert>
|
||||||
|
<Alert
|
||||||
|
cancelButtonText={<T id={'cancel'} />}
|
||||||
|
confirmButtonText={<T id={'deliver'} />}
|
||||||
|
intent={Intent.WARNING}
|
||||||
|
isOpen={deliverEstimate}
|
||||||
|
onCancel={handleCancelDeliverEstimate}
|
||||||
|
onConfirm={handleConfirmEstimateDeliver}
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
<T id={'are_sure_to_deliver_this_estimate'} />
|
||||||
|
</p>
|
||||||
|
</Alert>
|
||||||
|
<Alert
|
||||||
|
cancelButtonText={<T id={'cancel'} />}
|
||||||
|
confirmButtonText={<T id={'approve'} />}
|
||||||
|
intent={Intent.WARNING}
|
||||||
|
isOpen={approveEstimate}
|
||||||
|
onCancel={handleCancelApproveEstimate}
|
||||||
|
onConfirm={handleConfirmEstimateApprove}
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
<T id={'are_sure_to_approve_this_estimate'} />
|
||||||
|
</p>
|
||||||
|
</Alert>
|
||||||
|
<Alert
|
||||||
|
cancelButtonText={<T id={'cancel'} />}
|
||||||
|
confirmButtonText={<T id={'reject'} />}
|
||||||
|
intent={Intent.WARNING}
|
||||||
|
isOpen={rejectEstimate}
|
||||||
|
onCancel={handleCancelRejectEstimate}
|
||||||
|
onConfirm={handleConfirmEstimateReject}
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
<T id={'are_sure_to_approve_this_estimate'} />
|
||||||
|
</p>
|
||||||
|
</Alert>
|
||||||
</DashboardPageContent>
|
</DashboardPageContent>
|
||||||
</DashboardInsider>
|
</DashboardInsider>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
MenuItem,
|
MenuItem,
|
||||||
MenuDivider,
|
MenuDivider,
|
||||||
Position,
|
Position,
|
||||||
|
Tag,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||||
@@ -17,9 +18,9 @@ import { compose, saveInvoke } from 'utils';
|
|||||||
import { useIsValuePassed } from 'hooks';
|
import { useIsValuePassed } from 'hooks';
|
||||||
|
|
||||||
import LoadingIndicator from 'components/LoadingIndicator';
|
import LoadingIndicator from 'components/LoadingIndicator';
|
||||||
import { DataTable, Money, Choose, Icon } from 'components';
|
import { DataTable, Money, Choose, Icon, If } from 'components';
|
||||||
import EstimatesEmptyStatus from './EstimatesEmptyStatus';
|
import EstimatesEmptyStatus from './EstimatesEmptyStatus';
|
||||||
|
import { statusAccessor } from './components';
|
||||||
import withEstimates from './withEstimates';
|
import withEstimates from './withEstimates';
|
||||||
import withEstimateActions from './withEstimateActions';
|
import withEstimateActions from './withEstimateActions';
|
||||||
|
|
||||||
@@ -38,6 +39,9 @@ function EstimatesDataTable({
|
|||||||
// #ownProps
|
// #ownProps
|
||||||
onEditEstimate,
|
onEditEstimate,
|
||||||
onDeleteEstimate,
|
onDeleteEstimate,
|
||||||
|
onDeliverEstimate,
|
||||||
|
onApproveEstimate,
|
||||||
|
onRejectEstimate,
|
||||||
onSelectedRowsChange,
|
onSelectedRowsChange,
|
||||||
}) {
|
}) {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
@@ -70,6 +74,40 @@ function EstimatesDataTable({
|
|||||||
text={formatMessage({ id: 'edit_estimate' })}
|
text={formatMessage({ id: 'edit_estimate' })}
|
||||||
onClick={handleEditEstimate(estimate)}
|
onClick={handleEditEstimate(estimate)}
|
||||||
/>
|
/>
|
||||||
|
<If condition={!estimate.is_delivered}>
|
||||||
|
<MenuItem
|
||||||
|
text={formatMessage({ id: 'mark_as_delivered' })}
|
||||||
|
onClick={() => onDeliverEstimate(estimate)}
|
||||||
|
/>
|
||||||
|
</If>
|
||||||
|
<Choose>
|
||||||
|
<Choose.When
|
||||||
|
condition={estimate.is_delivered && estimate.is_approved}
|
||||||
|
>
|
||||||
|
<MenuItem
|
||||||
|
text={formatMessage({ id: 'mark_as_rejected' })}
|
||||||
|
onClick={() => onRejectEstimate(estimate)}
|
||||||
|
/>
|
||||||
|
</Choose.When>
|
||||||
|
<Choose.When
|
||||||
|
condition={estimate.is_delivered && estimate.is_rejected}
|
||||||
|
>
|
||||||
|
<MenuItem
|
||||||
|
text={formatMessage({ id: 'mark_as_approved' })}
|
||||||
|
onClick={() => onApproveEstimate(estimate)}
|
||||||
|
/>
|
||||||
|
</Choose.When>
|
||||||
|
<Choose.When condition={estimate.is_delivered}>
|
||||||
|
<MenuItem
|
||||||
|
text={formatMessage({ id: 'mark_as_approved' })}
|
||||||
|
onClick={() => onApproveEstimate(estimate)}
|
||||||
|
/>
|
||||||
|
<MenuItem
|
||||||
|
text={formatMessage({ id: 'mark_as_rejected' })}
|
||||||
|
onClick={() => onRejectEstimate(estimate)}
|
||||||
|
/>
|
||||||
|
</Choose.When>
|
||||||
|
</Choose>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={formatMessage({ id: 'delete_estimate' })}
|
text={formatMessage({ id: 'delete_estimate' })}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
@@ -114,7 +152,8 @@ function EstimatesDataTable({
|
|||||||
{
|
{
|
||||||
id: 'estimate_number',
|
id: 'estimate_number',
|
||||||
Header: formatMessage({ id: 'estimate_number' }),
|
Header: formatMessage({ id: 'estimate_number' }),
|
||||||
accessor: (row) => (row.estimate_number ? `#${row.estimate_number}` : null),
|
accessor: (row) =>
|
||||||
|
row.estimate_number ? `#${row.estimate_number}` : null,
|
||||||
width: 140,
|
width: 140,
|
||||||
className: 'estimate_number',
|
className: 'estimate_number',
|
||||||
},
|
},
|
||||||
@@ -126,6 +165,15 @@ function EstimatesDataTable({
|
|||||||
width: 140,
|
width: 140,
|
||||||
className: 'amount',
|
className: 'amount',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 'status',
|
||||||
|
Header: formatMessage({ id: 'status' }),
|
||||||
|
accessor: (row) => statusAccessor(row),
|
||||||
|
width: 140,
|
||||||
|
className: 'status',
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
id: 'reference',
|
id: 'reference',
|
||||||
Header: formatMessage({ id: 'reference_no' }),
|
Header: formatMessage({ id: 'reference_no' }),
|
||||||
@@ -133,6 +181,7 @@ function EstimatesDataTable({
|
|||||||
width: 140,
|
width: 140,
|
||||||
className: 'reference',
|
className: 'reference',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
id: 'actions',
|
id: 'actions',
|
||||||
Header: '',
|
Header: '',
|
||||||
@@ -183,7 +232,7 @@ function EstimatesDataTable({
|
|||||||
const showEmptyStatus = [
|
const showEmptyStatus = [
|
||||||
estimatesCurrentPage.length === 0,
|
estimatesCurrentPage.length === 0,
|
||||||
estimatesCurrentViewId === -1,
|
estimatesCurrentViewId === -1,
|
||||||
].every(d => d === true);
|
].every((d) => d === true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(CLASSES.DASHBOARD_DATATABLE)}>
|
<div className={classNames(CLASSES.DASHBOARD_DATATABLE)}>
|
||||||
|
|||||||
31
client/src/containers/Sales/Estimate/components.js
Normal file
31
client/src/containers/Sales/Estimate/components.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Intent, Tag } from '@blueprintjs/core';
|
||||||
|
import { Choose, If } from 'components';
|
||||||
|
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
export const statusAccessor = (row) => (
|
||||||
|
<Choose>
|
||||||
|
<Choose.When condition={row.is_delivered && row.is_approved}>
|
||||||
|
<Tag minimal={true} intent={Intent.SUCCESS}>
|
||||||
|
<T id={'approved'} />
|
||||||
|
</Tag>
|
||||||
|
</Choose.When>
|
||||||
|
<Choose.When condition={row.is_delivered && row.is_rejected}>
|
||||||
|
<Tag minimal={true} intent={Intent.DANGER}>
|
||||||
|
<T id={'rejected'} />
|
||||||
|
</Tag>
|
||||||
|
</Choose.When>
|
||||||
|
<Choose.When
|
||||||
|
condition={row.is_delivered && !row.is_rejected && !row.is_approved}
|
||||||
|
>
|
||||||
|
<Tag minimal={true} intent={Intent.SUCCESS}>
|
||||||
|
<T id={'delivered'} />
|
||||||
|
</Tag>
|
||||||
|
</Choose.When>
|
||||||
|
<Choose.Otherwise>
|
||||||
|
<Tag minimal={true}>
|
||||||
|
<T id={'draft'} />
|
||||||
|
</Tag>
|
||||||
|
</Choose.Otherwise>
|
||||||
|
</Choose>
|
||||||
|
);
|
||||||
@@ -5,6 +5,9 @@ import {
|
|||||||
deleteEstimate,
|
deleteEstimate,
|
||||||
fetchEstimate,
|
fetchEstimate,
|
||||||
fetchEstimatesTable,
|
fetchEstimatesTable,
|
||||||
|
deliverEstimate,
|
||||||
|
approveEstimate,
|
||||||
|
rejectEstimate
|
||||||
} from 'store/Estimate/estimates.actions';
|
} from 'store/Estimate/estimates.actions';
|
||||||
import t from 'store/types';
|
import t from 'store/types';
|
||||||
|
|
||||||
@@ -15,6 +18,9 @@ const mapDipatchToProps = (dispatch) => ({
|
|||||||
requestFetchEstimatesTable: (query = {}) =>
|
requestFetchEstimatesTable: (query = {}) =>
|
||||||
dispatch(fetchEstimatesTable({ query: { ...query } })),
|
dispatch(fetchEstimatesTable({ query: { ...query } })),
|
||||||
requestDeleteEstimate: (id) => dispatch(deleteEstimate({ id })),
|
requestDeleteEstimate: (id) => dispatch(deleteEstimate({ id })),
|
||||||
|
requestDeliverdEstimate: (id) => dispatch(deliverEstimate({ id })),
|
||||||
|
requestApproveEstimate: (id) => dispatch(approveEstimate({ id })),
|
||||||
|
requestRejectEstimate: (id) => dispatch(rejectEstimate({ id })),
|
||||||
|
|
||||||
changeEstimateView: (id) =>
|
changeEstimateView: (id) =>
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default function InvoiceFloatingActions({
|
|||||||
const handleSubmitDeliverBtnClick = (event) => {
|
const handleSubmitDeliverBtnClick = (event) => {
|
||||||
saveInvoke(onSubmitClick, event, {
|
saveInvoke(onSubmitClick, event, {
|
||||||
redirect: true,
|
redirect: true,
|
||||||
delivered: true,
|
deliver: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ export default function InvoiceFloatingActions({
|
|||||||
submitForm();
|
submitForm();
|
||||||
saveInvoke(onSubmitClick, event, {
|
saveInvoke(onSubmitClick, event, {
|
||||||
redirect: false,
|
redirect: false,
|
||||||
delivered: true,
|
deliver: true,
|
||||||
resetForm: true,
|
resetForm: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -49,14 +49,14 @@ export default function InvoiceFloatingActions({
|
|||||||
submitForm();
|
submitForm();
|
||||||
saveInvoke(onSubmitClick, event, {
|
saveInvoke(onSubmitClick, event, {
|
||||||
redirect: false,
|
redirect: false,
|
||||||
delivered: true,
|
deliver: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmitDraftBtnClick = (event) => {
|
const handleSubmitDraftBtnClick = (event) => {
|
||||||
saveInvoke(onSubmitClick, event, {
|
saveInvoke(onSubmitClick, event, {
|
||||||
redirect: true,
|
redirect: true,
|
||||||
delivered: false,
|
deliver: false,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ export default function InvoiceFloatingActions({
|
|||||||
submitForm();
|
submitForm();
|
||||||
saveInvoke(onSubmitClick, event, {
|
saveInvoke(onSubmitClick, event, {
|
||||||
redirect: false,
|
redirect: false,
|
||||||
delivered: false,
|
deliver: false,
|
||||||
resetForm: true,
|
resetForm: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -73,7 +73,7 @@ export default function InvoiceFloatingActions({
|
|||||||
submitForm();
|
submitForm();
|
||||||
saveInvoke(onSubmitClick, event, {
|
saveInvoke(onSubmitClick, event, {
|
||||||
redirect: false,
|
redirect: false,
|
||||||
delivered: false,
|
deliver: false,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -145,13 +145,6 @@ function InvoicesDataTable({
|
|||||||
width: 140,
|
width: 140,
|
||||||
className: 'balance',
|
className: 'balance',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: 'reference_no',
|
|
||||||
Header: formatMessage({ id: 'reference_no' }),
|
|
||||||
accessor: 'reference_no',
|
|
||||||
width: 140,
|
|
||||||
className: 'reference_no',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'status',
|
id: 'status',
|
||||||
Header: formatMessage({ id: 'status' }),
|
Header: formatMessage({ id: 'status' }),
|
||||||
@@ -159,6 +152,13 @@ function InvoicesDataTable({
|
|||||||
width: 140,
|
width: 140,
|
||||||
className: 'status',
|
className: 'status',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'reference_no',
|
||||||
|
Header: formatMessage({ id: 'reference_no' }),
|
||||||
|
accessor: 'reference_no',
|
||||||
|
width: 140,
|
||||||
|
className: 'reference_no',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'actions',
|
id: 'actions',
|
||||||
Header: '',
|
Header: '',
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ function ReceiptsDataTable({
|
|||||||
accessor: (row) => (
|
accessor: (row) => (
|
||||||
<Choose>
|
<Choose>
|
||||||
<Choose.When condition={row.is_closed}>
|
<Choose.When condition={row.is_closed}>
|
||||||
<Tag minimal={true}>
|
<Tag minimal={true} intent={Intent.SUCCESS}>
|
||||||
<T id={'closed'} />
|
<T id={'closed'} />
|
||||||
</Tag>
|
</Tag>
|
||||||
</Choose.When>
|
</Choose.When>
|
||||||
|
|||||||
@@ -902,4 +902,33 @@ export default {
|
|||||||
open: 'Open',
|
open: 'Open',
|
||||||
are_sure_to_open_this_bill: 'Are you sure you want to open this bill?',
|
are_sure_to_open_this_bill: 'Are you sure you want to open this bill?',
|
||||||
opened: 'Opened',
|
opened: 'Opened',
|
||||||
};
|
the_estimate_has_been_successfully_delivered:
|
||||||
|
'The estimate has been successfully delivered.',
|
||||||
|
the_estimate_has_been_successfully_approved:
|
||||||
|
'The estimate has been successfully approved.',
|
||||||
|
the_estimate_has_been_successfully_rejected:
|
||||||
|
'The estimate has been successfully rejected.',
|
||||||
|
are_sure_to_deliver_this_estimate:
|
||||||
|
'Are you sure you want to deliver this estimate?',
|
||||||
|
approve: 'Approve',
|
||||||
|
are_sure_to_approve_this_estimate:
|
||||||
|
'Are you sure you want to approve this estimate?',
|
||||||
|
reject: 'Reject',
|
||||||
|
are_sure_to_reject_this_estimate:
|
||||||
|
'Are you sure you want to reject this estimate?',
|
||||||
|
mark_as_approved: 'Mark as approved',
|
||||||
|
mark_as_rejected: 'Mark as rejected',
|
||||||
|
delivered: 'Delivered',
|
||||||
|
rejected: 'Rejected',
|
||||||
|
approved: 'Approved',
|
||||||
|
the_item_has_been_successfully_inactivated:
|
||||||
|
'The item has been successfully inactivated.',
|
||||||
|
the_item_has_been_successfully_activated:
|
||||||
|
'The item has been successfully activated.',
|
||||||
|
are_sure_to_inactive_this_item:
|
||||||
|
'Are you sure you want to inactive this item? You will be able to activate it later',
|
||||||
|
are_sure_to_activate_this_item:
|
||||||
|
'Are you sure you want to activate this item? You will be able to inactivate it later',
|
||||||
|
inactivate_item: 'Inactivate Item',
|
||||||
|
activate_item: 'Activate Item',
|
||||||
|
};
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export const fetchEstimate = ({ id }) => {
|
|||||||
|
|
||||||
export const fetchEstimatesTable = ({ query = {} }) => {
|
export const fetchEstimatesTable = ({ query = {} }) => {
|
||||||
return (dispatch, getState) =>
|
return (dispatch, getState) =>
|
||||||
new Promise((resolve, rejcet) => {
|
new Promise((resolve, reject) => {
|
||||||
const pageQuery = getState().salesEstimates.tableQuery;
|
const pageQuery = getState().salesEstimates.tableQuery;
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.ESTIMATES_TABLE_LOADING,
|
type: t.ESTIMATES_TABLE_LOADING,
|
||||||
@@ -117,7 +117,17 @@ export const fetchEstimatesTable = ({ query = {} }) => {
|
|||||||
resolve(response);
|
resolve(response);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rejcet(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const deliverEstimate = ({ id }) => {
|
||||||
|
return (dispatch) => ApiService.post(`sales/estimates/${id}/deliver`);
|
||||||
|
};
|
||||||
|
export const approveEstimate = ({ id }) => {
|
||||||
|
return (dispatch) => ApiService.post(`sales/estimates/${id}/approve`);
|
||||||
|
};
|
||||||
|
export const rejectEstimate = ({ id }) => {
|
||||||
|
return (dispatch) => ApiService.post(`sales/estimates/${id}/reject`);
|
||||||
|
};
|
||||||
|
|||||||
@@ -105,3 +105,11 @@ export const deleteBulkItems = ({ ids }) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const activateItem = ({ id }) => {
|
||||||
|
return (dispatch) => ApiService.post(`items/${id}/activate`);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const inactiveItem = ({ id }) => {
|
||||||
|
return (dispatch) => ApiService.post(`items/${id}/inactivate`);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
|
.page-form--item {
|
||||||
.page-form--item{
|
|
||||||
$self: '.page-form';
|
$self: '.page-form';
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
|
||||||
#{$self}__header{
|
#{$self}__header {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
#{$self}__primary-section{
|
#{$self}__primary-section {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
@@ -15,88 +14,87 @@
|
|||||||
max-width: 1000px;
|
max-width: 1000px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#{$self}__body{
|
#{$self}__body {
|
||||||
.bp3-form-group{
|
.bp3-form-group {
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
|
|
||||||
&.bp3-inline{
|
&.bp3-inline {
|
||||||
|
.bp3-label {
|
||||||
.bp3-label{
|
|
||||||
min-width: 140px;
|
min-width: 140px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.bp3-form-content{
|
.bp3-form-content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h3{
|
h3 {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-bottom: 1.4rem;
|
margin-bottom: 1.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bp3-control{
|
.bp3-control {
|
||||||
|
h3 {
|
||||||
h3{
|
|
||||||
display: inline;
|
display: inline;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group--sellable,
|
.form-group--sellable,
|
||||||
.form-group--purchasable{
|
.form-group--purchasable {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#{$self}__section{
|
#{$self}__section {
|
||||||
max-width: 850px;
|
max-width: 850px;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
|
||||||
.bp3-form-group{
|
.bp3-form-group {
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--selling-cost{
|
&--selling-cost {
|
||||||
border-bottom: 1px solid #eaeaea;
|
border-bottom: 1px solid #eaeaea;
|
||||||
margin-bottom: 1.25rem;
|
margin-bottom: 1.25rem;
|
||||||
padding-bottom: 0.25rem;
|
padding-bottom: 0.25rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#{$self}__floating-actions{
|
#{$self}__floating-actions {
|
||||||
margin-left: -40px;
|
margin-left: -40px;
|
||||||
margin-right: -40px;
|
margin-right: -40px;
|
||||||
|
|
||||||
.form-group--active{
|
.form-group--active {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
margin-left: 40px;
|
margin-left: 40px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.bp3-tooltip-indicator{
|
.bp3-tooltip-indicator {
|
||||||
border-bottom: 1px dashed #d0d0d0;
|
border-bottom: 1px dashed #d0d0d0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dashboard__insider--items-list {
|
||||||
|
.bigcapital-datatable {
|
||||||
.dashboard__insider--items-list{
|
.table {
|
||||||
|
.tbody {
|
||||||
|
.item_type.td {
|
||||||
.bigcapital-datatable{
|
.bp3-tag {
|
||||||
|
|
||||||
.table{
|
|
||||||
.tbody{
|
|
||||||
.item_type.td{
|
|
||||||
|
|
||||||
.bp3-tag{
|
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.tr.inactive .td {
|
||||||
|
color: #646b82;
|
||||||
|
|
||||||
|
&.normal .#{$ns}-icon {
|
||||||
|
color: #9eaab6;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user