diff --git a/forms-flow-web/src/components/FOI/customComponents/Watcher.scss b/forms-flow-web/src/components/FOI/customComponents/Watcher.scss index 975751b07..9f674e35a 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Watcher.scss +++ b/forms-flow-web/src/components/FOI/customComponents/Watcher.scss @@ -27,7 +27,7 @@ } .foi-eye-container { - width: auto; + width: 100px; height: 40px; background-color: #00336652; border-radius: 40px 0px 0px 40px; @@ -38,11 +38,12 @@ .foi-watcher-all { padding-top: 10px; display: flex; + width: 188px; } .foi-watcher-select { padding-top: 8px; - width: 80px; + width: 100px; height: 40px; background-color:#003366; color: white; diff --git a/forms-flow-web/src/components/FOI/customComponents/requestflag.scss b/forms-flow-web/src/components/FOI/customComponents/requestflag.scss index 7df546c97..fcbc352ff 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 { - padding-top: 50px; .request-flag-dropdown-all { padding-top: 10px; @@ -27,7 +26,7 @@ } .request-flag-select{ - border: 1px solid #a0192f; + border: 1px solid #fa7c16; //padding-top: 8px; //width:40px; height: 40px; diff --git a/request-management-api/request_api/models/FOIMinistryRequests.py b/request-management-api/request_api/models/FOIMinistryRequests.py index 89f7039e7..dc25bc8ac 100644 --- a/request-management-api/request_api/models/FOIMinistryRequests.py +++ b/request-management-api/request_api/models/FOIMinistryRequests.py @@ -493,7 +493,7 @@ def getrequestssubquery(cls, groups, filterfields, keyword, additionalfilter, us ministry_restricted_requests.isrestricted.label('isministryrestricted'), SubjectCode.name.label('subjectcode'), FOIMinistryRequest.isoipcreview.label('isoipcreview'), - FOIRequestOIPC.oipcno.label('oipc_number') + literal(None).label('oipc_number'), ] basequery = _session.query( @@ -564,11 +564,9 @@ def getrequestssubquery(cls, groups, filterfields, keyword, additionalfilter, us SubjectCode, SubjectCode.subjectcodeid == FOIMinistryRequestSubjectCode.subjectcodeid, isouter=True - ).join( - FOIRequestOIPC, - and_(FOIRequestOIPC.foiministryrequest_id == FOIMinistryRequest.foiministryrequestid, FOIRequestOIPC.foiministryrequestversion_id == FOIMinistryRequest.version), - isouter=True ).filter(or_(FOIMinistryRequest.requeststatusid != 3, and_(FOIMinistryRequest.isoipcreview == True, FOIMinistryRequest.requeststatusid == 3))) + + if(additionalfilter == 'watchingRequests'): #watchby @@ -675,8 +673,7 @@ def findfield(cls, x, iaoassignee, ministryassignee): 'requestPageCount': FOIMinistryRequest.requestpagecount, 'closedate': FOIMinistryRequest.closedate, 'subjectcode': SubjectCode.name, - 'isoipcreview': FOIMinistryRequest.isoipcreview, - 'oipc_number': FOIRequestOIPC.oipcno + 'isoipcreview': FOIMinistryRequest.isoipcreview }.get(x, FOIMinistryRequest.axisrequestid) @classmethod @@ -1047,7 +1044,7 @@ def getbasequery(cls, iaoassignee, ministryassignee, userid=None, requestby='IAO ministry_restricted_requests.isrestricted.label('isministryrestricted'), SubjectCode.name.label('subjectcode'), FOIMinistryRequest.isoipcreview.label('isoipcreview'), - FOIRequestOIPC.oipcno.label('oipc_number') + literal(None).label('oipc_number') ] basequery = _session.query( @@ -1118,11 +1115,8 @@ def getbasequery(cls, iaoassignee, ministryassignee, userid=None, requestby='IAO SubjectCode, SubjectCode.subjectcodeid == FOIMinistryRequestSubjectCode.subjectcodeid, isouter=True - ).join( - FOIRequestOIPC, - and_(FOIRequestOIPC.foiministryrequest_id == FOIMinistryRequest.foiministryrequestid, FOIRequestOIPC.foiministryrequestversion_id == FOIMinistryRequest.version), - isouter=True ) + if(isiaorestrictedfilemanager == True or isministryrestrictedfilemanager == True): dbquery = basequery.filter(ministryfilter) @@ -1319,6 +1313,14 @@ def getfilterforsearch(cls, params, iaoassignee, ministryassignee): searchcondition1.append(FOIMinistryRequest.findfield('assignedministrypersonFirstName', iaoassignee, ministryassignee).ilike('%'+keyword+'%')) searchcondition2.append(FOIMinistryRequest.findfield('assignedministrypersonLastName', iaoassignee, ministryassignee).ilike('%'+keyword+'%')) return or_(and_(*searchcondition1), and_(*searchcondition2)) + elif(params['search'] == 'oipc_number'): + searchcondition1 = [] + searchcondition2 = [] + for keyword in params['keywords']: + oipccondition = FOIRequestOIPC.getrequestidsbyoipcno(keyword) + searchcondition1.append(oipccondition.c.foiministryrequest_id == FOIMinistryRequest.foiministryrequestid) + searchcondition2.append(oipccondition.c.foiministryrequestversion_id == FOIMinistryRequest.version) + return and_(and_(*searchcondition1), and_(*searchcondition2)) else: searchcondition = [] for keyword in params['keywords']: diff --git a/request-management-api/request_api/models/FOIRequestOIPC.py b/request-management-api/request_api/models/FOIRequestOIPC.py index a68407b9f..2931a304a 100644 --- a/request-management-api/request_api/models/FOIRequestOIPC.py +++ b/request-management-api/request_api/models/FOIRequestOIPC.py @@ -47,9 +47,17 @@ def getoipc(cls,ministryrequestid,ministryrequestversion): divisioninfos = oipc_schema.dump(_oipclist) return divisioninfos + + @classmethod + def getrequestidsbyoipcno(cls, oipcno): + return db.session.query( + FOIRequestOIPC.foiministryrequest_id, + FOIRequestOIPC.foiministryrequestversion_id + ).filter(FOIRequestOIPC.oipcno.ilike('%'+oipcno+'%')).group_by(FOIRequestOIPC.foiministryrequest_id, FOIRequestOIPC.foiministryrequestversion_id).subquery() + class FOIRequestOIPCSchema(ma.Schema): class Meta: fields = ('oipcid', 'version', 'ministryrequestid', 'investigator','ministryversion','oipcno','reviewtypeid','reasonid','statusid','outcomeid','isinquiry','inquiryattributes','isjudicialreview', - 'issubsequentappeal','isactive','receiveddate','closeddate','created_at','createdby','updated_at','updatedby', + 'issubsequentappeal','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/services/foirequest/requestservicebuilder.py b/request-management-api/request_api/services/foirequest/requestservicebuilder.py index b6315671b..dd1a0516b 100644 --- a/request-management-api/request_api/services/foirequest/requestservicebuilder.py +++ b/request-management-api/request_api/services/foirequest/requestservicebuilder.py @@ -151,7 +151,6 @@ def prepareoipc(self, requestschema, ministryrequestid, version, userid): oipcreview.issubsequentappeal = oipc["issubsequentappeal"] 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"] oipcreview.createdby=userid diff --git a/request-management-api/request_api/services/foirequest/requestserviceministrybuilder.py b/request-management-api/request_api/services/foirequest/requestserviceministrybuilder.py index 3c05ea9ba..ecdee3daf 100644 --- a/request-management-api/request_api/services/foirequest/requestserviceministrybuilder.py +++ b/request-management-api/request_api/services/foirequest/requestserviceministrybuilder.py @@ -88,7 +88,7 @@ def createfoiministryrequestfromobject(self, ministryschema, requestschema, user foiministryrequest.closedate = requestdict['closedate'] foiministryrequest.closereasonid = requestdict['closereasonid'] foiministryrequest.isoipcreview = ministryschema["isoipcreview"] - foiministryrequest.oipcreviews = self.createfoirequestoipcs(foiministryrequest.isoipcreview, ministryschema["foirequest_id"], ministryschema["version"], userid, usertype) + foiministryrequest.oipcreviews = self.createfoirequestoipcs(foiministryrequest.isoipcreview, ministryschema["foirequest_id"], ministryschema["version"]) return foiministryrequest def __createministrydivisions(self, requestschema, foiministryrequestid, foiministryrequestversion, userid): @@ -313,7 +313,7 @@ def createfoirequestdivision(self, requestschema, requestid, version, userid): def createfoiassigneefromobject(self, username, firstname, middlename, lastname): return FOIAssignee.saveassignee(username, firstname, middlename, lastname) - def createfoirequestoipcs(self, isoipcreview, requestid, version, userid, usertype): + def createfoirequestoipcs(self, isoipcreview, requestid, version): current_oipcs = FOIRequestOIPC.getoipc(requestid, version) if (isoipcreview == True): updated_oipcs = [] @@ -326,19 +326,16 @@ def createfoirequestoipcs(self, isoipcreview, requestid, version, userid, userty oipcreview.reasonid = oipc["reasonid"] oipcreview.statusid = oipc["statusid"] oipcreview.outcomeid = oipc["outcomeid"] - oipcreview.investigator = oipc["investigator"] if oipc["investigator"] not in (None, "") else None + oipcreview.investigator = oipc["investigator"] oipcreview.isinquiry = oipc["isinquiry"] oipcreview.isjudicialreview = oipc["isjudicialreview"] oipcreview.issubsequentappeal = oipc["issubsequentappeal"] oipcreview.issubsequentappeal = oipc["issubsequentappeal"] - 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"] - oipcreview.createdby = oipc["createdby"] if usertype == "ministry" else userid - oipcreview.created_at= oipc["created_at"] if usertype == "ministry" else datetime2.now().isoformat() - + oipcreview.receiveddate = oipc["receiveddate"] + oipcreview.closeddate = oipc["closeddate"] + oipcreview.inquiryattributes = oipc["inquiryattributes"] + oipcreview.createdby=oipc["createdby"] + oipcreview.created_at= oipc["created_at"] updated_oipcs.append(oipcreview) return updated_oipcs return []