diff --git a/client/src/containers/Customers/CustomerFloatingActions.js b/client/src/containers/Customers/CustomerFloatingActions.js index 8af9af147..e390794d0 100644 --- a/client/src/containers/Customers/CustomerFloatingActions.js +++ b/client/src/containers/Customers/CustomerFloatingActions.js @@ -3,13 +3,14 @@ import { Intent, Button } from '@blueprintjs/core'; import { FormattedMessage as T } from 'react-intl'; import classNames from 'classnames'; import { CLASSES } from 'common/classes'; +import { saveInvoke } from 'utils'; export default function CustomerFloatingActions({ - isSubmitting, - resetForm, onSubmitClick, + onSubmitAndNewClick, onCancelClick, + isSubmitting, customerId, }) { return ( @@ -18,8 +19,8 @@ export default function CustomerFloatingActions({ disabled={isSubmitting} intent={Intent.PRIMARY} type="submit" - onClick={() => { - onSubmitClick({ publish: true, redirect: true }); + onClick={(event) => { + saveInvoke(onSubmitClick, event); }} > {customerId ? : } @@ -30,8 +31,9 @@ export default function CustomerFloatingActions({ intent={Intent.PRIMARY} className={'ml1'} name={'save_and_new'} - onClick={() => { - onSubmitClick({ publish: true, redirect: false }); + type="submit" + onClick={(event) => { + saveInvoke(onSubmitAndNewClick, event); }} > @@ -39,8 +41,8 @@ export default function CustomerFloatingActions({ - @@ -42,4 +68,4 @@ export default function ItemFormFloatingActions({ isSubmitting, itemId, onCancel ); -} \ No newline at end of file +} diff --git a/client/src/containers/Items/ItemFormPrimarySection.js b/client/src/containers/Items/ItemFormPrimarySection.js index 9411779f5..d34a4d5f2 100644 --- a/client/src/containers/Items/ItemFormPrimarySection.js +++ b/client/src/containers/Items/ItemFormPrimarySection.js @@ -9,6 +9,7 @@ import { } from '@blueprintjs/core'; import { FormattedMessage as T } from 'react-intl'; import { ErrorMessage, FastField } from 'formik'; +import { useIntl } from 'react-intl'; import { CategoriesSelectList, Hint, @@ -21,6 +22,7 @@ import { CLASSES } from 'common/classes'; import withItemCategories from 'containers/Items/withItemCategories'; import withAccounts from 'containers/Accounts/withAccounts'; +import withDashboardActions from 'containers/Dashboard/withDashboardActions'; import { compose, handleStringChange, inputIntent } from 'utils'; @@ -30,7 +32,12 @@ import { compose, handleStringChange, inputIntent } from 'utils'; function ItemFormPrimarySection({ // #withItemCategories categoriesList, + + // #withDashboardActions + changePageSubtitle }) { + const { formatMessage } = useIntl(); + const itemTypeHintContent = ( <>
@@ -78,6 +85,7 @@ function ItemFormPrimarySection({ inline={true} onChange={handleStringChange((_value) => { form.setFieldValue('type', _value); + changePageSubtitle(formatMessage({ id: _value })); })} selectedValue={value} > @@ -171,4 +179,5 @@ export default compose( withItemCategories(({ categoriesList }) => ({ categoriesList, })), + withDashboardActions )(ItemFormPrimarySection); diff --git a/client/src/lang/en/index.js b/client/src/lang/en/index.js index 3b4bffaf8..ac1620d2e 100644 --- a/client/src/lang/en/index.js +++ b/client/src/lang/en/index.js @@ -219,7 +219,7 @@ export default { 'The item category has been successfully edited.', the_item_category_has_been_successfully_deleted: 'The item category has been successfully deleted', - once_delete_these_item_categories_you_will_not_able_restore_them: + once_delete_these_item_categories_you_will_not_able_restore_them: "Once you delete these categories, you won't be able to retrieve them later. Are you sure you want to delete them?", once_delete_these_views_you_will_not_able_restore_them: "Once you delete the custom view, you won't be able to restore it later. Are you sure you want to delete this view?", @@ -809,11 +809,12 @@ export default { notes: 'Notes', i_purchase_this_item: 'I purchase this item from a vendor.', i_sell_this_item: 'I sell this item to a customer.', - select_display_name_as:'Select display name as', + select_display_name_as: 'Select display name as', opening_date: 'Opening date', item_code: 'Item code', quantity_on_hand: 'Quantity on hand', average_rate: 'Average rate', the_name_used_before: 'The name is already used.', - the_item_has_associated_transactions: 'The item has associated transactions.' + the_item_has_associated_transactions: 'The item has associated transactions.', + customer_has_sales_invoices: 'Customer has sales invoices', };