diff --git a/backend/src/provision/dto/create-provision.dto.ts b/backend/src/provision/dto/create-provision.dto.ts index 1b9e0ae8..dcf795a9 100644 --- a/backend/src/provision/dto/create-provision.dto.ts +++ b/backend/src/provision/dto/create-provision.dto.ts @@ -7,7 +7,6 @@ export class CreateProvisionDto extends PickType(ProvisionDto, [ 'provision_name', 'free_text', 'list_items', - 'list_enabled', 'help_text', 'category', 'sequence_value', diff --git a/backend/src/provision/dto/provision.dto.ts b/backend/src/provision/dto/provision.dto.ts index fcac0ce7..51d99ab8 100644 --- a/backend/src/provision/dto/provision.dto.ts +++ b/backend/src/provision/dto/provision.dto.ts @@ -4,7 +4,6 @@ export class ProvisionDto { provision_name?: string; free_text?: string; list_items?: string[]; - list_enabled?: boolean; help_text?: string; category?: string; sequence_value?: number; diff --git a/backend/src/provision/dto/update-provision.dto.ts b/backend/src/provision/dto/update-provision.dto.ts index b412bbb2..9eb992d8 100644 --- a/backend/src/provision/dto/update-provision.dto.ts +++ b/backend/src/provision/dto/update-provision.dto.ts @@ -7,7 +7,6 @@ export class UpdateProvisionDto extends PickType(ProvisionDto, [ 'provision_name', 'free_text', 'list_items', - 'list_enabled', 'help_text', 'category', 'sequence_value', diff --git a/backend/src/provision/entities/provision.entity.ts b/backend/src/provision/entities/provision.entity.ts index 1849e942..a6d3e33d 100644 --- a/backend/src/provision/entities/provision.entity.ts +++ b/backend/src/provision/entities/provision.entity.ts @@ -17,9 +17,6 @@ export class Provision { @Column({ type: 'text', array: true, default: '{}' }) list_items: string[]; - @Column({ nullable: true }) - list_enabled: boolean; - @Column({ nullable: true }) help_text: string; @@ -66,7 +63,6 @@ export class Provision { provision_name?: string, free_text?: string, list_items?: string[], - list_enabled?: boolean, category?: string, active_flag?: boolean, create_userid?: string, @@ -75,7 +71,6 @@ export class Provision { this.provision_name = provision_name || ''; this.free_text = free_text || ''; this.list_items = list_items || []; - this.list_enabled = list_enabled || false; this.category = category || ''; this.active_flag = active_flag || true; this.create_userid = create_userid || ''; diff --git a/backend/src/provision/provision.controller.ts b/backend/src/provision/provision.controller.ts index 33dc8bd1..c50862d8 100644 --- a/backend/src/provision/provision.controller.ts +++ b/backend/src/provision/provision.controller.ts @@ -61,7 +61,6 @@ export class ProvisionController { provision: string; free_text: string; list_items: string[]; - list_enabled: boolean; help_text: string; category: string; }, diff --git a/backend/src/provision/provision.service.ts b/backend/src/provision/provision.service.ts index 9a0af85f..6ebd90ef 100644 --- a/backend/src/provision/provision.service.ts +++ b/backend/src/provision/provision.service.ts @@ -49,7 +49,6 @@ export class ProvisionService { existingProvision.provision_name = provision.provision_name; existingProvision.free_text = provision.free_text; existingProvision.list_items = provision.list_items; - existingProvision.list_enabled = provision.list_enabled; existingProvision.help_text = provision.help_text; existingProvision.category = provision.category; existingProvision.update_userid = provision.update_userid; @@ -275,7 +274,6 @@ export class ProvisionService { provision_name: docTypeProvision.provision.provision_name, free_text: docTypeProvision.provision.free_text, list_items: docTypeProvision.provision.list_items, - list_enabled: docTypeProvision.provision.list_enabled, help_text: docTypeProvision.provision.help_text, category: docTypeProvision.provision.category, active_flag: docTypeProvision.provision.active_flag, diff --git a/backend/src/report/report.service.ts b/backend/src/report/report.service.ts index ca933f15..fc7a8ce6 100644 --- a/backend/src/report/report.service.ts +++ b/backend/src/report/report.service.ts @@ -140,7 +140,7 @@ export class ReportService { let provisions: { [key: string]: { provision_name: string; free_text: string; list: { item: string }[] }[]; } = {}; - provisionJson.forEach(({ provision_name, provision_group, free_text, list_items, list_enabled }) => { + provisionJson.forEach(({ provision_name, provision_group, free_text, list_items }) => { if (free_text.includes('«')) { // regex which converts «DB_TENURE_TYPE» to {d.DB_Tenure_Type}, also works for VAR_ free_text = free_text.replace(/«([^»]+)»/g, function (match, innerText) { @@ -192,12 +192,7 @@ export class ReportService { provisions[key] = []; } - // for now, only pass free_text or list, not both - if (list_enabled) { - provisions[key].push({ provision_name, free_text: null, list }); - } else { - provisions[key].push({ provision_name, free_text, list: [] }); - } + provisions[key].push({ provision_name, free_text, list }); }); // get the TTLS DB_ variables diff --git a/backend/src/types.ts b/backend/src/types.ts index f46782e7..c85e4535 100644 --- a/backend/src/types.ts +++ b/backend/src/types.ts @@ -28,7 +28,6 @@ export type ProvisionJSON = { provision_group: number; free_text: string; list_items: string[]; - list_enabled: boolean; provision_id: number; sequence_value: number; doc_type_provision_id: number; @@ -62,7 +61,6 @@ export type ManageDocTypeProvision = { provision_name: string; free_text: string; list_items: string[]; - list_enabled: boolean; help_text: string; category: string; active_flag: boolean; diff --git a/frontend/src/app/components/modal/manage-provisions/AddProvisionModal.tsx b/frontend/src/app/components/modal/manage-provisions/AddProvisionModal.tsx index dbb06957..fba33fb2 100644 --- a/frontend/src/app/components/modal/manage-provisions/AddProvisionModal.tsx +++ b/frontend/src/app/components/modal/manage-provisions/AddProvisionModal.tsx @@ -15,7 +15,6 @@ const AddProvisionModal: React.FC = ({ show, addProvisio const [provisionName, setProvisionName] = useState(''); const [freeText, setFreeText] = useState(''); const [listItems, setListItems] = useState(['']); - const [listEnabled, setListEnabled] = useState(false); const [helpText, setHelpText] = useState(''); const [category, setCategory] = useState(''); @@ -35,10 +34,6 @@ const AddProvisionModal: React.FC = ({ show, addProvisio setCategory(e.target.value); }; - const handleListEnabledChange = (e: React.ChangeEvent) => { - setListEnabled(e.target.checked); - }; - const handleListItemChange = (e: React.ChangeEvent, index: number) => { const newListItems = [...listItems]; newListItems[index] = e.target.value; @@ -62,8 +57,7 @@ const AddProvisionModal: React.FC = ({ show, addProvisio const provisionUpload: ProvisionUpload = { provision_name: provisionName, free_text: freeText, - list_items: listEnabled ? listItems : [], - list_enabled: listEnabled, + list_items: listItems ? listItems : [], help_text: helpText, category: category, }; @@ -80,7 +74,6 @@ const AddProvisionModal: React.FC = ({ show, addProvisio const handleOnHide = () => { onHide(); - setListEnabled(false); setListItems(['']); }; @@ -112,55 +105,43 @@ const AddProvisionModal: React.FC = ({ show, addProvisio - - Enable List} - checked={listEnabled} - onChange={handleListEnabledChange} - /> + + + Free Text + + + + - {listEnabled ? ( - - - List Items - - {listItems.map((item, index) => ( -
- - handleListItemChange(e, index)} - /> - - - - -
- ))} -
- + + + List Items + + {listItems.map((item, index) => ( +
+ + handleListItemChange(e, index)} + /> + + + +
-
- ) : ( - - - Free Text - - - - - - )} + ))} +
+ +
+ diff --git a/frontend/src/app/components/modal/manage-provisions/forms/EditProvisionModalForm.tsx b/frontend/src/app/components/modal/manage-provisions/forms/EditProvisionModalForm.tsx index fda50516..14457371 100644 --- a/frontend/src/app/components/modal/manage-provisions/forms/EditProvisionModalForm.tsx +++ b/frontend/src/app/components/modal/manage-provisions/forms/EditProvisionModalForm.tsx @@ -29,7 +29,6 @@ const EditProvisionModalForm: React.FC = ({ const [provisionName, setProvisionName] = useState(''); const [freeText, setFreeText] = useState(''); const [listItems, setListItems] = useState(['']); - const [listEnabled, setListEnabled] = useState(false); const [helpText, setHelpText] = useState(''); const [category, setCategory] = useState(''); @@ -39,7 +38,6 @@ const EditProvisionModalForm: React.FC = ({ setProvisionName(provision.provision_name); setFreeText(provision.free_text); setListItems(provision.list_items); - setListEnabled(provision.list_enabled); setHelpText(provision.help_text); setCategory(provision.category); } @@ -64,10 +62,6 @@ const EditProvisionModalForm: React.FC = ({ setCategory(e.target.value); }; - const handleListEnabledChange = (e: React.ChangeEvent) => { - setListEnabled(e.target.checked); - }; - const handleListItemChange = (e: React.ChangeEvent, index: number) => { const newListItems = [...listItems]; newListItems[index] = e.target.value; @@ -90,7 +84,6 @@ const EditProvisionModalForm: React.FC = ({ provision_name: provisionName, free_text: freeText, list_items: listItems, - list_enabled: listEnabled, help_text: helpText, category: category, }; @@ -131,61 +124,49 @@ const EditProvisionModalForm: React.FC = ({ - - Enable List} - checked={listEnabled} - onChange={handleListEnabledChange} - /> + + + Free Text + + + + - {listEnabled ? ( - - - List Items - - {listItems.map((item, index) => ( -
- - handleListItemChange(e, index)} - /> - - - - -
- ))} -
- + + + List Items + + {listItems.map((item, index) => ( +
+ + handleListItemChange(e, index)} + /> + + + +
-
- ) : ( - - - Free Text - - - - - - )} + ))} +
+ +
+ diff --git a/frontend/src/app/content/pages/LandingPage.tsx b/frontend/src/app/content/pages/LandingPage.tsx index acb21a99..0cd1b6b9 100644 --- a/frontend/src/app/content/pages/LandingPage.tsx +++ b/frontend/src/app/content/pages/LandingPage.tsx @@ -335,7 +335,6 @@ const LandingPage: FC = () => { provision_name: provision.provision_name, free_text: provision.free_text, list_items: provision.list_items, - list_enabled: provision.list_enabled, }; }); const selectedVariables: Variable[] = variables.filter((variable) => selectedVariableIds.includes(variable.id)); diff --git a/frontend/src/app/types/types.ts b/frontend/src/app/types/types.ts index 064ab6d6..e623abb5 100644 --- a/frontend/src/app/types/types.ts +++ b/frontend/src/app/types/types.ts @@ -125,7 +125,6 @@ export type ProvisionObject = { provision_name: string; free_text: string; list_items: string[]; - list_enabled: boolean; category: string; active_flag: boolean; create_userid: string; @@ -158,7 +157,6 @@ export type Provision = { create_userid: string; free_text: string; list_items: string[]; - list_enabled: boolean; help_text: string; id: number; is_deleted: boolean; @@ -172,7 +170,6 @@ export type ProvisionUpload = { provision_name: string; free_text: string; list_items: string[]; - list_enabled: boolean; help_text: string; category: string; }; @@ -200,7 +197,6 @@ export type ProvisionDataObject = { category: string; free_text: string; list_items: string[]; - list_enabled: boolean; help_text: string; active_flag: boolean; // from global provision is_deleted: boolean; // from global provision @@ -222,7 +218,6 @@ export type ReducedProvisionDataObject = { category: string; free_text: string; list_items: string[]; - list_enabled: boolean; help_text: string; active_flag: boolean; // from global provision is_deleted: boolean; // from global provision @@ -314,7 +309,6 @@ export type DocumentDataObject = { export type DocumentDataProvisionObject = { provision_free_text: string; provision_list_items: string[]; - provision_list_enabled: boolean; id: number; provision: ProvisionObject; }; diff --git a/migrations/sql/V1.0.21__provision_list_update.sql b/migrations/sql/V1.0.21__provision_list_update.sql new file mode 100644 index 00000000..3e7bbc84 --- /dev/null +++ b/migrations/sql/V1.0.21__provision_list_update.sql @@ -0,0 +1,2 @@ +ALTER TABLE provision +DROP COLUMN list_enabled;