-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce OpenOrder logic and related components
- Implemented a new function `getReservableOnAnotherLibrary` to verify if a material is categorized as "overbygningsmateriale". This function returns both a boolean and a list of PIDs. - Utilized `getReservableOnAnotherLibrary` function to determine the visibility of the `MaterialButtonReservableOnAnotherLibrary` button. - Introduced a new component, `OpenOrderResponse`, as the `ReservationSuccess` does not have the same response structure. - Added `translateOpenOrderStatus` to interpret and display the response status.
- Loading branch information
1 parent
966cefd
commit 7c23601
Showing
7 changed files
with
376 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import FocusTrap from "focus-trap-react"; | ||
import React from "react"; | ||
import { useDispatch } from "react-redux"; | ||
import { closeModal } from "../../core/modal.slice"; | ||
import { useText } from "../../core/utils/text"; | ||
import { Button } from "../Buttons/Button"; | ||
import { OpenOrderMutation } from "../../core/dbc-gateway/generated/graphql"; | ||
import { translateOpenOrderStatus } from "./helper"; | ||
|
||
type OpenOrderResponseProps = { | ||
title: string; | ||
modalId: string; | ||
openOrderResponse: OpenOrderMutation; | ||
}; | ||
|
||
const OpenOrderResponse: React.FC<OpenOrderResponseProps> = ({ | ||
modalId, | ||
title, | ||
openOrderResponse | ||
}) => { | ||
const dispatch = useDispatch(); | ||
const t = useText(); | ||
|
||
return ( | ||
<FocusTrap | ||
focusTrapOptions={{ | ||
allowOutsideClick: true | ||
}} | ||
> | ||
<section className="reservation-modal reservation-modal--confirm"> | ||
<h2 | ||
data-cy="reservation-success-title-text" | ||
className="text-header-h3 pb-48" | ||
> | ||
{t("openOrderResponseTitleText")} | ||
</h2> | ||
|
||
<p className="text-body-medium-regular pb-24"> | ||
{title} {t("openOrderResponseIsReservedForYouText")} | ||
</p> | ||
|
||
{openOrderResponse.submitOrder?.status && ( | ||
<p className="text-body-medium-regular pb-24"> | ||
{translateOpenOrderStatus(openOrderResponse.submitOrder?.status, t)} | ||
</p> | ||
)} | ||
|
||
<Button | ||
dataCy="reservation-success-close-button" | ||
classNames="reservation-modal__confirm-button" | ||
label={t("okButtonText")} | ||
buttonType="none" | ||
disabled={false} | ||
collapsible={false} | ||
size="small" | ||
variant="filled" | ||
onClick={() => { | ||
dispatch(closeModal({ modalId })); | ||
}} | ||
/> | ||
</section> | ||
</FocusTrap> | ||
); | ||
}; | ||
|
||
export default OpenOrderResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.