Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution attempt #1688

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/OrderLinesList/Details/OrderLineDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ const OrderLineDetails = ({
[lineId, order],
);

const goToReceive = useCallback(
() => {
history.push({
pathname: '/receiving',
search: `qindex=poLine.poLineNumber&query=${line.poLineNumber}`,
});
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[lineId, line],
);

const deleteLine = useCallback(
() => {
const lineNumber = line.poLineNumber;
Expand Down Expand Up @@ -206,6 +217,7 @@ const OrderLineDetails = ({
materialTypes={materialTypes}
funds={funds}
goToOrderDetails={goToOrderDetails}
goToReceive={goToReceive}
deleteLine={deleteLine}
cancelLine={cancelLine}
tagsToggle={toggleTagsPane}
Expand Down
12 changes: 12 additions & 0 deletions src/components/POLine/POLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ function POLine({
[orderId],
);

const goToReceive = useCallback(
() => {
history.push({
pathname: '/receiving',
search: `qindex=poLine.poLineNumber&query=${line.poLineNumber}`,
});
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[lineId, line],
);

const deleteLine = useCallback(
() => {
const lineNumber = line?.poLineNumber;
Expand Down Expand Up @@ -211,6 +222,7 @@ function POLine({
locations={locations}
poURL={poURL}
funds={funds}
goToReceive={goToReceive}
deleteLine={deleteLine}
cancelLine={cancelLine}
tagsToggle={toggleTagsPane}
Expand Down
9 changes: 8 additions & 1 deletion src/components/POLine/POLineActionMenu/POLineActionMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const POLineActionMenu = ({
onDeleteLine,
onEditLine,
onNavigateToOrder,
onReceive,
onPrintLine,
onPrintOrder,
onReexport,
Expand Down Expand Up @@ -56,6 +57,11 @@ export const POLineActionMenu = ({
onNavigateToOrder();
}, [onNavigateToOrder, onToggle]);

const onClickReceive = useCallback(() => {
onToggle();
onReceive();
}, [onReceive, onToggle]);

const onClickReexport = useCallback(() => {
onToggle();
onReexport();
Expand Down Expand Up @@ -137,7 +143,7 @@ export const POLineActionMenu = ({
data-testid="line-details-receive-action"
buttonStyle="dropdownItem"
data-test-line-receive-button
to={`/receiving?qindex=poLine.poLineNumber&query=${line.poLineNumber}`}
onClick={onClickReceive}
>
<Icon size="small" icon="receive">
<FormattedMessage id="ui-orders.paneBlock.receiveBtn" />
Expand Down Expand Up @@ -232,6 +238,7 @@ POLineActionMenu.propTypes = {
onDeleteLine: PropTypes.func.isRequired,
onEditLine: PropTypes.func.isRequired,
onNavigateToOrder: PropTypes.func,
onReceive: PropTypes.func,
onPrintLine: PropTypes.func.isRequired,
onPrintOrder: PropTypes.func.isRequired,
onReexport: PropTypes.func.isRequired,
Expand Down
4 changes: 4 additions & 0 deletions src/components/POLine/POLineView.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const POLineView = ({
deleteLine,
editable,
goToOrderDetails,
goToReceive,
history,
line,
location,
Expand Down Expand Up @@ -265,6 +266,7 @@ const POLineView = ({
onDeleteLine={toggleConfirmDelete}
onEditLine={onEditPOLine}
onNavigateToOrder={goToOrderDetails}
onReceive={goToReceive}
onPrintLine={togglePrintLineModal}
onPrintOrder={togglePrintOrderModal}
onReexport={toggleOrderLineReexportModal}
Expand All @@ -274,6 +276,7 @@ const POLineView = ({
}, [
editable,
goToOrderDetails,
goToReceive,
hiddenFields,
isCancelable,
isRestrictionsLoading,
Expand Down Expand Up @@ -646,6 +649,7 @@ POLineView.propTypes = {
onClose: PropTypes.func,
editable: PropTypes.bool,
goToOrderDetails: PropTypes.func,
goToReceive: PropTypes.func,
deleteLine: PropTypes.func,
cancelLine: PropTypes.func,
tagsToggle: PropTypes.func.isRequired,
Expand Down
5 changes: 4 additions & 1 deletion src/components/PurchaseOrder/getPOActionMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ export function getPOActionMenu({
buttonStyle="dropdownItem"
data-test-receiving-button
data-testid="order-receiving-button"
onClick={clickReceive}
onClick={() => {
onToggle();
clickReceive();
}}
>
<Icon size="small" icon="receive">
<FormattedMessage id="ui-orders.paneBlock.receiveBtn" />
Expand Down
Loading