Skip to content

Commit

Permalink
psp-9080 add missing LEASE_STAKEHOLDER_TYPE codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
devinleighsmith committed Aug 27, 2024
1 parent 5446afe commit e2ea042
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
IF EXISTS (
SELECT
1
FROM
PIMS_LEASE_STAKEHOLDER_TYPE
WHERE
LEASE_STAKEHOLDER_TYPE_CODE = 'OWNER'
) BEGIN
UPDATE
PIMS_LEASE_STAKEHOLDER_TYPE
SET
IS_DISABLED = 1,
CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE
LEASE_STAKEHOLDER_TYPE_CODE = 'OWNER';

END;

IF EXISTS (
SELECT
1
FROM
PIMS_LEASE_STAKEHOLDER_TYPE
WHERE
LEASE_STAKEHOLDER_TYPE_CODE = 'OWNREP'
) BEGIN
UPDATE
PIMS_LEASE_STAKEHOLDER_TYPE
SET
IS_DISABLED = 1,
CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE
LEASE_STAKEHOLDER_TYPE_CODE = 'OWNREP';

END;

GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
IF NOT EXISTS (
SELECT
1
FROM
PIMS_LEASE_STAKEHOLDER_TYPE
WHERE
LEASE_STAKEHOLDER_TYPE_CODE = 'OWNER'
)
INSERT INTO
PIMS_LEASE_STAKEHOLDER_TYPE (
LEASE_STAKEHOLDER_TYPE_CODE,
DESCRIPTION,
IS_PAYABLE_RELATED
)
VALUES
('OWNER', N'Owner', 1);

ELSE
UPDATE
PIMS_LEASE_STAKEHOLDER_TYPE
SET
IS_DISABLED = 0,
CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE
LEASE_STAKEHOLDER_TYPE_CODE = 'OWNER';

IF NOT EXISTS (
SELECT
1
FROM
PIMS_LEASE_STAKEHOLDER_TYPE
WHERE
LEASE_STAKEHOLDER_TYPE_CODE = 'OWNREP'
)
INSERT INTO
PIMS_LEASE_STAKEHOLDER_TYPE (
LEASE_STAKEHOLDER_TYPE_CODE,
DESCRIPTION,
IS_PAYABLE_RELATED
)
VALUES
('OWNREP', N'Owner Representative', 1);

ELSE
UPDATE
PIMS_LEASE_STAKEHOLDER_TYPE
SET
IS_DISABLED = 0,
CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE
LEASE_STAKEHOLDER_TYPE_CODE = 'OWNREP';

GO
8 changes: 5 additions & 3 deletions source/frontend/src/components/common/form/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ export const Select: React.FC<React.PropsWithChildren<SelectProps>> = ({
};

const renderPlaceholder = () => {
if (!placeholder) {
const calculatedPlaceholder =
placeholder ?? options.find(option => option.value === value) ? null : 'N/A'; // Render N/A in the event that the currently selected value is not in the list.
if (!calculatedPlaceholder) {
return null;
}
return <option value="">{`${placeholder}`}</option>;
return <option value="">{`${calculatedPlaceholder}`}</option>;
};

const renderOptions = () => {
Expand Down Expand Up @@ -153,7 +155,7 @@ export const Select: React.FC<React.PropsWithChildren<SelectProps>> = ({
custom={custom}
isInvalid={!!touch && !!error}
{...rest}
value={getIn(values, field) ?? ''}
value={value ?? ''}
multiple={multiple}
onChange={onSelectChange}
onBlur={(e: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export const AddLeaseStakeholderForm: React.FunctionComponent<
setSelectedStakeholders(remainingContacts);
setSelectedContacts(remainingContacts);
};
console.log(stakeholderTypesOptions, initialValues, selectedStakeholders, isPayableLease);
return (
<StyledSummarySection>
<Section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export interface ITenantProps {
export const ViewStakeholderForm: React.FunctionComponent<
React.PropsWithChildren<ITenantProps>
> = ({ nameSpace, stakeholders, loading, leaseStakeholderTypes, isPayableLease }) => {
console.log(leaseStakeholderTypes, isPayableLease);
return (
<FormSectionOne>
<Formik
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const getColumns = (
isPayableLease: boolean,
): ColumnWithProps<FormStakeholder>[] => {
const stakeholderType = isPayableLease ? 'Payee type' : 'Contact type';
console.log(stakeholderTypes);
return [
{
Header: (
Expand Down

0 comments on commit e2ea042

Please sign in to comment.