Skip to content

Commit

Permalink
frontend: Change condition of sale delete button to be always visible
Browse files Browse the repository at this point in the history
  • Loading branch information
indigane committed May 7, 2024
1 parent 4b94494 commit f046ba1
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {useFieldArray, useForm, useFormContext} from "react-hook-form";
import {DeleteButton, GenericActionModal, Heading, NavigateBackButton, SaveButton} from "../../common/components";
import {FormProviderForm, RelatedModelInput, SaveFormButton} from "../../common/components/forms";
import {getConditionOfSaleGracePeriodLabel} from "../../common/localisation";
import {IApartmentConditionOfSale, IApartmentDetails, IOwner, IOwnership} from "../../common/schemas";
import {IApartmentConditionOfSale, IOwner, IOwnership} from "../../common/schemas";
import {
useCreateConditionOfSaleMutation,
useDeleteConditionOfSaleMutation,
Expand Down Expand Up @@ -325,7 +325,7 @@ const DeleteConditionOfSaleButton = ({conditionOfSale}: {conditionOfSale: IApart
);
};

const getConditionsOfSaleTableColumns = (apartment: IApartmentDetails) => {
const getConditionsOfSaleTableColumns = () => {
return [
{
key: "stair",
Expand Down Expand Up @@ -392,12 +392,7 @@ const getConditionsOfSaleTableColumns = (apartment: IApartmentDetails) => {
{
key: "delete",
headerName: "",
transform: (obj) =>
!apartment.ownerships.find((ownership) => ownership.owner.id === obj.owner.id) && !obj.fulfilled ? (
<DeleteConditionOfSaleButton conditionOfSale={obj} />
) : (
""
),
transform: (obj) => <DeleteConditionOfSaleButton conditionOfSale={obj} />,
},
];
};
Expand All @@ -413,7 +408,7 @@ const LoadedConditionsOfSalePage = () => {
{apartment.conditions_of_sale.length ? (
<Table
id="conditions-of-sale-table"
cols={getConditionsOfSaleTableColumns(apartment)}
cols={getConditionsOfSaleTableColumns()}
rows={apartment.conditions_of_sale}
indexKey="id"
variant="light"
Expand Down

0 comments on commit f046ba1

Please sign in to comment.