Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release 11.5 - merge dev #5497

Merged
merged 24 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
433261f
Add bulk edit button
milosdes Dec 11, 2024
e60ee65
Fix bug in recordservicegetter
milosdes Dec 11, 2024
7020c44
Remove default personaltag when bulk editting
milosdes Dec 11, 2024
be9b885
Merge branch 'dev' into dev-MD-3622
milosdes Dec 16, 2024
737784c
Save only updated attributes
milosdes Dec 16, 2024
1e55551
Display upload button for IAO users
milosdes Dec 17, 2024
5941374
Fixed FOIMOD-3635, fixed intake in progress advance search
nagarajaPC-AOT Dec 18, 2024
6c193da
Removed unused getfilterforidnumber
nagarajaPC-AOT Dec 18, 2024
c156526
Merge pull request #5486 from bcgov/dev-NC-FOIMOD-3635
nagarajaPC-AOT Dec 18, 2024
b220b2a
Merge pull request #5484 from bcgov/dev-MD-3622
milosdes Dec 18, 2024
1c562fe
Merge pull request #5485 from bcgov/dev-MD-3621
milosdes Dec 18, 2024
5a434fa
Fix validation for feewaiver
milosdes Dec 18, 2024
1e4f1de
Merge pull request #5487 from bcgov/dev-MD-3662
milosdes Dec 18, 2024
3f1b858
Handle bulk division updates
milosdes Dec 20, 2024
1aa20ae
Merge pull request #5489 from bcgov/dev-MD-3622
milosdes Dec 20, 2024
773e267
Disable draggable feature to stop refocusing of modal issue
milosdes Dec 24, 2024
5ea9290
Remove accidental useRef import
milosdes Dec 24, 2024
9ee2e11
Merge pull request #5490 from bcgov/dev-MD-3622
milosdes Dec 24, 2024
e0f323d
Remove draggable import
milosdes Dec 30, 2024
6caa53d
Merge pull request #5494 from bcgov/dev-MD-3622
milosdes Dec 30, 2024
7f9652c
Change layout to match scanning team for IAO
milosdes Dec 30, 2024
b2717f3
Merge pull request #5495 from bcgov/dev-MD-3621
milosdes Dec 30, 2024
550eebc
Remove draggable from package.json
milosdes Dec 30, 2024
975b07d
Merge pull request #5496 from bcgov/dev-MD-3622
milosdes Dec 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion forms-flow-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@
"node_modules/(?!(astronomia|client-zip|reactjs-popup|react-quill)/)"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,9 @@ export const CFRForm = ({
}

const isFeeWaiverDisabled = () => {
if(isMinistry || requestState === StateEnum.peerreview.name || (!isMinistry && (requestState !== StateEnum.onhold.name || requestState !== StateEnum.onholdother.name || formData?.formStatus !== 'approved')))
if(isMinistry ||
requestState === StateEnum.peerreview.name ||
(!isMinistry && (requestState !== StateEnum.onhold.name && requestState !== StateEnum.onholdother.name || formData?.formStatus !== 'approved')))
return true;
else
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import TextField from '@material-ui/core/TextField';
import AddCircleIcon from '@mui/icons-material/AddCircle';
import _ from 'lodash';
import { MCFPopularSections } from "../../../../constants/FOI/enum";
// import Draggable from 'react-draggable';

const MCFPersonal = ({
editTagModalOpen,
Expand All @@ -34,7 +35,8 @@ const MCFPersonal = ({
divisionModalTagValue,
divisions=[],
isMinistryCoordinator,
currentEditRecord
currentEditRecord,
isBulkEdit
}) => {
const [personalAttributes, setPersonalAttributes] = useState();
useEffect(() => {
Expand Down Expand Up @@ -81,16 +83,27 @@ const MCFPersonal = ({
}

useEffect(() => {
setDisableSave(
personalAttributes?.person === undefined
|| personalAttributes?.person === ""
|| personalAttributes?.filetype === undefined
|| personalAttributes?.filetype === ""
|| personalAttributes?.trackingid === undefined
|| personalAttributes?.trackingid === ""
|| (!isMinistryCoordinator && comparePersonalAttributes(personalAttributes, curPersonalAttributes))
|| (isMinistryCoordinator && comparePersonalAttributes(personalAttributes, curPersonalAttributes) && compareDivision(currentEditRecord.attributes.divisions[0].divisionid, divisionModalTagValue))
if (isBulkEdit) {
setDisableSave(
personalAttributes?.person === ""
&& personalAttributes?.filetype === ""
&& personalAttributes?.trackingid === ""
&& personalAttributes?.personaltag === ""
&& personalAttributes?.volume === ""
&& divisionModalTagValue === -1
);
} else {
setDisableSave(
personalAttributes?.person === undefined
|| personalAttributes?.person === ""
|| personalAttributes?.filetype === undefined
|| personalAttributes?.filetype === ""
|| personalAttributes?.trackingid === undefined
|| personalAttributes?.trackingid === ""
|| (!isMinistryCoordinator && comparePersonalAttributes(personalAttributes, curPersonalAttributes))
|| (isMinistryCoordinator && comparePersonalAttributes(personalAttributes, curPersonalAttributes) && compareDivision(currentEditRecord.attributes.divisions[0].divisionid, divisionModalTagValue))
);
}
},[personalAttributes, divisionModalTagValue])

useEffect(() => {
Expand Down Expand Up @@ -277,12 +290,22 @@ const MCFPersonal = ({
setFileTypeSearchValue("");
};

// Disabling draggable modal - this causing issues with the modal refocusing at the top
// const PaperComponent = (props) => {
// return (
// <Draggable handle="#state-change-dialog-title" cancel={'[class*="MuiDialogContent-root"]'}>
// <Paper {...props} />
// </Draggable>
// );
// }

return (

<div className="state-change-dialog">
<Dialog
open={editTagModalOpen}
onClose={() => handleClose()}
// PaperComponent={PaperComponent}
aria-labelledby="state-change-dialog-title"
aria-describedby="state-change-dialog-description"
maxWidth={"md"}
Expand Down Expand Up @@ -637,20 +660,31 @@ const MCFPersonal = ({
</DialogContentText>
</DialogContent>
<DialogActions>
{!isBulkEdit &&
<>
<button
className={`btn-bottom btn-save btn`}
onClick={() => {updatePersonalAttributes();reset();}}
disabled={disableSave}
>
Update for Individual
</button>
<button
className={`btn-bottom btn-save btn`}
onClick={() => {updatePersonalAttributes(true);reset();}}
disabled={disableSave || isMinistryCoordinator}
>
Update for All
</button>
</>}
{isBulkEdit &&
<button
className={`btn-bottom btn-save btn`}
onClick={() => {updatePersonalAttributes();reset();}}
disabled={disableSave}
>
Update for Individual
</button>
<button
className={`btn-bottom btn-save btn`}
onClick={() => {updatePersonalAttributes(true);reset();}}
disabled={disableSave || isMinistryCoordinator}
>
Update for All
</button>
Continue
</button>}
<button
className="btn-bottom btn-cancel"
onClick={() => handleClose()}
Expand Down
100 changes: 91 additions & 9 deletions forms-flow-web/src/components/FOI/customComponents/Records/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,23 @@ export const RecordsLog = ({
&& a?.trackingid === b?.trackingid;
};

const [isBulkEdit, setIsBulkEdit] = React.useState(false);

useEffect(() => {
let selectedRecords = records.filter((record) => record.isselected);
setIsBulkEdit(selectedRecords.length > 1);
}, [records])

const isBulkEditDisabled = () => {
if (isBulkEdit) {
return false;
} else {
return true;
}
}

const updatePersonalAttributes = (_all = false) => {
const selectedRecords = records.filter((record) => record.isselected);
setEditTagModalOpen(false);
var updateRecords = [];
var updateDivisionForRecords = [];
Expand Down Expand Up @@ -1927,7 +1943,17 @@ export const RecordsLog = ({
}
}
}
} else {
} else if (selectedRecords.length > 1 && !currentEditRecord) {
for (let selectedRecord of selectedRecords) {
updateRecords.push(
{
recordid: selectedRecord.recordid,
documentmasterid: selectedRecord.documentmasterid,
filepath: selectedRecord.s3uripath
}
);
}
} else if (currentEditRecord) {
updateRecords.push(
{
recordid: currentEditRecord.recordid,
Expand All @@ -1939,6 +1965,7 @@ export const RecordsLog = ({
}

if(isMinistryCoordinator
&& currentEditRecord
&& currentEditRecord.attributes.divisions[0].divisionname != "TBD"
&& currentEditRecord.attributes.divisions[0].divisionid != divisionModalTagValue) {
updateDivisionForRecords.push(
Expand All @@ -1950,7 +1977,21 @@ export const RecordsLog = ({
);
}

if(currentEditRecord) {
if(isMinistryCoordinator
&& selectedRecords.length > 1
&& divisionModalTagValue !== -1
)
for (let selectedRecord of selectedRecords) {
updateDivisionForRecords.push(
{
recordid: selectedRecord.recordid,
documentmasterid: selectedRecord.documentmasterid,
filepath: selectedRecord.s3uripath
}
);
}

if(currentEditRecord || selectedRecords.length > 1) {
if(updateRecords.length > 0 && !comparePersonalAttributes(newPersonalAttributes, curPersonalAttributes)) {
dispatch(
editPersonalAttributes(
Expand Down Expand Up @@ -2128,7 +2169,7 @@ export const RecordsLog = ({
</h1>
</Grid>
{validLockRecordsState() ?
<Grid item xs={isScanningTeamMember ? 1 : 2}>
<Grid item xs={isScanningTeamMember ? 1 : 1}>
<Tooltip
enterDelay={1000}
title={isMinistryCoordinator ? "Only the IAO analyst can manually lock or unlock the records log, please contact the assigned analyst for assistance" : "Manually unlock or lock the records log"}
Expand All @@ -2155,12 +2196,12 @@ export const RecordsLog = ({
</span>
}
</Tooltip>
</Grid> : <Grid item xs={isScanningTeamMember ? 1 : 2}></Grid>
</Grid> : <Grid item xs={isScanningTeamMember ? 1 : 1}></Grid>
}
{(isMinistryCoordinator == false &&
records?.length > 0 &&
DISABLE_REDACT_WEBLINK?.toLowerCase() == "false" && (
<Grid item xs={isScanningTeamMember ? 1 : 2}>
<Grid item xs={isScanningTeamMember ? 1 : 1}>
<a
href={DOC_REVIEWER_WEB_URL + "/foi/" + ministryId}
target="_blank"
Expand Down Expand Up @@ -2242,10 +2283,7 @@ export const RecordsLog = ({
</Grid>
<Grid item xs={2}>
{
(!isHistoricalRequest && (isMinistryCoordinator || (isScanningTeamMember &&
MinistryNeedsScanning.includes(bcgovcode.replaceAll('"', "")) &&
requestType ===
FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL))) && (
(!isHistoricalRequest) && (
<button
className={clsx("btn", "addAttachment", classes.createButton)}
variant="contained"
Expand Down Expand Up @@ -2634,6 +2672,49 @@ export const RecordsLog = ({
</span>
</Tooltip>
)}
{(isMCFPersonal) && (
<Tooltip
title={
isBulkEditDisabled() ? (
<div style={{ fontSize: "11px" }}>
To bulk edit tags, please select two or more files, otherwise please use the 'Edit Tags' option from the ellipses dropdown next to the individual file
</div>
) : (
<div style={{ fontSize: "11px" }}>Edit Tags</div>
)
}
sx={{ fontSize: "11px" }}
>
<span>
<button
className={` btn`}
onClick={() => {
setCurPersonalAttributes({
person: "",
filetype: "",
volume: "",
trackingid: "",
personaltag: ""
});
setDivisionModalTagValue(-1);
setEditTagModalOpen(true);
}}
disabled={lockRecords || isBulkEditDisabled()}
style={
lockRecords || isBulkEditDisabled()
? { pointerEvents: "none" }
: {}
}
>
<FontAwesomeIcon
icon={faPenToSquare}
size="lg"
color="#38598A"
/>
</button>
</span>
</Tooltip>
)}
<Tooltip title={<div style={{ fontSize: "11px" }}>Delete</div>}>
<span>
<button
Expand Down Expand Up @@ -2826,6 +2907,7 @@ export const RecordsLog = ({
divisions={divisions}
isMinistryCoordinator={isMinistryCoordinator}
currentEditRecord={currentEditRecord}
isBulkEdit={isBulkEdit}
/>
):(
<div className="state-change-dialog">
Expand Down
13 changes: 1 addition & 12 deletions request-management-api/request_api/models/FOIRawRequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,9 +979,7 @@ def getfilterforsearch(cls, params):
return FOIRawRequest.__getfilterforapplicantname(params)
elif(params['search'] == 'assigneename'):
return FOIRawRequest.__getfilterforassigneename(params)
elif(params['search'] == 'idnumber'):
return FOIRawRequest.__getfilterforidnumber(params)
elif(params['search'] == 'axisrequest_number'):
elif(params['search'] == 'idnumber' or params['search'] == 'axisrequest_number'):
return FOIRawRequest.__getfilterforaxisnumber(params)
else:
searchcondition = []
Expand Down Expand Up @@ -1021,15 +1019,6 @@ def __getfilterforassigneename(cls,params):
searchcondition2.append(FOIRawRequest.findfield('assignedToLastName').ilike('%'+keyword+'%'))
searchcondition3.append(FOIRawRequest.assignedgroup.ilike('%'+keyword+'%'))
return or_(and_(*searchcondition1), and_(*searchcondition2), and_(*searchcondition3))

@classmethod
def __getfilterforidnumber(cls,params):
searchcondition = []
for keyword in params['keywords']:
keyword = keyword.lower()
keyword = keyword.replace('u-00', '')
searchcondition.append(FOIRawRequest.findfield('idNumber').ilike('%'+keyword+'%'))
return and_(*searchcondition)

@classmethod
def __getfilterforaxisnumber(cls,params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def __getcomputingerror(self, computingresponse):
if computingresponse["conversionstatus"] == "error":
return "conversion"
elif computingresponse["deduplicationstatus"] == "error":
return "deduplication. " + computingresponse["message"] if computingresponse["message"] not in ['', None] else "deduplication"
return "deduplication. " + computingresponse["message"] if "message" in computingresponse else "deduplication"
return None

def __getcomputingsummary(self, computingresponse):
Expand Down
4 changes: 3 additions & 1 deletion request-management-api/request_api/services/recordservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def updatepersonalattributes(self, requestid, ministryrequestid, requestdata, us
records = FOIRequestRecord.getrecordsbyid(recordids)
for record in records:
record['attributes'] = json.loads(record['attributes'])
record['attributes']['personalattributes'] = requestdata['newpersonalattributes']
for attribute in requestdata['newpersonalattributes']:
if (requestdata['newpersonalattributes'][attribute] is not None and len(requestdata['newpersonalattributes'][attribute]) > 0):
record['attributes']['personalattributes'][attribute] = requestdata['newpersonalattributes'][attribute]
# divisions = divisions + [div for div in record['attributes']['divisions'] if div not in divisions]
record.update({'updated_at': datetime.now(), 'updatedby': userid})
record['version'] += 1
Expand Down
Loading