From 1cdd0a515ab73b5f0349e7fa070d548769e952de Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 14 Nov 2023 22:56:02 -0800 Subject: [PATCH 01/82] Create migration file for OIPC tables --- .../3b399ca506fe_create_oipc_tables.py | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py diff --git a/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py b/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py new file mode 100644 index 000000000..549d04ade --- /dev/null +++ b/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py @@ -0,0 +1,75 @@ +"""Create OIPC tables + +Revision ID: 3b399ca506fe +Revises: 7fa7236d06fb +Create Date: 2023-11-14 22:29:58.451320 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql +from sqlalchemy import Table, Column, Integer, String, MetaData +meta = MetaData() + + +# revision identifiers, used by Alembic. +revision = '3b399ca506fe' +down_revision = '7fa7236d06fb' +branch_labels = None +depends_on = None + + +def upgrade(): + subjectcodestable = op.create_table('OIPCReviewTypes', + sa.Column('reviewtypeid', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=True), + sa.Column('createdby', sa.String(length=120), nullable=True), + sa.Column('updated_at', sa.DateTime(), nullable=True), + sa.Column('updatedby', sa.String(length=120), nullable=True), + sa.Column('isactive', sa.Boolean(), nullable=False), + sa.PrimaryKeyConstraint('reviewtypeid') + ) + + reasonstable = op.create_table('OIPCReasons', + sa.Column('reasonid', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=True), + sa.Column('createdby', sa.String(length=120), nullable=True), + sa.Column('updated_at', sa.DateTime(), nullable=True), + sa.Column('updatedby', sa.String(length=120), nullable=True), + sa.Column('isactive', sa.Boolean(), nullable=False), + sa.PrimaryKeyConstraint('reasonid') + ) + + statusestable = op.create_table('OIPCStatuses', + sa.Column('statusid', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=True), + sa.Column('createdby', sa.String(length=120), nullable=True), + sa.Column('updated_at', sa.DateTime(), nullable=True), + sa.Column('updatedby', sa.String(length=120), nullable=True), + sa.Column('isactive', sa.Boolean(), nullable=False), + sa.PrimaryKeyConstraint('statusid') + ) + + outcomestable = op.create_table('OIPCOutcomes', + sa.Column('outcomeid', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=True), + sa.Column('createdby', sa.String(length=120), nullable=True), + sa.Column('updated_at', sa.DateTime(), nullable=True), + sa.Column('updatedby', sa.String(length=120), nullable=True), + sa.Column('isactive', sa.Boolean(), nullable=False), + sa.PrimaryKeyConstraint('outcomeid') + ) + # op.execute('''CREATE TABLE OIPCReviewTypes ( + # reviewtypeid integer PRIMARY KEY, + # created_at datetime, + # created_by varchar(120), + # updated_at datetime, + # updated_by varchar(120), + # isactive boolean NOT NULL + # )''') + +def downgrade(): + op.drop_table('OIPCReviewTypes') + op.drop_table('OIPCReasons') + op.drop_table('OIPCStatuses') + op.drop_table('OIPCOutcomes') From 92e416b92498e9032370597eab6c725f1f9b2ace Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Wed, 15 Nov 2023 12:24:12 -0800 Subject: [PATCH 02/82] Update migration file --- .../3b399ca506fe_create_oipc_tables.py | 92 +++++++++++++------ 1 file changed, 63 insertions(+), 29 deletions(-) diff --git a/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py b/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py index 549d04ade..c4f22eccb 100644 --- a/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py +++ b/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py @@ -20,56 +20,90 @@ def upgrade(): - subjectcodestable = op.create_table('OIPCReviewTypes', + reviewtypestable = op.create_table('OIPCReviewTypes', sa.Column('reviewtypeid', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=True), - sa.Column('createdby', sa.String(length=120), nullable=True), - sa.Column('updated_at', sa.DateTime(), nullable=True), - sa.Column('updatedby', sa.String(length=120), nullable=True), - sa.Column('isactive', sa.Boolean(), nullable=False), + sa.Column('name', sa.String(length=100), unique=False, nullable=False), + sa.Column('isactive', sa.Boolean(), unique=False, nullable=False), sa.PrimaryKeyConstraint('reviewtypeid') ) reasonstable = op.create_table('OIPCReasons', sa.Column('reasonid', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=True), - sa.Column('createdby', sa.String(length=120), nullable=True), - sa.Column('updated_at', sa.DateTime(), nullable=True), - sa.Column('updatedby', sa.String(length=120), nullable=True), - sa.Column('isactive', sa.Boolean(), nullable=False), + sa.Column('name', sa.String(length=100), unique=False, nullable=False), + sa.Column('isactive', sa.Boolean(), unique=False, nullable=False), sa.PrimaryKeyConstraint('reasonid') ) statusestable = op.create_table('OIPCStatuses', sa.Column('statusid', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=True), - sa.Column('createdby', sa.String(length=120), nullable=True), - sa.Column('updated_at', sa.DateTime(), nullable=True), - sa.Column('updatedby', sa.String(length=120), nullable=True), - sa.Column('isactive', sa.Boolean(), nullable=False), + sa.Column('name', sa.String(length=100), unique=False, nullable=False), + sa.Column('isactive', sa.Boolean(), unique=False, nullable=False), sa.PrimaryKeyConstraint('statusid') ) outcomestable = op.create_table('OIPCOutcomes', sa.Column('outcomeid', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=True), - sa.Column('createdby', sa.String(length=120), nullable=True), - sa.Column('updated_at', sa.DateTime(), nullable=True), - sa.Column('updatedby', sa.String(length=120), nullable=True), - sa.Column('isactive', sa.Boolean(), nullable=False), + sa.Column('name', sa.String(length=100), unique=False, nullable=False), + sa.Column('isactive', sa.Boolean(), unique=False, nullable=False), sa.PrimaryKeyConstraint('outcomeid') ) - # op.execute('''CREATE TABLE OIPCReviewTypes ( - # reviewtypeid integer PRIMARY KEY, - # created_at datetime, - # created_by varchar(120), - # updated_at datetime, - # updated_by varchar(120), - # isactive boolean NOT NULL - # )''') + + inquiryoutcomestable = op.create_table('OIPCInquiryOutcomes', + sa.Column('inquiryoutcomeid', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('name', sa.String(length=100), unique=False, nullable=False), + sa.Column('isactive', sa.Boolean(), unique=False, nullable=False), + sa.PrimaryKeyConstraint('inquiryoutcomeid') + ) + + op.execute('''INSERT INTO public."OIPCReviewTypes" (name, isactive) + VALUES + ('Complaint', True), + ('Review', True), + ('Investigation', True);commit;''') + + op.execute('''INSERT INTO public."OIPCReasons" (name, isactive) + VALUES + ('Adequate Search', True), + ('Application of Exceptions', True), + ('Deemed Refusal', True), + ('Extension', True), + ('Fee Amount', True), + ('Fee Waiver', True), + ('Records do not Exist', True), + ('Duty to Assist', True), + ('TPN - 22', True), + ('TPN - 21', True), + ('TPN - 18.1', True), + ('Reg 3', True), + ('Reg 4', True), + ('Reg 5', True), + ('s. 43', True), + ('Other', True);commit;''') + + op.execute('''INSERT INTO public."OIPCStatuses" (name, isactive) + VALUES + ('Mediation', True), + ('Investigation', True), + ('Inquiry', True), + ('Awaiting Order', True), + ('Closed', True);commit;''') + + op.execute('''INSERT INTO public."OIPCOutcomes" (name, isactive) + VALUES + ('Abandoned', True), + ('Withdrawn', True), + ('Resolved in Mediation', True), + ('Closed', True);commit;''') + + op.execute('''INSERT INTO public."OIPCInquiryOutcomes" (name, isactive) + VALUES + ('Decision Upheld', True), + ('Decision Partially Upheld', True), + ('Decision Overturned', True);commit;''') def downgrade(): op.drop_table('OIPCReviewTypes') op.drop_table('OIPCReasons') op.drop_table('OIPCStatuses') op.drop_table('OIPCOutcomes') + op.drop_table('OIPCInquiryOutcomes') From 0b4cdd1417ebdd9be4f1690ac2dc27c7bfd1095b Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Wed, 15 Nov 2023 12:25:33 -0800 Subject: [PATCH 03/82] Create endpoints for OIPC data --- .../resources/foiflowmasterdata.py | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/request-management-api/request_api/resources/foiflowmasterdata.py b/request-management-api/request_api/resources/foiflowmasterdata.py index 6525eef82..2d75d602c 100644 --- a/request-management-api/request_api/resources/foiflowmasterdata.py +++ b/request-management-api/request_api/resources/foiflowmasterdata.py @@ -33,6 +33,7 @@ from request_api.services.extensionreasonservice import extensionreasonservice from request_api.services.cacheservice import cacheservice from request_api.services.subjectcodeservice import subjectcodeservice +from request_api.services.oipcservice import oipcservice import json import request_api import requests @@ -380,3 +381,113 @@ def post(): return {"success": resp_flag } , 200 if resp_flag == True else 500 except BusinessException: return "Error happened while clearing cache" , 500 + +@cors_preflight('GET,OPTIONS') +@API.route('/foiflow/oipc/reviewtypes') +class FOIFlowOIPCReviewTypes(Resource): + """Retrieves OIPC review types + """ + @staticmethod + @TRACER.trace() + @cross_origin(origins=allowedorigins()) + # @auth.require + @request_api.cache.cached( + key_prefix="oipcreviewtypes", + unless=cache_filter, + response_filter=response_filter + ) + def get(): + try: + data = oipcservice().getreviewtypes() + jsondata = json.dumps(data) + return jsondata , 200 + except BusinessException: + return "Error happened while accessing OIPC review types" , 500 + +@cors_preflight('GET,OPTIONS') +@API.route('/foiflow/oipc/statuses') +class FOIFlowOIPCStatuses(Resource): + """Retrieves OIPC statuses + """ + @staticmethod + @TRACER.trace() + @cross_origin(origins=allowedorigins()) + # @auth.require + @request_api.cache.cached( + key_prefix="oipcstatuses", + unless=cache_filter, + response_filter=response_filter + ) + def get(): + try: + data = oipcservice().getstatuses() + jsondata = json.dumps(data) + return jsondata , 200 + except BusinessException: + return "Error happened while accessing OIPC statuses" , 500 + +@cors_preflight('GET,OPTIONS') +@API.route('/foiflow/oipc/reasons') +class FOIFlowOIPCReasons(Resource): + """Retrieves OIPC reasons + """ + @staticmethod + @TRACER.trace() + @cross_origin(origins=allowedorigins()) + # @auth.require + @request_api.cache.cached( + key_prefix="oipcreasons", + unless=cache_filter, + response_filter=response_filter + ) + def get(): + try: + data = oipcservice().getreasons() + jsondata = json.dumps(data) + return jsondata , 200 + except BusinessException: + return "Error happened while accessing OIPC reasons" , 500 + +@cors_preflight('GET,OPTIONS') +@API.route('/foiflow/oipc/outcomes') +class FOIFlowOIPCOutcomes(Resource): + """Retrieves OIPC outcomes + """ + @staticmethod + @TRACER.trace() + @cross_origin(origins=allowedorigins()) + # @auth.require + @request_api.cache.cached( + key_prefix="oipcoutcomes", + unless=cache_filter, + response_filter=response_filter + ) + def get(): + try: + data = oipcservice().getoutcomes() + jsondata = json.dumps(data) + return jsondata , 200 + except BusinessException: + return "Error happened while accessing OIPC outcomes" , 500 + +@cors_preflight('GET,OPTIONS') +@API.route('/foiflow/oipc/inquiryoutcomes') +class FOIFlowOIPCInquiryOutcomes(Resource): + """Retrieves OIPC inquiry outcomes + """ + @staticmethod + @TRACER.trace() + @cross_origin(origins=allowedorigins()) + # @auth.require + @request_api.cache.cached( + key_prefix="oipcinquiryoutcomes", + unless=cache_filter, + response_filter=response_filter + ) + def get(): + try: + data = oipcservice().getinquiryoutcomes() + jsondata = json.dumps(data) + return jsondata , 200 + except BusinessException: + return "Error happened while accessing OIPC inquiry outcomes" , 500 \ No newline at end of file From 7fd77828e540fc2d0bc4028b155285354b6f70d7 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Wed, 15 Nov 2023 12:26:12 -0800 Subject: [PATCH 04/82] Create OIPC models and service --- .../request_api/models/OIPCInquiryOutcomes.py | 19 +++++++++++++++ .../request_api/models/OIPCOutcomes.py | 19 +++++++++++++++ .../request_api/models/OIPCReasons.py | 20 ++++++++++++++++ .../request_api/models/OIPCReviewTypes.py | 19 +++++++++++++++ .../request_api/models/OIPCStatuses.py | 19 +++++++++++++++ .../request_api/services/oipcservice.py | 23 +++++++++++++++++++ 6 files changed, 119 insertions(+) create mode 100644 request-management-api/request_api/models/OIPCInquiryOutcomes.py create mode 100644 request-management-api/request_api/models/OIPCOutcomes.py create mode 100644 request-management-api/request_api/models/OIPCReasons.py create mode 100644 request-management-api/request_api/models/OIPCReviewTypes.py create mode 100644 request-management-api/request_api/models/OIPCStatuses.py create mode 100644 request-management-api/request_api/services/oipcservice.py diff --git a/request-management-api/request_api/models/OIPCInquiryOutcomes.py b/request-management-api/request_api/models/OIPCInquiryOutcomes.py new file mode 100644 index 000000000..a613f0a7f --- /dev/null +++ b/request-management-api/request_api/models/OIPCInquiryOutcomes.py @@ -0,0 +1,19 @@ +from .db import db, ma + +class OIPCInquiryOutcomes(db.Model): + __tablename__ = 'OIPCInquiryOutcomes' + # Defining the columns + inquiryoutcomeid = db.Column(db.Integer, primary_key=True,autoincrement=True) + name = db.Column(db.String(100), unique=False, nullable=False) + isactive = db.Column(db.Boolean, unique=False, nullable=False) + + @classmethod + def getinquiryoutcomes(cls): + type_schema = InquiryOutcomeSchema(many=True) + query = db.session.query(OIPCInquiryOutcomes).filter_by(isactive=True).all() + return type_schema.dump(query) + + +class InquiryOutcomeSchema(ma.Schema): + class Meta: + fields = ('inquiryoutcomeid', 'name','isactive') \ No newline at end of file diff --git a/request-management-api/request_api/models/OIPCOutcomes.py b/request-management-api/request_api/models/OIPCOutcomes.py new file mode 100644 index 000000000..c891a88a8 --- /dev/null +++ b/request-management-api/request_api/models/OIPCOutcomes.py @@ -0,0 +1,19 @@ +from .db import db, ma + +class OIPCOutcomes(db.Model): + __tablename__ = 'OIPCOutcomes' + # Defining the columns + outcomeid = db.Column(db.Integer, primary_key=True,autoincrement=True) + name = db.Column(db.String(100), unique=False, nullable=False) + isactive = db.Column(db.Boolean, unique=False, nullable=False) + + @classmethod + def getoutcomes(cls): + type_schema = OutcomeSchema(many=True) + query = db.session.query(OIPCOutcomes).filter_by(isactive=True).all() + return type_schema.dump(query) + + +class OutcomeSchema(ma.Schema): + class Meta: + fields = ('outcomeid', 'name','isactive') \ No newline at end of file diff --git a/request-management-api/request_api/models/OIPCReasons.py b/request-management-api/request_api/models/OIPCReasons.py new file mode 100644 index 000000000..6eadc03b6 --- /dev/null +++ b/request-management-api/request_api/models/OIPCReasons.py @@ -0,0 +1,20 @@ + +from .db import db, ma + +class OIPCReasons(db.Model): + __tablename__ = 'OIPCReasons' + # Defining the columns + reasonid = db.Column(db.Integer, primary_key=True,autoincrement=True) + name = db.Column(db.String(100), unique=False, nullable=False) + isactive = db.Column(db.Boolean, unique=False, nullable=False) + + @classmethod + def getreasons(cls): + type_schema = ReasonSchema(many=True) + query = db.session.query(OIPCReasons).filter_by(isactive=True).all() + return type_schema.dump(query) + + +class ReasonSchema(ma.Schema): + class Meta: + fields = ('reasonid', 'name','isactive') \ No newline at end of file diff --git a/request-management-api/request_api/models/OIPCReviewTypes.py b/request-management-api/request_api/models/OIPCReviewTypes.py new file mode 100644 index 000000000..bb5317de8 --- /dev/null +++ b/request-management-api/request_api/models/OIPCReviewTypes.py @@ -0,0 +1,19 @@ +from .db import db, ma + +class OIPCReviewTypes(db.Model): + __tablename__ = 'OIPCReviewTypes' + # Defining the columns + reviewtypeid = db.Column(db.Integer, primary_key=True,autoincrement=True) + name = db.Column(db.String(100), unique=False, nullable=False) + isactive = db.Column(db.Boolean, unique=False, nullable=False) + + @classmethod + def getreviewtypes(cls): + type_schema = ReviewTypeSchema(many=True) + query = db.session.query(OIPCReviewTypes).filter_by(isactive=True).all() + return type_schema.dump(query) + + +class ReviewTypeSchema(ma.Schema): + class Meta: + fields = ('reviewtypeid', 'name','isactive') \ No newline at end of file diff --git a/request-management-api/request_api/models/OIPCStatuses.py b/request-management-api/request_api/models/OIPCStatuses.py new file mode 100644 index 000000000..dce07aac2 --- /dev/null +++ b/request-management-api/request_api/models/OIPCStatuses.py @@ -0,0 +1,19 @@ +from .db import db, ma + +class OIPCStatuses(db.Model): + __tablename__ = 'OIPCStatuses' + # Defining the columns + statusid = db.Column(db.Integer, primary_key=True,autoincrement=True) + name = db.Column(db.String(100), unique=False, nullable=False) + isactive = db.Column(db.Boolean, unique=False, nullable=False) + + @classmethod + def getstatuses(cls): + type_schema = StatusSchema(many=True) + query = db.session.query(OIPCStatuses).filter_by(isactive=True).all() + return type_schema.dump(query) + + +class StatusSchema(ma.Schema): + class Meta: + fields = ('statusid', 'name','isactive') \ No newline at end of file diff --git a/request-management-api/request_api/services/oipcservice.py b/request-management-api/request_api/services/oipcservice.py new file mode 100644 index 000000000..2ea4719f8 --- /dev/null +++ b/request-management-api/request_api/services/oipcservice.py @@ -0,0 +1,23 @@ +from request_api.models.OIPCReviewTypes import OIPCReviewTypes +from request_api.models.OIPCStatuses import OIPCStatuses +from request_api.models.OIPCReasons import OIPCReasons +from request_api.models.OIPCOutcomes import OIPCOutcomes +from request_api.models.OIPCInquiryOutcomes import OIPCInquiryOutcomes + +class oipcservice: + """ OIPC service + """ + def getreviewtypes(self): + return OIPCReviewTypes.getreviewtypes() + + def getreasons(self): + return OIPCReasons.getreasons() + + def getstatuses(self): + return OIPCStatuses.getstatuses() + + def getoutcomes(self): + return OIPCOutcomes.getoutcomes() + + def getinquiryoutcomes(self): + return OIPCInquiryOutcomes.getinquiryoutcomes() \ No newline at end of file From 7de09918acd0c02a986b1df6d1f837f4a03c82ae Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Wed, 15 Nov 2023 13:32:52 -0800 Subject: [PATCH 05/82] Initial commit / setup --- .../components/FOI/FOIRequest/FOIRequest.js | 5 ++ .../FOIRequest/OIPCDetails/AddOIPCButton.jsx | 0 .../OIPCDetails/AdditionalFields.jsx | 0 .../OIPCDetails/AdditionalInquiryFields.jsx | 0 .../FOI/FOIRequest/OIPCDetails/Index.jsx | 51 +++++++++++++++++++ .../OIPCDetails/MandatoryFields.jsx | 0 .../OIPCDetails/OIPCDetailsList.jsx | 14 +++++ .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 0 .../FOIRequest/OIPCDetails/oipcdetails.scss | 34 +++++++++++++ 9 files changed, 104 insertions(+) create mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AddOIPCButton.jsx create mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AdditionalFields.jsx create mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AdditionalInquiryFields.jsx create mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx create mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/MandatoryFields.jsx create mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx create mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx create mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index d754731d2..26a40787d 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -89,6 +89,7 @@ import { UnsavedModal } from "../customComponents"; import { DISABLE_GATHERINGRECORDS_TAB } from "../../../constants/constants"; import _ from "lodash"; import { MinistryNeedsScanning } from "../../../constants/FOI/enum"; +import OIPCDetails from "./OIPCDetails/Index"; const useStyles = makeStyles((theme) => ({ root: { @@ -251,6 +252,7 @@ const FOIRequest = React.memo(({ userDetail }) => { const [isIAORestricted, setIsIAORestricted] = useState(false); const [redactedSections, setRedactedSections] = useState(""); const [isMCFPersonal, setIsMCFPersonal] = useState(bcgovcode.replaceAll('"', '') == "MCF" && requestDetails.requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); + const [showOIPCDetails, setShowOIPCDetails] = useState(true); useEffect(() => { if (window.location.href.indexOf("comments") > -1) { @@ -1207,6 +1209,9 @@ const FOIRequest = React.memo(({ userDetail }) => { divisions={requestDetails.divisions} /> )} + {showOIPCDetails && ( + + )} { + const oipcData = [ + { oipcNumber: "F23-12345", reviewType: "Complaint", reason: "Deemed Refusal", status: "Inquiry", isInquiry: false, inquiryDate: null, investigator: "Filip Forsberg", outcome: "Withdrawn", isJudicalReview: false, isSubAppeal: false }, + { oipcNumber: "F23-12346", reviewType: "Review", reason: "Other", status: "Mediation", isInquiry: false, investigator: "Peter Forsberg", outcome: "Closed", isJudicalReview: false, isSubAppeal: true }, + { oipcNumber: "F23-12347", reviewType: "Investigation", reason: "TPN-21", status: "Awaiting Order", isInquiry: false, investigator: "Quinn Hughes", outcome: "Abandoned", isJudicalReview: true, isSubAppeal: true } + ] + + const useStyles = makeStyles({ + heading: { + color: '#FFF', + fontSize: '16px !important', + fontWeight: 'bold !important' + }, + accordionSummary: { + flexDirection: 'row-reverse' + } + }); + const classes = useStyles(); + + return ( +
+ + }> + OIPC Details + + + + + + +
+ ); +} + +export default OIPCDetails; + +//IDEA = MasterData is held in a oipcData [{}] state (there is a backend api call to generate the existing oipc data). This is mapped in OIPCDetailsList where each elm is mapped as a OIPCItem. Each OIPC Item has EDITABLE Fields (unless oipcObj outcome value exists? -> therefore we disable the field) +//EACH OIPCITEM HAS ITS OWN INTERNAL STATE WE CAN change and if changed -> the oipcData state wil change as well +// When add button is clicked, we add a new oipcObj to the oipcData state which then creates a new oipcITEM with its own default state which can be edited. +// if any oipcObjs in the oipcData state are missing any of the mandatory fields -> Save button cannot be selected./is disalbed +// When save button is enabled and clicked -> we send the backend api requeset and save the oipc data in backend by sending the master oipc data over. \ No newline at end of file diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/MandatoryFields.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/MandatoryFields.jsx new file mode 100644 index 000000000..e69de29bb diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx new file mode 100644 index 000000000..e41438981 --- /dev/null +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -0,0 +1,14 @@ +const OIPCDetailsList = (props) => { + const {oipcData} = props; + const OIPCItems = oipcData?.map((oipcObj, index) => { + return oipcObj.oipcNumber; + }) + + return ( + <> + {OIPCItems} + + ); +} + +export default OIPCDetailsList; \ No newline at end of file diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx new file mode 100644 index 000000000..e69de29bb diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss new file mode 100644 index 000000000..e9129c6ca --- /dev/null +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss @@ -0,0 +1,34 @@ + +.align-division{ + text-align: center; +} + +.divisions-row{ + font-weight: bold; + font-size: 16px; + margin-bottom: 20px; +} + +.arrow { + display: inline-flex; + + .line { + margin-top: 14px; + // width: 320px; + width: 258px; + background: #979797; + height: 1px; + float: left; + } + + .point { + width: 0; + height: 0; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-left: 10px solid #979797; + float: right; + margin-top: 9px; + } +} + \ No newline at end of file From 8a699ead916847c54fe132e0ddd07cb714e24ae6 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Wed, 15 Nov 2023 17:08:32 -0800 Subject: [PATCH 06/82] Base design and fields completed. WIP finalziing style/design + incorporating state --- .../FOI/FOIRequest/OIPCDetails/Index.jsx | 9 +- .../OIPCDetails/OIPCDetailsList.jsx | 13 +- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 151 ++++++++++++++++++ 3 files changed, 164 insertions(+), 9 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx index 903355be5..7267752d7 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx @@ -1,5 +1,4 @@ import OIPCDetailsList from "./OIPCDetailsList"; -import './oipcdetails.scss'; import Accordion from '@material-ui/core/Accordion'; import AccordionSummary from '@material-ui/core/AccordionSummary'; import AccordionDetails from '@material-ui/core/AccordionDetails'; @@ -10,9 +9,9 @@ import { makeStyles } from '@material-ui/styles'; const OIPCDetails = (props) => { const oipcData = [ - { oipcNumber: "F23-12345", reviewType: "Complaint", reason: "Deemed Refusal", status: "Inquiry", isInquiry: false, inquiryDate: null, investigator: "Filip Forsberg", outcome: "Withdrawn", isJudicalReview: false, isSubAppeal: false }, - { oipcNumber: "F23-12346", reviewType: "Review", reason: "Other", status: "Mediation", isInquiry: false, investigator: "Peter Forsberg", outcome: "Closed", isJudicalReview: false, isSubAppeal: true }, - { oipcNumber: "F23-12347", reviewType: "Investigation", reason: "TPN-21", status: "Awaiting Order", isInquiry: false, investigator: "Quinn Hughes", outcome: "Abandoned", isJudicalReview: true, isSubAppeal: true } + { oipcNumber: "F23-12345", reviewType: "Complaint", reason: "Deemed Refusal", status: "Inquiry", isInquiry: false, inquiryDate: null, receivedDate: "05-08-2022", complyDate: "10-10-2023", investigator: "Filip Forsberg", outcome: "Withdrawn", isJudicalReview: false, isSubAppeal: false }, + { oipcNumber: "F23-12346", reviewType: "Review", reason: "Other", status: "Mediation", isInquiry: false, inquiryDate: null, receivedDate: "09-08-2022", complyDate: "12-10-2022", investigator: "Peter Forsberg", outcome: "Closed", isJudicalReview: false, isSubAppeal: true }, + { oipcNumber: "F23-12347", reviewType: "Investigation", reason: "TPN-21", status: "Awaiting Order", isInquiry: false, inquiryDate: null, receivedDate: "11-08-2022", complyDate: "01-10-2023", investigator: "Quinn Hughes", outcome: "Abandoned", isJudicalReview: true, isSubAppeal: true } ] const useStyles = makeStyles({ @@ -35,7 +34,7 @@ const OIPCDetails = (props) => { - + diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index e41438981..552c8d4fe 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -1,13 +1,18 @@ +import OIPCItem from "./OIPCItem"; + const OIPCDetailsList = (props) => { const {oipcData} = props; + const OIPCItems = oipcData?.map((oipcObj, index) => { - return oipcObj.oipcNumber; - }) + return ( + + ); + }); return ( - <> +
{OIPCItems} - +
); } diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index e69de29bb..039d879a3 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -0,0 +1,151 @@ +import { TextField, Typography, Select, FormControl, FormControlLabel, MenuItem, InputLabel, Grid, Checkbox } from '@material-ui/core'; +import { useState } from "react"; + +const OIPCItem = (props) => { + const {oipcObj} = props; + + const [oipcData, setOipcData] = useState({ + oipcNumber: "", + reviewType: "", + reason: "", + status: "", + isInquiry: false, + inquiryDate: null, + receivedDate: "", + complyDate: "", + investigator: "", + outcome: "", + isJudicalReview: true, + isSubAppeal: true + }); + + const handleReviewType = () => { + console.log("BANG") + } + + return ( + + + + + + } + variant="outlined" + fullWidth + value={oipcData.reviewType} + label="Review Type" + onChange={handleReviewType} + required={true} + > + Complaint + Review + Investigation + + + + } + variant="outlined" + fullWidth + value={oipcData.reason} + label="Reason" + onChange={handleReviewType} + required={true} + > + Adequate search + Application of Exceptions + Deemed Refusal + Extension + Fee Amount + Fee Waiver + Records do Not Exist + Duty to Assist + TPN - 22 + TPN - 21 + TPN - 18.1 + Reg 3 + Reg 4 + Reg 5 + s. 43 + Other + + + + } + variant="outlined" + fullWidth + value={oipcData.status} + label="Status" + onChange={handleReviewType} + required={true} + > + Mediation + Investigation + Inquiry + Awaiting Order + Closed + + + + + + + } + variant="outlined" + fullWidth + value={oipcData.outcome} + label="Outcome" + onChange={handleReviewType} + required={true} + > + Abandoned + Withdrawn + Resolved in Mediation + Closed + + + + In Inquiry? + } label="Yes" /> + } label="No" /> + + + In Judicial Review? + } label="Yes" /> + } label="No" /> + + + In Subsequent Appeal? + } label="Yes" /> + } label="No" /> + + + ); +} + +export default OIPCItem; \ No newline at end of file From 12b41fbbb69da5490b28edbcf8034a87bf38edc2 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 16 Nov 2023 11:17:42 -0800 Subject: [PATCH 07/82] Insert amend into Outcomes table --- .../migrations/versions/3b399ca506fe_create_oipc_tables.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py b/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py index c4f22eccb..e426ec587 100644 --- a/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py +++ b/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py @@ -93,7 +93,8 @@ def upgrade(): ('Abandoned', True), ('Withdrawn', True), ('Resolved in Mediation', True), - ('Closed', True);commit;''') + ('Closed', True), + ('Amend', True);commit;''') op.execute('''INSERT INTO public."OIPCInquiryOutcomes" (name, isactive) VALUES From 7f382c4216ffd153c1ed1b17689ecee70b6e2d5d Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 16 Nov 2023 17:07:45 -0800 Subject: [PATCH 08/82] Added revised inputs per new ACS. Added additonal styling and added deleting of oipcs from FE. WIP Finalziing styling + state managemtnt of oipcs + BE call --- .../FOI/FOIRequest/OIPCDetails/Index.jsx | 45 ++- .../OIPCDetails/OIPCDetailsList.jsx | 12 +- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 286 ++++++++++-------- .../FOIRequest/OIPCDetails/oipcdetails.scss | 5 + 4 files changed, 204 insertions(+), 144 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx index 7267752d7..f5474df3b 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx @@ -1,3 +1,4 @@ +import { useState } from 'react'; import OIPCDetailsList from "./OIPCDetailsList"; import Accordion from '@material-ui/core/Accordion'; import AccordionSummary from '@material-ui/core/AccordionSummary'; @@ -8,12 +9,11 @@ import Button from '@material-ui/core/Button'; import { makeStyles } from '@material-ui/styles'; const OIPCDetails = (props) => { - const oipcData = [ - { oipcNumber: "F23-12345", reviewType: "Complaint", reason: "Deemed Refusal", status: "Inquiry", isInquiry: false, inquiryDate: null, receivedDate: "05-08-2022", complyDate: "10-10-2023", investigator: "Filip Forsberg", outcome: "Withdrawn", isJudicalReview: false, isSubAppeal: false }, - { oipcNumber: "F23-12346", reviewType: "Review", reason: "Other", status: "Mediation", isInquiry: false, inquiryDate: null, receivedDate: "09-08-2022", complyDate: "12-10-2022", investigator: "Peter Forsberg", outcome: "Closed", isJudicalReview: false, isSubAppeal: true }, - { oipcNumber: "F23-12347", reviewType: "Investigation", reason: "TPN-21", status: "Awaiting Order", isInquiry: false, inquiryDate: null, receivedDate: "11-08-2022", complyDate: "01-10-2023", investigator: "Quinn Hughes", outcome: "Abandoned", isJudicalReview: true, isSubAppeal: true } - ] - + const [oipcData, setOipcData] = useState([ + { oipcNumber: "F23-12345", reviewType: "Complaint", reason: "Deemed Refusal", status: "Inquiry", isInquiry: false, inquiryDate: null, receivedDate: "05-08-2022", investigator: "Filip Forsberg", outcome: "Withdrawn", isJudicalReview: false, isSubAppeal: false }, + { oipcNumber: "F23-12346", reviewType: "Review", reason: "Other", status: "Mediation", isInquiry: false, inquiryDate: null, receivedDate: "09-08-2022", investigator: "Peter Forsberg", outcome: "Closed", isJudicalReview: false, isSubAppeal: true }, + { oipcNumber: "F23-12347", reviewType: "Investigation", reason: "TPN-21", status: "Awaiting Order", isInquiry: false, inquiryDate: null, receivedDate: "11-08-2022", investigator: "Quinn Hughes", outcome: "Abandoned", isJudicalReview: true, isSubAppeal: true } + ]); const useStyles = makeStyles({ heading: { color: '#FFF', @@ -24,8 +24,35 @@ const OIPCDetails = (props) => { flexDirection: 'row-reverse' } }); - const classes = useStyles(); + const classes = useStyles(); + //Function to Add an OIPC + const addOIPC = () => { + setOipcData((prev) => { + return [...prev, { + oipcNumber: "", + reviewType: "", + reason: "", + status: "", + isInquiry: false, + inquiryDate: null, + receivedDate: "", + complyDate: "", + investigator: "", + outcome: "", + isJudicalReview: false, + isSubAppeal: false + }]; + }) + } + //Function to Remove an OIPC + const removeOIPC = (oipcNo) => { + setOipcData((prev) => { + const previousOIPCData = [...prev]; + return previousOIPCData.filter(oipc => oipcNo !== oipc.oipcNumber); + }); + } + return (
@@ -33,8 +60,8 @@ const OIPCDetails = (props) => { OIPC Details - - + +
diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index 552c8d4fe..00e31392c 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -1,11 +1,19 @@ import OIPCItem from "./OIPCItem"; +import Divider from '@material-ui/core/Divider'; +import './oipcdetails.scss'; +import Button from '@material-ui/core/Button'; const OIPCDetailsList = (props) => { - const {oipcData} = props; + const {oipcData, removeOIPC} = props; + console.log("TEST THIS", oipcData); const OIPCItems = oipcData?.map((oipcObj, index) => { return ( - + <> + + + {index !== (oipcData.length - 1) && } + ); }); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 039d879a3..33f45b539 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -1,22 +1,24 @@ -import { TextField, Typography, Select, FormControl, FormControlLabel, MenuItem, InputLabel, Grid, Checkbox } from '@material-ui/core'; +import { TextField, FormControlLabel, MenuItem, Grid, Checkbox } from '@material-ui/core'; import { useState } from "react"; const OIPCItem = (props) => { const {oipcObj} = props; - const [oipcData, setOipcData] = useState({ - oipcNumber: "", - reviewType: "", - reason: "", - status: "", - isInquiry: false, + console.log(oipcObj); + + const [oipc, setOipc] = useState({ + oipcNumber: oipcObj?.oipcNumber, + reviewType: oipcObj?.reviewType, + reason: oipcObj?.reason, + status: oipcObj?.status, + isInquiry: oipcObj?.isInquiry, inquiryDate: null, - receivedDate: "", - complyDate: "", - investigator: "", - outcome: "", - isJudicalReview: true, - isSubAppeal: true + receivedDate: oipcObj?.receivedDate, + complyDate: oipcObj?.complyDate, + investigator: oipcObj?.investigator, + outcome: oipcObj?.outcome, + isJudicalReview: oipcObj?.isJudicalReview, + isSubAppeal: oipcObj?.isSubAppeal, }); const handleReviewType = () => { @@ -24,127 +26,145 @@ const OIPCItem = (props) => { } return ( - - - - - - } - variant="outlined" - fullWidth - value={oipcData.reviewType} - label="Review Type" - onChange={handleReviewType} - required={true} - > - Complaint - Review - Investigation - - - - } - variant="outlined" - fullWidth - value={oipcData.reason} - label="Reason" - onChange={handleReviewType} - required={true} - > - Adequate search - Application of Exceptions - Deemed Refusal - Extension - Fee Amount - Fee Waiver - Records do Not Exist - Duty to Assist - TPN - 22 - TPN - 21 - TPN - 18.1 - Reg 3 - Reg 4 - Reg 5 - s. 43 - Other - - - - } - variant="outlined" - fullWidth - value={oipcData.status} - label="Status" - onChange={handleReviewType} - required={true} - > - Mediation - Investigation - Inquiry - Awaiting Order - Closed - - - - - - - } - variant="outlined" - fullWidth - value={oipcData.outcome} - label="Outcome" - onChange={handleReviewType} - required={true} - > - Abandoned - Withdrawn - Resolved in Mediation - Closed - - - - In Inquiry? - } label="Yes" /> - } label="No" /> - - - In Judicial Review? - } label="Yes" /> - } label="No" /> - - - In Subsequent Appeal? - } label="Yes" /> - } label="No" /> + <> + + + } + InputLabelProps={{ shrink: true }} + /> + + + } + InputLabelProps={{ shrink: true }} + type="date" + InputProps={{inputProps: { max: new Date()} }} + /> + + + } + variant="outlined" + fullWidth + value={oipc.reviewType} + label="Review Type" + onChange={handleReviewType} + required={true} + > + Complaint + Review + Investigation + + + + } + variant="outlined" + fullWidth + value={oipc.reason} + label="Reason" + onChange={handleReviewType} + required={true} + > + Adequate search + Application of Exceptions + Deemed Refusal + Extension + Fee Amount + Fee Waiver + Records do Not Exist + Duty to Assist + TPN - 22 + TPN - 21 + TPN - 18.1 + Reg 3 + Reg 4 + Reg 5 + s. 43 + Other + + + + } + variant="outlined" + fullWidth + value={oipc.status} + label="Status" + onChange={handleReviewType} + required={true} + > + Mediation + Investigation + Inquiry + Awaiting Order + Closed + + + + + + + } + variant="outlined" + fullWidth + value={oipc.outcome} + label="Outcome" + onChange={handleReviewType} + required={true} + > + Abandoned + Withdrawn + Resolved in Mediation + Closed + + - +
+
+

In Inquiry?

+ } label="Yes" /> + } label="No" /> +
+
+

In Judicial Review?

+ } label="Yes" /> + } label="No" /> +
+
+

In Subsequent Appeal?

+ } label="Yes" /> + } label="No" /> +
+
+ ); } diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss index e9129c6ca..e226fc3e7 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss @@ -31,4 +31,9 @@ margin-top: 9px; } } + +.MuiDivider-root { + margin: 10px 0px 30px 0px !important; + height: 1.5px !important; +} \ No newline at end of file From 278447931c597d6e230277ea0f3d205f9f95f45f Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Fri, 17 Nov 2023 13:32:21 -0800 Subject: [PATCH 09/82] Styling 1.0 completed. WIP State management + API Call + Final Styling --- .../components/FOI/FOIRequest/OIPCDetails/Index.jsx | 10 ++++++++-- .../FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx | 11 ++++++++--- .../FOI/FOIRequest/OIPCDetails/oipcdetails.scss | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx index f5474df3b..74f373ad8 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx @@ -5,8 +5,9 @@ import AccordionSummary from '@material-ui/core/AccordionSummary'; import AccordionDetails from '@material-ui/core/AccordionDetails'; import Typography from '@material-ui/core/Typography'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; -import Button from '@material-ui/core/Button'; import { makeStyles } from '@material-ui/styles'; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faCirclePlus } from '@fortawesome/free-solid-svg-icons'; const OIPCDetails = (props) => { const [oipcData, setOipcData] = useState([ @@ -61,7 +62,12 @@ const OIPCDetails = (props) => { - +
+ +

Add Additional OIPC Complaint

+
diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index 00e31392c..b12aa4236 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -1,7 +1,8 @@ import OIPCItem from "./OIPCItem"; import Divider from '@material-ui/core/Divider'; import './oipcdetails.scss'; -import Button from '@material-ui/core/Button'; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faTrash } from '@fortawesome/free-solid-svg-icons'; const OIPCDetailsList = (props) => { const {oipcData, removeOIPC} = props; @@ -10,8 +11,12 @@ const OIPCDetailsList = (props) => { const OIPCItems = oipcData?.map((oipcObj, index) => { return ( <> - - +
+ +
+ {index !== (oipcData.length - 1) && } ); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss index e226fc3e7..4683c050f 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss @@ -33,7 +33,7 @@ } .MuiDivider-root { - margin: 10px 0px 30px 0px !important; + margin: 10px 0px 16px 0px !important; height: 1.5px !important; } \ No newline at end of file From 89bab58fbed5767b007dfb467a6a55786d87560f Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Fri, 17 Nov 2023 15:35:57 -0800 Subject: [PATCH 10/82] Draft commit. --- .../versions/455a24da8c58_oipc_txn_changes.py | 50 +++++++++++++++++++ .../request_api/models/FOIMinistryRequests.py | 8 ++- .../request_api/models/FOIRequestOIPC.py | 47 +++++++++++++++++ .../request_api/schemas/foirequestwrapper.py | 30 +++++++++++ .../services/external/keycloakadminservice.py | 10 ++-- .../foirequest/requestservicebuilder.py | 31 ++++++++++++ .../foirequest/requestservicegetter.py | 26 ++++++++++ 7 files changed, 196 insertions(+), 6 deletions(-) create mode 100644 request-management-api/migrations/versions/455a24da8c58_oipc_txn_changes.py create mode 100644 request-management-api/request_api/models/FOIRequestOIPC.py diff --git a/request-management-api/migrations/versions/455a24da8c58_oipc_txn_changes.py b/request-management-api/migrations/versions/455a24da8c58_oipc_txn_changes.py new file mode 100644 index 000000000..764909fc4 --- /dev/null +++ b/request-management-api/migrations/versions/455a24da8c58_oipc_txn_changes.py @@ -0,0 +1,50 @@ +"""empty message + +Revision ID: 455a24da8c58 +Revises: 3b399ca506fe +Create Date: 2023-11-15 12:31:33.274617 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = '455a24da8c58' +down_revision = '3b399ca506fe' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('FOIMinistryRequests', sa.Column('isoipcreview', sa.Boolean, nullable=True,default=False)) + op.create_table('FOIRequestOIPC', + sa.Column('oipcid', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('foiministryrequest_id', sa.Integer(), nullable=False), + sa.Column('foiministryrequestversion_id', sa.Integer(), nullable=False), + sa.Column('oipcno', sa.String(length=250), nullable=False), + sa.Column('investigator', sa.String(length=500), nullable=True), + sa.Column('reviewtypeid', sa.Integer(), nullable=False), + sa.Column('reasonid', sa.Integer(), nullable=False), + sa.Column('statusid', sa.Integer(), nullable=True), + sa.Column('outcomeid', sa.Integer(), nullable=True), + sa.Column('isinquiry', sa.Boolean(), nullable=True), + sa.Column('isjudicialreview', sa.Boolean(), nullable=True), + sa.Column('issubsequentappeal', sa.Boolean(), nullable=True), + sa.Column('inquiryattributes', sa.JSON, nullable=True), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('createdby', sa.String(length=120), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=True), + sa.Column('updatedby', sa.String(length=120), nullable=True), + sa.ForeignKeyConstraint(['foiministryrequest_id', 'foiministryrequestversion_id'], ['FOIMinistryRequests.foiministryrequestid', 'FOIMinistryRequests.version'], ), + sa.PrimaryKeyConstraint('oipcid') + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('FOIMinistryRequests', 'isoipcreview') + op.drop_table('FOIRequestOIPC') + # ### end Alembic commands ### diff --git a/request-management-api/request_api/models/FOIMinistryRequests.py b/request-management-api/request_api/models/FOIMinistryRequests.py index cd6e2a8e9..dfb5cfbf5 100644 --- a/request-management-api/request_api/models/FOIMinistryRequests.py +++ b/request-management-api/request_api/models/FOIMinistryRequests.py @@ -92,6 +92,10 @@ class FOIMinistryRequest(db.Model): "FOIMinistryRequest.version==FOIMinistryRequestDocument.foiministryrequestversion_id)") extensions = relationship('FOIRequestExtension', primaryjoin="and_(FOIMinistryRequest.foiministryrequestid==FOIRequestExtension.foiministryrequest_id, " "FOIMinistryRequest.version==FOIRequestExtension.foiministryrequestversion_id)") + + oipcreviews = relationship('FOIRequestOIPC', primaryjoin="and_(FOIMinistryRequest.foiministryrequestid==FOIRequestOIPC.foiministryrequest_id, " + "FOIMinistryRequest.version==FOIRequestOIPC.foiministryrequestversion_id)") + assignee = relationship('FOIAssignee', foreign_keys="[FOIMinistryRequest.assignedto]") ministryassignee = relationship('FOIAssignee', foreign_keys="[FOIMinistryRequest.assignedministryperson]") @@ -99,6 +103,8 @@ class FOIMinistryRequest(db.Model): "FOIMinistryRequest.version==FOIMinistryRequestSubjectCode.foiministryrequestversion)") isofflinepayment = db.Column(db.Boolean, unique=False, nullable=True,default=False) + isoipcreview = db.Column(db.Boolean, unique=False, nullable=True,default=False) + @classmethod def getrequest(cls,ministryrequestid): request_schema = FOIMinistryRequestSchema(many=False) @@ -1307,5 +1313,5 @@ class Meta: 'foirequest.receivedmodeid','requeststatus.requeststatusid','requeststatus.name','programarea.bcgovcode', 'programarea.name','foirequest_id','foirequestversion_id','created_at','updated_at','createdby','assignedministryperson', 'assignedministrygroup','cfrduedate','closedate','closereasonid','closereason.name', - 'assignee.firstname','assignee.lastname','ministryassignee.firstname','ministryassignee.lastname', 'axisrequestid', 'axissyncdate', 'requestpagecount', 'linkedrequests', 'ministrysignoffapproval', 'identityverified','originalldd') + 'assignee.firstname','assignee.lastname','ministryassignee.firstname','ministryassignee.lastname', 'axisrequestid', 'axissyncdate', 'requestpagecount', 'linkedrequests', 'ministrysignoffapproval', 'identityverified','originalldd','isoipcreview') diff --git a/request-management-api/request_api/models/FOIRequestOIPC.py b/request-management-api/request_api/models/FOIRequestOIPC.py new file mode 100644 index 000000000..1aacce9fd --- /dev/null +++ b/request-management-api/request_api/models/FOIRequestOIPC.py @@ -0,0 +1,47 @@ +from flask.app import Flask +from sqlalchemy.sql.schema import ForeignKey +from .db import db, ma +from datetime import datetime +from sqlalchemy.orm import relationship,backref +from .default_method_result import DefaultMethodResult +from sqlalchemy.dialects.postgresql import JSON, UUID +from sqlalchemy.sql.expression import distinct +from sqlalchemy import text, and_, func +import logging +import json +from sqlalchemy.dialects.postgresql import JSON, insert + +class FOIRequestOIPC(db.Model): + # Name of the table in our database + __tablename__ = 'FOIRequestOIPC' + # Defining the columns + oipcid = db.Column(db.Integer, primary_key=True,autoincrement=True) + foiministryrequest_id =db.Column(db.Integer, db.ForeignKey('FOIMinistryRequests.foiministryrequestid')) + foiministryrequestversion_id =db.Column(db.Integer, db.ForeignKey('FOIMinistryRequests.version')) + oipcno = db.Column(db.String(120), unique=False, nullable=True) + reviewtypeid = db.Column(db.Integer, unique=False, nullable=False) + reasonid = db.Column(db.Integer, unique=False, nullable=False) + statusid = db.Column(db.Integer, unique=False, nullable=True) + outcomeid = db.Column(db.Integer, unique=False, nullable=True) + isinquiry = db.Column(db.Boolean, unique=False, nullable=True) + inquiryattributes = db.Column(JSON, unique=False, nullable=True) + isjudicialreview = db.Column(db.Boolean, unique=False, nullable=True) + issubsequentappeal = db.Column(db.Boolean, unique=False, nullable=True) + investigator = db.Column(db.String(500), unique=False, nullable=True) + created_at = db.Column(db.DateTime, default=datetime.now) + createdby = db.Column(db.String(120), unique=False, nullable=False) + updated_at = db.Column(db.DateTime, nullable=True) + updatedby = db.Column(db.String(120), unique=False, nullable=True) + + + @classmethod + def getoipc(cls,ministryrequestid,ministryrequestversion): + oipc_schema = FOIRequestOIPCSchema(many=True) + _oipclist = db.session.query(FOIRequestOIPC).filter(FOIRequestOIPC.foiministryrequest_id == ministryrequestid , FOIRequestOIPC.foiministryrequestversion_id == ministryrequestversion).order_by(FOIRequestOIPC.oipcid.asc()).all() + divisioninfos = oipc_schema.dump(_oipclist) + return divisioninfos + + +class FOIRequestOIPCSchema(ma.Schema): + class Meta: + fields = ('oipcid', 'version', 'ministryrequestid', 'investigator','ministryversion','oipcno','reviewtypeid','reasonid','statusid','outcomeid','isinquiry','inquiryattributes','isjudicialreview','issubsequentappeal','isactive','created_at','createdby','updated_at','updatedby') \ No newline at end of file diff --git a/request-management-api/request_api/schemas/foirequestwrapper.py b/request-management-api/request_api/schemas/foirequestwrapper.py index efdb027ac..38a9ab1dc 100644 --- a/request-management-api/request_api/schemas/foirequestwrapper.py +++ b/request-management-api/request_api/schemas/foirequestwrapper.py @@ -53,6 +53,33 @@ class Meta: # pylint: disable=too-few-public-methods documentpath = fields.Str(data_key="documentpath",allow_none=False, validate=[validate.Length(max=1000, error=MAX_EXCEPTION_MESSAGE)]) filename = fields.Str(data_key="filename",allow_none=False, validate=[validate.Length(max=120, error=MAX_EXCEPTION_MESSAGE)]) category = fields.Str(data_key="category",allow_none=False, validate=[validate.Length(max=120, error=MAX_EXCEPTION_MESSAGE)]) + +class FOIOIPCInquirySchema(Schema): + class Meta: # pylint: disable=too-few-public-methods + """Exclude unknown fields in the deserialized output.""" + + unknown = EXCLUDE + inquirydate = fields.Str(data_key="inquirydate",allow_none=True) + orderno = fields.Str(data_key="orderno",allow_none=True) + inquiryoutcome = fields.Str(data_key="outcome",allow_none=True) + +class FOIMinistryRequestOIPCSchema(Schema): + class Meta: # pylint: disable=too-few-public-methods + """Exclude unknown fields in the deserialized output.""" + + unknown = EXCLUDE + oipcno = fields.Str(data_key="oipcno") + reviewtypeid = fields.Int(data_key="reviewtypeid") + reasonid = fields.Int(data_key="reasonid") + statusid = fields.Int(data_key="statusid") + outcomeid = fields.Int(data_key="outcomeid") + investigator = fields.Str(data_key="investigator",allow_none=True, validate=[validate.Length(max=500, error=MAX_EXCEPTION_MESSAGE)]) + isinquiry = fields.Bool(data_key="isinquiry") + isjudicialreview = fields.Bool(data_key="isjudicialreview") + issubsequentappeal = fields.Bool(data_key="issubsequentappeal") + inquiryattributes = fields.Nested(FOIOIPCInquirySchema, data_key="inquiryattributes", allow_none=True) + + class FOIRequestWrapperSchema(Schema): class Meta: # pylint: disable=too-few-public-methods @@ -110,6 +137,7 @@ class Meta: # pylint: disable=too-few-public-methods correctionalServiceNumber = fields.Str(data_key="correctionalServiceNumber",allow_none=True, validate=[validate.Length(max=50, error=MAX_EXCEPTION_MESSAGE)]) publicServiceEmployeeNumber = fields.Str(data_key="publicServiceEmployeeNumber",allow_none=True, validate=[validate.Length(max=50, error=MAX_EXCEPTION_MESSAGE)]) isiaorestricted = fields.Bool(data_key="isiaorestricted") + isoipcreview = fields.Bool(data_key="isoipcreview") selectedMinistries = fields.Nested(FOIMinistryRequestWrapperSchema, many=True) additionalPersonalInfo = fields.Nested(FOIAdditionallPersonalInfoWrapperSchema,required=False,allow_none=True) @@ -120,6 +148,8 @@ class Meta: # pylint: disable=too-few-public-methods linkedRequests = fields.List(fields.Dict(data_key="linkedRequests", required=False)) identityVerified = fields.Str(data_key="identityVerified",allow_none=True) + oipcdetails = fields.Nested(FOIMinistryRequestOIPCSchema, many=True,allow_none=True) + class EditableFOIMinistryRequestWrapperSchema(Schema): class Meta: # pylint: disable=too-few-public-methods diff --git a/request-management-api/request_api/services/external/keycloakadminservice.py b/request-management-api/request_api/services/external/keycloakadminservice.py index 5ec6af21e..3a632d34b 100644 --- a/request-management-api/request_api/services/external/keycloakadminservice.py +++ b/request-management-api/request_api/services/external/keycloakadminservice.py @@ -24,8 +24,8 @@ class KeycloakAdminService: def get_token(self): _accesstoken=None try: - cache_client = redis.from_url(self.cache_redis_url,decode_responses=True) - _accesstoken = cache_client.get("foi:kcsrcacnttoken") + #cache_client = redis.from_url(self.cache_redis_url,decode_responses=True) + _accesstoken = None #cache_client.get("foi:kcsrcacnttoken") if _accesstoken is None: url = '{0}/auth/realms/{1}/protocol/openid-connect/token'.format(self.keycloakhost,self.keycloakrealm) params = { @@ -38,11 +38,11 @@ def get_token(self): } x = requests.post(url, params, verify=True).content.decode('utf-8') _accesstoken = str(ast.literal_eval(x)['access_token']) - cache_client.set("foi:kcsrcacnttoken",_accesstoken,ex=int(self.kctokenexpiry)) + #cache_client.set("foi:kcsrcacnttoken",_accesstoken,ex=int(self.kctokenexpiry)) except BusinessException as exception: print("Error happened while accessing token on KeycloakAdminService {0}".format(exception.message)) - finally: - cache_client = None + # finally: + # cache_client = None return _accesstoken diff --git a/request-management-api/request_api/services/foirequest/requestservicebuilder.py b/request-management-api/request_api/services/foirequest/requestservicebuilder.py index 4f6db7aa5..790cbc540 100644 --- a/request-management-api/request_api/services/foirequest/requestservicebuilder.py +++ b/request-management-api/request_api/services/foirequest/requestservicebuilder.py @@ -8,6 +8,8 @@ from request_api.models.FOIRequestApplicants import FOIRequestApplicant from request_api.models.FOIRequestApplicantMappings import FOIRequestApplicantMapping from request_api.models.FOIRequestTeams import FOIRequestTeam +from request_api.models.FOIRequestOIPC import FOIRequestOIPC + from datetime import datetime as datetime2 from request_api.utils.enums import MinistryTeamWithKeycloackGroup from request_api.services.foirequest.requestserviceconfigurator import requestserviceconfigurator @@ -34,6 +36,10 @@ def createministry(self, requestschema, ministry, activeversion, userid, filenum foiministryrequest.linkedrequests = requestschema.get("linkedRequests") foiministryrequest.identityverified = requestschema.get("identityVerified") foiministryrequest.originalldd = requestschema.get("originalDueDate") + if requestschema.get("isoipcreview") is not None and requestschema.get("isoipcreview") != "": + foiministryrequest.isoipcreview = requestschema.get("isoipcreview") + foiministryrequest.oipcreviews = self.prepareoipc(requestschema, ministryid, activeversion, userid) + if requestschema.get("cfrDueDate") is not None and requestschema.get("cfrDueDate") != "": foiministryrequest.cfrduedate = requestschema.get("cfrDueDate") startdate = "" @@ -126,6 +132,31 @@ def createpersonalattribute(self, name, value,attributetypes, userid): personalattribute.attributevalue = value return personalattribute + def prepareoipc(self, requestschema, ministryrequestid, version, userid): + oipcarr = [] + if 'oipcdetails' in requestschema: + for oipc in requestschema['oipcdetails']: + oipcreview = FOIRequestOIPC() + oipcreview.foiministryrequest_id = ministryrequestid + oipcreview.foiministryrequestversion_id=version + oipcreview.oipcno = oipc["oipcno"] + oipcreview.reviewtypeid = oipc["reviewtypeid"] + oipcreview.reasonid = oipc["reasonid"] + oipcreview.statusid = oipc["statusid"] + oipcreview.outcomeid = oipc["outcomeid"] + oipcreview.investigator = oipc["investigator"] + oipcreview.isinquiry = oipc["isinquiry"] + oipcreview.isjudicialreview = oipc["isjudicialreview"] + oipcreview.issubsequentappeal = oipc["issubsequentappeal"] + oipcreview.issubsequentappeal = oipc["issubsequentappeal"] + oipcreview.isactive = True + if oipc["isinquiry"] == True: + oipcreview.inquiryattributes = oipc["inquiryattributes"] + oipcreview.createdby=userid + oipcreview.created_at= datetime2.now().isoformat() + oipcarr.append(oipcreview) + return oipcarr + def isNotBlankorNone(self, dataschema, key, location): if location == "main": diff --git a/request-management-api/request_api/services/foirequest/requestservicegetter.py b/request-management-api/request_api/services/foirequest/requestservicegetter.py index e5ae2c249..d3fedf68b 100644 --- a/request-management-api/request_api/services/foirequest/requestservicegetter.py +++ b/request-management-api/request_api/services/foirequest/requestservicegetter.py @@ -8,6 +8,7 @@ from request_api.models.FOIRequestApplicantMappings import FOIRequestApplicantMapping from request_api.models.FOIMinistryRequestSubjectCodes import FOIMinistryRequestSubjectCode from request_api.models.FOIRestrictedMinistryRequests import FOIRestrictedMinistryRequest +from request_api.models.FOIRequestOIPC import FOIRequestOIPC from dateutil.parser import parse from request_api.services.cfrfeeservice import cfrfeeservice from request_api.services.paymentservice import paymentservice @@ -165,6 +166,8 @@ def __preparebaseinfo(self,request,foiministryrequestid,requestministry,requestm 'assignedministryperson':requestministry["assignedministryperson"], 'selectedMinistries':[{'code':requestministry['programarea.bcgovcode'],'id':requestministry['foiministryrequestid'],'name':requestministry['programarea.name'],'selected':'true'}], 'divisions': self.getdivisions(requestministrydivisions), + 'isoipcreview': requestministry['isoipcreview'], + 'oipcdetails': self.getoipcdetails(foiministryrequestid, requestministry['version']), 'onholdTransitionDate': self.getonholdtransition(foiministryrequestid), 'stateTransition': FOIMinistryRequest.getstatesummary(foiministryrequestid), 'assignedToFirstName': requestministry["assignee.firstname"] if requestministry["assignedto"] != None else None, @@ -208,6 +211,29 @@ def getdivisions(self, ministrydivisions): divisions.append(division) return divisions + def getoipcdetails(self, ministryrequestid, ministryrequestversion): + oipcdetails = [] + _oipclist = FOIRequestOIPC.getoipc(ministryrequestid, ministryrequestversion) + if _oipclist is not None: + for entry in _oipclist: + oipc = { + "oipcid": entry["oipcid"], + "reviewtypeid": entry["reviewtypeid"], + "reasonid": entry["reasonid"], + "statusid": entry["statusid"], + "outcomeid": entry["outcomeid"], + "investigator": entry["investigator"], + "isinquiry": entry["isinquiry"], + "isjudicialreview": entry["isjudicialreview"], + "issubsequentappeal": entry["issubsequentappeal"], + "inquiryattributes": entry["inquiryattributes"], + "createdby": entry["createdby"], + "created_at": parse(entry["created_at"]).strftime(self.__genericdateformat()) + } + oipcdetails.append(oipc) + return oipcdetails + + def getonholdtransition(self, foiministryrequestid): onholddate = None From 2758073ea955dc9a6ec5b1277554634b4af279cd Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Fri, 17 Nov 2023 15:57:51 -0800 Subject: [PATCH 11/82] OIPCData form/state management WIP --- .../FOIRequest/OIPCDetails/AddOIPCButton.jsx | 0 .../FOI/FOIRequest/OIPCDetails/Index.jsx | 18 ++++++-- .../OIPCDetails/OIPCDetailsList.jsx | 4 +- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 42 +++++++++++++++---- 4 files changed, 52 insertions(+), 12 deletions(-) delete mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AddOIPCButton.jsx diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AddOIPCButton.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AddOIPCButton.jsx deleted file mode 100644 index e69de29bb..000000000 diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx index 74f373ad8..f1daadc5d 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx @@ -13,7 +13,6 @@ const OIPCDetails = (props) => { const [oipcData, setOipcData] = useState([ { oipcNumber: "F23-12345", reviewType: "Complaint", reason: "Deemed Refusal", status: "Inquiry", isInquiry: false, inquiryDate: null, receivedDate: "05-08-2022", investigator: "Filip Forsberg", outcome: "Withdrawn", isJudicalReview: false, isSubAppeal: false }, { oipcNumber: "F23-12346", reviewType: "Review", reason: "Other", status: "Mediation", isInquiry: false, inquiryDate: null, receivedDate: "09-08-2022", investigator: "Peter Forsberg", outcome: "Closed", isJudicalReview: false, isSubAppeal: true }, - { oipcNumber: "F23-12347", reviewType: "Investigation", reason: "TPN-21", status: "Awaiting Order", isInquiry: false, inquiryDate: null, receivedDate: "11-08-2022", investigator: "Quinn Hughes", outcome: "Abandoned", isJudicalReview: true, isSubAppeal: true } ]); const useStyles = makeStyles({ heading: { @@ -47,12 +46,25 @@ const OIPCDetails = (props) => { }) } //Function to Remove an OIPC - const removeOIPC = (oipcNo) => { + const removeOIPC = (oipcNo, index) => { setOipcData((prev) => { const previousOIPCData = [...prev]; return previousOIPCData.filter(oipc => oipcNo !== oipc.oipcNumber); }); } + //Function to Update an OIPC + const updateOIPC = (newOIPCObj, index) => { + setOipcData((prev) => { + const previousOIPCData = [...prev]; + return previousOIPCData.map((oipc) => { + if (oipc.oipcNumber === newOIPCObj.oipcNumber) { + return newOIPCObj; + } else { + return oipc; + } + }); + }); + } return (
@@ -61,7 +73,7 @@ const OIPCDetails = (props) => { OIPC Details - +
- + {index !== (oipcData.length - 1) && } ); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 33f45b539..f8fc20cd6 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -2,9 +2,7 @@ import { TextField, FormControlLabel, MenuItem, Grid, Checkbox } from '@material import { useState } from "react"; const OIPCItem = (props) => { - const {oipcObj} = props; - - console.log(oipcObj); + const {oipcObj, updateOIPC} = props; const [oipc, setOipc] = useState({ oipcNumber: oipcObj?.oipcNumber, @@ -20,9 +18,40 @@ const OIPCItem = (props) => { isJudicalReview: oipcObj?.isJudicalReview, isSubAppeal: oipcObj?.isSubAppeal, }); + + console.log(oipcObj); - const handleReviewType = () => { - console.log("BANG") + const handleReviewType = (value) => { + const newOIPCObj = oipc; + newOIPCObj.reviewType = value; + updateOIPC(newOIPCObj); + } + const handleOIPCNumber = (event) => { + console.log("BANG"); + } + const handleReceivedDate = (event) => { + console.log("BANG"); + } + const handleReason = (event) => { + console.log("BANG"); + } + const handleStatus = (event) => { + console.log("BANG"); + } + const handleInvestiagtor = (event) => { + console.log("BANG"); + } + const handleOutcome = (event) => { + console.log("BANG"); + } + const handleInquiry = (event) => { + console.log("BANG"); + } + const handleJudicalReview = (event) => { + console.log("BANG"); + } + const handleSubsequentAppeal = (event) => { + console.log("BANG"); } return ( @@ -61,7 +90,7 @@ const OIPCItem = (props) => { fullWidth value={oipc.reviewType} label="Review Type" - onChange={handleReviewType} + onChange={(event) => handleReviewType(event.target.value)} required={true} > Complaint @@ -137,7 +166,6 @@ const OIPCItem = (props) => { fullWidth value={oipc.outcome} label="Outcome" - onChange={handleReviewType} required={true} > Abandoned From aa653200abdcdaf12c87eb120e184cc528e43023 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Mon, 20 Nov 2023 14:57:34 -0800 Subject: [PATCH 12/82] WIP Integration of BE + Inquiry Story + Saving of OIPC to BE + validation --- .../FOI/FOIRequest/OIPCDetails/Index.jsx | 34 +++-- .../OIPCDetails/OIPCDetailsList.jsx | 2 +- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 136 +++++++++++------- 3 files changed, 103 insertions(+), 69 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx index f1daadc5d..d84b76fcc 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx @@ -10,10 +10,19 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faCirclePlus } from '@fortawesome/free-solid-svg-icons'; const OIPCDetails = (props) => { - const [oipcData, setOipcData] = useState([ - { oipcNumber: "F23-12345", reviewType: "Complaint", reason: "Deemed Refusal", status: "Inquiry", isInquiry: false, inquiryDate: null, receivedDate: "05-08-2022", investigator: "Filip Forsberg", outcome: "Withdrawn", isJudicalReview: false, isSubAppeal: false }, - { oipcNumber: "F23-12346", reviewType: "Review", reason: "Other", status: "Mediation", isInquiry: false, inquiryDate: null, receivedDate: "09-08-2022", investigator: "Peter Forsberg", outcome: "Closed", isJudicalReview: false, isSubAppeal: true }, - ]); + const createOIPCId = (oipcData) => { + if (oipcData.length > 0) { + return oipcData.map((item, index) => { + item.id = index; + return item; + }); + } + } + const [oipcData, setOipcData] = useState(createOIPCId([ + { oipcNumber: "F23-12345", reviewType: "Complaint", reason: "Extension", status: "Inquiry", isInquiry: false, inquiryDate: null, receivedDate: "2022-05-08", investigator: "Filip Forsberg", outcome: "Withdrawn", isJudicalReview: false, isSubAppeal: false }, + { oipcNumber: "F23-12346", reviewType: "Review", reason: "Other", status: "Mediation", isInquiry: false, inquiryDate: null, receivedDate: "2022-09-08", investigator: "Peter Forsberg", outcome: "Closed", isJudicalReview: false, isSubAppeal: true }, + ])); + const useStyles = makeStyles({ heading: { color: '#FFF', @@ -26,18 +35,17 @@ const OIPCDetails = (props) => { }); const classes = useStyles(); - //Function to Add an OIPC + //Functions const addOIPC = () => { setOipcData((prev) => { return [...prev, { + id: oipcData.length > 0 ? oipcData[oipcData.length - 1].id + 1 : 0, oipcNumber: "", reviewType: "", reason: "", status: "", isInquiry: false, - inquiryDate: null, receivedDate: "", - complyDate: "", investigator: "", outcome: "", isJudicalReview: false, @@ -45,19 +53,17 @@ const OIPCDetails = (props) => { }]; }) } - //Function to Remove an OIPC - const removeOIPC = (oipcNo, index) => { + const removeOIPC = (oipcId) => { setOipcData((prev) => { const previousOIPCData = [...prev]; - return previousOIPCData.filter(oipc => oipcNo !== oipc.oipcNumber); + return previousOIPCData.filter(oipc => oipcId !== oipc.id); }); } - //Function to Update an OIPC - const updateOIPC = (newOIPCObj, index) => { + const updateOIPC = (newOIPCObj) => { setOipcData((prev) => { const previousOIPCData = [...prev]; return previousOIPCData.map((oipc) => { - if (oipc.oipcNumber === newOIPCObj.oipcNumber) { + if (oipc.oipcId === newOIPCObj.oipcId) { return newOIPCObj; } else { return oipc; @@ -70,7 +76,7 @@ const OIPCDetails = (props) => {
}> - OIPC Details + OIPC DETAILS diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index 7183448a2..e3c8ac499 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -12,7 +12,7 @@ const OIPCDetailsList = (props) => { return ( <>
-
diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index f8fc20cd6..7d42ae1c3 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -1,5 +1,7 @@ import { TextField, FormControlLabel, MenuItem, Grid, Checkbox } from '@material-ui/core'; import { useState } from "react"; +import { formatDate } from "../../../../helper/FOI/helper"; + const OIPCItem = (props) => { const {oipcObj, updateOIPC} = props; @@ -10,9 +12,7 @@ const OIPCItem = (props) => { reason: oipcObj?.reason, status: oipcObj?.status, isInquiry: oipcObj?.isInquiry, - inquiryDate: null, receivedDate: oipcObj?.receivedDate, - complyDate: oipcObj?.complyDate, investigator: oipcObj?.investigator, outcome: oipcObj?.outcome, isJudicalReview: oipcObj?.isJudicalReview, @@ -22,38 +22,51 @@ const OIPCItem = (props) => { console.log(oipcObj); const handleReviewType = (value) => { - const newOIPCObj = oipc; - newOIPCObj.reviewType = value; - updateOIPC(newOIPCObj); + updateOIPC({...oipc, reviewType: value, reason: ""}); + } + const handleOIPCNumber = (value) => { + updateOIPC({...oipc, oipcNumber: value}); } - const handleOIPCNumber = (event) => { - console.log("BANG"); + const handleReceivedDate = (value) => { + updateOIPC({...oipc, receivedDate: value}); } - const handleReceivedDate = (event) => { - console.log("BANG"); + const handleReason = (value) => { + updateOIPC({...oipc, reason: value}); } - const handleReason = (event) => { - console.log("BANG"); + const handleStatus = (value) => { + updateOIPC({...oipc, status: value}); } - const handleStatus = (event) => { - console.log("BANG"); + const handleInvestiagtor = (value) => { + updateOIPC({...oipc, investigator: value}); } - const handleInvestiagtor = (event) => { - console.log("BANG"); + const handleOutcome = (value) => { + updateOIPC({...oipc, outcome: value}); } - const handleOutcome = (event) => { - console.log("BANG"); + const handleInquiry = (value) => { + updateOIPC({...oipc, isInquiry: value}); } - const handleInquiry = (event) => { - console.log("BANG"); + const handleJudicalReview = (value) => { + updateOIPC({...oipc, isJudicalReview: value}); } - const handleJudicalReview = (event) => { - console.log("BANG"); + const handleSubsequentAppeal = (value) => { + updateOIPC({...oipc, isSubAppeal: value}); } - const handleSubsequentAppeal = (event) => { - console.log("BANG"); + //REFACTOR THIS!!! + const filterReasonOptions = (reviewType) => { + if (reviewType === "Complaint") { + return ["Adequate search","Extension", "Fee Amount", "Fee Waiver", "Duty to Assist", "Other"]; + } + if (reviewType === "Review") { + return ["Application of Exceptions", "Deemed Refusal", "TPN - 22", "TPN - 21", "TPN - 18.1", "Reg 3", "Reg 4", "Reg 5", "s. 43", "Other"]; + } + if (reviewType === "Investigation") { + return ["Other"] + } + return ["Adequate search","Extension", "Fee Amount", "Fee Waiver", "Duty to Assist", "Application of Exceptions", "Deemed Refusal", "TPN - 22", "TPN - 21", "TPN - 18.1", "Reg 3", "Reg 4", "Reg 5", "s. 43", "Other"]; } + const reasons = filterReasonOptions(oipc.reviewType) + return ( <> @@ -64,7 +77,7 @@ const OIPCItem = (props) => { variant="outlined" required={true} value={oipc.oipcNumber} - // input={} + onChange = {(event) => handleOIPCNumber(event.target.value)} InputLabelProps={{ shrink: true }} /> @@ -75,17 +88,16 @@ const OIPCItem = (props) => { variant="outlined" required={true} value={oipc.receivedDate} - // input={} + onChange = {(event) => handleReceivedDate(event.target.value)} InputLabelProps={{ shrink: true }} + InputProps={{inputProps: { max: oipc.receivedDate || formatDate(new Date())} }} type="date" - InputProps={{inputProps: { max: new Date()} }} /> } variant="outlined" fullWidth value={oipc.reviewType} @@ -102,42 +114,27 @@ const OIPCItem = (props) => { } variant="outlined" fullWidth value={oipc.reason} label="Reason" - onChange={handleReviewType} + onChange = {(event) => handleReason(event.target.value)} required={true} > - Adequate search - Application of Exceptions - Deemed Refusal - Extension - Fee Amount - Fee Waiver - Records do Not Exist - Duty to Assist - TPN - 22 - TPN - 21 - TPN - 18.1 - Reg 3 - Reg 4 - Reg 5 - s. 43 - Other + {reasons.map((reason) => { + return {reason} + })} } variant="outlined" fullWidth value={oipc.status} label="Status" - onChange={handleReviewType} + onChange = {(event) => handleStatus(event.target.value)} required={true} > Mediation @@ -153,6 +150,7 @@ const OIPCItem = (props) => { label="Investigator/Adjudicator" variant="outlined" required={true} + onChange = {(event) => handleInvestiagtor(event.target.value)} value={oipc.investigator} InputLabelProps={{ shrink: true }} /> @@ -161,8 +159,8 @@ const OIPCItem = (props) => { } variant="outlined" + onChange = {(event) => handleOutcome(event.target.value)} fullWidth value={oipc.outcome} label="Outcome" @@ -178,18 +176,48 @@ const OIPCItem = (props) => {

In Inquiry?

- } label="Yes" /> - } label="No" /> + handleInquiry(true)} + />} + label="Yes" + /> + handleInquiry(false)} + />} + label="No" + />

In Judicial Review?

- } label="Yes" /> - } label="No" /> + handleJudicalReview(true)} + />} + label="Yes" + /> + handleJudicalReview(false)} + />} + label="No" + />

In Subsequent Appeal?

- } label="Yes" /> - } label="No" /> + handleSubsequentAppeal(true)} + />} + label="Yes" + /> + handleSubsequentAppeal(false)} + />} + label="No" + />
From 04ae6a42031bd6e8e62ced3e251e9326ce5bd3bd Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Mon, 20 Nov 2023 15:27:44 -0800 Subject: [PATCH 13/82] Small code changes / fixes --- forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js | 4 +++- .../src/components/FOI/FOIRequest/OIPCDetails/Index.jsx | 4 +++- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 26a40787d..10c384bc8 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -1210,7 +1210,9 @@ const FOIRequest = React.memo(({ userDetail }) => { /> )} {showOIPCDetails && ( - + )} { + //Local State const createOIPCId = (oipcData) => { if (oipcData.length > 0) { return oipcData.map((item, index) => { @@ -23,6 +24,7 @@ const OIPCDetails = (props) => { { oipcNumber: "F23-12346", reviewType: "Review", reason: "Other", status: "Mediation", isInquiry: false, inquiryDate: null, receivedDate: "2022-09-08", investigator: "Peter Forsberg", outcome: "Closed", isJudicalReview: false, isSubAppeal: true }, ])); + //Styling const useStyles = makeStyles({ heading: { color: '#FFF', @@ -63,7 +65,7 @@ const OIPCDetails = (props) => { setOipcData((prev) => { const previousOIPCData = [...prev]; return previousOIPCData.map((oipc) => { - if (oipc.oipcId === newOIPCObj.oipcId) { + if (oipc.id === newOIPCObj.id) { return newOIPCObj; } else { return oipc; diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 7d42ae1c3..dc1e6ba8e 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -60,12 +60,12 @@ const OIPCItem = (props) => { return ["Application of Exceptions", "Deemed Refusal", "TPN - 22", "TPN - 21", "TPN - 18.1", "Reg 3", "Reg 4", "Reg 5", "s. 43", "Other"]; } if (reviewType === "Investigation") { - return ["Other"] + return ["Other"]; } return ["Adequate search","Extension", "Fee Amount", "Fee Waiver", "Duty to Assist", "Application of Exceptions", "Deemed Refusal", "TPN - 22", "TPN - 21", "TPN - 18.1", "Reg 3", "Reg 4", "Reg 5", "s. 43", "Other"]; } - const reasons = filterReasonOptions(oipc.reviewType) + const reasons = filterReasonOptions(oipc.reviewType); return ( <> From d745a3e6c338abc31ae55eca56c21359f869acbf Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Mon, 20 Nov 2023 15:58:39 -0800 Subject: [PATCH 14/82] Backend changes for oipcreview --- .../request_api/models/FOIMinistryRequests.py | 7 +++++-- .../request_api/models/FOIRawRequests.py | 3 ++- .../request_api/services/dashboardservice.py | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/request-management-api/request_api/models/FOIMinistryRequests.py b/request-management-api/request_api/models/FOIMinistryRequests.py index dfb5cfbf5..7f203d8d0 100644 --- a/request-management-api/request_api/models/FOIMinistryRequests.py +++ b/request-management-api/request_api/models/FOIMinistryRequests.py @@ -364,7 +364,7 @@ def getrequestssubquery(cls, groups, filterfields, keyword, additionalfilter, us if(len(filterfields) > 0 and keyword is not None): filtercondition = [] - if(keyword != "restricted"): + if(keyword != "restricted" and keyword.lower() != "oipc"): for field in filterfields: filtercondition.append(FOIMinistryRequest.findfield(field, iaoassignee, ministryassignee).ilike('%'+keyword+'%')) else: @@ -372,6 +372,8 @@ def getrequestssubquery(cls, groups, filterfields, keyword, additionalfilter, us filtercondition.append(FOIRestrictedMinistryRequest.isrestricted == True) else: filtercondition.append(ministry_restricted_requests.isrestricted == True) + if (keyword.lower() == "oipc"): + filtercondition.append(FOIMinistryRequest.isoipcreview == True) intakesorting = case([ (and_(FOIMinistryRequest.assignedto == None, FOIMinistryRequest.assignedgroup == 'Intake Team'), # Unassigned requests first @@ -488,7 +490,8 @@ def getrequestssubquery(cls, groups, filterfields, keyword, additionalfilter, us extensions, FOIRestrictedMinistryRequest.isrestricted.label('isiaorestricted'), ministry_restricted_requests.isrestricted.label('isministryrestricted'), - SubjectCode.name.label('subjectcode') + SubjectCode.name.label('subjectcode'), + FOIMinistryRequest.isoipcreview.label('isoipcreview') ] basequery = _session.query( diff --git a/request-management-api/request_api/models/FOIRawRequests.py b/request-management-api/request_api/models/FOIRawRequests.py index 9a0169647..cedb898b5 100644 --- a/request-management-api/request_api/models/FOIRawRequests.py +++ b/request-management-api/request_api/models/FOIRawRequests.py @@ -570,7 +570,8 @@ def getbasequery(cls, additionalfilter=None, userid=None, isiaorestrictedfileman literal(None).label('extensions'), isiaorestricted, literal(None).label('isministryrestricted'), - subjectcode + subjectcode, + literal(None).label('isoipcreview') ] basequery = _session.query(*selectedcolumns).join(subquery_maxversion, and_(*joincondition)).join(FOIAssignee, FOIAssignee.username == FOIRawRequest.assignedto, isouter=True) diff --git a/request-management-api/request_api/services/dashboardservice.py b/request-management-api/request_api/services/dashboardservice.py index ba2f913d1..5a89ac3c6 100644 --- a/request-management-api/request_api/services/dashboardservice.py +++ b/request-management-api/request_api/services/dashboardservice.py @@ -50,6 +50,8 @@ def __preparefoirequestinfo(self, request, receiveddate, receiveddateuf, idnumbe baserequestinfo.update({'onBehalfFirstName': request.onBehalfFirstName}) baserequestinfo.update({'onBehalfLastName': request.onBehalfLastName}) baserequestinfo.update({'requestPageCount': request.requestPageCount}) + isoipcreview = request.isoipcreview if request.isoipcreview == True else False + baserequestinfo.update({'isoipcreview': isoipcreview}) return baserequestinfo def __preparebaserequestinfo(self, id, requesttype, status, receiveddate, receiveddateuf, assignedgroup, assignedto, idnumber, axisrequestid, version, description, fromdate, todate): @@ -148,6 +150,8 @@ def getministryrequestqueuepagination (self, groups=None, page=1, size=10, sorti isministryrestricted = request.isministryrestricted if request.isministryrestricted == True else False _openrequest.update({'isministryrestricted': isministryrestricted}) + isoipcreview = request.isoipcreview if request.isoipcreview == True else False + _openrequest.update({'isoipcreview': isoipcreview}) requestqueue.append(_openrequest) meta = { From 59842f081d3bcb542c01e8718796570c8728a348 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Mon, 20 Nov 2023 15:59:02 -0800 Subject: [PATCH 15/82] Frontend changes for OIPC review --- .../components/FOI/Dashboard/IAO/columns.js | 26 +++++++----- .../FOI/Dashboard/Ministry/Queue.js | 16 ++++--- .../components/FOI/Dashboard/dashboard.scss | 21 +++++++++- .../src/components/FOI/Dashboard/utils.js | 42 ++++++++++++++++++- 4 files changed, 84 insertions(+), 21 deletions(-) diff --git a/forms-flow-web/src/components/FOI/Dashboard/IAO/columns.js b/forms-flow-web/src/components/FOI/Dashboard/IAO/columns.js index 4cb4166be..213b3dd1d 100644 --- a/forms-flow-web/src/components/FOI/Dashboard/IAO/columns.js +++ b/forms-flow-web/src/components/FOI/Dashboard/IAO/columns.js @@ -5,6 +5,7 @@ import { // onBehalfFullName, displayIcon, displayHeaderIcon, + displayQueueFlagIcons, cellTooltipRender } from "../utils"; import { @@ -15,6 +16,15 @@ import { } from "../../../../helper/FOI/helper"; const ProcessingTeamColumns = [ + { + field: "flags", + // renderHeader: displayHeaderIcon, + headerName: "FLAGS", + headerAlign: "left", + renderCell: displayQueueFlagIcons, + // cellClassName: 'foi-dashboard-', + // flex: 1, + }, { field: "axisRequestId", headerName: "ID NUMBER", @@ -89,12 +99,10 @@ const ProcessingTeamColumns = [ const IntakeTeamColumns = [ { - field: "isiaorestricted", - renderHeader: displayHeaderIcon, + field: "flags", + headerName: "FLAGS", headerAlign: "left", - renderCell:displayIcon, - cellClassName: 'foi-dashboard-restricted', - width: 60, + renderCell: displayQueueFlagIcons, }, { field: "axisRequestId", @@ -161,12 +169,10 @@ const IntakeTeamColumns = [ const FlexTeamColumns = [ { - field: "isiaorestricted", - renderHeader: displayHeaderIcon, + field: "flags", + headerName: "FLAGS", headerAlign: "left", - renderCell:displayIcon, - cellClassName: 'foi-dashboard-restricted', - width: 60, + renderCell: displayQueueFlagIcons, }, { field: "axisRequestId", diff --git a/forms-flow-web/src/components/FOI/Dashboard/Ministry/Queue.js b/forms-flow-web/src/components/FOI/Dashboard/Ministry/Queue.js index 7f775e9bb..33980929a 100644 --- a/forms-flow-web/src/components/FOI/Dashboard/Ministry/Queue.js +++ b/forms-flow-web/src/components/FOI/Dashboard/Ministry/Queue.js @@ -6,7 +6,7 @@ import { useDispatch, useSelector } from "react-redux"; import { push } from "connected-react-router"; import { fetchFOIMinistryRequestListByPage } from "../../../../apiManager/services/FOI/foiRequestServices"; import Loading from "../../../../containers/Loading"; -import { debounce, ClickableChip, displayIconMinistry, displayHeaderIcon, cellTooltipRender } from "../utils"; +import { debounce, ClickableChip, displayRestrictedIconMinistry, displayOipcReviewIconMinistry, displayPhasedReleaseIconMinistry, displayHeaderIcon, cellTooltipRender, displayQueueFlagIcons } from "../utils"; import Grid from "@mui/material/Grid"; import Stack from "@mui/material/Stack"; import SearchIcon from "@material-ui/icons/Search"; @@ -112,6 +112,12 @@ const Queue = ({ userDetail, tableInfo }) => { } const columns = React.useRef([ + { + field: "flags", + headerName: "FLAGS", + headerAlign: "left", + renderCell: displayQueueFlagIcons, + }, { field: "axisRequestId", headerName: "ID NUMBER", @@ -165,14 +171,6 @@ const Queue = ({ userDetail, tableInfo }) => { width: 0, hide: true, renderCell: (_params) => , - }, - { - field: "isministryrestricted", - renderHeader: displayHeaderIcon, - headerAlign: "left", - renderCell: displayIconMinistry, - cellClassName: 'foi-dashboard-restricted', - flex: 1, } ]); diff --git a/forms-flow-web/src/components/FOI/Dashboard/dashboard.scss b/forms-flow-web/src/components/FOI/Dashboard/dashboard.scss index 92123f7a5..1cf6da99d 100644 --- a/forms-flow-web/src/components/FOI/Dashboard/dashboard.scss +++ b/forms-flow-web/src/components/FOI/Dashboard/dashboard.scss @@ -246,9 +246,28 @@ nav.MuiPagination-root { padding-right: 15px !important; } -.foi-dashboard-restricted { +.dashboard-flag-restricted { font-size: 10px; color: #A0192F; + padding: 2px; +} + +.dashboard-flag-oipcreview { + font-size: 10px; + color: #fa7c16; + padding: 2px; +} + +.dashboard-flag-phasedrelease { + font-size: 10px; + color: #9207b7; + padding: 2px; +} + +.dashboard-flag-placeholder { + font-size: 10px; + color: #c1bfbf; + padding: 2px; } .table-cell-truncate { diff --git a/forms-flow-web/src/components/FOI/Dashboard/utils.js b/forms-flow-web/src/components/FOI/Dashboard/utils.js index 0bb6d1a6a..a363e303e 100644 --- a/forms-flow-web/src/components/FOI/Dashboard/utils.js +++ b/forms-flow-web/src/components/FOI/Dashboard/utils.js @@ -219,9 +219,49 @@ export const displayIconMinistry = (params) => { ); }; +export const displayQueueFlagIcons = (params) => { + let restricted = + + if (params?.row?.isiaorestricted || params?.row?.isministryrestricted) { + restricted = + Restricted +
+ }> + + + } else { + restricted = + } + + const oipcreview = params?.row?.isoipcreview ? + + OIPC +
+ }> + : + + + const phasedrelease = params?.row?.isphasedrelease ? + + Phased Release + + }> + : + + + return
+ {restricted} + {oipcreview} + {/* {phasedrelease} */} +
+} + export const displayHeaderIcon = (params) => { return ( - + ); }; From e00f1b7a5fb8e8abba7ffb680a539fa30af371dd Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Mon, 20 Nov 2023 16:00:38 -0800 Subject: [PATCH 16/82] State mgmt code fixes --- .../OIPCDetails/OIPCDetailsList.jsx | 4 +- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 47 ++++++++++++++----- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index e3c8ac499..5d5e4bdf1 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -6,7 +6,7 @@ import { faTrash } from '@fortawesome/free-solid-svg-icons'; const OIPCDetailsList = (props) => { const {oipcData, removeOIPC, updateOIPC} = props; - console.log("TEST THIS", oipcData); + console.log("ARRAY", oipcData); const OIPCItems = oipcData?.map((oipcObj, index) => { return ( @@ -16,7 +16,7 @@ const OIPCDetailsList = (props) => { - + {index !== (oipcData.length - 1) && } ); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index dc1e6ba8e..1c0212009 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -7,11 +7,13 @@ const OIPCItem = (props) => { const {oipcObj, updateOIPC} = props; const [oipc, setOipc] = useState({ + id: oipcObj?.id, oipcNumber: oipcObj?.oipcNumber, reviewType: oipcObj?.reviewType, reason: oipcObj?.reason, status: oipcObj?.status, isInquiry: oipcObj?.isInquiry, + inquiryDate: null, receivedDate: oipcObj?.receivedDate, investigator: oipcObj?.investigator, outcome: oipcObj?.outcome, @@ -22,34 +24,55 @@ const OIPCItem = (props) => { console.log(oipcObj); const handleReviewType = (value) => { - updateOIPC({...oipc, reviewType: value, reason: ""}); + const newOIPCObj = oipc; + newOIPCObj.reviewType = value; + newOIPCObj.reason = ""; + updateOIPC(newOIPCObj); } const handleOIPCNumber = (value) => { - updateOIPC({...oipc, oipcNumber: value}); + const newOIPCObj = oipc; + newOIPCObj.oipcNumber = value; + updateOIPC(newOIPCObj); } const handleReceivedDate = (value) => { - updateOIPC({...oipc, receivedDate: value}); + const newOIPCObj = oipc; + newOIPCObj.receivedDate = value; + updateOIPC(newOIPCObj); } const handleReason = (value) => { - updateOIPC({...oipc, reason: value}); + const newOIPCObj = oipc; + newOIPCObj.reason = value; + updateOIPC(newOIPCObj); } const handleStatus = (value) => { - updateOIPC({...oipc, status: value}); + const newOIPCObj = oipc; + newOIPCObj.status = value; + updateOIPC(newOIPCObj); } const handleInvestiagtor = (value) => { - updateOIPC({...oipc, investigator: value}); + const newOIPCObj = oipc; + newOIPCObj.investigator = value; + updateOIPC(newOIPCObj); } const handleOutcome = (value) => { - updateOIPC({...oipc, outcome: value}); + const newOIPCObj = oipc; + newOIPCObj.outcome = value; + updateOIPC(newOIPCObj); } const handleInquiry = (value) => { - updateOIPC({...oipc, isInquiry: value}); + const newOIPCObj = oipc; + newOIPCObj.isInquiry = value; + updateOIPC(newOIPCObj); } const handleJudicalReview = (value) => { - updateOIPC({...oipc, isJudicalReview: value}); + const newOIPCObj = oipc; + newOIPCObj.isJudicalReview = value; + updateOIPC(newOIPCObj); } const handleSubsequentAppeal = (value) => { - updateOIPC({...oipc, isSubAppeal: value}); + const newOIPCObj = oipc; + newOIPCObj.isSubAppeal = value; + updateOIPC(newOIPCObj); } //REFACTOR THIS!!! const filterReasonOptions = (reviewType) => { @@ -60,12 +83,12 @@ const OIPCItem = (props) => { return ["Application of Exceptions", "Deemed Refusal", "TPN - 22", "TPN - 21", "TPN - 18.1", "Reg 3", "Reg 4", "Reg 5", "s. 43", "Other"]; } if (reviewType === "Investigation") { - return ["Other"]; + return ["Other"] } return ["Adequate search","Extension", "Fee Amount", "Fee Waiver", "Duty to Assist", "Application of Exceptions", "Deemed Refusal", "TPN - 22", "TPN - 21", "TPN - 18.1", "Reg 3", "Reg 4", "Reg 5", "s. 43", "Other"]; } - const reasons = filterReasonOptions(oipc.reviewType); + const reasons = filterReasonOptions(oipc.reviewType) return ( <> From a37f06a21d4c8640193cf73dca3959bd50299b3c Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 21 Nov 2023 09:48:09 -0800 Subject: [PATCH 17/82] Remove unused imports --- forms-flow-web/src/components/FOI/Dashboard/Ministry/Queue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/Dashboard/Ministry/Queue.js b/forms-flow-web/src/components/FOI/Dashboard/Ministry/Queue.js index 33980929a..a8b92a7ac 100644 --- a/forms-flow-web/src/components/FOI/Dashboard/Ministry/Queue.js +++ b/forms-flow-web/src/components/FOI/Dashboard/Ministry/Queue.js @@ -6,7 +6,7 @@ import { useDispatch, useSelector } from "react-redux"; import { push } from "connected-react-router"; import { fetchFOIMinistryRequestListByPage } from "../../../../apiManager/services/FOI/foiRequestServices"; import Loading from "../../../../containers/Loading"; -import { debounce, ClickableChip, displayRestrictedIconMinistry, displayOipcReviewIconMinistry, displayPhasedReleaseIconMinistry, displayHeaderIcon, cellTooltipRender, displayQueueFlagIcons } from "../utils"; +import { debounce, ClickableChip, cellTooltipRender, displayQueueFlagIcons } from "../utils"; import Grid from "@mui/material/Grid"; import Stack from "@mui/material/Stack"; import SearchIcon from "@material-ui/icons/Search"; From 0181105e732ae1d2543de481f028f512326f486f Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Tue, 21 Nov 2023 16:25:39 -0800 Subject: [PATCH 18/82] Changes to include descriptive value for masterdata + new date inlusion. --- .../versions/455a24da8c58_oipc_txn_changes.py | 6 ++++++ .../request_api/models/FOIRequestOIPC.py | 18 +++++++++++++----- .../request_api/schemas/foirequestwrapper.py | 3 ++- .../foirequest/requestservicebuilder.py | 2 ++ .../foirequest/requestservicegetter.py | 6 ++++++ 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/request-management-api/migrations/versions/455a24da8c58_oipc_txn_changes.py b/request-management-api/migrations/versions/455a24da8c58_oipc_txn_changes.py index 764909fc4..20f8ab5c5 100644 --- a/request-management-api/migrations/versions/455a24da8c58_oipc_txn_changes.py +++ b/request-management-api/migrations/versions/455a24da8c58_oipc_txn_changes.py @@ -33,11 +33,17 @@ def upgrade(): sa.Column('isjudicialreview', sa.Boolean(), nullable=True), sa.Column('issubsequentappeal', sa.Boolean(), nullable=True), sa.Column('inquiryattributes', sa.JSON, nullable=True), + sa.Column('receiveddate', sa.Date(), nullable=True), + sa.Column('closeddate', sa.Date(), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('createdby', sa.String(length=120), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('updatedby', sa.String(length=120), nullable=True), sa.ForeignKeyConstraint(['foiministryrequest_id', 'foiministryrequestversion_id'], ['FOIMinistryRequests.foiministryrequestid', 'FOIMinistryRequests.version'], ), + sa.ForeignKeyConstraint(['reviewtypeid'], ['OIPCReviewTypes.reviewtypeid']), + sa.ForeignKeyConstraint(['reasonid'], ['OIPCReasons.reasonid']), + sa.ForeignKeyConstraint(['statusid'], ['OIPCStatuses.statusid']), + sa.ForeignKeyConstraint(['outcomeid'], ['OIPCOutcomes.outcomeid']), sa.PrimaryKeyConstraint('oipcid') ) # ### end Alembic commands ### diff --git a/request-management-api/request_api/models/FOIRequestOIPC.py b/request-management-api/request_api/models/FOIRequestOIPC.py index 1aacce9fd..a68407b9f 100644 --- a/request-management-api/request_api/models/FOIRequestOIPC.py +++ b/request-management-api/request_api/models/FOIRequestOIPC.py @@ -19,15 +19,21 @@ class FOIRequestOIPC(db.Model): foiministryrequest_id =db.Column(db.Integer, db.ForeignKey('FOIMinistryRequests.foiministryrequestid')) foiministryrequestversion_id =db.Column(db.Integer, db.ForeignKey('FOIMinistryRequests.version')) oipcno = db.Column(db.String(120), unique=False, nullable=True) - reviewtypeid = db.Column(db.Integer, unique=False, nullable=False) - reasonid = db.Column(db.Integer, unique=False, nullable=False) - statusid = db.Column(db.Integer, unique=False, nullable=True) - outcomeid = db.Column(db.Integer, unique=False, nullable=True) + reviewtypeid = db.Column(db.Integer,ForeignKey('OIPCReviewTypes.reviewtypeid')) + reviewtype = relationship("OIPCReviewTypes",backref=backref("OIPCReviewTypes"),uselist=False) + reasonid = db.Column(db.Integer,ForeignKey('OIPCReasons.reasonid')) + reason = relationship("OIPCReasons",backref=backref("OIPCReasons"),uselist=False) + statusid = db.Column(db.Integer,ForeignKey('OIPCStatuses.statusid')) + status = relationship("OIPCStatuses",backref=backref("OIPCStatuses"),uselist=False) + outcomeid = db.Column(db.Integer,ForeignKey('OIPCOutcomes.outcomeid')) + outcome = relationship("OIPCOutcomes",backref=backref("OIPCOutcomes"),uselist=False) isinquiry = db.Column(db.Boolean, unique=False, nullable=True) inquiryattributes = db.Column(JSON, unique=False, nullable=True) isjudicialreview = db.Column(db.Boolean, unique=False, nullable=True) issubsequentappeal = db.Column(db.Boolean, unique=False, nullable=True) investigator = db.Column(db.String(500), unique=False, nullable=True) + receiveddate = db.Column(db.Date, nullable=True) + closeddate = db.Column(db.Date, nullable=True) created_at = db.Column(db.DateTime, default=datetime.now) createdby = db.Column(db.String(120), unique=False, nullable=False) updated_at = db.Column(db.DateTime, nullable=True) @@ -44,4 +50,6 @@ def getoipc(cls,ministryrequestid,ministryrequestversion): class FOIRequestOIPCSchema(ma.Schema): class Meta: - fields = ('oipcid', 'version', 'ministryrequestid', 'investigator','ministryversion','oipcno','reviewtypeid','reasonid','statusid','outcomeid','isinquiry','inquiryattributes','isjudicialreview','issubsequentappeal','isactive','created_at','createdby','updated_at','updatedby') \ No newline at end of file + fields = ('oipcid', 'version', 'ministryrequestid', 'investigator','ministryversion','oipcno','reviewtypeid','reasonid','statusid','outcomeid','isinquiry','inquiryattributes','isjudicialreview', + 'issubsequentappeal','isactive','receiveddate','closeddate','created_at','createdby','updated_at','updatedby', + 'reviewtype.name', 'reason.name', 'status.name', 'outcome.name') \ No newline at end of file diff --git a/request-management-api/request_api/schemas/foirequestwrapper.py b/request-management-api/request_api/schemas/foirequestwrapper.py index 38a9ab1dc..186f226fb 100644 --- a/request-management-api/request_api/schemas/foirequestwrapper.py +++ b/request-management-api/request_api/schemas/foirequestwrapper.py @@ -78,7 +78,8 @@ class Meta: # pylint: disable=too-few-public-methods isjudicialreview = fields.Bool(data_key="isjudicialreview") issubsequentappeal = fields.Bool(data_key="issubsequentappeal") inquiryattributes = fields.Nested(FOIOIPCInquirySchema, data_key="inquiryattributes", allow_none=True) - + receiveddate = fields.Str(data_key="receiveddate",allow_none=True) + closeddate = fields.Str(data_key="closeddate",allow_none=True) class FOIRequestWrapperSchema(Schema): diff --git a/request-management-api/request_api/services/foirequest/requestservicebuilder.py b/request-management-api/request_api/services/foirequest/requestservicebuilder.py index 790cbc540..1e89300e4 100644 --- a/request-management-api/request_api/services/foirequest/requestservicebuilder.py +++ b/request-management-api/request_api/services/foirequest/requestservicebuilder.py @@ -149,6 +149,8 @@ def prepareoipc(self, requestschema, ministryrequestid, version, userid): oipcreview.isjudicialreview = oipc["isjudicialreview"] oipcreview.issubsequentappeal = oipc["issubsequentappeal"] oipcreview.issubsequentappeal = oipc["issubsequentappeal"] + oipcreview.receiveddate = oipc["receiveddate"] + oipcreview.closeddate = oipc["closeddate"] oipcreview.isactive = True if oipc["isinquiry"] == True: oipcreview.inquiryattributes = oipc["inquiryattributes"] diff --git a/request-management-api/request_api/services/foirequest/requestservicegetter.py b/request-management-api/request_api/services/foirequest/requestservicegetter.py index d3fedf68b..31ad6750c 100644 --- a/request-management-api/request_api/services/foirequest/requestservicegetter.py +++ b/request-management-api/request_api/services/foirequest/requestservicegetter.py @@ -219,15 +219,21 @@ def getoipcdetails(self, ministryrequestid, ministryrequestversion): oipc = { "oipcid": entry["oipcid"], "reviewtypeid": entry["reviewtypeid"], + "reviewetype": entry["reviewtype.name"], "reasonid": entry["reasonid"], + "reason": entry["reason.name"], "statusid": entry["statusid"], + "status":entry["status.name"], "outcomeid": entry["outcomeid"], + "outcome": entry["outcome.name"], "investigator": entry["investigator"], "isinquiry": entry["isinquiry"], "isjudicialreview": entry["isjudicialreview"], "issubsequentappeal": entry["issubsequentappeal"], "inquiryattributes": entry["inquiryattributes"], "createdby": entry["createdby"], + "receiveddate" : parse(entry["receiveddate"]).strftime('%b, %d %Y') if entry["receiveddate"] is not None else '', + "closeddate": parse(entry["closeddate"]).strftime('%b, %d %Y') if entry["closeddate"] is not None else '', "created_at": parse(entry["created_at"]).strftime(self.__genericdateformat()) } oipcdetails.append(oipc) From 35c5a001de863949cf3999049d7a931d5bf25563 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Tue, 21 Nov 2023 17:32:35 -0800 Subject: [PATCH 19/82] Changes to include descriptive value for inquiry outcome --- .../request_api/schemas/foirequestwrapper.py | 2 +- .../services/foirequest/requestservicegetter.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/request-management-api/request_api/schemas/foirequestwrapper.py b/request-management-api/request_api/schemas/foirequestwrapper.py index 186f226fb..967a67a14 100644 --- a/request-management-api/request_api/schemas/foirequestwrapper.py +++ b/request-management-api/request_api/schemas/foirequestwrapper.py @@ -61,7 +61,7 @@ class Meta: # pylint: disable=too-few-public-methods unknown = EXCLUDE inquirydate = fields.Str(data_key="inquirydate",allow_none=True) orderno = fields.Str(data_key="orderno",allow_none=True) - inquiryoutcome = fields.Str(data_key="outcome",allow_none=True) + inquiryoutcome = fields.Int(data_key="inquiryoutcome",allow_none=True) class FOIMinistryRequestOIPCSchema(Schema): class Meta: # pylint: disable=too-few-public-methods diff --git a/request-management-api/request_api/services/foirequest/requestservicegetter.py b/request-management-api/request_api/services/foirequest/requestservicegetter.py index 31ad6750c..16beb77da 100644 --- a/request-management-api/request_api/services/foirequest/requestservicegetter.py +++ b/request-management-api/request_api/services/foirequest/requestservicegetter.py @@ -9,6 +9,7 @@ from request_api.models.FOIMinistryRequestSubjectCodes import FOIMinistryRequestSubjectCode from request_api.models.FOIRestrictedMinistryRequests import FOIRestrictedMinistryRequest from request_api.models.FOIRequestOIPC import FOIRequestOIPC +from request_api.services.oipcservice import oipcservice from dateutil.parser import parse from request_api.services.cfrfeeservice import cfrfeeservice from request_api.services.paymentservice import paymentservice @@ -214,6 +215,7 @@ def getdivisions(self, ministrydivisions): def getoipcdetails(self, ministryrequestid, ministryrequestversion): oipcdetails = [] _oipclist = FOIRequestOIPC.getoipc(ministryrequestid, ministryrequestversion) + inquiryoutcomes = oipcservice().getinquiryoutcomes() if _oipclist is not None: for entry in _oipclist: oipc = { @@ -230,7 +232,7 @@ def getoipcdetails(self, ministryrequestid, ministryrequestversion): "isinquiry": entry["isinquiry"], "isjudicialreview": entry["isjudicialreview"], "issubsequentappeal": entry["issubsequentappeal"], - "inquiryattributes": entry["inquiryattributes"], + "inquiryattributes": self.formatinquiryattribute(entry["inquiryattributes"], inquiryoutcomes), "createdby": entry["createdby"], "receiveddate" : parse(entry["receiveddate"]).strftime('%b, %d %Y') if entry["receiveddate"] is not None else '', "closeddate": parse(entry["closeddate"]).strftime('%b, %d %Y') if entry["closeddate"] is not None else '', @@ -239,7 +241,13 @@ def getoipcdetails(self, ministryrequestid, ministryrequestversion): oipcdetails.append(oipc) return oipcdetails - + def formatinquiryattribute(self, inquiryattribute, inquiryoutcomes): + if inquiryattribute not in (None, {}): + for outcome in inquiryoutcomes: + if inquiryattribute["inquiryoutcome"] == outcome["inquiryoutcomeid"]: + inquiryattribute["inquiryoutcomename"] = outcome["name"] + return inquiryattribute + def getonholdtransition(self, foiministryrequestid): onholddate = None From 214cc23c653487d7a25df97ad90e590e46878b44 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Tue, 21 Nov 2023 17:45:22 -0800 Subject: [PATCH 20/82] BE integration work --- .../src/actions/FOI/foiActionConstants.js | 4 + .../src/actions/FOI/foiRequestActions.js | 21 +++ .../src/apiManager/endpoints/index.js | 4 + .../services/FOI/foiMasterDataServices.js | 69 +++++++++ .../components/FOI/FOIRequest/FOIRequest.js | 9 +- .../OIPCDetails/AdditionalFields.jsx | 0 .../FOI/FOIRequest/OIPCDetails/Index.jsx | 47 +++--- .../OIPCDetails/MandatoryFields.jsx | 0 .../OIPCDetails/OIPCDetailsList.jsx | 1 - .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 134 ++++++++++++------ .../src/modules/FOI/foiRequestsReducer.js | 9 ++ .../foirequest/requestservicegetter.py | 1 + 12 files changed, 227 insertions(+), 72 deletions(-) delete mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AdditionalFields.jsx delete mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/MandatoryFields.jsx diff --git a/forms-flow-web/src/actions/FOI/foiActionConstants.js b/forms-flow-web/src/actions/FOI/foiActionConstants.js index beaca7433..ef0bc6dac 100644 --- a/forms-flow-web/src/actions/FOI/foiActionConstants.js +++ b/forms-flow-web/src/actions/FOI/foiActionConstants.js @@ -89,6 +89,10 @@ const FOI_ACTION_CONSTANTS = { "FOI_PDF_STITCHED_STATUS_FOR_RESPONSEPACKAGE", FOI_PDF_STITCHED_RECORD_FOR_RESPONSEPACKAGE: "FOI_PDF_STITCHED_RECORD_FOR_RESPONSEPACKAGE", + + OIPC_OUTCOMES: "OIPC_OUTCOMES", + OIPC_STATUSES: "OIPC_STATUSES", + OIPC_REVIEWTYPES: "OIPC_REVIEWTYPES", }; export default FOI_ACTION_CONSTANTS; diff --git a/forms-flow-web/src/actions/FOI/foiRequestActions.js b/forms-flow-web/src/actions/FOI/foiRequestActions.js index 8cb6826c1..46ffcf494 100644 --- a/forms-flow-web/src/actions/FOI/foiRequestActions.js +++ b/forms-flow-web/src/actions/FOI/foiRequestActions.js @@ -425,3 +425,24 @@ export const setConversionFormats = (data) => (dispatch) => { payload: data, }); }; + +export const setOIPCOutcomes = (data) => (dispatch) => { + dispatch({ + type: FOI_ACTION_CONSTANTS.OIPC_OUTCOMES, + payload: data, + }); +}; + +export const setOIPCStatuses = (data) => (dispatch) => { + dispatch({ + type: FOI_ACTION_CONSTANTS.OIPC_STATUSES, + payload: data, + }); +}; + +export const setOIPCReviewtypes = (data) => (dispatch) => { + dispatch({ + type: FOI_ACTION_CONSTANTS.OIPC_REVIEWTYPES, + payload: data, + }); +}; diff --git a/forms-flow-web/src/apiManager/endpoints/index.js b/forms-flow-web/src/apiManager/endpoints/index.js index 111ee62ec..60762afca 100644 --- a/forms-flow-web/src/apiManager/endpoints/index.js +++ b/forms-flow-web/src/apiManager/endpoints/index.js @@ -133,5 +133,9 @@ const API = { FOI_DOWNLOAD_RECORDS_FOR_RESPONSEPACKAGE: `${FOI_BASE_API_URL}/api/foirecord//ministryrequest//download/responsepackage`, FOI_PDF_STITCH_STATUS_FOR_RESPONSEPACKAGE: `${FOI_BASE_API_URL}/api/foirecord//ministryrequest//responsepackage/pdfstitchjobstatus`, + + FOI_GET_OIPC_OUTCOMES: `${FOI_BASE_API_URL}/api/foiflow/oipc/outcomes`, + FOI_GET_OIPC_STATUSES: `${FOI_BASE_API_URL}/api/foiflow/oipc/statuses`, + FOI_GET_OIPC_REVIEWTYPES: `${FOI_BASE_API_URL}/api/foiflow/oipc/reviewtypes`, }; export default API; diff --git a/forms-flow-web/src/apiManager/services/FOI/foiMasterDataServices.js b/forms-flow-web/src/apiManager/services/FOI/foiMasterDataServices.js index b8eb8d385..16bd8476b 100644 --- a/forms-flow-web/src/apiManager/services/FOI/foiMasterDataServices.js +++ b/forms-flow-web/src/apiManager/services/FOI/foiMasterDataServices.js @@ -22,6 +22,9 @@ import { setFOISubjectCodeList, setCommentTagListLoader, setFOIAdminProgramAreaList, + setOIPCOutcomes, + setOIPCStatuses, + setOIPCReviewtypes, } from "../../../actions/FOI/foiRequestActions"; import { fnDone, catchError } from "./foiServicesUtil"; import UserService from "../../../services/UserService"; @@ -508,4 +511,70 @@ import { }); }; }; + + export const fetchOIPCOutcomes = () => { + return (dispatch) => { + httpGETRequest(API.FOI_GET_OIPC_OUTCOMES, {}, UserService.getToken()) + .then((res) => { + if (res.data) { + const oipcOutcomes = res.data; + dispatch(setOIPCOutcomes(oipcOutcomes)); + dispatch(setFOILoader(false)); + } else { + console.log("Error while fetching OIPC outcomes master data", res); + dispatch(serviceActionError(res)); + dispatch(setFOILoader(false)); + } + }) + .catch((error) => { + console.log("Error while fetching OIPC outcomes master data", error); + dispatch(serviceActionError(error)); + dispatch(setFOILoader(false)); + }); + }; + }; + + export const fetchOIPCStatuses = () => { + return (dispatch) => { + httpGETRequest(API.FOI_GET_OIPC_STATUSES, {}, UserService.getToken()) + .then((res) => { + if (res.data) { + const oipcStatuses = res.data; + dispatch(setOIPCStatuses(oipcStatuses)); + dispatch(setFOILoader(false)); + } else { + console.log("Error while fetching OIPC statuses master data", res); + dispatch(serviceActionError(res)); + dispatch(setFOILoader(false)); + } + }) + .catch((error) => { + console.log("Error while fetching OIPC statuses master data", error); + dispatch(serviceActionError(error)); + dispatch(setFOILoader(false)); + }); + }; + }; + + export const fetchOIPCReviewtypes = () => { + return (dispatch) => { + httpGETRequest(API.FOI_GET_OIPC_REVIEWTYPES, {}, UserService.getToken()) + .then((res) => { + if (res.data) { + const oipcReviewtypes = res.data; + dispatch(setOIPCReviewtypes(oipcReviewtypes)); + dispatch(setFOILoader(false)); + } else { + console.log("Error while fetching OIPC reviewtypes master data", res); + dispatch(serviceActionError(res)); + dispatch(setFOILoader(false)); + } + }) + .catch((error) => { + console.log("Error while fetching OIPC reviewtypes master data", error); + dispatch(serviceActionError(error)); + dispatch(setFOILoader(false)); + }); + }; + }; \ No newline at end of file diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 10c384bc8..2142892cf 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -24,6 +24,9 @@ import { fetchFOIMinistryAssignedToList, fetchFOISubjectCodeList, fetchFOIPersonalDivisionsAndSections, + fetchOIPCOutcomes, + fetchOIPCStatuses, + fetchOIPCReviewtypes, } from "../../../apiManager/services/FOI/foiMasterDataServices"; import { fetchFOIRequestDetailsWrapper, @@ -293,6 +296,10 @@ const FOIRequest = React.memo(({ userDetail }) => { dispatch(fetchFOIDeliveryModeList()); dispatch(fetchFOISubjectCodeList()); dispatch(fetchClosingReasonList()); + + dispatch(fetchOIPCOutcomes()); + dispatch(fetchOIPCStatuses()); + dispatch(fetchOIPCReviewtypes()); if (bcgovcode) dispatch(fetchFOIMinistryAssignedToList(bcgovcode)); }, [requestId, ministryId, comment, attachments]); @@ -1211,7 +1218,7 @@ const FOIRequest = React.memo(({ userDetail }) => { )} {showOIPCDetails && ( )} diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AdditionalFields.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AdditionalFields.jsx deleted file mode 100644 index e69de29bb..000000000 diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx index adcffe4a1..d9fa50c4b 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx @@ -10,19 +10,18 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faCirclePlus } from '@fortawesome/free-solid-svg-icons'; const OIPCDetails = (props) => { - //Local State - const createOIPCId = (oipcData) => { - if (oipcData.length > 0) { - return oipcData.map((item, index) => { - item.id = index; - return item; - }); - } - } - const [oipcData, setOipcData] = useState(createOIPCId([ - { oipcNumber: "F23-12345", reviewType: "Complaint", reason: "Extension", status: "Inquiry", isInquiry: false, inquiryDate: null, receivedDate: "2022-05-08", investigator: "Filip Forsberg", outcome: "Withdrawn", isJudicalReview: false, isSubAppeal: false }, - { oipcNumber: "F23-12346", reviewType: "Review", reason: "Other", status: "Mediation", isInquiry: false, inquiryDate: null, receivedDate: "2022-09-08", investigator: "Peter Forsberg", outcome: "Closed", isJudicalReview: false, isSubAppeal: true }, - ])); + const { oipcDetails } = props; + + //Local State + const createOIPCId = (oipcData) => { + if (oipcData.length > 0) { + return oipcData.map((item, index) => { + item.id = index; + return item; + }); + } + } + const [oipcData, setOipcData] = useState(createOIPCId(oipcDetails)); //Styling const useStyles = makeStyles({ @@ -36,22 +35,24 @@ const OIPCDetails = (props) => { } }); const classes = useStyles(); - + //Functions const addOIPC = () => { setOipcData((prev) => { return [...prev, { id: oipcData.length > 0 ? oipcData[oipcData.length - 1].id + 1 : 0, - oipcNumber: "", - reviewType: "", - reason: "", - status: "", - isInquiry: false, - receivedDate: "", + oipcno: "", + reviewtypeid: null, + reasonid: null, + statusid: null, + isinquiry: false, + inquiryattributes: null, + receiveddate: "", + closeddate: "", investigator: "", - outcome: "", - isJudicalReview: false, - isSubAppeal: false + outcomeid: null, + isjudicialreview: false, + issubsequentappeal: false }]; }) } diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/MandatoryFields.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/MandatoryFields.jsx deleted file mode 100644 index e69de29bb..000000000 diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index 5d5e4bdf1..16e5cdfe6 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -6,7 +6,6 @@ import { faTrash } from '@fortawesome/free-solid-svg-icons'; const OIPCDetailsList = (props) => { const {oipcData, removeOIPC, updateOIPC} = props; - console.log("ARRAY", oipcData); const OIPCItems = oipcData?.map((oipcObj, index) => { return ( diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 1c0212009..02ed42071 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -1,52 +1,69 @@ import { TextField, FormControlLabel, MenuItem, Grid, Checkbox } from '@material-ui/core'; import { useState } from "react"; +import { useSelector } from "react-redux"; import { formatDate } from "../../../../helper/FOI/helper"; const OIPCItem = (props) => { const {oipcObj, updateOIPC} = props; + //Local State const [oipc, setOipc] = useState({ id: oipcObj?.id, - oipcNumber: oipcObj?.oipcNumber, - reviewType: oipcObj?.reviewType, - reason: oipcObj?.reason, - status: oipcObj?.status, - isInquiry: oipcObj?.isInquiry, - inquiryDate: null, - receivedDate: oipcObj?.receivedDate, + oipcno: oipcObj?.oipcno, + reviewtypeid: oipcObj?.reviewtypeid, + reasonid: oipcObj?.reasonid, + statusid: oipcObj?.statusid, + isinquiry: oipcObj?.isinquiry, + inquiryattributes: oipcObj?.inquiryattributes, + receiveddate: oipcObj?.receiveddate, + closeddate: oipcObj?.closeddate, investigator: oipcObj?.investigator, - outcome: oipcObj?.outcome, - isJudicalReview: oipcObj?.isJudicalReview, - isSubAppeal: oipcObj?.isSubAppeal, + outcomeid: oipcObj?.outcomeid, + isjudicialreview: oipcObj?.isjudicialreview, + issubsequentappeal: oipcObj?.issubsequentappeal, }); - console.log(oipcObj); + //App State + const oipcOutcomes = useSelector(state=> state.foiRequests.oipcOutcomes); + const oipcStatuses = useSelector(state=> state.foiRequests.oipcStatuses); + const oipcReviewtypes = useSelector(state=> state.foiRequests.oipcReviewtypes); + + console.log(oipc); + console.log(oipcOutcomes) + console.log(oipcStatuses) + console.log(oipcReviewtypes) + //Functions const handleReviewType = (value) => { const newOIPCObj = oipc; - newOIPCObj.reviewType = value; - newOIPCObj.reason = ""; + newOIPCObj.reviewtypeid = value; + newOIPCObj.reasonid = -1; updateOIPC(newOIPCObj); } const handleOIPCNumber = (value) => { const newOIPCObj = oipc; - newOIPCObj.oipcNumber = value; + newOIPCObj.oipcno = value; updateOIPC(newOIPCObj); } const handleReceivedDate = (value) => { const newOIPCObj = oipc; - newOIPCObj.receivedDate = value; + newOIPCObj.receiveddate = value; + updateOIPC(newOIPCObj); + } + const handleClosedDate = (value) => { + const newOIPCObj = oipc; + newOIPCObj.closeddate = value; updateOIPC(newOIPCObj); } const handleReason = (value) => { const newOIPCObj = oipc; - newOIPCObj.reason = value; + newOIPCObj.reasonid = value; updateOIPC(newOIPCObj); } const handleStatus = (value) => { const newOIPCObj = oipc; - newOIPCObj.status = value; + newOIPCObj.statusid = value; updateOIPC(newOIPCObj); } const handleInvestiagtor = (value) => { @@ -56,24 +73,38 @@ const OIPCItem = (props) => { } const handleOutcome = (value) => { const newOIPCObj = oipc; - newOIPCObj.outcome = value; + newOIPCObj.outcomeid = value; updateOIPC(newOIPCObj); } const handleInquiry = (value) => { const newOIPCObj = oipc; - newOIPCObj.isInquiry = value; + newOIPCObj.isinquiry = value; updateOIPC(newOIPCObj); } const handleJudicalReview = (value) => { const newOIPCObj = oipc; - newOIPCObj.isJudicalReview = value; + newOIPCObj.isjudicialreview = value; updateOIPC(newOIPCObj); } const handleSubsequentAppeal = (value) => { const newOIPCObj = oipc; - newOIPCObj.isSubAppeal = value; + newOIPCObj.issubsequentappeal = value; updateOIPC(newOIPCObj); } + const getNameFromId = (attribute, id) => { + if (attribute === "STATUS") { + const status = oipcStatuses.find(status => status.statusid === id); + return status.name; + } + if (attribute === "REVIEW_TYPE") { + const reviewtype = oipcReviewtypes.find(reviewtype => reviewtype.reviewtypeid === id); + return reviewtype.name; + } + if (attribute === "OUTCOME") { + const outcome = oipcOutcomes.find(outcome => outcome.outcomeid === id); + return outcome.name; + } + } //REFACTOR THIS!!! const filterReasonOptions = (reviewType) => { if (reviewType === "Complaint") { @@ -87,7 +118,6 @@ const OIPCItem = (props) => { } return ["Adequate search","Extension", "Fee Amount", "Fee Waiver", "Duty to Assist", "Application of Exceptions", "Deemed Refusal", "TPN - 22", "TPN - 21", "TPN - 18.1", "Reg 3", "Reg 4", "Reg 5", "s. 43", "Other"]; } - const reasons = filterReasonOptions(oipc.reviewType) return ( @@ -99,7 +129,7 @@ const OIPCItem = (props) => { label="OIPC No" variant="outlined" required={true} - value={oipc.oipcNumber} + value={oipc.oipcno} onChange = {(event) => handleOIPCNumber(event.target.value)} InputLabelProps={{ shrink: true }} /> @@ -110,10 +140,10 @@ const OIPCItem = (props) => { label="Received Date" variant="outlined" required={true} - value={oipc.receivedDate} + value={oipc.receiveddate} onChange = {(event) => handleReceivedDate(event.target.value)} InputLabelProps={{ shrink: true }} - InputProps={{inputProps: { max: oipc.receivedDate || formatDate(new Date())} }} + InputProps={{inputProps: { max: oipc.receiveddate || formatDate(new Date())} }} type="date" />
@@ -123,14 +153,14 @@ const OIPCItem = (props) => { select variant="outlined" fullWidth - value={oipc.reviewType} + value={getNameFromId("REVIEW_TYPE", oipc.reviewtypeid)} label="Review Type" onChange={(event) => handleReviewType(event.target.value)} required={true} > - Complaint - Review - Investigation + {oipcReviewtypes.map((reviewtype) => { + return {reviewtype.name} + })} @@ -139,7 +169,7 @@ const OIPCItem = (props) => { select variant="outlined" fullWidth - value={oipc.reason} + // value={getNameFromId("REASON", oipc.reasonid)} label="Reason" onChange = {(event) => handleReason(event.target.value)} required={true} @@ -155,16 +185,14 @@ const OIPCItem = (props) => { select variant="outlined" fullWidth - value={oipc.status} + value={getNameFromId("STATUS", oipc.statusid)} label="Status" onChange = {(event) => handleStatus(event.target.value)} required={true} > - Mediation - Investigation - Inquiry - Awaiting Order - Closed + {oipcStatuses.map((status) => { + return {status.name} + })} @@ -185,28 +213,40 @@ const OIPCItem = (props) => { variant="outlined" onChange = {(event) => handleOutcome(event.target.value)} fullWidth - value={oipc.outcome} + value={getNameFromId("OUTCOME", oipc.outcomeid)} label="Outcome" required={true} > - Abandoned - Withdrawn - Resolved in Mediation - Closed + {oipcOutcomes.map((outcome) => { + return {outcome.name} + })} + + handleClosedDate(event.target.value)} + InputLabelProps={{ shrink: true }} + InputProps={{inputProps: { max: oipc.closeddate || formatDate(new Date())} }} + type="date" + /> +

In Inquiry?

handleInquiry(true)} />} label="Yes" /> handleInquiry(false)} />} label="No" @@ -215,13 +255,13 @@ const OIPCItem = (props) => {

In Judicial Review?

handleJudicalReview(true)} />} label="Yes" /> handleJudicalReview(false)} />} label="No" @@ -230,13 +270,13 @@ const OIPCItem = (props) => {

In Subsequent Appeal?

handleSubsequentAppeal(true)} />} label="Yes" /> handleSubsequentAppeal(false)} />} label="No" diff --git a/forms-flow-web/src/modules/FOI/foiRequestsReducer.js b/forms-flow-web/src/modules/FOI/foiRequestsReducer.js index 8dd27296b..0c090a82e 100644 --- a/forms-flow-web/src/modules/FOI/foiRequestsReducer.js +++ b/forms-flow-web/src/modules/FOI/foiRequestsReducer.js @@ -145,6 +145,9 @@ const initialState = { ".jpg", ], conversionFormats: [], + oipcOutcomes: [], + oipcStatuses: [], + oipcReviewtypes: [], }; const foiRequests = (state = initialState, action) => { @@ -307,6 +310,12 @@ const foiRequests = (state = initialState, action) => { return { ...state, recordFormats: action.payload }; case FOI_ACTION_CONSTANTS.CONVERSION_FORMATS: return { ...state, conversionFormats: action.payload }; + case FOI_ACTION_CONSTANTS.OIPC_OUTCOMES: + return { ...state, oipcOutcomes: action.payload }; + case FOI_ACTION_CONSTANTS.OIPC_STATUSES: + return { ...state, oipcStatuses: action.payload }; + case FOI_ACTION_CONSTANTS.OIPC_REVIEWTYPES: + return { ...state, oipcReviewtypes: action.payload }; default: return state; } diff --git a/request-management-api/request_api/services/foirequest/requestservicegetter.py b/request-management-api/request_api/services/foirequest/requestservicegetter.py index d3fedf68b..11ec9c2d8 100644 --- a/request-management-api/request_api/services/foirequest/requestservicegetter.py +++ b/request-management-api/request_api/services/foirequest/requestservicegetter.py @@ -218,6 +218,7 @@ def getoipcdetails(self, ministryrequestid, ministryrequestversion): for entry in _oipclist: oipc = { "oipcid": entry["oipcid"], + "oipcno": entry["oipcno"], "reviewtypeid": entry["reviewtypeid"], "reasonid": entry["reasonid"], "statusid": entry["statusid"], From 54f582a1c89fddb3996b26fa3aaf7f461f762569 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Wed, 22 Nov 2023 12:04:59 -0800 Subject: [PATCH 21/82] Add OIPCReviewTypesReasons table and update endpoint --- .../3b399ca506fe_create_oipc_tables.py | 30 +++++++++++++ .../models/OIPCReviewTypesReasons.py | 43 +++++++++++++++++++ .../resources/foiflowmasterdata.py | 29 ++----------- .../request_api/services/oipcservice.py | 4 ++ 4 files changed, 81 insertions(+), 25 deletions(-) create mode 100644 request-management-api/request_api/models/OIPCReviewTypesReasons.py diff --git a/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py b/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py index e426ec587..386eb9c68 100644 --- a/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py +++ b/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py @@ -10,6 +10,7 @@ from sqlalchemy.dialects import postgresql from sqlalchemy import Table, Column, Integer, String, MetaData meta = MetaData() +from sqlalchemy.sql.schema import ForeignKey # revision identifiers, used by Alembic. @@ -34,6 +35,14 @@ def upgrade(): sa.PrimaryKeyConstraint('reasonid') ) + reviewtypes_reasons_table = op.create_table('OIPCReviewTypesReasons', + sa.Column('reviewtypereasonid', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('reviewtypeid', sa.Integer(), ForeignKey('OIPCReviewTypes.reviewtypeid'), unique=False, nullable=False), + sa.Column('reasonid', sa.Integer(), ForeignKey('OIPCReasons.reasonid'), unique=False, nullable=False), + sa.Column('isactive', sa.Boolean(), unique=False, nullable=False), + sa.PrimaryKeyConstraint('reviewtypereasonid'), + ) + statusestable = op.create_table('OIPCStatuses', sa.Column('statusid', sa.Integer(), autoincrement=True, nullable=False), sa.Column('name', sa.String(length=100), unique=False, nullable=False), @@ -102,7 +111,28 @@ def upgrade(): ('Decision Partially Upheld', True), ('Decision Overturned', True);commit;''') + op.execute('''INSERT INTO public."OIPCReviewTypesReasons" (reviewtypeid, reasonid, isactive) + VALUES + (1, 1, True), + (1, 4, True), + (1, 5, True), + (1, 6, True), + (1, 8, True), + (1, 16, True), + (2, 2, True), + (2, 3, True), + (2, 9, True), + (2, 10, True), + (2, 11, True), + (2, 12, True), + (2, 13, True), + (2, 14, True), + (2, 15, True), + (2, 16, True), + (3, 16, True);commit;''') + def downgrade(): + op.drop_table('OIPCReviewTypesReasons') op.drop_table('OIPCReviewTypes') op.drop_table('OIPCReasons') op.drop_table('OIPCStatuses') diff --git a/request-management-api/request_api/models/OIPCReviewTypesReasons.py b/request-management-api/request_api/models/OIPCReviewTypesReasons.py new file mode 100644 index 000000000..3fc17e221 --- /dev/null +++ b/request-management-api/request_api/models/OIPCReviewTypesReasons.py @@ -0,0 +1,43 @@ +from .db import db, ma +from sqlalchemy.orm import relationship, backref +from sqlalchemy.sql.schema import ForeignKey +from sqlalchemy import text + +class OIPCReviewTypesReasons(db.Model): + __tablename__ = 'OIPCReviewTypesReasons' + # Defining the columns + reviewtypereasonid = db.Column(db.Integer, primary_key=True,autoincrement=True) + reviewtypeid = db.Column(db.Integer, ForeignKey('FOIReviewTypes')) + relationship("FOIReviewTypes", backref=backref("FOIReviewTypes"), uselist=False) + reasonid = db.Column(db.Integer, ForeignKey('FOIReasons')) + relationship("FOIReasons", backref=backref("FOIReasons"), uselist=False) + isactive = db.Column(db.Boolean, unique=False, nullable=False) + + @classmethod + def getreviewtypeswithreasons(cls): + type_schema = ReviewTypeReasonSchema(many=True) + sql = ''' + SELECT types.reviewtypeid, reasons.reasonid, reasons.name as reason_name, types.name as type_name, typereason.isactive as reviewtypereason_isactive, reasons.isactive as reason_isactive, types.isactive as reviewtype_isactive FROM public."OIPCReviewTypesReasons" typereason + JOIN public."OIPCReasons" reasons + ON reasons.reasonid = typereason.reasonid + JOIN public."OIPCReviewTypes" types + ON types.reviewtypeid = typereason.reviewtypeid + ORDER BY reviewtypereasonid ASC + ''' + rs = db.session.execute(text(sql)) + reviewtypereasons = [] + for row in rs: + reviewtypereasons.append({ + "reviewtypeid": row["reviewtypeid"], + "reasonid": row["reasonid"], + "reason_name": row["reason_name"], + "type_name": row["type_name"], + "reviewtypereason_isactive": row["reviewtypereason_isactive"], + "reviewtype_isactive": row["reviewtype_isactive"], + "reason_isactive": row["reason_isactive"], + }) + return reviewtypereasons + +class ReviewTypeReasonSchema(ma.Schema): + class Meta: + fields = ('reviewtypereasonid', 'reviewtypeid', 'reasonid', 'isactive') \ No newline at end of file diff --git a/request-management-api/request_api/resources/foiflowmasterdata.py b/request-management-api/request_api/resources/foiflowmasterdata.py index 2d75d602c..297880fbf 100644 --- a/request-management-api/request_api/resources/foiflowmasterdata.py +++ b/request-management-api/request_api/resources/foiflowmasterdata.py @@ -385,24 +385,24 @@ def post(): @cors_preflight('GET,OPTIONS') @API.route('/foiflow/oipc/reviewtypes') class FOIFlowOIPCReviewTypes(Resource): - """Retrieves OIPC review types + """Retrieves OIPC review types along with reasons for each type """ @staticmethod @TRACER.trace() @cross_origin(origins=allowedorigins()) # @auth.require @request_api.cache.cached( - key_prefix="oipcreviewtypes", + key_prefix="oipcreviewtypesreasons", unless=cache_filter, response_filter=response_filter ) def get(): try: - data = oipcservice().getreviewtypes() + data = oipcservice().getreviewtypeswithreasons() jsondata = json.dumps(data) return jsondata , 200 except BusinessException: - return "Error happened while accessing OIPC review types" , 500 + return "Error happened while accessing OIPC review types and associated reasons" , 500 @cors_preflight('GET,OPTIONS') @API.route('/foiflow/oipc/statuses') @@ -426,27 +426,6 @@ def get(): except BusinessException: return "Error happened while accessing OIPC statuses" , 500 -@cors_preflight('GET,OPTIONS') -@API.route('/foiflow/oipc/reasons') -class FOIFlowOIPCReasons(Resource): - """Retrieves OIPC reasons - """ - @staticmethod - @TRACER.trace() - @cross_origin(origins=allowedorigins()) - # @auth.require - @request_api.cache.cached( - key_prefix="oipcreasons", - unless=cache_filter, - response_filter=response_filter - ) - def get(): - try: - data = oipcservice().getreasons() - jsondata = json.dumps(data) - return jsondata , 200 - except BusinessException: - return "Error happened while accessing OIPC reasons" , 500 @cors_preflight('GET,OPTIONS') @API.route('/foiflow/oipc/outcomes') diff --git a/request-management-api/request_api/services/oipcservice.py b/request-management-api/request_api/services/oipcservice.py index 2ea4719f8..636044430 100644 --- a/request-management-api/request_api/services/oipcservice.py +++ b/request-management-api/request_api/services/oipcservice.py @@ -3,6 +3,7 @@ from request_api.models.OIPCReasons import OIPCReasons from request_api.models.OIPCOutcomes import OIPCOutcomes from request_api.models.OIPCInquiryOutcomes import OIPCInquiryOutcomes +from request_api.models.OIPCReviewTypesReasons import OIPCReviewTypesReasons class oipcservice: """ OIPC service @@ -10,6 +11,9 @@ class oipcservice: def getreviewtypes(self): return OIPCReviewTypes.getreviewtypes() + def getreviewtypeswithreasons(self): + return OIPCReviewTypesReasons.getreviewtypeswithreasons() + def getreasons(self): return OIPCReasons.getreasons() From 9f8964433eb1e29b51f2c0bd27f016777d86562d Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Wed, 22 Nov 2023 13:54:55 -0800 Subject: [PATCH 22/82] BE integration -> fetch calles for master, transacntional oipc data completed. intergration of data to FE + validation + save WIP --- .../FOI/FOIRequest/OIPCDetails/Index.jsx | 6 +- .../OIPCDetails/OIPCDetailsList.jsx | 1 - .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 55 +++++++++---------- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx index d9fa50c4b..fac3bb4ae 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx @@ -52,7 +52,11 @@ const OIPCDetails = (props) => { investigator: "", outcomeid: null, isjudicialreview: false, - issubsequentappeal: false + issubsequentappeal: false, + reviewtype: "", + status: "", + outcome: "", + reason: "", }]; }) } diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index 16e5cdfe6..b47afe895 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -6,7 +6,6 @@ import { faTrash } from '@fortawesome/free-solid-svg-icons'; const OIPCDetailsList = (props) => { const {oipcData, removeOIPC, updateOIPC} = props; - const OIPCItems = oipcData?.map((oipcObj, index) => { return ( <> diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 02ed42071..8c72986c9 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -1,11 +1,15 @@ import { TextField, FormControlLabel, MenuItem, Grid, Checkbox } from '@material-ui/core'; -import { useState } from "react"; -import { useSelector } from "react-redux"; +import { useState, useEffect } from "react"; import { formatDate } from "../../../../helper/FOI/helper"; - +import { useSelector } from "react-redux"; const OIPCItem = (props) => { const {oipcObj, updateOIPC} = props; + + //App State + const oipcOutcomes = useSelector(state=> state.foiRequests.oipcOutcomes); + const oipcStatuses = useSelector(state=> state.foiRequests.oipcStatuses); + const oipcReviewtypes = useSelector(state=> state.foiRequests.oipcReviewtypes); //Local State const [oipc, setOipc] = useState({ @@ -21,18 +25,13 @@ const OIPCItem = (props) => { investigator: oipcObj?.investigator, outcomeid: oipcObj?.outcomeid, isjudicialreview: oipcObj?.isjudicialreview, - issubsequentappeal: oipcObj?.issubsequentappeal, + reviewtypeName: oipcObj?.reviewtypeName, + reasonName: "", + statusName: oipcObj?.statusName, + outcomeName: oipcObj?.outcomeName, }); - //App State - const oipcOutcomes = useSelector(state=> state.foiRequests.oipcOutcomes); - const oipcStatuses = useSelector(state=> state.foiRequests.oipcStatuses); - const oipcReviewtypes = useSelector(state=> state.foiRequests.oipcReviewtypes); - console.log(oipc); - console.log(oipcOutcomes) - console.log(oipcStatuses) - console.log(oipcReviewtypes) //Functions const handleReviewType = (value) => { @@ -91,20 +90,16 @@ const OIPCItem = (props) => { newOIPCObj.issubsequentappeal = value; updateOIPC(newOIPCObj); } - const getNameFromId = (attribute, id) => { - if (attribute === "STATUS") { - const status = oipcStatuses.find(status => status.statusid === id); - return status.name; - } - if (attribute === "REVIEW_TYPE") { - const reviewtype = oipcReviewtypes.find(reviewtype => reviewtype.reviewtypeid === id); - return reviewtype.name; - } - if (attribute === "OUTCOME") { - const outcome = oipcOutcomes.find(outcome => outcome.outcomeid === id); - return outcome.name; - } + const generateNamesFromOIPCId = (oipcObj) => { + const reviewtype = oipcReviewtypes.find(reviewtype => reviewtype.reviewtypeid === oipcObj.reviewtypeid); + const status = oipcStatuses.find(status => status.statusid === oipcObj.statusid); + const outcome = oipcOutcomes.find(outcome => outcome.outcomeid === oipcObj.outcomeid); + + oipcObj.reviewtypeName = reviewtype ? reviewtype.name : ""; + oipcObj.statusName = status ? status.name : ""; + oipcObj.outcomeName = outcome ? outcome.name : ""; } + //REFACTOR THIS!!! const filterReasonOptions = (reviewType) => { if (reviewType === "Complaint") { @@ -120,6 +115,10 @@ const OIPCItem = (props) => { } const reasons = filterReasonOptions(oipc.reviewType) + useEffect(() => { + generateNamesFromOIPCId(oipcObj); + }, [oipcObj]) + return ( <> @@ -153,7 +152,7 @@ const OIPCItem = (props) => { select variant="outlined" fullWidth - value={getNameFromId("REVIEW_TYPE", oipc.reviewtypeid)} + value={oipc.reviewtypeid} label="Review Type" onChange={(event) => handleReviewType(event.target.value)} required={true} @@ -185,7 +184,7 @@ const OIPCItem = (props) => { select variant="outlined" fullWidth - value={getNameFromId("STATUS", oipc.statusid)} + value={oipc.statusid} label="Status" onChange = {(event) => handleStatus(event.target.value)} required={true} @@ -213,7 +212,7 @@ const OIPCItem = (props) => { variant="outlined" onChange = {(event) => handleOutcome(event.target.value)} fullWidth - value={getNameFromId("OUTCOME", oipc.outcomeid)} + value={oipc.outcomeid} label="Outcome" required={true} > From 88d45e14b519e2744bee2a5ad1d4e17f5e36683d Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Wed, 22 Nov 2023 16:34:16 -0800 Subject: [PATCH 23/82] BE integration completed. WIP Validation + BE Save --- .../components/FOI/FOIRequest/FOIRequest.js | 2 +- .../FOI/FOIRequest/OIPCDetails/Index.jsx | 6 +-- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 42 ++++++++----------- 3 files changed, 21 insertions(+), 29 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 2142892cf..6ec696b18 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -1216,7 +1216,7 @@ const FOIRequest = React.memo(({ userDetail }) => { divisions={requestDetails.divisions} /> )} - {showOIPCDetails && ( + {showOIPCDetails && requestDetails.oipcdetails && ( diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx index fac3bb4ae..e44f4c500 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx @@ -19,6 +19,8 @@ const OIPCDetails = (props) => { item.id = index; return item; }); + } else { + return oipcData; } } const [oipcData, setOipcData] = useState(createOIPCId(oipcDetails)); @@ -53,10 +55,6 @@ const OIPCDetails = (props) => { outcomeid: null, isjudicialreview: false, issubsequentappeal: false, - reviewtype: "", - status: "", - outcome: "", - reason: "", }]; }) } diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 8c72986c9..be04ac841 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -26,7 +26,7 @@ const OIPCItem = (props) => { outcomeid: oipcObj?.outcomeid, isjudicialreview: oipcObj?.isjudicialreview, reviewtypeName: oipcObj?.reviewtypeName, - reasonName: "", + reasonName: oipcObj?.reasonName, statusName: oipcObj?.statusName, outcomeName: oipcObj?.outcomeName, }); @@ -37,7 +37,7 @@ const OIPCItem = (props) => { const handleReviewType = (value) => { const newOIPCObj = oipc; newOIPCObj.reviewtypeid = value; - newOIPCObj.reasonid = -1; + newOIPCObj.reasonid = null; updateOIPC(newOIPCObj); } const handleOIPCNumber = (value) => { @@ -91,30 +91,21 @@ const OIPCItem = (props) => { updateOIPC(newOIPCObj); } const generateNamesFromOIPCId = (oipcObj) => { - const reviewtype = oipcReviewtypes.find(reviewtype => reviewtype.reviewtypeid === oipcObj.reviewtypeid); + const reviewtype = oipcReviewtypes.find(reviewtype => reviewtype.reviewtypeid === oipcObj.reviewtypeid && reviewtype.reasonid === oipcObj.reasonid); const status = oipcStatuses.find(status => status.statusid === oipcObj.statusid); const outcome = oipcOutcomes.find(outcome => outcome.outcomeid === oipcObj.outcomeid); - oipcObj.reviewtypeName = reviewtype ? reviewtype.name : ""; + oipcObj.reviewtypeName = reviewtype ? reviewtype.type_name : ""; oipcObj.statusName = status ? status.name : ""; oipcObj.outcomeName = outcome ? outcome.name : ""; + oipcObj.reasonName = reviewtype ? reviewtype.reason_name : ""; } - - //REFACTOR THIS!!! - const filterReasonOptions = (reviewType) => { - if (reviewType === "Complaint") { - return ["Adequate search","Extension", "Fee Amount", "Fee Waiver", "Duty to Assist", "Other"]; - } - if (reviewType === "Review") { - return ["Application of Exceptions", "Deemed Refusal", "TPN - 22", "TPN - 21", "TPN - 18.1", "Reg 3", "Reg 4", "Reg 5", "s. 43", "Other"]; - } - if (reviewType === "Investigation") { - return ["Other"] - } - return ["Adequate search","Extension", "Fee Amount", "Fee Waiver", "Duty to Assist", "Application of Exceptions", "Deemed Refusal", "TPN - 22", "TPN - 21", "TPN - 18.1", "Reg 3", "Reg 4", "Reg 5", "s. 43", "Other"]; + const uniqueReviewTypes = (oipcReviewTypes) => { + const uniqeValues = {}; + return oipcReviewTypes.filter(reviewtype => !uniqeValues[reviewtype.type_name] && (uniqeValues[reviewtype.type_name] = true)); } - const reasons = filterReasonOptions(oipc.reviewType) + //useEffect to create name attributes using id's for oipcObject useEffect(() => { generateNamesFromOIPCId(oipcObj); }, [oipcObj]) @@ -157,8 +148,8 @@ const OIPCItem = (props) => { onChange={(event) => handleReviewType(event.target.value)} required={true} > - {oipcReviewtypes.map((reviewtype) => { - return {reviewtype.name} + {uniqueReviewTypes(oipcReviewtypes).map((reviewtype) => { + return {reviewtype.type_name} })} @@ -168,14 +159,17 @@ const OIPCItem = (props) => { select variant="outlined" fullWidth - // value={getNameFromId("REASON", oipc.reasonid)} + value={oipc.reasonid} label="Reason" onChange = {(event) => handleReason(event.target.value)} required={true} > - {reasons.map((reason) => { - return {reason} - })} + {oipc.reviewtypeid ? + oipcReviewtypes.map((reviewtype) => { + if (reviewtype.reviewtypeid === oipc.reviewtypeid) { + return {reviewtype.reason_name} + } + }) : null} From a593a5e6b9ac64062a0340668d47a13c0e2976fb Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 23 Nov 2023 09:50:50 -0800 Subject: [PATCH 24/82] Update sql to insert with SELECT --- .../3b399ca506fe_create_oipc_tables.py | 104 +++++++++++++++--- 1 file changed, 86 insertions(+), 18 deletions(-) diff --git a/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py b/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py index 386eb9c68..8733a7034 100644 --- a/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py +++ b/request-management-api/migrations/versions/3b399ca506fe_create_oipc_tables.py @@ -112,24 +112,92 @@ def upgrade(): ('Decision Overturned', True);commit;''') op.execute('''INSERT INTO public."OIPCReviewTypesReasons" (reviewtypeid, reasonid, isactive) - VALUES - (1, 1, True), - (1, 4, True), - (1, 5, True), - (1, 6, True), - (1, 8, True), - (1, 16, True), - (2, 2, True), - (2, 3, True), - (2, 9, True), - (2, 10, True), - (2, 11, True), - (2, 12, True), - (2, 13, True), - (2, 14, True), - (2, 15, True), - (2, 16, True), - (3, 16, True);commit;''') + VALUES + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Complaint'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Adequate Search'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Complaint'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Extension'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Complaint'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Fee Amount'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Complaint'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Fee Waiver'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Complaint'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Duty to Assist'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Complaint'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Other'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Review'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Application of Exceptions'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Review'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Deemed Refusal'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Review'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'TPN - 22'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Review'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'TPN - 21'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Review'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'TPN - 18.1'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Review'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Reg 3'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Review'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Reg 4'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Review'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Reg 5'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Review'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 's. 43'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Review'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Other'), + True + ), + ( + (SELECT reviewtypeid FROM public."OIPCReviewTypes" WHERE name = 'Investigation'), + (SELECT reasonid FROM public."OIPCReasons" WHERE name = 'Other'), + True + );commit;''') def downgrade(): op.drop_table('OIPCReviewTypesReasons') From 025ce067979e34df5f59b3d88113ce667d232989 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 23 Nov 2023 11:18:30 -0800 Subject: [PATCH 25/82] Inquiry Story/feature completed. WIP Validation + Save of OIPCDetails to BE --- .../src/actions/FOI/foiActionConstants.js | 1 + .../src/actions/FOI/foiRequestActions.js | 7 ++ .../src/apiManager/endpoints/index.js | 1 + .../services/FOI/foiMasterDataServices.js | 23 ++++++ .../components/FOI/FOIRequest/FOIRequest.js | 2 + .../FOI/FOIRequest/OIPCDetails/Index.jsx | 28 +++++--- .../OIPCDetails/OIPCDetailsList.jsx | 1 + .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 70 ++++++++++++++++++- .../src/modules/FOI/foiRequestsReducer.js | 3 + 9 files changed, 123 insertions(+), 13 deletions(-) diff --git a/forms-flow-web/src/actions/FOI/foiActionConstants.js b/forms-flow-web/src/actions/FOI/foiActionConstants.js index ef0bc6dac..8a94f7f00 100644 --- a/forms-flow-web/src/actions/FOI/foiActionConstants.js +++ b/forms-flow-web/src/actions/FOI/foiActionConstants.js @@ -93,6 +93,7 @@ const FOI_ACTION_CONSTANTS = { OIPC_OUTCOMES: "OIPC_OUTCOMES", OIPC_STATUSES: "OIPC_STATUSES", OIPC_REVIEWTYPES: "OIPC_REVIEWTYPES", + OIPC_INQUIRYOUTCOMES: "OIPC_INQUIRYOUTCOMES", }; export default FOI_ACTION_CONSTANTS; diff --git a/forms-flow-web/src/actions/FOI/foiRequestActions.js b/forms-flow-web/src/actions/FOI/foiRequestActions.js index 46ffcf494..ad9a7beb7 100644 --- a/forms-flow-web/src/actions/FOI/foiRequestActions.js +++ b/forms-flow-web/src/actions/FOI/foiRequestActions.js @@ -446,3 +446,10 @@ export const setOIPCReviewtypes = (data) => (dispatch) => { payload: data, }); }; + +export const setOIPCInquiryoutcomes = (data) => (dispatch) => { + dispatch({ + type: FOI_ACTION_CONSTANTS.OIPC_INQUIRYOUTCOMES, + payload: data, + }); +}; \ No newline at end of file diff --git a/forms-flow-web/src/apiManager/endpoints/index.js b/forms-flow-web/src/apiManager/endpoints/index.js index 60762afca..9e2ddb7d7 100644 --- a/forms-flow-web/src/apiManager/endpoints/index.js +++ b/forms-flow-web/src/apiManager/endpoints/index.js @@ -137,5 +137,6 @@ const API = { FOI_GET_OIPC_OUTCOMES: `${FOI_BASE_API_URL}/api/foiflow/oipc/outcomes`, FOI_GET_OIPC_STATUSES: `${FOI_BASE_API_URL}/api/foiflow/oipc/statuses`, FOI_GET_OIPC_REVIEWTYPES: `${FOI_BASE_API_URL}/api/foiflow/oipc/reviewtypes`, + FOI_GET_OIPC_INQUIRYOUTCOMES: `${FOI_BASE_API_URL}/api/foiflow/oipc/inquiryoutcomes`, }; export default API; diff --git a/forms-flow-web/src/apiManager/services/FOI/foiMasterDataServices.js b/forms-flow-web/src/apiManager/services/FOI/foiMasterDataServices.js index 16bd8476b..5399f22da 100644 --- a/forms-flow-web/src/apiManager/services/FOI/foiMasterDataServices.js +++ b/forms-flow-web/src/apiManager/services/FOI/foiMasterDataServices.js @@ -25,6 +25,7 @@ import { setOIPCOutcomes, setOIPCStatuses, setOIPCReviewtypes, + setOIPCInquiryoutcomes, } from "../../../actions/FOI/foiRequestActions"; import { fnDone, catchError } from "./foiServicesUtil"; import UserService from "../../../services/UserService"; @@ -577,4 +578,26 @@ import { }); }; }; + + export const fetchOIPCInquiryoutcomes = () => { + return (dispatch) => { + httpGETRequest(API.FOI_GET_OIPC_INQUIRYOUTCOMES, {}, UserService.getToken()) + .then((res) => { + if (res.data) { + const oipcInquiryoutcomes = res.data; + dispatch(setOIPCInquiryoutcomes(oipcInquiryoutcomes)); + dispatch(setFOILoader(false)); + } else { + console.log("Error while fetching OIPC inqiuryoutcomes master data", res); + dispatch(serviceActionError(res)); + dispatch(setFOILoader(false)); + } + }) + .catch((error) => { + console.log("Error while fetching OIPC inqiuryoutcomes master data", error); + dispatch(serviceActionError(error)); + dispatch(setFOILoader(false)); + }); + }; + }; \ No newline at end of file diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 6ec696b18..46a69644e 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -27,6 +27,7 @@ import { fetchOIPCOutcomes, fetchOIPCStatuses, fetchOIPCReviewtypes, + fetchOIPCInquiryoutcomes } from "../../../apiManager/services/FOI/foiMasterDataServices"; import { fetchFOIRequestDetailsWrapper, @@ -300,6 +301,7 @@ const FOIRequest = React.memo(({ userDetail }) => { dispatch(fetchOIPCOutcomes()); dispatch(fetchOIPCStatuses()); dispatch(fetchOIPCReviewtypes()); + dispatch(fetchOIPCInquiryoutcomes()); if (bcgovcode) dispatch(fetchFOIMinistryAssignedToList(bcgovcode)); }, [requestId, ministryId, comment, attachments]); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx index e44f4c500..4edf4bcb0 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx @@ -13,17 +13,31 @@ const OIPCDetails = (props) => { const { oipcDetails } = props; //Local State - const createOIPCId = (oipcData) => { + const createOIPCIds = (oipcData) => { if (oipcData.length > 0) { return oipcData.map((item, index) => { item.id = index; return item; }); } else { - return oipcData; + return [{ + id: 0, + oipcno: "", + reviewtypeid: null, + reasonid: null, + statusid: null, + isinquiry: false, + inquiryattributes: null, + receiveddate: "", + closeddate: "", + investigator: "", + outcomeid: null, + isjudicialreview: false, + issubsequentappeal: false, + }]; } } - const [oipcData, setOipcData] = useState(createOIPCId(oipcDetails)); + const [oipcData, setOipcData] = useState(createOIPCIds(oipcDetails)); //Styling const useStyles = makeStyles({ @@ -97,10 +111,4 @@ const OIPCDetails = (props) => { ); } -export default OIPCDetails; - -//IDEA = MasterData is held in a oipcData [{}] state (there is a backend api call to generate the existing oipc data). This is mapped in OIPCDetailsList where each elm is mapped as a OIPCItem. Each OIPC Item has EDITABLE Fields (unless oipcObj outcome value exists? -> therefore we disable the field) -//EACH OIPCITEM HAS ITS OWN INTERNAL STATE WE CAN change and if changed -> the oipcData state wil change as well -// When add button is clicked, we add a new oipcObj to the oipcData state which then creates a new oipcITEM with its own default state which can be edited. -// if any oipcObjs in the oipcData state are missing any of the mandatory fields -> Save button cannot be selected./is disalbed -// When save button is enabled and clicked -> we send the backend api requeset and save the oipc data in backend by sending the master oipc data over. \ No newline at end of file +export default OIPCDetails; \ No newline at end of file diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index b47afe895..dc5cb8b72 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -6,6 +6,7 @@ import { faTrash } from '@fortawesome/free-solid-svg-icons'; const OIPCDetailsList = (props) => { const {oipcData, removeOIPC, updateOIPC} = props; + const OIPCItems = oipcData?.map((oipcObj, index) => { return ( <> diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index be04ac841..b5a8bea92 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -10,6 +10,7 @@ const OIPCItem = (props) => { const oipcOutcomes = useSelector(state=> state.foiRequests.oipcOutcomes); const oipcStatuses = useSelector(state=> state.foiRequests.oipcStatuses); const oipcReviewtypes = useSelector(state=> state.foiRequests.oipcReviewtypes); + const oipcInquiryoutcomes = useSelector(state=> state.foiRequests.oipcInquiryoutcomes); //Local State const [oipc, setOipc] = useState({ @@ -77,6 +78,15 @@ const OIPCItem = (props) => { } const handleInquiry = (value) => { const newOIPCObj = oipc; + if (value === false) { + newOIPCObj.inquiryattributes = null; + } else { + newOIPCObj.inquiryattributes = { + inquirydate: "", + orderno: "", + inquiryoutcomeid: null, + }; + } newOIPCObj.isinquiry = value; updateOIPC(newOIPCObj); } @@ -90,6 +100,19 @@ const OIPCItem = (props) => { newOIPCObj.issubsequentappeal = value; updateOIPC(newOIPCObj); } + const handleInquiryFields = (value, attribute) => { + const newOIPCObj = oipc; + if (attribute === "COMPLYDATE") { + newOIPCObj.inquiryattributes.inquirydate = value; + } + if (attribute === "ORDERNO") { + newOIPCObj.inquiryattributes.orderno = value; + } + if (attribute === "INQUIRYOUTCOME") { + newOIPCObj.inquiryattributes.inquiryoutcomeid = value; + } + updateOIPC(newOIPCObj); + } const generateNamesFromOIPCId = (oipcObj) => { const reviewtype = oipcReviewtypes.find(reviewtype => reviewtype.reviewtypeid === oipcObj.reviewtypeid && reviewtype.reasonid === oipcObj.reasonid); const status = oipcStatuses.find(status => status.statusid === oipcObj.statusid); @@ -193,7 +216,6 @@ const OIPCItem = (props) => { fullWidth label="Investigator/Adjudicator" variant="outlined" - required={true} onChange = {(event) => handleInvestiagtor(event.target.value)} value={oipc.investigator} InputLabelProps={{ shrink: true }} @@ -208,7 +230,6 @@ const OIPCItem = (props) => { fullWidth value={oipc.outcomeid} label="Outcome" - required={true} > {oipcOutcomes.map((outcome) => { return {outcome.name} @@ -220,7 +241,6 @@ const OIPCItem = (props) => { fullWidth label="Closed Date" variant="outlined" - required={true} value={oipc.closeddate} onChange = {(event) => handleClosedDate(event.target.value)} InputLabelProps={{ shrink: true }} @@ -276,6 +296,50 @@ const OIPCItem = (props) => { />
+ {oipc.isinquiry && + + + handleInquiryFields(event.target.value, "COMPLYDATE")} + InputLabelProps={{ shrink: true }} + InputProps={{inputProps: { min: oipc.receiveddate } }} + type="date" + /> + + + handleInquiryFields(event.target.value, "ORDERNO")} + InputLabelProps={{ shrink: true }} + /> + + + handleInquiryFields(event.target.value, "INQUIRYOUTCOME")} + fullWidth + value={oipc.inquiryattributes.inquiryoutcomeid} + label="Outcome" + > + {oipcInquiryoutcomes.map((inquiryoutcome) => { + return {inquiryoutcome.name} + })} + + + + } ); } diff --git a/forms-flow-web/src/modules/FOI/foiRequestsReducer.js b/forms-flow-web/src/modules/FOI/foiRequestsReducer.js index 0c090a82e..9edb8ab4e 100644 --- a/forms-flow-web/src/modules/FOI/foiRequestsReducer.js +++ b/forms-flow-web/src/modules/FOI/foiRequestsReducer.js @@ -148,6 +148,7 @@ const initialState = { oipcOutcomes: [], oipcStatuses: [], oipcReviewtypes: [], + oipcInquiryoutcomes: [], }; const foiRequests = (state = initialState, action) => { @@ -316,6 +317,8 @@ const foiRequests = (state = initialState, action) => { return { ...state, oipcStatuses: action.payload }; case FOI_ACTION_CONSTANTS.OIPC_REVIEWTYPES: return { ...state, oipcReviewtypes: action.payload }; + case FOI_ACTION_CONSTANTS.OIPC_INQUIRYOUTCOMES: + return { ...state, oipcInquiryoutcomes: action.payload }; default: return state; } From a8d46253cfd582982a37c40a18a151a4bd3b92d8 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 23 Nov 2023 15:09:42 -0800 Subject: [PATCH 26/82] Validation work completed. WIP BE post/save + refactor + styling final --- .../components/FOI/FOIRequest/FOIRequest.js | 12 +- .../OIPCDetails/AdditionalInquiryFields.jsx | 0 .../FOI/FOIRequest/OIPCDetails/Index.jsx | 130 +++++------------- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 8 ++ .../FOI/FOIRequest/OIPCDetails/oipcHook.js | 80 +++++++++++ .../src/components/FOI/FOIRequest/utils.js | 10 +- 6 files changed, 135 insertions(+), 105 deletions(-) delete mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AdditionalInquiryFields.jsx create mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 46a69644e..7132275fe 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -94,6 +94,7 @@ import { DISABLE_GATHERINGRECORDS_TAB } from "../../../constants/constants"; import _ from "lodash"; import { MinistryNeedsScanning } from "../../../constants/FOI/enum"; import OIPCDetails from "./OIPCDetails/Index"; +import useOIPCHook from "./OIPCDetails/oipcHook"; const useStyles = makeStyles((theme) => ({ root: { @@ -256,8 +257,9 @@ const FOIRequest = React.memo(({ userDetail }) => { const [isIAORestricted, setIsIAORestricted] = useState(false); const [redactedSections, setRedactedSections] = useState(""); const [isMCFPersonal, setIsMCFPersonal] = useState(bcgovcode.replaceAll('"', '') == "MCF" && requestDetails.requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); + const {oipcData, addOIPC, removeOIPC, updateOIPC} = useOIPCHook(); const [showOIPCDetails, setShowOIPCDetails] = useState(true); - + useEffect(() => { if (window.location.href.indexOf("comments") > -1) { tabclick("Comments"); @@ -661,7 +663,8 @@ const FOIRequest = React.memo(({ userDetail }) => { requiredRequestDetailsValues, requiredAxisDetails, isAddRequest, - _currentrequestStatus + _currentrequestStatus, + oipcData, ); const classes = useStyles(); @@ -1220,7 +1223,10 @@ const FOIRequest = React.memo(({ userDetail }) => { )} {showOIPCDetails && requestDetails.oipcdetails && ( )} diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AdditionalInquiryFields.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AdditionalInquiryFields.jsx deleted file mode 100644 index e69de29bb..000000000 diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx index 4edf4bcb0..c7a6985b1 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx @@ -1,4 +1,3 @@ -import { useState } from 'react'; import OIPCDetailsList from "./OIPCDetailsList"; import Accordion from '@material-ui/core/Accordion'; import AccordionSummary from '@material-ui/core/AccordionSummary'; @@ -10,105 +9,38 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faCirclePlus } from '@fortawesome/free-solid-svg-icons'; const OIPCDetails = (props) => { - const { oipcDetails } = props; - - //Local State - const createOIPCIds = (oipcData) => { - if (oipcData.length > 0) { - return oipcData.map((item, index) => { - item.id = index; - return item; - }); - } else { - return [{ - id: 0, - oipcno: "", - reviewtypeid: null, - reasonid: null, - statusid: null, - isinquiry: false, - inquiryattributes: null, - receiveddate: "", - closeddate: "", - investigator: "", - outcomeid: null, - isjudicialreview: false, - issubsequentappeal: false, - }]; - } + const { oipcData, addOIPC, removeOIPC, updateOIPC } = props; + //Styling + const useStyles = makeStyles({ + heading: { + color: '#FFF', + fontSize: '16px !important', + fontWeight: 'bold !important' + }, + accordionSummary: { + flexDirection: 'row-reverse' } - const [oipcData, setOipcData] = useState(createOIPCIds(oipcDetails)); - - //Styling - const useStyles = makeStyles({ - heading: { - color: '#FFF', - fontSize: '16px !important', - fontWeight: 'bold !important' - }, - accordionSummary: { - flexDirection: 'row-reverse' - } - }); - const classes = useStyles(); - - //Functions - const addOIPC = () => { - setOipcData((prev) => { - return [...prev, { - id: oipcData.length > 0 ? oipcData[oipcData.length - 1].id + 1 : 0, - oipcno: "", - reviewtypeid: null, - reasonid: null, - statusid: null, - isinquiry: false, - inquiryattributes: null, - receiveddate: "", - closeddate: "", - investigator: "", - outcomeid: null, - isjudicialreview: false, - issubsequentappeal: false, - }]; - }) - } - const removeOIPC = (oipcId) => { - setOipcData((prev) => { - const previousOIPCData = [...prev]; - return previousOIPCData.filter(oipc => oipcId !== oipc.id); - }); - } - const updateOIPC = (newOIPCObj) => { - setOipcData((prev) => { - const previousOIPCData = [...prev]; - return previousOIPCData.map((oipc) => { - if (oipc.id === newOIPCObj.id) { - return newOIPCObj; - } else { - return oipc; - } - }); - }); - } - - return ( -
- - }> - OIPC DETAILS - - - -
- -

Add Additional OIPC Complaint

-
-
-
-
- ); + }); + const classes = useStyles(); + + return ( +
+ + }> + OIPC DETAILS + + + +
+ +

Add Additional OIPC Complaint

+
+
+
+
+ ); } export default OIPCDetails; \ No newline at end of file diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index b5a8bea92..c1121bf93 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -145,6 +145,7 @@ const OIPCItem = (props) => { value={oipc.oipcno} onChange = {(event) => handleOIPCNumber(event.target.value)} InputLabelProps={{ shrink: true }} + error={oipc.oipcno === ""} /> @@ -158,6 +159,7 @@ const OIPCItem = (props) => { InputLabelProps={{ shrink: true }} InputProps={{inputProps: { max: oipc.receiveddate || formatDate(new Date())} }} type="date" + error={oipc.receiveddate === ""} /> @@ -170,6 +172,7 @@ const OIPCItem = (props) => { label="Review Type" onChange={(event) => handleReviewType(event.target.value)} required={true} + error={oipc.reviewtypeid === null} > {uniqueReviewTypes(oipcReviewtypes).map((reviewtype) => { return {reviewtype.type_name} @@ -186,6 +189,7 @@ const OIPCItem = (props) => { label="Reason" onChange = {(event) => handleReason(event.target.value)} required={true} + error={oipc.reasonid === null} > {oipc.reviewtypeid ? oipcReviewtypes.map((reviewtype) => { @@ -205,6 +209,7 @@ const OIPCItem = (props) => { label="Status" onChange = {(event) => handleStatus(event.target.value)} required={true} + error={oipc.statusid === null} > {oipcStatuses.map((status) => { return {status.name} @@ -309,6 +314,7 @@ const OIPCItem = (props) => { InputLabelProps={{ shrink: true }} InputProps={{inputProps: { min: oipc.receiveddate } }} type="date" + error={oipc.inquiryattributes.inquirydate === ""} /> @@ -320,6 +326,7 @@ const OIPCItem = (props) => { value={oipc.inquiryattributes.orderno} onChange = {(event) => handleInquiryFields(event.target.value, "ORDERNO")} InputLabelProps={{ shrink: true }} + error={oipc.inquiryattributes.orderno === ""} /> @@ -332,6 +339,7 @@ const OIPCItem = (props) => { fullWidth value={oipc.inquiryattributes.inquiryoutcomeid} label="Outcome" + error={oipc.inquiryattributes.inquiryoutcomeid === null} > {oipcInquiryoutcomes.map((inquiryoutcome) => { return {inquiryoutcome.name} diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js new file mode 100644 index 000000000..1225fe366 --- /dev/null +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js @@ -0,0 +1,80 @@ +import { useState } from "react"; +import { useSelector } from "react-redux"; + +const useOIPCHook = () => { + //OIPC State + const requestDetails = useSelector((state) => state.foiRequests.foiRequestDetail); + const stageOIPCData = (oipcData) => { + if (oipcData?.length > 0) { + return oipcData.map((item, index) => { + item.id = index; + return item; + }); + } else { + return [{ + id: 0, + oipcno: "", + reviewtypeid: null, + reasonid: null, + statusid: null, + isinquiry: false, + inquiryattributes: null, + receiveddate: "", + closeddate: "", + investigator: "", + outcomeid: null, + isjudicialreview: false, + issubsequentappeal: false, + }]; + } + } + const [oipcData, setOipcData] = useState(stageOIPCData(requestDetails.oipcdetails)); + + //OIPC Functions + const addOIPC = () => { + setOipcData((prev) => { + return [...prev, { + id: oipcData.length > 0 ? oipcData[oipcData.length - 1].id + 1 : 0, + oipcno: "", + reviewtypeid: null, + reasonid: null, + statusid: null, + isinquiry: false, + inquiryattributes: null, + receiveddate: "", + closeddate: "", + investigator: "", + outcomeid: null, + isjudicialreview: false, + issubsequentappeal: false, + }]; + }) + } + const removeOIPC = (oipcId) => { + setOipcData((prev) => { + const previousOIPCData = [...prev]; + return previousOIPCData.filter(oipc => oipcId !== oipc.id); + }); + } + const updateOIPC = (newOIPCObj) => { + setOipcData((prev) => { + const previousOIPCData = [...prev]; + return previousOIPCData.map((oipc) => { + if (oipc.id === newOIPCObj.id) { + return newOIPCObj; + } else { + return oipc; + } + }); + }); + } + + return { + oipcData, + addOIPC, + removeOIPC, + updateOIPC, + }; +}; + +export default useOIPCHook; \ No newline at end of file diff --git a/forms-flow-web/src/components/FOI/FOIRequest/utils.js b/forms-flow-web/src/components/FOI/FOIRequest/utils.js index f4aa33500..f608e6147 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/utils.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/utils.js @@ -321,9 +321,9 @@ export const checkValidationError = ( requiredRequestDetailsValues, requiredAxisDetails, isAddRequest, - currentrequestStatus + currentrequestStatus, + oipcData ) => { - return ( requiredApplicantDetails.firstName === "" || requiredApplicantDetails.lastName === "" || @@ -346,7 +346,11 @@ export const checkValidationError = ( .includes("select") || !requiredRequestDetailsValues.receivedDate || !requiredRequestDetailsValues.requestStartDate || - !requiredAxisDetails.axisRequestId + !requiredAxisDetails.axisRequestId || + oipcData.some((oipc) => { + return oipc.oipcno === "" || oipc.receiveddate === "" || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null || + oipc.inquiryattributes?.orderno === "" || oipc.inquiryattributes?.inquiryoutcomeid === null || oipc.inquiryattributes?.inquirydate === ""; + }) ); }; From 49ebfe6067ce56889e4025075b4bfd92fc125ee4 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 23 Nov 2023 15:55:44 -0800 Subject: [PATCH 27/82] Create RequestFlag component --- .../FOI/customComponents/RequestFlag.js | 348 ++++++++++++++++++ .../FOI/customComponents/requestflag.scss | 78 ++++ 2 files changed, 426 insertions(+) create mode 100644 forms-flow-web/src/components/FOI/customComponents/RequestFlag.js create mode 100644 forms-flow-web/src/components/FOI/customComponents/requestflag.scss diff --git a/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js b/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js new file mode 100644 index 000000000..0cc461e70 --- /dev/null +++ b/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js @@ -0,0 +1,348 @@ +import React, { useEffect, useState } from "react"; +import "./requestflag.scss"; + +import OutlinedInput from "@material-ui/core/OutlinedInput"; +import InputLabel from "@mui/material/InputLabel"; +import MenuItem from "@material-ui/core/MenuItem"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faFlag } from "@fortawesome/free-regular-svg-icons"; +import { faFlag as faSolidFlag } from "@fortawesome/free-solid-svg-icons"; +import Dialog from "@material-ui/core/Dialog"; +import DialogActions from "@material-ui/core/DialogActions"; +import DialogContent from "@material-ui/core/DialogContent"; +import DialogContentText from "@material-ui/core/DialogContentText"; +import DialogTitle from "@material-ui/core/DialogTitle"; +import CloseIcon from "@material-ui/icons/Close"; +import IconButton from "@material-ui/core/IconButton"; +import TextField from "@mui/material/TextField"; +import { useParams } from "react-router-dom"; +import { saveRequestDetails } from "../../../apiManager/services/FOI/foiRequestServices"; +import { toast } from "react-toastify"; +import { useDispatch } from "react-redux"; +import { + restrictRequest, + fetchFOIRequestDetailsWrapper, +} from "../../../apiManager/services/FOI/foiRequestServices"; +import { request } from "http"; +import { is } from "immutable"; + +//Types are: +//oipcreview +//phasedrelease +const RequestFlag = ({ type, requestDetails }) => { + const [isSelected, setIsSelected] = useState(requestDetails.isActive); + const [modalOpen, setModalOpen] = useState(false); + const [modalHeading, setModalHeading] = useState(""); + const [modalMessage, setModalMessage] = useState(""); + const [modalDescription, setModalDescription] = useState(""); + + const { requestId, ministryId } = useParams(); + + const dispatch = useDispatch(); + + + + // These need to be set for each type + let options; + let id; + let modalHeadingActive = ""; + let modalHeadingInactive = ""; + let modalMessageActive = ""; + let modalMessageInactive = ""; + let modalDescriptionActive = ""; + let modalDescriptionInactive = ""; + + let handleSaveForActive = () => {}; + let handleSaveForInactive = () => {}; + + // css + let iconClass; + let isSelectedBgClass; + let bgClass; + + console.log('options: ', options) + console.log('type: ', type) + switch (type) { + //Need to change heading, message, description for modals as well + case "oipcreview": + options = [ + { + value: true, + label: "OIPC Review", + disabled: false, + }, + { + value: false, + label: "No Review", + disabled: false, + }, + ]; + + id = "oipc-review-flag"; + iconClass = "oipc-review-icon"; + isSelectedBgClass = + "linear-gradient(to right, rgba(250,124,22,0.32) 80%, #fa7c16 0%)"; + bgClass = "linear-gradient(to right, #fff 80%, #fa7c16 0%)"; + + //when setting to active + modalHeadingActive = "OIPC Review"; + modalMessageActive = + "Are you sure you want to flag this request as OIPC review?"; + modalDescriptionActive = ( + + This will create a new OIPC review section on this request. + + ); + console.log('options: ', options) + + handleSaveForActive = () => { + console.log("setting to active"); + requestDetails.isoipcreview = true; + console.log(requestDetails); + }; + + //when setting to inactive + modalHeadingActive = "OIPC Review"; + modalMessageInactive = + "Are you sure you want to remove the OIPC review flag from this request?"; + modalDescriptionInactive = ( + + This will remove the OIPC review section from this request. + + ); + handleSaveForInactive = () => { + console.log("setting to inactive"); + requestDetails.isoipcreview = false; + console.log(requestDetails); + }; + break; + + case "phasedrelease": + options = [ + { + value: true, + label: "Phased Release", + disabled: false, + }, + { + value: false, + label: "Single Release", + disabled: false, + }, + ]; + + id = "phased-release-flag"; + iconClass = "phased-release-icon"; + isSelectedBgClass = + "linear-gradient(to right, rgba(146, 7, 183, 0.32) 80%, #9207b7 0%)"; + bgClass = "linear-gradient(to right, #fff 80%, #9207b7 0%)"; + + //when setting to active + modalHeadingActive = "Phased Release"; + modalMessageActive = + "Are you sure you want to flag this request as a Phased Release?"; + modalDescriptionActive = ( + This will tag the request as Phased Release. + ); + handleSaveForActive = () => { + console.log("setting to active"); + requestDetails.isphasedrelease = true; + console.log(requestDetails); + }; + + //when setting to inactive + modalHeadingInactive = "Single Release"; + modalMessageInactive = + "Are you sure you want to change this request to Single Release?"; + modalDescriptionInactive = ( + This will tag the request as Single Release. + ); + handleSaveForInactive = () => { + console.log("setting to inactive"); + requestDetails.isphasedrelease = false; + console.log(requestDetails); + }; + break; + } + + const handleValueChange = (e) => { + setModalOpen(true); + + if (e.target.value == true) { + setModalHeading(modalHeadingActive); + setModalMessage(modalMessageActive); + setModalDescription(modalDescriptionActive); + } else { + setModalHeading(modalHeadingInactive); + setModalMessage(modalMessageInactive); + setModalDescription(modalDescriptionInactive); + } + setIsSelected(e.target.value); + }; + + const handleClose = () => { + setModalOpen(false); + setIsSelected(requestDetails.isActive); + }; + + const handleSave = (e) => { + setModalOpen(false); + saveOipcReviewStatus(); + // if (isSelected) { + // handleSaveForActive(); + // } else { + // handleSaveForInactive(); + // } + }; + + const saveOipcReviewStatus = () => { + // dispatch(setFOILoader(setLoader)); + let updatedRequestDetails; + if (type == "oipcreview") { + updatedRequestDetails = { + ...requestDetails, + isoipcreview: isSelected, + }; + } else if (type == "phasedrelease") { + updatedRequestDetails = { + ...requestDetails, + isphasedrelease: isSelected, + }; + } + dispatch( + saveRequestDetails( + updatedRequestDetails, + -2, + requestId, + ministryId, + (err, res) => { + if (!err) { + toast.success("The request has been saved successfully.", { + position: "top-right", + autoClose: 3000, + hideProgressBar: true, + closeOnClick: true, + pauseOnHover: true, + draggable: true, + progress: undefined, + }); + // const _state = getRequestState({ + // currentSelectedStatus, + // requestState, + // urlIndexCreateRequest, + // saveRequestObject, + // }); + // handleSaveRequest(_state, false, res.id); + // hasStatusRequestSaved(currentSelectedStatus); + } else { + toast.error( + "Temporarily unable to save your request. Please try again in a few minutes.", + { + position: "top-right", + autoClose: 3000, + hideProgressBar: true, + closeOnClick: true, + pauseOnHover: true, + draggable: true, + progress: undefined, + } + ); + // handleSaveRequest(requestState, true, ""); + } + } + ) + ); + }; + + return ( + <> +
+
+
+ {isSelected ? ( + + ) : ( + + )} + {/* + Unrestricted + */} + } + disabled={false} + > + {options.map((option) => ( + + {option.label} + + ))} + +
+
+
+
+ { + console.log("onClose"); + }} + aria-labelledby="state-change-dialog-title" + aria-describedby="restricted-modal-text" + maxWidth={"md"} + fullWidth={true} + // id="state-change-dialog" + > + +

{modalHeading}

+ + Close + + +
+ + +
+
{modalMessage}
+
+ {modalDescription} +
+
+
+
+ + + + +
+
+ + ); +}; + +export default RequestFlag; diff --git a/forms-flow-web/src/components/FOI/customComponents/requestflag.scss b/forms-flow-web/src/components/FOI/customComponents/requestflag.scss new file mode 100644 index 000000000..4eb12f1e6 --- /dev/null +++ b/forms-flow-web/src/components/FOI/customComponents/requestflag.scss @@ -0,0 +1,78 @@ +.request-flag { + + margin-left: 15px; + + .request-flag-dropdown-all { + padding-top: 10px; + display: flex; + min-width: 200px !important; + } + + .oipc-review-icon{ + color: #fa7c16; + padding-left: 14px; + margin-top: 3px; + } + + .phased-release-icon{ + color: #9207b7; + padding-left: 14px; + margin-top: 3px; + } + + .restrict-label { + border: 1px solid #a0192f; + width: 100px; + border-radius: 40px 0 0 40px; + } + + .request-flag-select{ + border: 1px solid #a0192f; + //padding-top: 8px; + //width:40px; + height: 40px; + border-radius: 40px; + padding-left: 3px; + //background: linear-gradient(to right, rgba(160,25,47,0.32) 80%, #a0192f 0%); + } + + + .request-flag-dropdown { + color: black !important; + width: 155px; + padding-left: 10px; + } + + .request-flag-dropdown .MuiSelect-icon { + color: white !important; + } + + .request-flag-dropdown .MuiOutlinedInput-notchedOutline { + border: none !important; + } + + .request-flag-dropdown .MuiInputBase-input, + .request-flag-dropdown .MuiOutlinedInput-input { + padding: 0px !important + } + + @media (max-width: 1242px) { + margin-left: 0px; + } + +} + +#restricted-modal-text{ + margin: 15px 65px; + display: block; + color: #000; +} + +.modal-msg { + text-align: center; +} + +.modal-msg-description { + padding-top: 25px; +} + From 9276b0eaa435f8f9ff885a45b6d5380cc3f0d475 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 23 Nov 2023 17:33:24 -0800 Subject: [PATCH 28/82] Request Object Adjusted. Testing of save to BE WIP + refactor + styling --- .../components/FOI/FOIRequest/FOIRequest.js | 9 ++++ .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 47 +++++++++++-------- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 7132275fe..59a339187 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -775,7 +775,16 @@ const FOIRequest = React.memo(({ userDetail }) => { }; } }, [editorChange]); + + //useEffect to update saveReq object with oipc data + useEffect(() => { + setSaveRequestObject((prev) => { + return {...prev, oipcdetails: oipcData} + }) + }, [oipcData]); + console.log(saveRequestObject) + const tabclick = (param) => { if (param === "Comments") { sessionStorage.setItem("foicommentcategory", 1); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index c1121bf93..fe98db8da 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -25,16 +25,39 @@ const OIPCItem = (props) => { closeddate: oipcObj?.closeddate, investigator: oipcObj?.investigator, outcomeid: oipcObj?.outcomeid, - isjudicialreview: oipcObj?.isjudicialreview, - reviewtypeName: oipcObj?.reviewtypeName, - reasonName: oipcObj?.reasonName, - statusName: oipcObj?.statusName, - outcomeName: oipcObj?.outcomeName, + isjudicialreview: oipcObj?.isjudicialreview, + issubsequentappeal: oipcObj?.issubsequentappeal, + reviewtypeName: "", + reasonName: "", + statusName: "", + outcomeName: "", }); console.log(oipc); //Functions + const generateNamesFromOIPCId = (oipcObj) => { + const reviewtype = oipcReviewtypes.find(reviewtype => reviewtype.reviewtypeid === oipcObj.reviewtypeid && reviewtype.reasonid === oipcObj.reasonid); + const status = oipcStatuses.find(status => status.statusid === oipcObj.statusid); + const outcome = oipcOutcomes.find(outcome => outcome.outcomeid === oipcObj.outcomeid); + + setOipc((prev) => { + return {...prev, reviewtypeName: reviewtype ? reviewtype.type_name : ""} + }) + setOipc((prev) => { + return {...prev, statusName: status ? status.type_name : ""} + }) + setOipc((prev) => { + return {...prev, outcomeName: outcome ? outcome.type_name : ""} + }) + setOipc((prev) => { + return {...prev, reasonName: reviewtype ? reviewtype.reason_name : ""} + }) + } + const uniqueReviewTypes = (oipcReviewTypes) => { + const uniqeValues = {}; + return oipcReviewTypes.filter(reviewtype => !uniqeValues[reviewtype.type_name] && (uniqeValues[reviewtype.type_name] = true)); + } const handleReviewType = (value) => { const newOIPCObj = oipc; newOIPCObj.reviewtypeid = value; @@ -113,20 +136,6 @@ const OIPCItem = (props) => { } updateOIPC(newOIPCObj); } - const generateNamesFromOIPCId = (oipcObj) => { - const reviewtype = oipcReviewtypes.find(reviewtype => reviewtype.reviewtypeid === oipcObj.reviewtypeid && reviewtype.reasonid === oipcObj.reasonid); - const status = oipcStatuses.find(status => status.statusid === oipcObj.statusid); - const outcome = oipcOutcomes.find(outcome => outcome.outcomeid === oipcObj.outcomeid); - - oipcObj.reviewtypeName = reviewtype ? reviewtype.type_name : ""; - oipcObj.statusName = status ? status.name : ""; - oipcObj.outcomeName = outcome ? outcome.name : ""; - oipcObj.reasonName = reviewtype ? reviewtype.reason_name : ""; - } - const uniqueReviewTypes = (oipcReviewTypes) => { - const uniqeValues = {}; - return oipcReviewTypes.filter(reviewtype => !uniqeValues[reviewtype.type_name] && (uniqeValues[reviewtype.type_name] = true)); - } //useEffect to create name attributes using id's for oipcObject useEffect(() => { From 1d61bd65d403e2940125c10eae71397201e7f87a Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Fri, 24 Nov 2023 15:42:03 -0800 Subject: [PATCH 29/82] Backend integration completed. WIP remaining stories/validations + refactor + styling finalization --- .../FOI/FOIRequest/BottomButtonGroup/index.js | 8 +++-- .../components/FOI/FOIRequest/FOIRequest.js | 12 ++------ .../OIPCDetails/OIPCDetailsList.jsx | 2 ++ .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 29 ++++++++++++++----- .../FOI/FOIRequest/OIPCDetails/oipcHook.js | 20 +++++++++---- .../src/components/FOI/FOIRequest/utils.js | 6 ++-- 6 files changed, 48 insertions(+), 29 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js index 5c301c061..ef9ba63d5 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js @@ -75,7 +75,8 @@ const BottomButtonGroup = React.memo( requestState, axisSyncedData, axisMessage, - attachmentsArray + attachmentsArray, + oipcData, }) => { /** * Bottom Button Group of Review request Page @@ -117,7 +118,10 @@ const BottomButtonGroup = React.memo( if (urlIndexCreateRequest > -1) { saveRequestObject.requeststatusid = StateEnum.intakeinprogress.id; setIsAddRequest(false); - } + } + //add oipc Data + saveRequestObject.oipcdetails = oipcData; + console.log(saveRequestObject) dispatch(setFOILoader(setLoader)) dispatch( saveRequestDetails( diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 59a339187..968049575 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -776,15 +776,6 @@ const FOIRequest = React.memo(({ userDetail }) => { } }, [editorChange]); - //useEffect to update saveReq object with oipc data - useEffect(() => { - setSaveRequestObject((prev) => { - return {...prev, oipcdetails: oipcData} - }) - }, [oipcData]); - - console.log(saveRequestObject) - const tabclick = (param) => { if (param === "Comments") { sessionStorage.setItem("foicommentcategory", 1); @@ -1230,7 +1221,7 @@ const FOIRequest = React.memo(({ userDetail }) => { divisions={requestDetails.divisions} /> )} - {showOIPCDetails && requestDetails.oipcdetails && ( + {showOIPCDetails && requestDetails.isoipcreview && requestState && requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && ( { axisSyncedData={axisSyncedData} axisMessage={axisMessage} attachmentsArray={requestAttachments} + oipcData={oipcData} /> diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index dc5cb8b72..f183df533 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -6,6 +6,8 @@ import { faTrash } from '@fortawesome/free-solid-svg-icons'; const OIPCDetailsList = (props) => { const {oipcData, removeOIPC, updateOIPC} = props; + + console.log("COMPONENT", oipcData) const OIPCItems = oipcData?.map((oipcObj, index) => { return ( diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index fe98db8da..b6c158685 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -27,10 +27,10 @@ const OIPCItem = (props) => { outcomeid: oipcObj?.outcomeid, isjudicialreview: oipcObj?.isjudicialreview, issubsequentappeal: oipcObj?.issubsequentappeal, - reviewtypeName: "", - reasonName: "", - statusName: "", - outcomeName: "", + reviewtypeName: oipcObj?.reviewtype, + reasonName: oipcObj?.reason, + statusName: oipcObj?.status, + outcomeName: oipcObj?.outcome, }); console.log(oipc); @@ -62,41 +62,49 @@ const OIPCItem = (props) => { const newOIPCObj = oipc; newOIPCObj.reviewtypeid = value; newOIPCObj.reasonid = null; + setOipc(newOIPCObj); updateOIPC(newOIPCObj); } const handleOIPCNumber = (value) => { const newOIPCObj = oipc; newOIPCObj.oipcno = value; + setOipc(newOIPCObj); updateOIPC(newOIPCObj); } const handleReceivedDate = (value) => { const newOIPCObj = oipc; newOIPCObj.receiveddate = value; + setOipc(newOIPCObj); updateOIPC(newOIPCObj); } const handleClosedDate = (value) => { const newOIPCObj = oipc; newOIPCObj.closeddate = value; + setOipc(newOIPCObj); updateOIPC(newOIPCObj); } const handleReason = (value) => { const newOIPCObj = oipc; newOIPCObj.reasonid = value; + setOipc(newOIPCObj); updateOIPC(newOIPCObj); } const handleStatus = (value) => { const newOIPCObj = oipc; newOIPCObj.statusid = value; + setOipc(newOIPCObj); updateOIPC(newOIPCObj); } const handleInvestiagtor = (value) => { const newOIPCObj = oipc; newOIPCObj.investigator = value; + setOipc(newOIPCObj); updateOIPC(newOIPCObj); } const handleOutcome = (value) => { const newOIPCObj = oipc; newOIPCObj.outcomeid = value; + setOipc(newOIPCObj); updateOIPC(newOIPCObj); } const handleInquiry = (value) => { @@ -111,16 +119,19 @@ const OIPCItem = (props) => { }; } newOIPCObj.isinquiry = value; + setOipc(newOIPCObj); updateOIPC(newOIPCObj); } const handleJudicalReview = (value) => { const newOIPCObj = oipc; newOIPCObj.isjudicialreview = value; + setOipc(newOIPCObj); updateOIPC(newOIPCObj); } const handleSubsequentAppeal = (value) => { const newOIPCObj = oipc; newOIPCObj.issubsequentappeal = value; + setOipc(newOIPCObj); updateOIPC(newOIPCObj); } const handleInquiryFields = (value, attribute) => { @@ -134,12 +145,13 @@ const OIPCItem = (props) => { if (attribute === "INQUIRYOUTCOME") { newOIPCObj.inquiryattributes.inquiryoutcomeid = value; } + setOipc(newOIPCObj); updateOIPC(newOIPCObj); } - //useEffect to create name attributes using id's for oipcObject useEffect(() => { - generateNamesFromOIPCId(oipcObj); + setOipc(oipcObj); + generateNamesFromOIPCId(oipc); }, [oipcObj]) return ( @@ -163,12 +175,13 @@ const OIPCItem = (props) => { label="Received Date" variant="outlined" required={true} + defaultValue="" value={oipc.receiveddate} onChange = {(event) => handleReceivedDate(event.target.value)} InputLabelProps={{ shrink: true }} - InputProps={{inputProps: { max: oipc.receiveddate || formatDate(new Date())} }} + InputProps={{inputProps: { max: formatDate(new Date())} }} type="date" - error={oipc.receiveddate === ""} + error={oipc.receiveddate === null} />
diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js index 1225fe366..0fb9d8704 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useState, useEffect } from "react"; import { useSelector } from "react-redux"; const useOIPCHook = () => { @@ -19,8 +19,8 @@ const useOIPCHook = () => { statusid: null, isinquiry: false, inquiryattributes: null, - receiveddate: "", - closeddate: "", + receiveddate: null, + closeddate: null, investigator: "", outcomeid: null, isjudicialreview: false, @@ -28,7 +28,14 @@ const useOIPCHook = () => { }]; } } - const [oipcData, setOipcData] = useState(stageOIPCData(requestDetails.oipcdetails)); + const [oipcData, setOipcData] = useState(requestDetails.oipcdetails); + + useEffect(() => { + const stagedOIPCData = stageOIPCData(requestDetails.oipcdetails); + setOipcData(stagedOIPCData); + }, [requestDetails]) + + console.log("HOOK", oipcData) //OIPC Functions const addOIPC = () => { @@ -41,8 +48,8 @@ const useOIPCHook = () => { statusid: null, isinquiry: false, inquiryattributes: null, - receiveddate: "", - closeddate: "", + receiveddate: null, + closeddate: null, investigator: "", outcomeid: null, isjudicialreview: false, @@ -74,6 +81,7 @@ const useOIPCHook = () => { addOIPC, removeOIPC, updateOIPC, + stageOIPCData, }; }; diff --git a/forms-flow-web/src/components/FOI/FOIRequest/utils.js b/forms-flow-web/src/components/FOI/FOIRequest/utils.js index f608e6147..b5398f082 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/utils.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/utils.js @@ -347,10 +347,10 @@ export const checkValidationError = ( !requiredRequestDetailsValues.receivedDate || !requiredRequestDetailsValues.requestStartDate || !requiredAxisDetails.axisRequestId || - oipcData.some((oipc) => { - return oipc.oipcno === "" || oipc.receiveddate === "" || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null || + (oipcData.length > 0 && oipcData.some((oipc) => { + return oipc.oipcno === "" || oipc.receiveddate === null || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null || oipc.inquiryattributes?.orderno === "" || oipc.inquiryattributes?.inquiryoutcomeid === null || oipc.inquiryattributes?.inquirydate === ""; - }) + })) ); }; From 46795f439a442fb7c30cfd7674b2e1ea53677600 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Fri, 24 Nov 2023 16:26:13 -0800 Subject: [PATCH 30/82] Date picker validation completed --- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index b6c158685..bcb2c5bef 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -32,8 +32,6 @@ const OIPCItem = (props) => { statusName: oipcObj?.status, outcomeName: oipcObj?.outcome, }); - - console.log(oipc); //Functions const generateNamesFromOIPCId = (oipcObj) => { @@ -176,7 +174,7 @@ const OIPCItem = (props) => { variant="outlined" required={true} defaultValue="" - value={oipc.receiveddate} + value={oipc.receiveddate ? formatDate(new Date(oipc.receiveddate)) : null} onChange = {(event) => handleReceivedDate(event.target.value)} InputLabelProps={{ shrink: true }} InputProps={{inputProps: { max: formatDate(new Date())} }} @@ -268,10 +266,9 @@ const OIPCItem = (props) => { fullWidth label="Closed Date" variant="outlined" - value={oipc.closeddate} + value={oipc.closeddate ? formatDate(new Date(oipc.closeddate)) : null} onChange = {(event) => handleClosedDate(event.target.value)} InputLabelProps={{ shrink: true }} - InputProps={{inputProps: { max: oipc.closeddate || formatDate(new Date())} }} type="date" /> @@ -331,10 +328,10 @@ const OIPCItem = (props) => { label="Comply By Date" variant="outlined" required={true} - value={oipc.inquiryattributes.inquirydate} + value={oipc.inquiryattributes.inquirydate ? formatDate(new Date(oipc.inquiryattributes.inquirydate)) : null} onChange = {(event) => handleInquiryFields(event.target.value, "COMPLYDATE")} InputLabelProps={{ shrink: true }} - InputProps={{inputProps: { min: oipc.receiveddate } }} + InputProps={{inputProps: { min: oipc.receiveddate ? formatDate(new Date(oipc.receiveddate)) : null } }} type="date" error={oipc.inquiryattributes.inquirydate === ""} /> From 5f22beff1cb6ccf5cf9435af3e3f8a35ce5b48eb Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Fri, 24 Nov 2023 17:19:32 -0800 Subject: [PATCH 31/82] Bug fixes for communication between backend and frontend (getting/posting) --- .../FOI/FOIRequest/BottomButtonGroup/index.js | 1 - .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 13 +++++++------ .../src/components/FOI/FOIRequest/utils.js | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js index ef9ba63d5..19678e50b 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js @@ -121,7 +121,6 @@ const BottomButtonGroup = React.memo( } //add oipc Data saveRequestObject.oipcdetails = oipcData; - console.log(saveRequestObject) dispatch(setFOILoader(setLoader)) dispatch( saveRequestDetails( diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index bcb2c5bef..a653305a9 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -111,9 +111,9 @@ const OIPCItem = (props) => { newOIPCObj.inquiryattributes = null; } else { newOIPCObj.inquiryattributes = { - inquirydate: "", + inquirydate: null, orderno: "", - inquiryoutcomeid: null, + inquiryoutcome: null, }; } newOIPCObj.isinquiry = value; @@ -141,7 +141,7 @@ const OIPCItem = (props) => { newOIPCObj.inquiryattributes.orderno = value; } if (attribute === "INQUIRYOUTCOME") { - newOIPCObj.inquiryattributes.inquiryoutcomeid = value; + newOIPCObj.inquiryattributes.inquiryoutcome = value; } setOipc(newOIPCObj); updateOIPC(newOIPCObj); @@ -269,6 +269,7 @@ const OIPCItem = (props) => { value={oipc.closeddate ? formatDate(new Date(oipc.closeddate)) : null} onChange = {(event) => handleClosedDate(event.target.value)} InputLabelProps={{ shrink: true }} + InputProps={{inputProps: { max: formatDate(new Date())} }} type="date" /> @@ -333,7 +334,7 @@ const OIPCItem = (props) => { InputLabelProps={{ shrink: true }} InputProps={{inputProps: { min: oipc.receiveddate ? formatDate(new Date(oipc.receiveddate)) : null } }} type="date" - error={oipc.inquiryattributes.inquirydate === ""} + error={oipc.inquiryattributes.inquirydate === null} /> @@ -356,9 +357,9 @@ const OIPCItem = (props) => { variant="outlined" onChange = {(event) => handleInquiryFields(event.target.value, "INQUIRYOUTCOME")} fullWidth - value={oipc.inquiryattributes.inquiryoutcomeid} + value={oipc.inquiryattributes.inquiryoutcome} label="Outcome" - error={oipc.inquiryattributes.inquiryoutcomeid === null} + error={oipc.inquiryattributes.inquiryoutcome === null} > {oipcInquiryoutcomes.map((inquiryoutcome) => { return {inquiryoutcome.name} diff --git a/forms-flow-web/src/components/FOI/FOIRequest/utils.js b/forms-flow-web/src/components/FOI/FOIRequest/utils.js index b5398f082..b73988d48 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/utils.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/utils.js @@ -349,7 +349,7 @@ export const checkValidationError = ( !requiredAxisDetails.axisRequestId || (oipcData.length > 0 && oipcData.some((oipc) => { return oipc.oipcno === "" || oipc.receiveddate === null || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null || - oipc.inquiryattributes?.orderno === "" || oipc.inquiryattributes?.inquiryoutcomeid === null || oipc.inquiryattributes?.inquirydate === ""; + oipc.inquiryattributes?.orderno === "" || oipc.inquiryattributes?.inquiryoutcome === null || oipc.inquiryattributes?.inquirydate === null; })) ); }; From c518e51c105630a1bc4a0bbb2d0809bf3f6cd353 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Sat, 25 Nov 2023 14:45:47 -0800 Subject: [PATCH 32/82] Added further deletion validation to OIPC reviews. WIP outcome validation + BE Testing + refactor/final styling --- .../FOI/FOIRequest/BottomButtonGroup/index.js | 9 ++- .../components/FOI/FOIRequest/FOIRequest.js | 1 + .../FOI/FOIRequest/OIPCDetails/Index.jsx | 1 + .../OIPCDetails/OIPCDetailsList.jsx | 12 +--- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 51 +++++++-------- .../OIPCDetails/RemoveOIPCModal.jsx | 62 +++++++++++++++++++ .../src/components/FOI/FOIRequest/utils.js | 5 +- 7 files changed, 96 insertions(+), 45 deletions(-) create mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx diff --git a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js index 19678e50b..1b2d06b3c 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js @@ -118,9 +118,12 @@ const BottomButtonGroup = React.memo( if (urlIndexCreateRequest > -1) { saveRequestObject.requeststatusid = StateEnum.intakeinprogress.id; setIsAddRequest(false); - } - //add oipc Data - saveRequestObject.oipcdetails = oipcData; + } + + //add oipc Data to save request object + saveRequestObject.oipcdetails = oipcData; + if (oipcData.length <= 0) saveRequestObject.isoipcreview = false; + dispatch(setFOILoader(setLoader)) dispatch( saveRequestDetails( diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 968049575..cf024584b 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -665,6 +665,7 @@ const FOIRequest = React.memo(({ userDetail }) => { isAddRequest, _currentrequestStatus, oipcData, + requestDetails.isoipcreview, ); const classes = useStyles(); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx index c7a6985b1..2d02e79e8 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/Index.jsx @@ -10,6 +10,7 @@ import { faCirclePlus } from '@fortawesome/free-solid-svg-icons'; const OIPCDetails = (props) => { const { oipcData, addOIPC, removeOIPC, updateOIPC } = props; + //Styling const useStyles = makeStyles({ heading: { diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index f183df533..afa6f2fa8 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -1,23 +1,15 @@ import OIPCItem from "./OIPCItem"; import Divider from '@material-ui/core/Divider'; import './oipcdetails.scss'; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faTrash } from '@fortawesome/free-solid-svg-icons'; const OIPCDetailsList = (props) => { const {oipcData, removeOIPC, updateOIPC} = props; console.log("COMPONENT", oipcData) - const OIPCItems = oipcData?.map((oipcObj, index) => { return ( - <> -
- -
- + <> + {index !== (oipcData.length - 1) && } ); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index a653305a9..27cd1aac1 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -2,9 +2,12 @@ import { TextField, FormControlLabel, MenuItem, Grid, Checkbox } from '@material import { useState, useEffect } from "react"; import { formatDate } from "../../../../helper/FOI/helper"; import { useSelector } from "react-redux"; +import RemoveOIPCModal from './RemoveOIPCModal'; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faTrash } from '@fortawesome/free-solid-svg-icons'; const OIPCItem = (props) => { - const {oipcObj, updateOIPC} = props; + const {oipcObj, updateOIPC, removeOIPC} = props; //App State const oipcOutcomes = useSelector(state=> state.foiRequests.oipcOutcomes); @@ -13,25 +16,8 @@ const OIPCItem = (props) => { const oipcInquiryoutcomes = useSelector(state=> state.foiRequests.oipcInquiryoutcomes); //Local State - const [oipc, setOipc] = useState({ - id: oipcObj?.id, - oipcno: oipcObj?.oipcno, - reviewtypeid: oipcObj?.reviewtypeid, - reasonid: oipcObj?.reasonid, - statusid: oipcObj?.statusid, - isinquiry: oipcObj?.isinquiry, - inquiryattributes: oipcObj?.inquiryattributes, - receiveddate: oipcObj?.receiveddate, - closeddate: oipcObj?.closeddate, - investigator: oipcObj?.investigator, - outcomeid: oipcObj?.outcomeid, - isjudicialreview: oipcObj?.isjudicialreview, - issubsequentappeal: oipcObj?.issubsequentappeal, - reviewtypeName: oipcObj?.reviewtype, - reasonName: oipcObj?.reason, - statusName: oipcObj?.status, - outcomeName: oipcObj?.outcome, - }); + const [oipc, setOipc] = useState(oipcObj); + const [showDeleteModal, setShowDeleteModal] = useState(false); //Functions const generateNamesFromOIPCId = (oipcObj) => { @@ -153,18 +139,24 @@ const OIPCItem = (props) => { }, [oipcObj]) return ( - <> + <> +
+ +
+ {showDeleteModal && } handleOIPCNumber(event.target.value)} InputLabelProps={{ shrink: true }} error={oipc.oipcno === ""} + required /> @@ -172,14 +164,13 @@ const OIPCItem = (props) => { fullWidth label="Received Date" variant="outlined" - required={true} - defaultValue="" value={oipc.receiveddate ? formatDate(new Date(oipc.receiveddate)) : null} onChange = {(event) => handleReceivedDate(event.target.value)} InputLabelProps={{ shrink: true }} InputProps={{inputProps: { max: formatDate(new Date())} }} type="date" error={oipc.receiveddate === null} + required /> @@ -191,8 +182,8 @@ const OIPCItem = (props) => { value={oipc.reviewtypeid} label="Review Type" onChange={(event) => handleReviewType(event.target.value)} - required={true} error={oipc.reviewtypeid === null} + required > {uniqueReviewTypes(oipcReviewtypes).map((reviewtype) => { return {reviewtype.type_name} @@ -208,8 +199,8 @@ const OIPCItem = (props) => { value={oipc.reasonid} label="Reason" onChange = {(event) => handleReason(event.target.value)} - required={true} error={oipc.reasonid === null} + required > {oipc.reviewtypeid ? oipcReviewtypes.map((reviewtype) => { @@ -228,8 +219,8 @@ const OIPCItem = (props) => { value={oipc.statusid} label="Status" onChange = {(event) => handleStatus(event.target.value)} - required={true} error={oipc.statusid === null} + required > {oipcStatuses.map((status) => { return {status.name} @@ -328,13 +319,13 @@ const OIPCItem = (props) => { fullWidth label="Comply By Date" variant="outlined" - required={true} value={oipc.inquiryattributes.inquirydate ? formatDate(new Date(oipc.inquiryattributes.inquirydate)) : null} onChange = {(event) => handleInquiryFields(event.target.value, "COMPLYDATE")} InputLabelProps={{ shrink: true }} InputProps={{inputProps: { min: oipc.receiveddate ? formatDate(new Date(oipc.receiveddate)) : null } }} type="date" error={oipc.inquiryattributes.inquirydate === null} + required /> @@ -342,24 +333,24 @@ const OIPCItem = (props) => { fullWidth label="Order No" variant="outlined" - required={true} value={oipc.inquiryattributes.orderno} onChange = {(event) => handleInquiryFields(event.target.value, "ORDERNO")} InputLabelProps={{ shrink: true }} error={oipc.inquiryattributes.orderno === ""} + required /> handleInquiryFields(event.target.value, "INQUIRYOUTCOME")} fullWidth value={oipc.inquiryattributes.inquiryoutcome} label="Outcome" error={oipc.inquiryattributes.inquiryoutcome === null} + required > {oipcInquiryoutcomes.map((inquiryoutcome) => { return {inquiryoutcome.name} diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx new file mode 100644 index 000000000..a63c8f1ae --- /dev/null +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx @@ -0,0 +1,62 @@ +import Dialog from '@material-ui/core/Dialog'; +import DialogActions from '@material-ui/core/DialogActions'; +import DialogContent from '@material-ui/core/DialogContent'; +import DialogContentText from '@material-ui/core/DialogContentText'; +import DialogTitle from '@material-ui/core/DialogTitle'; +import CloseIcon from '@material-ui/icons/Close'; +import IconButton from '@material-ui/core/IconButton'; + +const RemoveOIPCModal= ({ + showModal, + removeOIPC, + setShowDeleteModal, + oipcid, +}) =>{ + + const handleSave = () => { + setShowDeleteModal(false); + removeOIPC(oipcid) + }; + const handleClose = () => { + setShowDeleteModal(false); + }; + + return ( +
+ + +

Remove OIPC

+ + Close + + +
+ + + + Are you sure you want to delete this OIPC Review? + + + + + + + +
+
+ ); +}; + +export default RemoveOIPCModal; diff --git a/forms-flow-web/src/components/FOI/FOIRequest/utils.js b/forms-flow-web/src/components/FOI/FOIRequest/utils.js index b73988d48..f71148f4b 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/utils.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/utils.js @@ -322,7 +322,8 @@ export const checkValidationError = ( requiredAxisDetails, isAddRequest, currentrequestStatus, - oipcData + oipcData, + isOipcReview ) => { return ( requiredApplicantDetails.firstName === "" || @@ -347,7 +348,7 @@ export const checkValidationError = ( !requiredRequestDetailsValues.receivedDate || !requiredRequestDetailsValues.requestStartDate || !requiredAxisDetails.axisRequestId || - (oipcData.length > 0 && oipcData.some((oipc) => { + (oipcData.length > 0 && isOipcReview && oipcData.some((oipc) => { return oipc.oipcno === "" || oipc.receiveddate === null || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null || oipc.inquiryattributes?.orderno === "" || oipc.inquiryattributes?.inquiryoutcome === null || oipc.inquiryattributes?.inquirydate === null; })) From 9549d512ec7710adb3887800793aad6faaec5eb4 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Mon, 27 Nov 2023 10:45:45 -0800 Subject: [PATCH 33/82] code adjustment --- .../FOI/FOIRequest/OIPCDetails/oipcHook.js | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js index 0fb9d8704..d9fb732a4 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js @@ -4,34 +4,38 @@ import { useSelector } from "react-redux"; const useOIPCHook = () => { //OIPC State const requestDetails = useSelector((state) => state.foiRequests.foiRequestDetail); - const stageOIPCData = (oipcData) => { - if (oipcData?.length > 0) { - return oipcData.map((item, index) => { - item.id = index; - return item; - }); + const stageOIPCData = (isoipcreview, oipcData) => { + if (isoipcreview) { + if (oipcData?.length > 0) { + return oipcData.map((item, index) => { + item.id = index; + return item; + }); + } else { + return [{ + id: 0, + oipcno: "", + reviewtypeid: null, + reasonid: null, + statusid: null, + isinquiry: false, + inquiryattributes: null, + receiveddate: null, + closeddate: null, + investigator: "", + outcomeid: null, + isjudicialreview: false, + issubsequentappeal: false, + }]; + } } else { - return [{ - id: 0, - oipcno: "", - reviewtypeid: null, - reasonid: null, - statusid: null, - isinquiry: false, - inquiryattributes: null, - receiveddate: null, - closeddate: null, - investigator: "", - outcomeid: null, - isjudicialreview: false, - issubsequentappeal: false, - }]; + return []; } } const [oipcData, setOipcData] = useState(requestDetails.oipcdetails); useEffect(() => { - const stagedOIPCData = stageOIPCData(requestDetails.oipcdetails); + const stagedOIPCData = stageOIPCData(requestDetails.isoipcreview, requestDetails.oipcdetails); setOipcData(stagedOIPCData); }, [requestDetails]) From aace890e3152a77d432b7bbf73c1e867e0b669d6 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Mon, 27 Nov 2023 11:10:47 -0800 Subject: [PATCH 34/82] Update requestflag component --- .../FOI/customComponents/RequestFlag.js | 55 ++++--------------- 1 file changed, 10 insertions(+), 45 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js b/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js index 0cc461e70..d29c9ece9 100644 --- a/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js +++ b/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js @@ -25,12 +25,13 @@ import { } from "../../../apiManager/services/FOI/foiRequestServices"; import { request } from "http"; import { is } from "immutable"; +import { setFOIUpdateLoader } from "../../../actions/FOI/foiRequestActions"; //Types are: //oipcreview //phasedrelease -const RequestFlag = ({ type, requestDetails }) => { - const [isSelected, setIsSelected] = useState(requestDetails.isActive); +const RequestFlag = ({ isActive, type, requestDetails }) => { + const [isSelected, setIsSelected] = useState(isActive || false); const [modalOpen, setModalOpen] = useState(false); const [modalHeading, setModalHeading] = useState(""); const [modalMessage, setModalMessage] = useState(""); @@ -60,8 +61,6 @@ const RequestFlag = ({ type, requestDetails }) => { let isSelectedBgClass; let bgClass; - console.log('options: ', options) - console.log('type: ', type) switch (type) { //Need to change heading, message, description for modals as well case "oipcreview": @@ -93,13 +92,6 @@ const RequestFlag = ({ type, requestDetails }) => { This will create a new OIPC review section on this request. ); - console.log('options: ', options) - - handleSaveForActive = () => { - console.log("setting to active"); - requestDetails.isoipcreview = true; - console.log(requestDetails); - }; //when setting to inactive modalHeadingActive = "OIPC Review"; @@ -110,11 +102,6 @@ const RequestFlag = ({ type, requestDetails }) => { This will remove the OIPC review section from this request. ); - handleSaveForInactive = () => { - console.log("setting to inactive"); - requestDetails.isoipcreview = false; - console.log(requestDetails); - }; break; case "phasedrelease": @@ -144,11 +131,6 @@ const RequestFlag = ({ type, requestDetails }) => { modalDescriptionActive = ( This will tag the request as Phased Release. ); - handleSaveForActive = () => { - console.log("setting to active"); - requestDetails.isphasedrelease = true; - console.log(requestDetails); - }; //when setting to inactive modalHeadingInactive = "Single Release"; @@ -157,11 +139,6 @@ const RequestFlag = ({ type, requestDetails }) => { modalDescriptionInactive = ( This will tag the request as Single Release. ); - handleSaveForInactive = () => { - console.log("setting to inactive"); - requestDetails.isphasedrelease = false; - console.log(requestDetails); - }; break; } @@ -182,21 +159,15 @@ const RequestFlag = ({ type, requestDetails }) => { const handleClose = () => { setModalOpen(false); - setIsSelected(requestDetails.isActive); + setIsSelected(isActive); }; const handleSave = (e) => { setModalOpen(false); saveOipcReviewStatus(); - // if (isSelected) { - // handleSaveForActive(); - // } else { - // handleSaveForInactive(); - // } }; const saveOipcReviewStatus = () => { - // dispatch(setFOILoader(setLoader)); let updatedRequestDetails; if (type == "oipcreview") { updatedRequestDetails = { @@ -209,15 +180,16 @@ const RequestFlag = ({ type, requestDetails }) => { isphasedrelease: isSelected, }; } + //dispatch loader dispatch( saveRequestDetails( updatedRequestDetails, - -2, + -2, //not an add request requestId, ministryId, (err, res) => { if (!err) { - toast.success("The request has been saved successfully.", { + toast.success("The OIPC review status has been successfully updated.", { position: "top-right", autoClose: 3000, hideProgressBar: true, @@ -226,17 +198,10 @@ const RequestFlag = ({ type, requestDetails }) => { draggable: true, progress: undefined, }); - // const _state = getRequestState({ - // currentSelectedStatus, - // requestState, - // urlIndexCreateRequest, - // saveRequestObject, - // }); - // handleSaveRequest(_state, false, res.id); - // hasStatusRequestSaved(currentSelectedStatus); + dispatch(fetchFOIRequestDetailsWrapper(requestId, ministryId)); } else { toast.error( - "Temporarily unable to save your request. Please try again in a few minutes.", + "Temporarily unable to update the OIPC review status. Please try again in a few minutes.", { position: "top-right", autoClose: 3000, @@ -247,7 +212,7 @@ const RequestFlag = ({ type, requestDetails }) => { progress: undefined, } ); - // handleSaveRequest(requestState, true, ""); + setIsSelected(isActive || false); } } ) From 912d9c91b41055870802097de0ad28856c478953 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Mon, 27 Nov 2023 11:14:22 -0800 Subject: [PATCH 35/82] Remove unused imports --- .../components/FOI/customComponents/RequestFlag.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js b/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js index d29c9ece9..abfc21310 100644 --- a/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js +++ b/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js @@ -1,8 +1,7 @@ -import React, { useEffect, useState } from "react"; +import { useState } from "react"; import "./requestflag.scss"; import OutlinedInput from "@material-ui/core/OutlinedInput"; -import InputLabel from "@mui/material/InputLabel"; import MenuItem from "@material-ui/core/MenuItem"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faFlag } from "@fortawesome/free-regular-svg-icons"; @@ -20,12 +19,8 @@ import { saveRequestDetails } from "../../../apiManager/services/FOI/foiRequestS import { toast } from "react-toastify"; import { useDispatch } from "react-redux"; import { - restrictRequest, fetchFOIRequestDetailsWrapper, } from "../../../apiManager/services/FOI/foiRequestServices"; -import { request } from "http"; -import { is } from "immutable"; -import { setFOIUpdateLoader } from "../../../actions/FOI/foiRequestActions"; //Types are: //oipcreview @@ -41,8 +36,6 @@ const RequestFlag = ({ isActive, type, requestDetails }) => { const dispatch = useDispatch(); - - // These need to be set for each type let options; let id; @@ -53,9 +46,6 @@ const RequestFlag = ({ isActive, type, requestDetails }) => { let modalDescriptionActive = ""; let modalDescriptionInactive = ""; - let handleSaveForActive = () => {}; - let handleSaveForInactive = () => {}; - // css let iconClass; let isSelectedBgClass; @@ -245,7 +235,6 @@ const RequestFlag = ({ isActive, type, requestDetails }) => { select value={isSelected} onChange={handleValueChange} - // onClick={handleValueChange} inputProps={{ "aria-labelledby": "restrict-dropdown-label" }} input={} disabled={false} From c55a12a47b7f11b3661cf76ffb3350dabc296267 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Mon, 27 Nov 2023 11:33:17 -0800 Subject: [PATCH 36/82] Outcome validation WIP --- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 7 +- .../FOIRequest/OIPCDetails/OutcomeModal.jsx | 64 +++++++++++++++++++ .../OIPCDetails/RemoveOIPCModal.jsx | 8 +-- 3 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OutcomeModal.jsx diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 27cd1aac1..c02cb76a7 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -3,6 +3,7 @@ import { useState, useEffect } from "react"; import { formatDate } from "../../../../helper/FOI/helper"; import { useSelector } from "react-redux"; import RemoveOIPCModal from './RemoveOIPCModal'; +import OutcomeModal from './OutcomeModal'; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faTrash } from '@fortawesome/free-solid-svg-icons'; @@ -18,6 +19,7 @@ const OIPCItem = (props) => { //Local State const [oipc, setOipc] = useState(oipcObj); const [showDeleteModal, setShowDeleteModal] = useState(false); + const [showOutcomeModal, setShowOutcomeModal] = useState(false); //Functions const generateNamesFromOIPCId = (oipcObj) => { @@ -89,7 +91,7 @@ const OIPCItem = (props) => { const newOIPCObj = oipc; newOIPCObj.outcomeid = value; setOipc(newOIPCObj); - updateOIPC(newOIPCObj); + setShowOutcomeModal(true); } const handleInquiry = (value) => { const newOIPCObj = oipc; @@ -145,7 +147,8 @@ const OIPCItem = (props) => {
- {showDeleteModal && } + {showDeleteModal && } + {showOutcomeModal && } { + + const handleSave = () => { + setShowModal(false); + updateOIPC(oipc); + }; + const handleClose = () => { + setShowModal(false); + setOipc(prev => ({ ...prev, outcomeid: null })); + }; + + return ( +
+ + +

Remove OIPC

+ + Close + + +
+ + + + Are you sure you are ready to select an outcome? This will complete the review and lock all fields + + + + + + + +
+
+ ); +}; + +export default OutcomeModal; \ No newline at end of file diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx index a63c8f1ae..853c28b54 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx @@ -9,16 +9,16 @@ import IconButton from '@material-ui/core/IconButton'; const RemoveOIPCModal= ({ showModal, removeOIPC, - setShowDeleteModal, + setShowModal, oipcid, }) =>{ const handleSave = () => { - setShowDeleteModal(false); + setShowModal(false); removeOIPC(oipcid) }; const handleClose = () => { - setShowDeleteModal(false); + setShowModal(false); }; return ( @@ -26,7 +26,7 @@ const RemoveOIPCModal= ({ From c5fd5906ce20a4616528a05ab832ed34d1dc34bc Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Mon, 27 Nov 2023 11:35:28 -0800 Subject: [PATCH 37/82] Add RequestFlag component to FOIRequest --- .../src/components/FOI/FOIRequest/FOIRequest.js | 7 ++++++- .../FOI/FOIRequest/FOIRequestHeader/index.js | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 7132275fe..3bf0747c9 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -258,7 +258,7 @@ const FOIRequest = React.memo(({ userDetail }) => { const [redactedSections, setRedactedSections] = useState(""); const [isMCFPersonal, setIsMCFPersonal] = useState(bcgovcode.replaceAll('"', '') == "MCF" && requestDetails.requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); const {oipcData, addOIPC, removeOIPC, updateOIPC} = useOIPCHook(); - const [showOIPCDetails, setShowOIPCDetails] = useState(true); + const [showOIPCDetails, setShowOIPCDetails] = useState(requestDetails.isoipcreview); useEffect(() => { if (window.location.href.indexOf("comments") > -1) { @@ -338,6 +338,11 @@ const FOIRequest = React.memo(({ userDetail }) => { setIsMCFPersonal(true); } } + if(requestDetails.isoipcreview) { + setShowOIPCDetails(true); + } else { + setShowOIPCDetails(false); + } }, [requestDetails]); useEffect(() => { diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js index 4ce2c617b..eaa1a1cf8 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js @@ -22,6 +22,7 @@ import { toast } from "react-toastify"; import _ from 'lodash'; import RequestRestriction from "../../customComponents/RequestRestriction"; import ConfirmModal from "../../customComponents/ConfirmModal"; +import RequestFlag from '../../customComponents/RequestFlag'; const useStyles = makeStyles((theme) => ({ formControl: { @@ -273,6 +274,16 @@ const FOIRequestHeader = React.memo( isIAORestrictedRequest={isIAORestrictedRequest} setIsLoaded={setIsLoaded} /> + +
)} {!isAddRequest && status.toLowerCase() !== StateEnum.unopened.name.toLowerCase() && (isIAORestrictedFileManager() || From d34aa81d20b53ce0ba7a24d494efa91ff0e32059 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Mon, 27 Nov 2023 14:04:17 -0800 Subject: [PATCH 38/82] outocme validation work completed. Testing wip --- .../components/FOI/FOIRequest/FOIRequest.js | 2 +- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 38 ++++-- .../FOIRequest/OIPCDetails/OutcomeModal.jsx | 115 ++++++++++++------ 3 files changed, 111 insertions(+), 44 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index cf024584b..0428b841b 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -1222,7 +1222,7 @@ const FOIRequest = React.memo(({ userDetail }) => { divisions={requestDetails.divisions} /> )} - {showOIPCDetails && requestDetails.isoipcreview && requestState && requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && ( + {showOIPCDetails && requestState && requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && ( { value={oipc.oipcno} onChange = {(event) => handleOIPCNumber(event.target.value)} InputLabelProps={{ shrink: true }} - error={oipc.oipcno === ""} + error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.oipcno === ""} required + disabled={oipc.outcomeid && oipc.outcomeid !== 5} /> @@ -172,8 +173,9 @@ const OIPCItem = (props) => { InputLabelProps={{ shrink: true }} InputProps={{inputProps: { max: formatDate(new Date())} }} type="date" - error={oipc.receiveddate === null} + error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.receiveddate === null} required + disabled={oipc.outcomeid && oipc.outcomeid !== 5} /> @@ -185,8 +187,9 @@ const OIPCItem = (props) => { value={oipc.reviewtypeid} label="Review Type" onChange={(event) => handleReviewType(event.target.value)} - error={oipc.reviewtypeid === null} + error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.reviewtypeid === null} required + disabled={oipc.outcomeid && oipc.outcomeid !== 5} > {uniqueReviewTypes(oipcReviewtypes).map((reviewtype) => { return {reviewtype.type_name} @@ -202,8 +205,9 @@ const OIPCItem = (props) => { value={oipc.reasonid} label="Reason" onChange = {(event) => handleReason(event.target.value)} - error={oipc.reasonid === null} + error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.reasonid === null} required + disabled={oipc.outcomeid && oipc.outcomeid !== 5} > {oipc.reviewtypeid ? oipcReviewtypes.map((reviewtype) => { @@ -222,8 +226,9 @@ const OIPCItem = (props) => { value={oipc.statusid} label="Status" onChange = {(event) => handleStatus(event.target.value)} - error={oipc.statusid === null} + error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.statusid === null} required + disabled={oipc.outcomeid && oipc.outcomeid !== 5} > {oipcStatuses.map((status) => { return {status.name} @@ -238,6 +243,7 @@ const OIPCItem = (props) => { onChange = {(event) => handleInvestiagtor(event.target.value)} value={oipc.investigator} InputLabelProps={{ shrink: true }} + disabled={oipc.outcomeid && oipc.outcomeid !== 5} /> @@ -251,7 +257,11 @@ const OIPCItem = (props) => { label="Outcome" > {oipcOutcomes.map((outcome) => { - return {outcome.name} + if (outcome.outcomeid !== 5) { + return {outcome.name} + } else { + return {outcome.name} + } })} @@ -265,6 +275,7 @@ const OIPCItem = (props) => { InputLabelProps={{ shrink: true }} InputProps={{inputProps: { max: formatDate(new Date())} }} type="date" + disabled={oipc.outcomeid && oipc.outcomeid !== 5} /> @@ -274,12 +285,14 @@ const OIPCItem = (props) => { handleInquiry(true)} + disabled={oipc.outcomeid && oipc.outcomeid !== 5} />} label="Yes" /> handleInquiry(false)} + disabled={oipc.outcomeid && oipc.outcomeid !== 5} />} label="No" /> @@ -289,12 +302,14 @@ const OIPCItem = (props) => { handleJudicalReview(true)} + disabled={oipc.outcomeid && oipc.outcomeid !== 5} />} label="Yes" /> handleJudicalReview(false)} + disabled={oipc.outcomeid && oipc.outcomeid !== 5} />} label="No" /> @@ -304,12 +319,14 @@ const OIPCItem = (props) => { handleSubsequentAppeal(true)} + disabled={oipc.outcomeid && oipc.outcomeid !== 5} />} label="Yes" /> handleSubsequentAppeal(false)} + disabled={oipc.outcomeid && oipc.outcomeid !== 5} />} label="No" /> @@ -327,8 +344,9 @@ const OIPCItem = (props) => { InputLabelProps={{ shrink: true }} InputProps={{inputProps: { min: oipc.receiveddate ? formatDate(new Date(oipc.receiveddate)) : null } }} type="date" - error={oipc.inquiryattributes.inquirydate === null} + error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.inquiryattributes.inquirydate === null} required + disabled={oipc.outcomeid && oipc.outcomeid !== 5} /> @@ -339,8 +357,9 @@ const OIPCItem = (props) => { value={oipc.inquiryattributes.orderno} onChange = {(event) => handleInquiryFields(event.target.value, "ORDERNO")} InputLabelProps={{ shrink: true }} - error={oipc.inquiryattributes.orderno === ""} + error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.inquiryattributes.orderno === ""} required + disabled={oipc.outcomeid && oipc.outcomeid !== 5} /> @@ -352,8 +371,9 @@ const OIPCItem = (props) => { fullWidth value={oipc.inquiryattributes.inquiryoutcome} label="Outcome" - error={oipc.inquiryattributes.inquiryoutcome === null} + error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.inquiryattributes.inquiryoutcome === null} required + disabled={oipc.outcomeid && oipc.outcomeid !== 5} > {oipcInquiryoutcomes.map((inquiryoutcome) => { return {inquiryoutcome.name} diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OutcomeModal.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OutcomeModal.jsx index 7f49f26c0..b1426c52a 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OutcomeModal.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OutcomeModal.jsx @@ -22,42 +22,89 @@ const OutcomeModal= ({ setShowModal(false); setOipc(prev => ({ ...prev, outcomeid: null })); }; + const handleAmendSave = () => { + setShowModal(false); + setOipc(prev => ({ ...prev, outcomeid: null })); + updateOIPC(oipc); + } + const handleAmendClose = () => { + setShowModal(false); + } - return ( -
- - -

Remove OIPC

- - Close - - -
- - - - Are you sure you are ready to select an outcome? This will complete the review and lock all fields - - - - - + + +
+
+ : +
+ - Continue - - - - -
+ +

Close OIPC

+ + Close + + +
+ + + + Are you sure you are ready to select an outcome? This will complete the review and lock all fields + + + + + + + + + + } + ); }; From c37f11ef0387ffdd86db1d94377a5e6d534c0ed7 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Mon, 27 Nov 2023 14:31:50 -0800 Subject: [PATCH 39/82] Adjustments to fe disabling of outcomes --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index b4d3fd4a9..45f26fb87 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -260,7 +260,7 @@ const OIPCItem = (props) => { if (outcome.outcomeid !== 5) { return {outcome.name} } else { - return {outcome.name} + return {outcome.name} } })} From 0df84fe770e6fff49b78c1b6fb8bf4cb2698da10 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Mon, 27 Nov 2023 15:21:30 -0800 Subject: [PATCH 40/82] Redo layout to incorporate request flags --- .../MinistryReview/RequestHeader.js | 28 +++++++++++++++---- .../customComponents/requestrestriction.scss | 2 -- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestHeader.js b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestHeader.js index 7d0bd79d0..44e0eaafd 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestHeader.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestHeader.js @@ -13,6 +13,7 @@ import { isRequestWatcherOrMinistryAssignee, addToRestrictedRequestTagList } fro import RequestMinistryRestriction from "../../customComponents/RequestMinistryRestriction"; import _ from 'lodash'; import {setCommentTagListLoader} from "../../../../actions/FOI/foiRequestActions"; +import RequestFlag from '../../customComponents/RequestFlag'; const RequestHeader = React.memo(({ requestDetails, @@ -101,6 +102,20 @@ const RequestHeader = React.memo(({ ) ); + const requestFlagsBox = ( +
+ + +
+ ); return ( <>
@@ -128,12 +143,9 @@ const RequestHeader = React.memo(({
-
-
-
+
{watcherBox} -
- { + { (isLoaded && (isRequestWatcherOrMinistryAssignee(requestWatchers,ministryAssigneeValue,userDetail?.preferred_username) || isMinistryRestrictedFileManager())) && } +
+
+
+ {requestFlagsBox}
-
+
Date: Mon, 27 Nov 2023 16:21:31 -0800 Subject: [PATCH 41/82] All validation work completed. WIP Testing + refactor + restyling --- .../FOI/FOIRequest/OIPCDetails/AmendModal.jsx | 66 ++++++++++ .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 6 + .../FOIRequest/OIPCDetails/OutcomeModal.jsx | 115 ++++++------------ 3 files changed, 106 insertions(+), 81 deletions(-) create mode 100644 forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AmendModal.jsx diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AmendModal.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AmendModal.jsx new file mode 100644 index 000000000..1554df284 --- /dev/null +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AmendModal.jsx @@ -0,0 +1,66 @@ +import Dialog from '@material-ui/core/Dialog'; +import DialogActions from '@material-ui/core/DialogActions'; +import DialogContent from '@material-ui/core/DialogContent'; +import DialogContentText from '@material-ui/core/DialogContentText'; +import DialogTitle from '@material-ui/core/DialogTitle'; +import CloseIcon from '@material-ui/icons/Close'; +import IconButton from '@material-ui/core/IconButton'; + +const AmendModal= ({ + showModal, + setShowModal, + updateOIPC, + oipc, + setOipc, +}) =>{ + + const handleSave = () => { + setShowModal(false); + const newOIPCObj = oipc; + newOIPCObj.outcomeid = null; + setOipc(newOIPCObj); + updateOIPC(newOIPCObj); + }; + const handleClose = () => { + setShowModal(false); + }; + + return ( +
+ + +

Amend Outcome

+ + Close + + +
+ + + + Are you sure you want to amend this completed OIPC review? You will need to re-select an outcome to close it again. + + + + + + + +
+
+ ); +}; + +export default AmendModal; \ No newline at end of file diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 45f26fb87..142962fe1 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -4,6 +4,7 @@ import { formatDate } from "../../../../helper/FOI/helper"; import { useSelector } from "react-redux"; import RemoveOIPCModal from './RemoveOIPCModal'; import OutcomeModal from './OutcomeModal'; +import AmendModal from './AmendModal'; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faTrash } from '@fortawesome/free-solid-svg-icons'; @@ -20,6 +21,7 @@ const OIPCItem = (props) => { const [oipc, setOipc] = useState(oipcObj); const [showDeleteModal, setShowDeleteModal] = useState(false); const [showOutcomeModal, setShowOutcomeModal] = useState(false); + const [showAmendModal, setShowAmendModal] = useState(false); //Functions const generateNamesFromOIPCId = (oipcObj) => { @@ -88,6 +90,9 @@ const OIPCItem = (props) => { updateOIPC(newOIPCObj); } const handleOutcome = (value) => { + if (value === 5) { + return setShowAmendModal(true); + } const newOIPCObj = oipc; newOIPCObj.outcomeid = value; setOipc(newOIPCObj); @@ -149,6 +154,7 @@ const OIPCItem = (props) => {
{showDeleteModal && } {showOutcomeModal && } + {showAmendModal && } ({ ...prev, outcomeid: null })); }; - const handleAmendSave = () => { - setShowModal(false); - setOipc(prev => ({ ...prev, outcomeid: null })); - updateOIPC(oipc); - } - const handleAmendClose = () => { - setShowModal(false); - } - + return ( - <> - {oipc.outcomeid === 5 ? -
- - -

Amend Outcome

- - Close - - -
- - - - Are you sure you want to amend this completed OIPC review? You will need to re-select an outcome to close it again - - - - - - - -
-
- : -
- + + +

Close OIPC

+ + Close + + +
+ + + + Are you sure you are ready to select an outcome? This will complete the review and lock all fields. + + + + + - - -
-
- } - + Continue + + + + +
); }; From fa9acac48e4b0cb572d82d444164508003e92a6c Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Tue, 28 Nov 2023 04:23:37 -0800 Subject: [PATCH 42/82] Fix for oipc outcome id issue. --- request-management-api/request_api/schemas/foirequestwrapper.py | 2 +- .../request_api/services/foirequest/requestservicegetter.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/request-management-api/request_api/schemas/foirequestwrapper.py b/request-management-api/request_api/schemas/foirequestwrapper.py index 967a67a14..4cfc64bea 100644 --- a/request-management-api/request_api/schemas/foirequestwrapper.py +++ b/request-management-api/request_api/schemas/foirequestwrapper.py @@ -72,7 +72,7 @@ class Meta: # pylint: disable=too-few-public-methods reviewtypeid = fields.Int(data_key="reviewtypeid") reasonid = fields.Int(data_key="reasonid") statusid = fields.Int(data_key="statusid") - outcomeid = fields.Int(data_key="outcomeid") + outcomeid = fields.Int(data_key="outcomeid",allow_none=True) investigator = fields.Str(data_key="investigator",allow_none=True, validate=[validate.Length(max=500, error=MAX_EXCEPTION_MESSAGE)]) isinquiry = fields.Bool(data_key="isinquiry") isjudicialreview = fields.Bool(data_key="isjudicialreview") diff --git a/request-management-api/request_api/services/foirequest/requestservicegetter.py b/request-management-api/request_api/services/foirequest/requestservicegetter.py index 1e9c371da..78181e224 100644 --- a/request-management-api/request_api/services/foirequest/requestservicegetter.py +++ b/request-management-api/request_api/services/foirequest/requestservicegetter.py @@ -228,7 +228,7 @@ def getoipcdetails(self, ministryrequestid, ministryrequestversion): "statusid": entry["statusid"], "status":entry["status.name"], "outcomeid": entry["outcomeid"], - "outcome": entry["outcome.name"], + "outcome": entry["outcome.name"] if entry["outcomeid"] not in (None, '') else None, "investigator": entry["investigator"], "isinquiry": entry["isinquiry"], "isjudicialreview": entry["isjudicialreview"], From 2bc0e8a4333be537db4bdc860f8c84c326968be1 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Tue, 28 Nov 2023 08:03:30 -0800 Subject: [PATCH 43/82] closedate exclude blank value --- .../services/foirequest/requestservicebuilder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/request-management-api/request_api/services/foirequest/requestservicebuilder.py b/request-management-api/request_api/services/foirequest/requestservicebuilder.py index 1e89300e4..b6315671b 100644 --- a/request-management-api/request_api/services/foirequest/requestservicebuilder.py +++ b/request-management-api/request_api/services/foirequest/requestservicebuilder.py @@ -144,13 +144,13 @@ def prepareoipc(self, requestschema, ministryrequestid, version, userid): oipcreview.reasonid = oipc["reasonid"] oipcreview.statusid = oipc["statusid"] oipcreview.outcomeid = oipc["outcomeid"] - oipcreview.investigator = oipc["investigator"] + oipcreview.investigator = oipc["investigator"] if oipc["investigator"] not in (None, "") else None oipcreview.isinquiry = oipc["isinquiry"] oipcreview.isjudicialreview = oipc["isjudicialreview"] oipcreview.issubsequentappeal = oipc["issubsequentappeal"] oipcreview.issubsequentappeal = oipc["issubsequentappeal"] - oipcreview.receiveddate = oipc["receiveddate"] - oipcreview.closeddate = oipc["closeddate"] + oipcreview.receiveddate = oipc["receiveddate"] if oipc["receiveddate"] not in (None, "") else None + oipcreview.closeddate = oipc["closeddate"] if oipc["closeddate"] not in (None, "") else None oipcreview.isactive = True if oipc["isinquiry"] == True: oipcreview.inquiryattributes = oipc["inquiryattributes"] From 87042f52b520baac60075410eb51f106133b2497 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 28 Nov 2023 09:13:52 -0800 Subject: [PATCH 44/82] Update layout for RequestFlags --- .../FOI/FOIRequest/FOIRequestHeader/index.js | 30 +++++++++---------- .../MinistryReview/RequestHeader.js | 16 +++++----- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js index eaa1a1cf8..74da8994b 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js @@ -260,11 +260,9 @@ const FOIRequestHeader = React.memo(
-
-
+
{window.location.href.indexOf(FOI_COMPONENT_CONSTANTS.ADDREQUEST) === -1 && ( -
- - -
)} {!isAddRequest && status.toLowerCase() !== StateEnum.unopened.name.toLowerCase() && (isIAORestrictedFileManager() || (isLoaded && isRequestWatcherOrAssignee(requestWatchers,assigneeObj,userDetail?.preferred_username))) && @@ -294,9 +281,20 @@ const FOIRequestHeader = React.memo( requestDetails={requestDetails} /> } -
-
+
+ + +
+
{showMinistryAssignedTo && ( <> diff --git a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestHeader.js b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestHeader.js index 44e0eaafd..4071f16fe 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestHeader.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestHeader.js @@ -144,16 +144,16 @@ const RequestHeader = React.memo(({
- {watcherBox} - { + {watcherBox} + { (isLoaded && (isRequestWatcherOrMinistryAssignee(requestWatchers,ministryAssigneeValue,userDetail?.preferred_username) || isMinistryRestrictedFileManager())) && - - } + + }
From a8be867f658fcd87efe943067ae43bcb25ab7bbb Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Tue, 28 Nov 2023 09:21:13 -0800 Subject: [PATCH 45/82] Small code change to oipc object --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 142962fe1..e7bec8f3b 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -33,10 +33,10 @@ const OIPCItem = (props) => { return {...prev, reviewtypeName: reviewtype ? reviewtype.type_name : ""} }) setOipc((prev) => { - return {...prev, statusName: status ? status.type_name : ""} + return {...prev, statusName: status ? status.status : ""} }) setOipc((prev) => { - return {...prev, outcomeName: outcome ? outcome.type_name : ""} + return {...prev, outcomeName: outcome ? outcome.outcome : ""} }) setOipc((prev) => { return {...prev, reasonName: reviewtype ? reviewtype.reason_name : ""} From a696e89662a999d97657017836ea539b1b3e382f Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Tue, 28 Nov 2023 13:14:08 -0800 Subject: [PATCH 46/82] WIP Flag Ingtegration + code adjustments --- .../FOI/FOIRequest/BottomButtonGroup/index.js | 8 ++++++-- .../src/components/FOI/FOIRequest/FOIRequest.js | 10 ++++++++++ .../FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx | 2 +- .../components/FOI/FOIRequest/OIPCDetails/oipcHook.js | 8 +++++--- forms-flow-web/src/components/FOI/FOIRequest/utils.js | 2 +- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js index 1b2d06b3c..fa6a7df22 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js @@ -120,9 +120,13 @@ const BottomButtonGroup = React.memo( setIsAddRequest(false); } - //add oipc Data to save request object + //add oipc Data to save request object and sync/validate isoipcreview attribute saveRequestObject.oipcdetails = oipcData; - if (oipcData.length <= 0) saveRequestObject.isoipcreview = false; + if (oipcData.length > 0) { + saveRequestObject.isoipcreview = true; + } else { + saveRequestObject.isoipcreview = false; + } dispatch(setFOILoader(setLoader)) dispatch( diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 6dfa7961b..8a6ae0ec4 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -345,6 +345,16 @@ const FOIRequest = React.memo(({ userDetail }) => { } }, [requestDetails]); + //useEffect to manage isoipcreview attribute for requestdetails state + useEffect(() => { + if(Object.keys(requestDetails).length !== 0 && oipcData?.length <= 0) { + requestDetails.isoipcreview = false; + setShowOIPCDetails(false); + } + }, [oipcData]) + + console.log(requestDetails) + useEffect(() => { if (isIAORestricted) dispatch(fetchRestrictedRequestCommentTagList(requestId, ministryId)); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index afa6f2fa8..2e06dfe43 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -10,7 +10,7 @@ const OIPCDetailsList = (props) => { return ( <> - {index !== (oipcData.length - 1) && } + {index !== (oipcData?.length - 1) && } ); }); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js index d9fb732a4..f75a4e500 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js @@ -28,8 +28,6 @@ const useOIPCHook = () => { issubsequentappeal: false, }]; } - } else { - return []; } } const [oipcData, setOipcData] = useState(requestDetails.oipcdetails); @@ -45,7 +43,7 @@ const useOIPCHook = () => { const addOIPC = () => { setOipcData((prev) => { return [...prev, { - id: oipcData.length > 0 ? oipcData[oipcData.length - 1].id + 1 : 0, + id: oipcData?.length > 0 ? oipcData[oipcData.length - 1].id + 1 : 0, oipcno: "", reviewtypeid: null, reasonid: null, @@ -79,6 +77,9 @@ const useOIPCHook = () => { }); }); } + const removeAllOIPCs = () => { + setOipcData([]); + } return { oipcData, @@ -86,6 +87,7 @@ const useOIPCHook = () => { removeOIPC, updateOIPC, stageOIPCData, + removeAllOIPCs, }; }; diff --git a/forms-flow-web/src/components/FOI/FOIRequest/utils.js b/forms-flow-web/src/components/FOI/FOIRequest/utils.js index f71148f4b..81d20752c 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/utils.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/utils.js @@ -348,7 +348,7 @@ export const checkValidationError = ( !requiredRequestDetailsValues.receivedDate || !requiredRequestDetailsValues.requestStartDate || !requiredAxisDetails.axisRequestId || - (oipcData.length > 0 && isOipcReview && oipcData.some((oipc) => { + (oipcData?.length > 0 && isOipcReview && oipcData?.some((oipc) => { return oipc.oipcno === "" || oipc.receiveddate === null || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null || oipc.inquiryattributes?.orderno === "" || oipc.inquiryattributes?.inquiryoutcome === null || oipc.inquiryattributes?.inquirydate === null; })) From 3ef75ccec853b6b9999aa36f93626fd4a2efabfa Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Tue, 28 Nov 2023 14:48:34 -0800 Subject: [PATCH 47/82] Small code changes + modal design adjustments --- .../components/FOI/FOIRequest/OIPCDetails/AmendModal.jsx | 2 +- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 6 +++--- .../components/FOI/FOIRequest/OIPCDetails/OutcomeModal.jsx | 2 +- .../components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AmendModal.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AmendModal.jsx index 1554df284..ba4912ae8 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AmendModal.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/AmendModal.jsx @@ -42,7 +42,7 @@ const AmendModal= ({ - + Are you sure you want to amend this completed OIPC review? You will need to re-select an outcome to close it again. diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index e7bec8f3b..f0d7275fd 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -28,15 +28,15 @@ const OIPCItem = (props) => { const reviewtype = oipcReviewtypes.find(reviewtype => reviewtype.reviewtypeid === oipcObj.reviewtypeid && reviewtype.reasonid === oipcObj.reasonid); const status = oipcStatuses.find(status => status.statusid === oipcObj.statusid); const outcome = oipcOutcomes.find(outcome => outcome.outcomeid === oipcObj.outcomeid); - + setOipc((prev) => { return {...prev, reviewtypeName: reviewtype ? reviewtype.type_name : ""} }) setOipc((prev) => { - return {...prev, statusName: status ? status.status : ""} + return {...prev, statusName: status ? status.name : ""} }) setOipc((prev) => { - return {...prev, outcomeName: outcome ? outcome.outcome : ""} + return {...prev, outcomeName: outcome ? outcome.name : ""} }) setOipc((prev) => { return {...prev, reasonName: reviewtype ? reviewtype.reason_name : ""} diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OutcomeModal.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OutcomeModal.jsx index 6a7e75783..34efe936e 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OutcomeModal.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OutcomeModal.jsx @@ -40,7 +40,7 @@ const OutcomeModal= ({ - + Are you sure you are ready to select an outcome? This will complete the review and lock all fields. diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss index 4683c050f..d28779da2 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss @@ -1,4 +1,3 @@ - .align-division{ text-align: center; } From 639e8c0de0b8bcb77f8fefc5f57871872d49b3e7 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Tue, 28 Nov 2023 14:57:10 -0800 Subject: [PATCH 48/82] Mandatory date validation adjusted (inquiry date and received date) --- forms-flow-web/src/components/FOI/FOIRequest/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/utils.js b/forms-flow-web/src/components/FOI/FOIRequest/utils.js index 81d20752c..2905bfea2 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/utils.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/utils.js @@ -349,8 +349,8 @@ export const checkValidationError = ( !requiredRequestDetailsValues.requestStartDate || !requiredAxisDetails.axisRequestId || (oipcData?.length > 0 && isOipcReview && oipcData?.some((oipc) => { - return oipc.oipcno === "" || oipc.receiveddate === null || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null || - oipc.inquiryattributes?.orderno === "" || oipc.inquiryattributes?.inquiryoutcome === null || oipc.inquiryattributes?.inquirydate === null; + return oipc.oipcno === "" || oipc.receiveddate === null || oipc.receiveddate === "" || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null || + oipc.inquiryattributes?.orderno === "" || oipc.inquiryattributes?.inquiryoutcome === null || oipc.inquiryattributes?.inquirydate === null || oipc.inquiryattributes?.inquirydate === ""; })) ); }; From 1343ece01d0db727113290cf1387085fbd37c07d Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Tue, 28 Nov 2023 15:31:18 -0800 Subject: [PATCH 49/82] Save request in raw request state bug fix --- .../src/components/FOI/FOIRequest/BottomButtonGroup/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js index fa6a7df22..458fc2147 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js @@ -122,7 +122,7 @@ const BottomButtonGroup = React.memo( //add oipc Data to save request object and sync/validate isoipcreview attribute saveRequestObject.oipcdetails = oipcData; - if (oipcData.length > 0) { + if (oipcData?.length > 0) { saveRequestObject.isoipcreview = true; } else { saveRequestObject.isoipcreview = false; From bcb35a01ae9b2780f0623c4c17b435af2377b31e Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 28 Nov 2023 15:53:39 -0800 Subject: [PATCH 50/82] Add column to getbasequery --- .../request_api/models/FOIMinistryRequests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/request-management-api/request_api/models/FOIMinistryRequests.py b/request-management-api/request_api/models/FOIMinistryRequests.py index 7f203d8d0..8abc19dc7 100644 --- a/request-management-api/request_api/models/FOIMinistryRequests.py +++ b/request-management-api/request_api/models/FOIMinistryRequests.py @@ -1010,7 +1010,8 @@ def getbasequery(cls, iaoassignee, ministryassignee, userid=None, requestby='IAO extensions, FOIRestrictedMinistryRequest.isrestricted.label('isiaorestricted'), ministry_restricted_requests.isrestricted.label('isministryrestricted'), - SubjectCode.name.label('subjectcode') + SubjectCode.name.label('subjectcode'), + FOIMinistryRequest.isoipcreview.label('isoipcreview') ] basequery = _session.query( From 0e54fb987baa0570bd8a97777f58605a7239badd Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 28 Nov 2023 15:59:30 -0800 Subject: [PATCH 51/82] Update request flag --- .../components/FOI/FOIRequest/FOIRequest.js | 17 ++++- .../FOI/FOIRequest/FOIRequestHeader/index.js | 5 ++ .../FOI/customComponents/RequestFlag.js | 71 +++---------------- 3 files changed, 30 insertions(+), 63 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 8a6ae0ec4..665bd3f53 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -258,7 +258,7 @@ const FOIRequest = React.memo(({ userDetail }) => { const [redactedSections, setRedactedSections] = useState(""); const [isMCFPersonal, setIsMCFPersonal] = useState(bcgovcode.replaceAll('"', '') == "MCF" && requestDetails.requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); const {oipcData, addOIPC, removeOIPC, updateOIPC} = useOIPCHook(); - const [showOIPCDetails, setShowOIPCDetails] = useState(requestDetails.isoipcreview); + const [showOIPCDetails, setShowOIPCDetails] = useState(requestDetails.oipcData?.length > 0); useEffect(() => { if (window.location.href.indexOf("comments") > -1) { @@ -649,6 +649,18 @@ const FOIRequest = React.memo(({ userDetail }) => { setAssignedToValue(value); }; + const oipcSectionRef = React.useRef(null); + const handleOipcReviewFlagChange = (isSelected) => { + setShowOIPCDetails(isSelected); + oipcSectionRef.current.scrollIntoView(); + //timeout to allow react state to update after setState call + if (isSelected) { + setTimeout(() => { + oipcSectionRef.current.scrollIntoView(); + }, (10)); + } + } + //handle email validation const [validation, setValidation] = React.useState({}); const handleEmailValidation = (validationObj) => { @@ -1122,6 +1134,8 @@ const FOIRequest = React.memo(({ userDetail }) => { userDetail={userDetail} disableInput={disableInput} isAddRequest={isAddRequest} + handleOipcReviewFlagChange={handleOipcReviewFlagChange} + showOipcReviewFlag={requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase()} /> {(isAddRequest || requestState === StateEnum.unopened.name) && ( @@ -1237,6 +1251,7 @@ const FOIRequest = React.memo(({ userDetail }) => { divisions={requestDetails.divisions} /> )} +
{showOIPCDetails && requestState && requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && ( { /** * Header of Review request in the UI @@ -287,11 +289,14 @@ const FOIRequestHeader = React.memo( type="oipcreview" requestDetails={requestDetails} isActive={requestDetails.isoipcreview} + handleSelect={handleOipcReviewFlagChange} + showFlag={showOipcReviewFlag} />
diff --git a/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js b/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js index abfc21310..1109fe8b4 100644 --- a/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js +++ b/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js @@ -1,6 +1,5 @@ import { useState } from "react"; import "./requestflag.scss"; - import OutlinedInput from "@material-ui/core/OutlinedInput"; import MenuItem from "@material-ui/core/MenuItem"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; @@ -15,17 +14,12 @@ import CloseIcon from "@material-ui/icons/Close"; import IconButton from "@material-ui/core/IconButton"; import TextField from "@mui/material/TextField"; import { useParams } from "react-router-dom"; -import { saveRequestDetails } from "../../../apiManager/services/FOI/foiRequestServices"; -import { toast } from "react-toastify"; import { useDispatch } from "react-redux"; -import { - fetchFOIRequestDetailsWrapper, -} from "../../../apiManager/services/FOI/foiRequestServices"; //Types are: //oipcreview //phasedrelease -const RequestFlag = ({ isActive, type, requestDetails }) => { +const RequestFlag = ({ isActive, type, handleSelect, showFlag = true }) => { const [isSelected, setIsSelected] = useState(isActive || false); const [modalOpen, setModalOpen] = useState(false); const [modalHeading, setModalHeading] = useState(""); @@ -133,7 +127,12 @@ const RequestFlag = ({ isActive, type, requestDetails }) => { } const handleValueChange = (e) => { - setModalOpen(true); + setIsSelected(e.target.value); + if (type == "oipcreview" && !isActive) { + handleSelect(e.target.value) + } else { + setModalOpen(true); + } if (e.target.value == true) { setModalHeading(modalHeadingActive); @@ -144,7 +143,6 @@ const RequestFlag = ({ isActive, type, requestDetails }) => { setModalMessage(modalMessageInactive); setModalDescription(modalDescriptionInactive); } - setIsSelected(e.target.value); }; const handleClose = () => { @@ -154,61 +152,10 @@ const RequestFlag = ({ isActive, type, requestDetails }) => { const handleSave = (e) => { setModalOpen(false); - saveOipcReviewStatus(); - }; - - const saveOipcReviewStatus = () => { - let updatedRequestDetails; - if (type == "oipcreview") { - updatedRequestDetails = { - ...requestDetails, - isoipcreview: isSelected, - }; - } else if (type == "phasedrelease") { - updatedRequestDetails = { - ...requestDetails, - isphasedrelease: isSelected, - }; - } - //dispatch loader - dispatch( - saveRequestDetails( - updatedRequestDetails, - -2, //not an add request - requestId, - ministryId, - (err, res) => { - if (!err) { - toast.success("The OIPC review status has been successfully updated.", { - position: "top-right", - autoClose: 3000, - hideProgressBar: true, - closeOnClick: true, - pauseOnHover: true, - draggable: true, - progress: undefined, - }); - dispatch(fetchFOIRequestDetailsWrapper(requestId, ministryId)); - } else { - toast.error( - "Temporarily unable to update the OIPC review status. Please try again in a few minutes.", - { - position: "top-right", - autoClose: 3000, - hideProgressBar: true, - closeOnClick: true, - pauseOnHover: true, - draggable: true, - progress: undefined, - } - ); - setIsSelected(isActive || false); - } - } - ) - ); + handleSelect(isSelected); }; + if (!showFlag) return <>; return ( <>
From 80fa9dab01aabfc14107c110d348d0b9b0fb0ccc Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 28 Nov 2023 16:00:06 -0800 Subject: [PATCH 52/82] Add RequestFlag to Ministry view --- .../MinistryReview/MinistryReview.js | 26 +++++++++++++++++++ .../MinistryReview/RequestHeader.js | 5 +++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js index 6b779db48..4071f7ae0 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js @@ -62,6 +62,8 @@ import { UnsavedModal } from "../../customComponents"; import { DISABLE_GATHERINGRECORDS_TAB } from "../../../../constants/constants"; import _ from "lodash"; import { MinistryNeedsScanning } from "../../../../constants/FOI/enum"; +import OIPCDetails from "../OIPCDetails/Index"; +import useOIPCHook from "../OIPCDetails/oipcHook"; const useStyles = makeStyles((theme) => ({ root: { @@ -108,6 +110,8 @@ const MinistryReview = React.memo(({ userDetail }) => { const [_currentrequestStatus, setcurrentrequestStatus] = React.useState(""); const [_tabStatus, settabStatus] = React.useState(requestState); + const {oipcData, addOIPC, removeOIPC, updateOIPC} = useOIPCHook(); + const [showOIPCDetails, setShowOIPCDetails] = useState(requestDetails.oipcData?.length > 0); //gets the request detail from the store const IsDivisionalCoordinator = () => { return userDetail?.role?.includes("DivisionalCoordinator"); @@ -582,6 +586,18 @@ const MinistryReview = React.memo(({ userDetail }) => { (state) => state.foiRequests.showEventQueue ); + const oipcSectionRef = React.useRef(null); + const handleOipcReviewFlagChange = (isSelected) => { + setShowOIPCDetails(isSelected); + oipcSectionRef.current.scrollIntoView(); + //timeout to allow react state to update after setState call + if (isSelected) { + setTimeout(() => { + oipcSectionRef.current.scrollIntoView(); + }, (10)); + } + } + return !isLoading && requestDetails && Object.keys(requestDetails).length !== 0 && @@ -752,6 +768,7 @@ const MinistryReview = React.memo(({ userDetail }) => { setSaveMinistryRequestObject } ministryAssigneeValue={ministryAssignedToValue} + handleOipcReviewFlagChange={handleOipcReviewFlagChange} /> @@ -767,6 +784,15 @@ const MinistryReview = React.memo(({ userDetail }) => { /> {divisionsBox} {/* */} +
+ {showOIPCDetails && requestState && requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && ( + + )} { const { requestId, ministryId } = useParams(); const _requestDetails = requestDetails; @@ -108,11 +109,13 @@ const RequestHeader = React.memo(({ type="oipcreview" requestDetails={requestDetails} isActive={requestDetails.isoipcreview} + handleSelect={handleOipcReviewFlagChange} /> console.log('selected')} />
); From cbc0f223b14f8ad74906bc2b8ceb67edfcff3949 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Tue, 28 Nov 2023 16:00:19 -0800 Subject: [PATCH 53/82] Saving bug for raw requests fixed --- .../FOI/FOIRequest/BottomButtonGroup/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js index 458fc2147..cad544815 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js @@ -121,11 +121,13 @@ const BottomButtonGroup = React.memo( } //add oipc Data to save request object and sync/validate isoipcreview attribute - saveRequestObject.oipcdetails = oipcData; - if (oipcData?.length > 0) { - saveRequestObject.isoipcreview = true; - } else { - saveRequestObject.isoipcreview = false; + if (requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && requestState.toLowerCase() !== StateEnum.unopened.name.toLowerCase()) { + saveRequestObject.oipcdetails = oipcData; + // if (oipcData?.length > 0) { + // saveRequestObject.isoipcreview = true; + // } else { + // saveRequestObject.isoipcreview = false; + // } } dispatch(setFOILoader(setLoader)) From 7b0755efae49340d68a56c94c21721e0fbdf75c6 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Tue, 28 Nov 2023 16:04:40 -0800 Subject: [PATCH 54/82] design changes --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index f0d7275fd..483518590 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -167,6 +167,7 @@ const OIPCItem = (props) => { error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.oipcno === ""} required disabled={oipc.outcomeid && oipc.outcomeid !== 5} + placeholder="OIPC Number" /> @@ -250,6 +251,7 @@ const OIPCItem = (props) => { value={oipc.investigator} InputLabelProps={{ shrink: true }} disabled={oipc.outcomeid && oipc.outcomeid !== 5} + placeholder="Firstname Lastname" /> @@ -366,6 +368,7 @@ const OIPCItem = (props) => { error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.inquiryattributes.orderno === ""} required disabled={oipc.outcomeid && oipc.outcomeid !== 5} + placeholder="Order Number" /> @@ -380,7 +383,7 @@ const OIPCItem = (props) => { error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.inquiryattributes.inquiryoutcome === null} required disabled={oipc.outcomeid && oipc.outcomeid !== 5} - > + > {oipcInquiryoutcomes.map((inquiryoutcome) => { return {inquiryoutcome.name} })} From 7c8bc271cd6f4b8e503c4c5a3036c3a77074d47f Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Tue, 28 Nov 2023 19:00:28 -0800 Subject: [PATCH 55/82] Adjusted flag button to change request details isoipcreview attribute + adjusted state to manage displaying the oipc details section --- .../FOI/FOIRequest/BottomButtonGroup/index.js | 2 +- .../src/components/FOI/FOIRequest/FOIRequest.js | 16 ++++++++-------- .../FOIRequest/MinistryReview/MinistryReview.js | 9 +++++---- .../FOI/FOIRequest/OIPCDetails/oipcHook.js | 8 ++++++-- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js index cad544815..7a9e7c217 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js @@ -122,7 +122,7 @@ const BottomButtonGroup = React.memo( //add oipc Data to save request object and sync/validate isoipcreview attribute if (requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && requestState.toLowerCase() !== StateEnum.unopened.name.toLowerCase()) { - saveRequestObject.oipcdetails = oipcData; + saveRequestObject.oipcdetails = oipcData ? oipcData : []; // if (oipcData?.length > 0) { // saveRequestObject.isoipcreview = true; // } else { diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 665bd3f53..7532dd07f 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -257,8 +257,7 @@ const FOIRequest = React.memo(({ userDetail }) => { const [isIAORestricted, setIsIAORestricted] = useState(false); const [redactedSections, setRedactedSections] = useState(""); const [isMCFPersonal, setIsMCFPersonal] = useState(bcgovcode.replaceAll('"', '') == "MCF" && requestDetails.requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); - const {oipcData, addOIPC, removeOIPC, updateOIPC} = useOIPCHook(); - const [showOIPCDetails, setShowOIPCDetails] = useState(requestDetails.oipcData?.length > 0); + const {oipcData, addOIPC, removeOIPC, updateOIPC, isOIPCReview, setIsOIPCReview} = useOIPCHook(); useEffect(() => { if (window.location.href.indexOf("comments") > -1) { @@ -339,9 +338,9 @@ const FOIRequest = React.memo(({ userDetail }) => { } } if(requestDetails.isoipcreview) { - setShowOIPCDetails(true); + setIsOIPCReview(true); } else { - setShowOIPCDetails(false); + setIsOIPCReview(false); } }, [requestDetails]); @@ -349,7 +348,7 @@ const FOIRequest = React.memo(({ userDetail }) => { useEffect(() => { if(Object.keys(requestDetails).length !== 0 && oipcData?.length <= 0) { requestDetails.isoipcreview = false; - setShowOIPCDetails(false); + setIsOIPCReview(false); } }, [oipcData]) @@ -651,7 +650,8 @@ const FOIRequest = React.memo(({ userDetail }) => { const oipcSectionRef = React.useRef(null); const handleOipcReviewFlagChange = (isSelected) => { - setShowOIPCDetails(isSelected); + setIsOIPCReview(isSelected); + requestDetails.isoipcreview = isSelected; oipcSectionRef.current.scrollIntoView(); //timeout to allow react state to update after setState call if (isSelected) { @@ -1135,7 +1135,7 @@ const FOIRequest = React.memo(({ userDetail }) => { disableInput={disableInput} isAddRequest={isAddRequest} handleOipcReviewFlagChange={handleOipcReviewFlagChange} - showOipcReviewFlag={requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase()} + showOipcReviewFlag={requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && requestState.toLowerCase() !== StateEnum.unopened.name.toLowerCase()} /> {(isAddRequest || requestState === StateEnum.unopened.name) && ( @@ -1252,7 +1252,7 @@ const FOIRequest = React.memo(({ userDetail }) => { /> )}
- {showOIPCDetails && requestState && requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && ( + {isOIPCReview && requestState && requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && requestState.toLowerCase() !== StateEnum.unopened.name.toLowerCase() && ( { const [_currentrequestStatus, setcurrentrequestStatus] = React.useState(""); const [_tabStatus, settabStatus] = React.useState(requestState); - const {oipcData, addOIPC, removeOIPC, updateOIPC} = useOIPCHook(); - const [showOIPCDetails, setShowOIPCDetails] = useState(requestDetails.oipcData?.length > 0); + const {oipcData, addOIPC, removeOIPC, updateOIPC, isOIPCReview, setIsOIPCReview} = useOIPCHook(); + //gets the request detail from the store const IsDivisionalCoordinator = () => { return userDetail?.role?.includes("DivisionalCoordinator"); @@ -588,7 +588,8 @@ const MinistryReview = React.memo(({ userDetail }) => { const oipcSectionRef = React.useRef(null); const handleOipcReviewFlagChange = (isSelected) => { - setShowOIPCDetails(isSelected); + setIsOIPCReview(isSelected); + requestDetails.isoipcreview = isSelected; oipcSectionRef.current.scrollIntoView(); //timeout to allow react state to update after setState call if (isSelected) { @@ -785,7 +786,7 @@ const MinistryReview = React.memo(({ userDetail }) => { {divisionsBox} {/* */}
- {showOIPCDetails && requestState && requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && ( + {isOIPCReview && requestState && requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && requestState.toLowerCase() !== StateEnum.unopened.name.toLowerCase() && ( { //OIPC State const requestDetails = useSelector((state) => state.foiRequests.foiRequestDetail); const stageOIPCData = (isoipcreview, oipcData) => { + console.log(isoipcreview) if (isoipcreview) { if (oipcData?.length > 0) { return oipcData.map((item, index) => { @@ -31,11 +32,12 @@ const useOIPCHook = () => { } } const [oipcData, setOipcData] = useState(requestDetails.oipcdetails); + const [isOIPCReview, setIsOIPCReview] = useState(requestDetails.isoipcreview); useEffect(() => { - const stagedOIPCData = stageOIPCData(requestDetails.isoipcreview, requestDetails.oipcdetails); + const stagedOIPCData = stageOIPCData(isOIPCReview, requestDetails.oipcdetails); setOipcData(stagedOIPCData); - }, [requestDetails]) + }, [isOIPCReview]) console.log("HOOK", oipcData) @@ -88,6 +90,8 @@ const useOIPCHook = () => { updateOIPC, stageOIPCData, removeAllOIPCs, + isOIPCReview, + setIsOIPCReview, }; }; From 10da09b1594b9e5e6666416ef47f7d843b03db67 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 28 Nov 2023 19:42:18 -0800 Subject: [PATCH 56/82] Add flags column to advanced search --- .../Ministry/AdvancedSearch/DataGridAdvancedSearch.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/Dashboard/Ministry/AdvancedSearch/DataGridAdvancedSearch.js b/forms-flow-web/src/components/FOI/Dashboard/Ministry/AdvancedSearch/DataGridAdvancedSearch.js index 11be2fbeb..fa6955135 100644 --- a/forms-flow-web/src/components/FOI/Dashboard/Ministry/AdvancedSearch/DataGridAdvancedSearch.js +++ b/forms-flow-web/src/components/FOI/Dashboard/Ministry/AdvancedSearch/DataGridAdvancedSearch.js @@ -8,7 +8,8 @@ import { updateSortModel, getLDD, getRecordsDue, - LightTooltip + LightTooltip, + displayQueueFlagIcons } from "../../utils"; import { ActionContext } from "./ActionContext"; import { ConditionalComponent } from "../../../../../helper/FOI/helper"; @@ -94,6 +95,12 @@ const DataGridAdvancedSearch = ({ userDetail }) => { }; const columns = React.useRef([ + { + field: "flags", + headerName: "FLAGS", + headerAlign: "left", + renderCell: displayQueueFlagIcons, + }, { field: "axisRequestId", headerName: "ID NUMBER", From 8b81caca7b984c2a143bc4c4fee9bbd55e1d1891 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 28 Nov 2023 20:44:49 -0800 Subject: [PATCH 57/82] Add validation and master data to MinistryReview --- .../FOIRequest/MinistryReview/MinistryReview.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js index ee57d2c08..8e8cc00c1 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js @@ -18,6 +18,10 @@ import { import { fetchFOIMinistryAssignedToList, fetchFOIPersonalDivisionsAndSections, + fetchOIPCInquiryoutcomes, + fetchOIPCOutcomes, + fetchOIPCReviewtypes, + fetchOIPCStatuses, } from "../../../../apiManager/services/FOI/foiMasterDataServices"; import { fetchFOIRequestAttachmentsList } from "../../../../apiManager/services/FOI/foiAttachmentServices"; @@ -214,6 +218,12 @@ const MinistryReview = React.memo(({ userDetail }) => { dispatch(fetchPDFStitchStatusForHarms(requestId, ministryId)); dispatch(fetchPDFStitchStatusForRedlines(requestId, ministryId)); dispatch(fetchPDFStitchStatusForResponsePackage(requestId, ministryId)); + + dispatch(fetchOIPCOutcomes()); + dispatch(fetchOIPCStatuses()); + dispatch(fetchOIPCReviewtypes()); + dispatch(fetchOIPCInquiryoutcomes()); + fetchCFRForm(ministryId, dispatch); if (bcgovcode) dispatch(fetchFOIMinistryAssignedToList(bcgovcode)); } @@ -322,6 +332,11 @@ const MinistryReview = React.memo(({ userDetail }) => { hasincompleteDivstage || !hasReceivedDate; + const isOipcReviewValidationError = (oipcData?.length > 0 && requestDetails.isoipcreview && oipcData?.some((oipc) => { + return oipc.oipcno === "" || oipc.receiveddate === null || oipc.receiveddate === "" || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null || + oipc.inquiryattributes?.orderno === "" || oipc.inquiryattributes?.inquiryoutcome === null || oipc.inquiryattributes?.inquirydate === null || oipc.inquiryattributes?.inquirydate === ""; + })) + const createMinistrySaveRequestObject = (_propName, _value, _value2) => { const requestObject = { ...saveMinistryRequestObject }; setUnSavedRequest(true); @@ -798,7 +813,7 @@ const MinistryReview = React.memo(({ userDetail }) => { requestState={requestState} stateChanged={stateChanged} attachmentsArray={requestAttachments} - isValidationError={isValidationError} + isValidationError={isValidationError || isOipcReviewValidationError} saveMinistryRequestObject={saveMinistryRequestObject} unSavedRequest={unSavedRequest} recordsUploading={recordsUploading} From fb170847891ad1d61cf1af192c4e2a3ddd399660 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Wed, 29 Nov 2023 00:08:11 -0800 Subject: [PATCH 58/82] Comment phased release. --- forms-flow-web/src/components/FOI/Dashboard/utils.js | 1 - .../src/components/FOI/FOIRequest/FOIRequestHeader/index.js | 4 ++-- .../components/FOI/FOIRequest/MinistryReview/RequestHeader.js | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/forms-flow-web/src/components/FOI/Dashboard/utils.js b/forms-flow-web/src/components/FOI/Dashboard/utils.js index a363e303e..a8374d54c 100644 --- a/forms-flow-web/src/components/FOI/Dashboard/utils.js +++ b/forms-flow-web/src/components/FOI/Dashboard/utils.js @@ -255,7 +255,6 @@ export const displayQueueFlagIcons = (params) => { return
{restricted} {oipcreview} - {/* {phasedrelease} */}
} diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js index 48f92607f..8b878d685 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js @@ -292,12 +292,12 @@ const FOIRequestHeader = React.memo( handleSelect={handleOipcReviewFlagChange} showFlag={showOipcReviewFlag} /> - + /> */}
diff --git a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestHeader.js b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestHeader.js index a8e1176d9..08df3663a 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestHeader.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestHeader.js @@ -111,12 +111,12 @@ const RequestHeader = React.memo(({ isActive={requestDetails.isoipcreview} handleSelect={handleOipcReviewFlagChange} /> - console.log('selected')} - /> + /> */}
); return ( From a554b03f7f1e6b6fa53465db76d3dd1d8dad8023 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Wed, 29 Nov 2023 14:28:01 -0800 Subject: [PATCH 59/82] Remove OIPC from ministry view --- .../MinistryReview/MinistryReview.js | 26 ------------------- .../MinistryReview/RequestHeader.js | 5 +--- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js index ee57d2c08..bb181645c 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js @@ -62,8 +62,6 @@ import { UnsavedModal } from "../../customComponents"; import { DISABLE_GATHERINGRECORDS_TAB } from "../../../../constants/constants"; import _ from "lodash"; import { MinistryNeedsScanning } from "../../../../constants/FOI/enum"; -import OIPCDetails from "../OIPCDetails/Index"; -import useOIPCHook from "../OIPCDetails/oipcHook"; const useStyles = makeStyles((theme) => ({ root: { @@ -110,7 +108,6 @@ const MinistryReview = React.memo(({ userDetail }) => { const [_currentrequestStatus, setcurrentrequestStatus] = React.useState(""); const [_tabStatus, settabStatus] = React.useState(requestState); - const {oipcData, addOIPC, removeOIPC, updateOIPC, isOIPCReview, setIsOIPCReview} = useOIPCHook(); //gets the request detail from the store const IsDivisionalCoordinator = () => { @@ -586,19 +583,6 @@ const MinistryReview = React.memo(({ userDetail }) => { (state) => state.foiRequests.showEventQueue ); - const oipcSectionRef = React.useRef(null); - const handleOipcReviewFlagChange = (isSelected) => { - setIsOIPCReview(isSelected); - requestDetails.isoipcreview = isSelected; - oipcSectionRef.current.scrollIntoView(); - //timeout to allow react state to update after setState call - if (isSelected) { - setTimeout(() => { - oipcSectionRef.current.scrollIntoView(); - }, (10)); - } - } - return !isLoading && requestDetails && Object.keys(requestDetails).length !== 0 && @@ -769,7 +753,6 @@ const MinistryReview = React.memo(({ userDetail }) => { setSaveMinistryRequestObject } ministryAssigneeValue={ministryAssignedToValue} - handleOipcReviewFlagChange={handleOipcReviewFlagChange} /> @@ -785,15 +768,6 @@ const MinistryReview = React.memo(({ userDetail }) => { /> {divisionsBox} {/* */} -
- {isOIPCReview && requestState && requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && requestState.toLowerCase() !== StateEnum.unopened.name.toLowerCase() && ( - - )} { const { requestId, ministryId } = useParams(); const _requestDetails = requestDetails; @@ -109,13 +108,11 @@ const RequestHeader = React.memo(({ type="oipcreview" requestDetails={requestDetails} isActive={requestDetails.isoipcreview} - handleSelect={handleOipcReviewFlagChange} /> console.log('selected')} />
); From 59bf1eb7ed0a9dac3f76f51d63eb613e4667f90e Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Wed, 29 Nov 2023 17:06:39 -0800 Subject: [PATCH 60/82] Add useEffect to sync flag to state --- .../src/components/FOI/customComponents/RequestFlag.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js b/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js index 1109fe8b4..dc1ab85dc 100644 --- a/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js +++ b/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import "./requestflag.scss"; import OutlinedInput from "@material-ui/core/OutlinedInput"; import MenuItem from "@material-ui/core/MenuItem"; @@ -28,6 +28,10 @@ const RequestFlag = ({ isActive, type, handleSelect, showFlag = true }) => { const { requestId, ministryId } = useParams(); + useEffect(() => { + setIsSelected(isActive); + }, [isActive]) + const dispatch = useDispatch(); // These need to be set for each type From ff59c3c24cb2796f6c3b329d842059762b71bffb Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Wed, 29 Nov 2023 23:31:41 -0800 Subject: [PATCH 61/82] Cosmetic changes for dropdown. --- forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js | 3 +-- .../components/FOI/FOIRequest/FOIRequestHeader/index.js | 7 ++++++- .../FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx | 1 - .../src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js | 3 +-- .../src/components/FOI/customComponents/requestflag.scss | 4 +++- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 7532dd07f..64f95c009 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -352,8 +352,7 @@ const FOIRequest = React.memo(({ userDetail }) => { } }, [oipcData]) - console.log(requestDetails) - + useEffect(() => { if (isIAORestricted) dispatch(fetchRestrictedRequestCommentTagList(requestId, ministryId)); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js index 8b878d685..69c3ed18f 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequestHeader/index.js @@ -36,6 +36,9 @@ const useStyles = makeStyles((theme) => ({ fontWeight: theme.typography.fontWeightBold, opacity: 1, }, + blankrow: { + padding: 25 + } })); const FOIRequestHeader = React.memo( ({ @@ -282,10 +285,12 @@ const FOIRequestHeader = React.memo( isIAORestrictedFileManager={isIAORestrictedFileManager()} requestDetails={requestDetails} /> + }
-
+ { const {oipcData, removeOIPC, updateOIPC} = props; - console.log("COMPONENT", oipcData) const OIPCItems = oipcData?.map((oipcObj, index) => { return ( <> diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js index 15a91f0cf..5cdf4b4a5 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js @@ -39,8 +39,7 @@ const useOIPCHook = () => { setOipcData(stagedOIPCData); }, [isOIPCReview]) - console.log("HOOK", oipcData) - + //OIPC Functions const addOIPC = () => { setOipcData((prev) => { diff --git a/forms-flow-web/src/components/FOI/customComponents/requestflag.scss b/forms-flow-web/src/components/FOI/customComponents/requestflag.scss index 4eb12f1e6..f9ac8c120 100644 --- a/forms-flow-web/src/components/FOI/customComponents/requestflag.scss +++ b/forms-flow-web/src/components/FOI/customComponents/requestflag.scss @@ -1,6 +1,7 @@ .request-flag { - margin-left: 15px; + margin-left: -50px; + padding-top: 50px; .request-flag-dropdown-all { padding-top: 10px; @@ -76,3 +77,4 @@ padding-top: 25px; } + From 348534510cb24d18b50f320bde70e6c2de906699 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Wed, 29 Nov 2023 23:55:27 -0800 Subject: [PATCH 62/82] Enabling cache --- .../services/external/keycloakadminservice.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/request-management-api/request_api/services/external/keycloakadminservice.py b/request-management-api/request_api/services/external/keycloakadminservice.py index 3a632d34b..5ec6af21e 100644 --- a/request-management-api/request_api/services/external/keycloakadminservice.py +++ b/request-management-api/request_api/services/external/keycloakadminservice.py @@ -24,8 +24,8 @@ class KeycloakAdminService: def get_token(self): _accesstoken=None try: - #cache_client = redis.from_url(self.cache_redis_url,decode_responses=True) - _accesstoken = None #cache_client.get("foi:kcsrcacnttoken") + cache_client = redis.from_url(self.cache_redis_url,decode_responses=True) + _accesstoken = cache_client.get("foi:kcsrcacnttoken") if _accesstoken is None: url = '{0}/auth/realms/{1}/protocol/openid-connect/token'.format(self.keycloakhost,self.keycloakrealm) params = { @@ -38,11 +38,11 @@ def get_token(self): } x = requests.post(url, params, verify=True).content.decode('utf-8') _accesstoken = str(ast.literal_eval(x)['access_token']) - #cache_client.set("foi:kcsrcacnttoken",_accesstoken,ex=int(self.kctokenexpiry)) + cache_client.set("foi:kcsrcacnttoken",_accesstoken,ex=int(self.kctokenexpiry)) except BusinessException as exception: print("Error happened while accessing token on KeycloakAdminService {0}".format(exception.message)) - # finally: - # cache_client = None + finally: + cache_client = None return _accesstoken From 2c036198cea660b5e678e5801cdda485702e5fb7 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 30 Nov 2023 09:23:42 -0800 Subject: [PATCH 63/82] Remove OIPC from ministryreview --- .../FOIRequest/MinistryReview/MinistryReview.js | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js index f620c7b60..bb181645c 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js @@ -18,10 +18,6 @@ import { import { fetchFOIMinistryAssignedToList, fetchFOIPersonalDivisionsAndSections, - fetchOIPCInquiryoutcomes, - fetchOIPCOutcomes, - fetchOIPCReviewtypes, - fetchOIPCStatuses, } from "../../../../apiManager/services/FOI/foiMasterDataServices"; import { fetchFOIRequestAttachmentsList } from "../../../../apiManager/services/FOI/foiAttachmentServices"; @@ -215,12 +211,6 @@ const MinistryReview = React.memo(({ userDetail }) => { dispatch(fetchPDFStitchStatusForHarms(requestId, ministryId)); dispatch(fetchPDFStitchStatusForRedlines(requestId, ministryId)); dispatch(fetchPDFStitchStatusForResponsePackage(requestId, ministryId)); - - dispatch(fetchOIPCOutcomes()); - dispatch(fetchOIPCStatuses()); - dispatch(fetchOIPCReviewtypes()); - dispatch(fetchOIPCInquiryoutcomes()); - fetchCFRForm(ministryId, dispatch); if (bcgovcode) dispatch(fetchFOIMinistryAssignedToList(bcgovcode)); } @@ -329,11 +319,6 @@ const MinistryReview = React.memo(({ userDetail }) => { hasincompleteDivstage || !hasReceivedDate; - const isOipcReviewValidationError = (oipcData?.length > 0 && requestDetails.isoipcreview && oipcData?.some((oipc) => { - return oipc.oipcno === "" || oipc.receiveddate === null || oipc.receiveddate === "" || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null || - oipc.inquiryattributes?.orderno === "" || oipc.inquiryattributes?.inquiryoutcome === null || oipc.inquiryattributes?.inquirydate === null || oipc.inquiryattributes?.inquirydate === ""; - })) - const createMinistrySaveRequestObject = (_propName, _value, _value2) => { const requestObject = { ...saveMinistryRequestObject }; setUnSavedRequest(true); @@ -787,7 +772,7 @@ const MinistryReview = React.memo(({ userDetail }) => { requestState={requestState} stateChanged={stateChanged} attachmentsArray={requestAttachments} - isValidationError={isValidationError || isOipcReviewValidationError} + isValidationError={isValidationError} saveMinistryRequestObject={saveMinistryRequestObject} unSavedRequest={unSavedRequest} recordsUploading={recordsUploading} From 9ca5ccdae5926081d5ce57a5e151c36bd49174d8 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 30 Nov 2023 09:27:50 -0800 Subject: [PATCH 64/82] Remove unused imports --- .../src/components/FOI/customComponents/RequestFlag.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js b/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js index dc1ab85dc..9bfd6cbaa 100644 --- a/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js +++ b/forms-flow-web/src/components/FOI/customComponents/RequestFlag.js @@ -13,8 +13,6 @@ import DialogTitle from "@material-ui/core/DialogTitle"; import CloseIcon from "@material-ui/icons/Close"; import IconButton from "@material-ui/core/IconButton"; import TextField from "@mui/material/TextField"; -import { useParams } from "react-router-dom"; -import { useDispatch } from "react-redux"; //Types are: //oipcreview @@ -26,14 +24,10 @@ const RequestFlag = ({ isActive, type, handleSelect, showFlag = true }) => { const [modalMessage, setModalMessage] = useState(""); const [modalDescription, setModalDescription] = useState(""); - const { requestId, ministryId } = useParams(); - useEffect(() => { setIsSelected(isActive); }, [isActive]) - const dispatch = useDispatch(); - // These need to be set for each type let options; let id; From b4424c575e7f78990305802657688e3b48f777fb Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 30 Nov 2023 09:47:56 -0800 Subject: [PATCH 65/82] Undo accidental commit --- .../services/external/keycloakadminservice.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/request-management-api/request_api/services/external/keycloakadminservice.py b/request-management-api/request_api/services/external/keycloakadminservice.py index 3a632d34b..57fe4536d 100644 --- a/request-management-api/request_api/services/external/keycloakadminservice.py +++ b/request-management-api/request_api/services/external/keycloakadminservice.py @@ -24,8 +24,8 @@ class KeycloakAdminService: def get_token(self): _accesstoken=None try: - #cache_client = redis.from_url(self.cache_redis_url,decode_responses=True) - _accesstoken = None #cache_client.get("foi:kcsrcacnttoken") + cache_client = redis.from_url(self.cache_redis_url,decode_responses=True) + _accesstoken = cache_client.get("foi:kcsrcacnttoken") if _accesstoken is None: url = '{0}/auth/realms/{1}/protocol/openid-connect/token'.format(self.keycloakhost,self.keycloakrealm) params = { @@ -38,11 +38,11 @@ def get_token(self): } x = requests.post(url, params, verify=True).content.decode('utf-8') _accesstoken = str(ast.literal_eval(x)['access_token']) - #cache_client.set("foi:kcsrcacnttoken",_accesstoken,ex=int(self.kctokenexpiry)) + cache_client.set("foi:kcsrcacnttoken",_accesstoken,ex=int(self.kctokenexpiry)) except BusinessException as exception: print("Error happened while accessing token on KeycloakAdminService {0}".format(exception.message)) - # finally: - # cache_client = None + finally: + cache_client = None return _accesstoken From 05f40331f652a5beffb35f37737303b14f282339 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 30 Nov 2023 09:49:48 -0800 Subject: [PATCH 66/82] Match origin/main --- .../request_api/services/external/keycloakadminservice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/request-management-api/request_api/services/external/keycloakadminservice.py b/request-management-api/request_api/services/external/keycloakadminservice.py index 57fe4536d..5b33b04ef 100644 --- a/request-management-api/request_api/services/external/keycloakadminservice.py +++ b/request-management-api/request_api/services/external/keycloakadminservice.py @@ -25,7 +25,7 @@ def get_token(self): _accesstoken=None try: cache_client = redis.from_url(self.cache_redis_url,decode_responses=True) - _accesstoken = cache_client.get("foi:kcsrcacnttoken") + _accesstoken = cache_client.get("foi:kcsrcacnttoken") if _accesstoken is None: url = '{0}/auth/realms/{1}/protocol/openid-connect/token'.format(self.keycloakhost,self.keycloakrealm) params = { @@ -42,7 +42,7 @@ def get_token(self): except BusinessException as exception: print("Error happened while accessing token on KeycloakAdminService {0}".format(exception.message)) finally: - cache_client = None + cache_client = None return _accesstoken From 3b83933e68f52560c48cef416cdeb0cb2ee5105d Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 30 Nov 2023 09:52:01 -0800 Subject: [PATCH 67/82] Add spaces to match main --- .../request_api/services/external/keycloakadminservice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/request-management-api/request_api/services/external/keycloakadminservice.py b/request-management-api/request_api/services/external/keycloakadminservice.py index 5b33b04ef..f11fa992f 100644 --- a/request-management-api/request_api/services/external/keycloakadminservice.py +++ b/request-management-api/request_api/services/external/keycloakadminservice.py @@ -25,7 +25,7 @@ def get_token(self): _accesstoken=None try: cache_client = redis.from_url(self.cache_redis_url,decode_responses=True) - _accesstoken = cache_client.get("foi:kcsrcacnttoken") + _accesstoken = cache_client.get("foi:kcsrcacnttoken") if _accesstoken is None: url = '{0}/auth/realms/{1}/protocol/openid-connect/token'.format(self.keycloakhost,self.keycloakrealm) params = { @@ -42,7 +42,7 @@ def get_token(self): except BusinessException as exception: print("Error happened while accessing token on KeycloakAdminService {0}".format(exception.message)) finally: - cache_client = None + cache_client = None return _accesstoken From ba3f9b5b07157c24735e039b7099d7770e7a47ae Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 30 Nov 2023 09:53:01 -0800 Subject: [PATCH 68/82] Add white space --- .../request_api/services/external/keycloakadminservice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/request-management-api/request_api/services/external/keycloakadminservice.py b/request-management-api/request_api/services/external/keycloakadminservice.py index f11fa992f..5ec6af21e 100644 --- a/request-management-api/request_api/services/external/keycloakadminservice.py +++ b/request-management-api/request_api/services/external/keycloakadminservice.py @@ -25,7 +25,7 @@ def get_token(self): _accesstoken=None try: cache_client = redis.from_url(self.cache_redis_url,decode_responses=True) - _accesstoken = cache_client.get("foi:kcsrcacnttoken") + _accesstoken = cache_client.get("foi:kcsrcacnttoken") if _accesstoken is None: url = '{0}/auth/realms/{1}/protocol/openid-connect/token'.format(self.keycloakhost,self.keycloakrealm) params = { From 2736d2e605525656f522c98623f84fd0469b423a Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 11:34:31 -0800 Subject: [PATCH 69/82] Consoles to debug delete refresh issue --- forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js | 2 ++ .../components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx | 2 ++ .../src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js | 2 ++ 3 files changed, 6 insertions(+) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 64f95c009..d6132bbc2 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -919,6 +919,8 @@ const FOIRequest = React.memo(({ userDetail }) => { requestState !== StateEnum.appfeeowing.name && requestDetails?.requestType === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_GENERAL) } + + console.log("REQ OBJ", requestDetails) return (!isLoading && requestDetails && diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index a4c825ce8..f8d67c07c 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -5,6 +5,8 @@ import './oipcdetails.scss'; const OIPCDetailsList = (props) => { const {oipcData, removeOIPC, updateOIPC} = props; + console.log("COMPONENT", oipcData) + const OIPCItems = oipcData?.map((oipcObj, index) => { return ( <> diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js index 5cdf4b4a5..c7d6da1ad 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js @@ -39,6 +39,8 @@ const useOIPCHook = () => { setOipcData(stagedOIPCData); }, [isOIPCReview]) + console.log("HOOK", oipcData) + //OIPC Functions const addOIPC = () => { From cd04784086410dcdd939e0ff1cc9bc1579b106f1 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 12:16:23 -0800 Subject: [PATCH 70/82] Debugging for delete modal refrehs bug --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 6 ++++-- .../FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 483518590..10ebd19e3 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -22,6 +22,8 @@ const OIPCItem = (props) => { const [showDeleteModal, setShowDeleteModal] = useState(false); const [showOutcomeModal, setShowOutcomeModal] = useState(false); const [showAmendModal, setShowAmendModal] = useState(false); + + console.log("ITEM", oipc) //Functions const generateNamesFromOIPCId = (oipcObj) => { @@ -147,12 +149,12 @@ const OIPCItem = (props) => { return ( <> -
+
- {showDeleteModal && } + {showDeleteModal && } {showOutcomeModal && } {showAmendModal && } diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx index 853c28b54..878d8bea8 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx @@ -10,12 +10,12 @@ const RemoveOIPCModal= ({ showModal, removeOIPC, setShowModal, - oipcid, + oipc, }) =>{ const handleSave = () => { setShowModal(false); - removeOIPC(oipcid) + removeOIPC(oipc.id) }; const handleClose = () => { setShowModal(false); From 3e3d313f494849d83a920668c0723242987d3e2e Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 12:25:48 -0800 Subject: [PATCH 71/82] Adjust to previous merge --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 10ebd19e3..507665ebf 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -154,7 +154,7 @@ const OIPCItem = (props) => {
- {showDeleteModal && } + {showDeleteModal && } {showOutcomeModal && } {showAmendModal && } From 0616672c6e09dd5323ad6cf456cea0a9fe83b9f4 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 13:15:31 -0800 Subject: [PATCH 72/82] removal of debug code not needed --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 507665ebf..0d998b9e2 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -149,7 +149,7 @@ const OIPCItem = (props) => { return ( <> -
+
From bee4d5942d6f95f72763e756a19a0092c031f5ea Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 30 Nov 2023 13:27:38 -0800 Subject: [PATCH 73/82] Add e.preventDefault --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 483518590..819bb1cee 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -148,7 +148,10 @@ const OIPCItem = (props) => { return ( <>
-
From 4461f9d868a467ca11ed8ea015630a7ebeb8ee28 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 30 Nov 2023 13:29:36 -0800 Subject: [PATCH 74/82] Undo previous commit --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 819bb1cee..483518590 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -148,10 +148,7 @@ const OIPCItem = (props) => { return ( <>
-
From 59237f78e13e37f318987c240b1ec59ad9f1c3f4 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 30 Nov 2023 13:30:43 -0800 Subject: [PATCH 75/82] Add e.preventDefault --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 0d998b9e2..07401afc7 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -150,7 +150,10 @@ const OIPCItem = (props) => { return ( <>
-
From d1241350a0e45ae24d134ef47d00919e8274a4d0 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 14:14:01 -0800 Subject: [PATCH 76/82] removal of console logs --- forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js | 2 -- .../components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx | 2 -- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 2 -- .../src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js | 2 -- 4 files changed, 8 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index d6132bbc2..64f95c009 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -919,8 +919,6 @@ const FOIRequest = React.memo(({ userDetail }) => { requestState !== StateEnum.appfeeowing.name && requestDetails?.requestType === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_GENERAL) } - - console.log("REQ OBJ", requestDetails) return (!isLoading && requestDetails && diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index f8d67c07c..a4c825ce8 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -5,8 +5,6 @@ import './oipcdetails.scss'; const OIPCDetailsList = (props) => { const {oipcData, removeOIPC, updateOIPC} = props; - console.log("COMPONENT", oipcData) - const OIPCItems = oipcData?.map((oipcObj, index) => { return ( <> diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 07401afc7..545480682 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -22,8 +22,6 @@ const OIPCItem = (props) => { const [showDeleteModal, setShowDeleteModal] = useState(false); const [showOutcomeModal, setShowOutcomeModal] = useState(false); const [showAmendModal, setShowAmendModal] = useState(false); - - console.log("ITEM", oipc) //Functions const generateNamesFromOIPCId = (oipcObj) => { diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js index c7d6da1ad..0d2a06c70 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js @@ -5,7 +5,6 @@ const useOIPCHook = () => { //OIPC State const requestDetails = useSelector((state) => state.foiRequests.foiRequestDetail); const stageOIPCData = (isoipcreview, oipcData) => { - console.log(isoipcreview) if (isoipcreview) { if (oipcData?.length > 0) { return oipcData.map((item, index) => { @@ -41,7 +40,6 @@ const useOIPCHook = () => { console.log("HOOK", oipcData) - //OIPC Functions const addOIPC = () => { setOipcData((prev) => { From 9973d3756294c506bae7193c86aea67933b1000d Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 14:14:27 -0800 Subject: [PATCH 77/82] removal of console logs --- .../src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js index 0d2a06c70..55538aac9 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js @@ -38,7 +38,7 @@ const useOIPCHook = () => { setOipcData(stagedOIPCData); }, [isOIPCReview]) - console.log("HOOK", oipcData) + // console.log("HOOK", oipcData) //OIPC Functions const addOIPC = () => { From edc4765b87de43853cf5239d2c5a7e79e1d897cb Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 16:31:43 -0800 Subject: [PATCH 78/82] Styling changes --- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 545480682..557f0c31d 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -194,13 +194,16 @@ const OIPCItem = (props) => { select variant="outlined" fullWidth - value={oipc.reviewtypeid} + value={oipc.reviewtypeid ? oipc.reviewtypeid : -1} label="Review Type" onChange={(event) => handleReviewType(event.target.value)} error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.reviewtypeid === null} required disabled={oipc.outcomeid && oipc.outcomeid !== 5} > + + Select Review Type + {uniqueReviewTypes(oipcReviewtypes).map((reviewtype) => { return {reviewtype.type_name} })} @@ -212,13 +215,16 @@ const OIPCItem = (props) => { select variant="outlined" fullWidth - value={oipc.reasonid} + value={oipc.reasonid ? oipc.reasonid : -1} label="Reason" onChange = {(event) => handleReason(event.target.value)} error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.reasonid === null} required disabled={oipc.outcomeid && oipc.outcomeid !== 5} > + + Select Review Type & Reason + {oipc.reviewtypeid ? oipcReviewtypes.map((reviewtype) => { if (reviewtype.reviewtypeid === oipc.reviewtypeid) { @@ -233,13 +239,16 @@ const OIPCItem = (props) => { select variant="outlined" fullWidth - value={oipc.statusid} + value={oipc.statusid ? oipc.statusid : -1} label="Status" onChange = {(event) => handleStatus(event.target.value)} error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.statusid === null} required disabled={oipc.outcomeid && oipc.outcomeid !== 5} > + + Select Status + {oipcStatuses.map((status) => { return {status.name} })} @@ -264,9 +273,12 @@ const OIPCItem = (props) => { variant="outlined" onChange = {(event) => handleOutcome(event.target.value)} fullWidth - value={oipc.outcomeid} + value={oipc.outcomeid ? oipc.outcomeid : -1} label="Outcome" > + + Select Outcome + {oipcOutcomes.map((outcome) => { if (outcome.outcomeid !== 5) { return {outcome.name} From ea3da2e7538a3848117fc61c8fe28d2ab730e62c Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 16:42:12 -0800 Subject: [PATCH 79/82] Default value stylying completed --- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 557f0c31d..a9f772b0e 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -202,7 +202,7 @@ const OIPCItem = (props) => { disabled={oipc.outcomeid && oipc.outcomeid !== 5} > - Select Review Type + Select Review Type {uniqueReviewTypes(oipcReviewtypes).map((reviewtype) => { return {reviewtype.type_name} @@ -223,7 +223,7 @@ const OIPCItem = (props) => { disabled={oipc.outcomeid && oipc.outcomeid !== 5} > - Select Review Type & Reason + Select Review Type & Reason {oipc.reviewtypeid ? oipcReviewtypes.map((reviewtype) => { @@ -247,7 +247,7 @@ const OIPCItem = (props) => { disabled={oipc.outcomeid && oipc.outcomeid !== 5} > - Select Status + Select Status {oipcStatuses.map((status) => { return {status.name} @@ -277,7 +277,7 @@ const OIPCItem = (props) => { label="Outcome" > - Select Outcome + Select Outcome {oipcOutcomes.map((outcome) => { if (outcome.outcomeid !== 5) { @@ -393,12 +393,15 @@ const OIPCItem = (props) => { variant="outlined" onChange = {(event) => handleInquiryFields(event.target.value, "INQUIRYOUTCOME")} fullWidth - value={oipc.inquiryattributes.inquiryoutcome} + value={oipc.inquiryattributes.inquiryoutcome ? oipc.inquiryattributes.inquiryoutcome : -1} label="Outcome" error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.inquiryattributes.inquiryoutcome === null} required disabled={oipc.outcomeid && oipc.outcomeid !== 5} - > + > + + Select Inquiry Outcome + {oipcInquiryoutcomes.map((inquiryoutcome) => { return {inquiryoutcome.name} })} From 6d58e93a464277eb2339b8d2ed70a50883821576 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 30 Nov 2023 17:13:16 -0800 Subject: [PATCH 80/82] Update disableInput when oipcData is changed --- .../components/FOI/FOIRequest/FOIRequest.js | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index d6132bbc2..2fab44743 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -163,8 +163,7 @@ const FOIRequest = React.memo(({ userDetail }) => { const [attachments, setAttachments] = useState(requestAttachments); const [comment, setComment] = useState([]); const [requestState, setRequestState] = useState(StateEnum.unopened.name); - const disableInput = - requestState?.toLowerCase() === StateEnum.closed.name.toLowerCase(); + const [disableInput, setDisableInput] = useState(requestState?.toLowerCase() === StateEnum.closed.name.toLowerCase()); const [_tabStatus, settabStatus] = React.useState(requestState); let foitabheaderBG = getTabBG(_tabStatus, requestState); @@ -258,7 +257,24 @@ const FOIRequest = React.memo(({ userDetail }) => { const [redactedSections, setRedactedSections] = useState(""); const [isMCFPersonal, setIsMCFPersonal] = useState(bcgovcode.replaceAll('"', '') == "MCF" && requestDetails.requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); const {oipcData, addOIPC, removeOIPC, updateOIPC, isOIPCReview, setIsOIPCReview} = useOIPCHook(); - + const [oipcDataInitial, setOipcDataInitial] = useState(oipcData); + + //Update disableInput when requestState changes + useEffect(() => { + setDisableInput(requestState?.toLowerCase() === StateEnum.closed.name.toLowerCase()) + }, [requestState]) + + useEffect(() => { + if (!oipcDataInitial) { + setOipcDataInitial(oipcData); + return; + } + //check to see if oipcData has been updated, if so, enable save button + if (JSON.stringify(oipcData) != JSON.stringify(oipcDataInitial)) { + setDisableInput(false) + } + }, [oipcData]); + useEffect(() => { if (window.location.href.indexOf("comments") > -1) { tabclick("Comments"); From cb95b335d236bf7e4dee863174156bae6a49c545 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 30 Nov 2023 19:37:22 -0800 Subject: [PATCH 81/82] changes to avoid default reset of data. --- .../FOI/FOIRequest/OIPCDetails/oipcHook.js | 12 ++++++++++-- .../components/FOI/customComponents/requestflag.scss | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js index 851651746..eb24abdd6 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js @@ -32,10 +32,12 @@ const useOIPCHook = () => { } const [oipcData, setOipcData] = useState(requestDetails.oipcdetails); const [isOIPCReview, setIsOIPCReview] = useState(requestDetails.isoipcreview); - + const [resettoInitial, setResettoInitial] = useState(false); useEffect(() => { + if (resettoInitial == false) { const stagedOIPCData = stageOIPCData(isOIPCReview, requestDetails.oipcdetails); setOipcData(stagedOIPCData); + } }, [isOIPCReview]) //OIPC Functions @@ -59,11 +61,17 @@ const useOIPCHook = () => { }) } const removeOIPC = (oipcId) => { + if (oipcData.length == 1) { + setOipcData([]); + setResettoInitial(true) + } + else { setOipcData((prev) => { const previousOIPCData = [...prev]; - return previousOIPCData.filter(oipc => oipcId !== oipc.id); + return previousOIPCData.filter(oipc => oipcId !== oipc.id); }); } + } const updateOIPC = (newOIPCObj) => { setOipcData((prev) => { const previousOIPCData = [...prev]; diff --git a/forms-flow-web/src/components/FOI/customComponents/requestflag.scss b/forms-flow-web/src/components/FOI/customComponents/requestflag.scss index f9ac8c120..7df546c97 100644 --- a/forms-flow-web/src/components/FOI/customComponents/requestflag.scss +++ b/forms-flow-web/src/components/FOI/customComponents/requestflag.scss @@ -1,6 +1,5 @@ .request-flag { - margin-left: -50px; padding-top: 50px; .request-flag-dropdown-all { From e1b7ea61109ee35e3dd37c46ffe142543b6b1b9a Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 30 Nov 2023 20:29:02 -0800 Subject: [PATCH 82/82] Remove important --- .../components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss index d28779da2..9d467ac10 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcdetails.scss @@ -32,7 +32,7 @@ } .MuiDivider-root { - margin: 10px 0px 16px 0px !important; - height: 1.5px !important; + margin: 10px 0px 16px 0px; + height: 1.5px; } \ No newline at end of file