@@ -251,7 +264,10 @@ function ItemForm({
)}
diff --git a/client/src/containers/Items/ItemFormBody.js b/client/src/containers/Items/ItemFormBody.js
index 27f23726c..71699c721 100644
--- a/client/src/containers/Items/ItemFormBody.js
+++ b/client/src/containers/Items/ItemFormBody.js
@@ -37,7 +37,7 @@ function ItemFormBody({ accountsList }) {
}
- defaultChecked={value}
+ checked={value}
{...field}
/>
@@ -59,7 +59,7 @@ function ItemFormBody({ accountsList }) {
prefix={'$'}
inputGroupProps={{
medium: true,
- // intent: error && touched/ && Intent.DANGER,
+ ...field,
}}
disabled={!form.values.sellable}
onChange={field.onChange}
@@ -132,9 +132,9 @@ function ItemFormBody({ accountsList }) {
prefix={'$'}
inputGroupProps={{
medium: true,
+ ...field,
}}
disabled={!form.values.purchasable}
- {...field}
/>
)}
diff --git a/client/src/containers/Items/ItemFormFloatingActions.js b/client/src/containers/Items/ItemFormFloatingActions.js
index ab32bfa99..6f4ab6e95 100644
--- a/client/src/containers/Items/ItemFormFloatingActions.js
+++ b/client/src/containers/Items/ItemFormFloatingActions.js
@@ -3,23 +3,49 @@ import { Button, Intent, FormGroup, Checkbox } from '@blueprintjs/core';
import { FormattedMessage as T } from 'react-intl';
import { saveInvoke } from 'utils';
import classNames from 'classnames';
-import { ErrorMessage, FastField } from 'formik';
+import { FastField } from 'formik';
import { CLASSES } from 'common/classes';
/**
* Item form floating actions.
*/
-export default function ItemFormFloatingActions({ isSubmitting, itemId, onCancelClick }) {
+export default function ItemFormFloatingActions({
+ isSubmitting,
+ itemId,
+ handleSubmit,
+ onCancelClick,
+ onSubmitClick,
+ onSubmitAndNewClick,
+}) {
const handleCancelBtnClick = (event) => {
saveInvoke(onCancelClick, event.currentTarget.value);
};
+
+ const handleSubmitBtnClick = (event) => {
+ saveInvoke(onSubmitClick, event);
+ };
+
+ const handleSubmitAndNewBtnClick = (event) => {
+ saveInvoke(onSubmitAndNewClick, event);
+ };
+
return (
-
);
-}
\ 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',
};