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

#2582 Merit List MVP 3.0 #2604

Merged
merged 20 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"lint-ci": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --no-fix --ignore-path .gitignore"
},
"dependencies": {
"@jac-uk/jac-kit": "4.1.49",
"@jac-uk/jac-kit": "4.1.50",
"@ministryofjustice/frontend": "0.2.4",
"@sentry/tracing": "^7.61.1",
"@sentry/vue": "^7.61.1",
Expand Down
61 changes: 49 additions & 12 deletions src/components/ScoreSheet/ScoreSheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
class="govuk-link govuk-!-margin-right-4"
@click="btnCopy"
>Copy</a>
<a
v-if="hasTool(SCORESHEET_TOOLS.EDIT) && editable"
class="govuk-link govuk-!-margin-right-4"
@click="btnToggle('editMode')"
><span v-if="editMode">View</span><span v-else>Edit</span></a>
</div>
<div class="govuk-grid-column-one-half text-right">
<a
Expand Down Expand Up @@ -175,21 +180,14 @@
<TitleBar @click="$refs['findApplicationModal'].closeModal()">
Find an application
</TitleBar>
<!-- <FindAnApplication
v-model="selectedApplication"
:data="data"
:search-fields="['referenceNumber']"
@update:model-value="onApplicationFound"
@cancel="selectedApplication = null; $refs['findApplicationModal'].closeModal()"
/> -->
<div style="padding: 0 20px 0 20px; min-height: 300px">
<PredictiveSearch
id="find-a-candidate"
v-model="selectedApplication"
hint="Type any part of reference number"
:hint="searchHint"
:show-full-list-on-focus="false"
:data="data"
:search-fields="['referenceNumber']"
:search-fields="searchFields"
required
@update:model-value="onApplicationFound"
/>
Expand All @@ -211,7 +209,7 @@ import TableCell from '@jac-uk/jac-kit/components/Table/TableCell.vue';
import Modal from '@jac-uk/jac-kit/components/Modal/Modal.vue';
import TitleBar from '../Page/TitleBar.vue';
import PredictiveSearch from '@jac-uk/jac-kit/draftComponents/Form/PredictiveSearch.vue';
import { SCORESHEET_TOOLS, markingScheme2Columns, markingScheme2ColumnHeaders } from '../../helpers/scoreSheetHelper';
import { SCORESHEET_TOOLS, MARKING_TYPE, markingScheme2Columns, markingScheme2ColumnHeaders } from '../../helpers/scoreSheetHelper';
import ScoreSheetCell from './ScoreSheetCell.vue';

export default {
Expand Down Expand Up @@ -254,10 +252,12 @@ export default {
default: () => [],
},
},
emits: ['updated'],
data() {
return {
showDiversity: false,
showScore: false,
editMode: false,
selectedApplication: null,
SCORESHEET_TOOLS: SCORESHEET_TOOLS,
};
Expand All @@ -269,8 +269,25 @@ export default {
scoreSheetHeaders() {
return markingScheme2ColumnHeaders(this.markingScheme);
},
isEditable() {
if (this.editable) {
if (this.hasTool(SCORESHEET_TOOLS.EDIT)) {
return this.editMode;
} else {
return true;
}
}
return false;
},
scoreSheetColumns() {
return markingScheme2Columns(this.markingScheme, this.editable);
const columns = markingScheme2Columns(this.markingScheme, this.isEditable);
columns.push({
title: 'Reason for change',
ref: 'Reason for change',
type: MARKING_TYPE.REASON_FOR_CHANGE.value,
editable: this.isEditable,
});
return columns;
},
tableColumns() {
let columns = [];
Expand Down Expand Up @@ -314,6 +331,18 @@ export default {
}
return columns;
},
searchFields() {
if (this.data[0].fullName) {
return ['referenceNumber', 'fullName'];
}
return ['referenceNumber'];
},
searchHint() {
if (this.data[0].fullName) {
return 'Type any part of candidate name or reference number';
}
return 'Type any part of reference number';
},
},
methods: {
hasTool(ref) {
Expand Down Expand Up @@ -366,7 +395,12 @@ export default {
this[ident] = !this[ident];
},
updateScoreSheet(row, column, newValue) {
console.log('updateScoreSheet', row.id, column.parent, column.ref, newValue);
this.$emit('updated', {
id: row.id,
parent: column.parent,
ref: column.ref,
newValue: newValue,
});
},
updateModeration(row, event) {
console.log('updateModeration', row, event);
Expand All @@ -386,6 +420,9 @@ export default {
</script>

<style lang="scss">
.govuk-link {
cursor: pointer;
}
.score-sheet {
table {
border: 1px solid govuk-colour("mid-grey") !important;
Expand Down
45 changes: 40 additions & 5 deletions src/components/ScoreSheet/ScoreSheetCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
:class="column.editable ? 'table-cell-score': 'table-cell-value'"
>
<template v-if="!column.editable">
<span v-if="column.parent">{{ lookupColumnValue(column, row.scoreSheet[column.parent][column.ref]) }}</span>
<span v-else>{{ lookupColumnValue(column, row.scoreSheet[column.ref]) }}</span>
{{ lookupColumnValue(row, column) }}
<span v-if="lookupColumnValue(row, column) && lookupChangedValue(row, column)"> &rarr; </span>
{{ lookupChangedValue(row, column) }}
</template>

<template v-else>
Expand All @@ -33,6 +34,9 @@
:value="option.value"
>
{{ option.label }}
<template v-if="lookupColumnValue(row, column) && lookupColumnValue(row, column) != option.label">
from {{ lookupColumnValue(row, column) }}
</template>
</option>
</select>
</template>
Expand Down Expand Up @@ -76,9 +80,17 @@ export default {
localValue: {
get() {
if (this.column.parent) {
return this.row.scoreSheet[this.column.parent][this.column.ref];
if (this.row.changes[this.column.parent] && this.row.changes[this.column.parent][this.column.ref]) {
return this.row.changes[this.column.parent][this.column.ref];
} else {
return this.row.scoreSheet[this.column.parent][this.column.ref];
}
} else {
return this.row.scoreSheet[this.column.ref];
if (this.row.changes[this.column.ref]) {
return this.row.changes[this.column.ref];
} else {
return this.row.scoreSheet[this.column.ref];
}
}
},
set(value) {
Expand All @@ -93,14 +105,34 @@ export default {
getOptions(type) {
return markingTypeGetOptions(type);
},
lookupColumnValue(column, value) {
lookupColumnValue(row, column) {
let value;
if (column.parent) {
value = row.scoreSheet[column.parent][column.ref];
} else {
value = row.scoreSheet[column.ref];
}
if (this.hasOptions(column.type)) {
const options = this.getOptions(column.type);
const option = options.find(option => option.value === value);
if (option) return option.label;
}
return value;
},
lookupChangedValue(row, column) {
let changedValue;
if (column.parent) {
if (row.changes && row.changes[column.parent] && row.changes[column.parent][column.ref]) changedValue = row.changes[column.parent][column.ref];
} else {
if (row.changes && row.changes[column.ref]) changedValue = row.changes[column.ref];
}
if (this.hasOptions(column.type)) {
const options = this.getOptions(column.type);
const option = options.find(option => option.value === changedValue);
if (option) return option.label;
}
return changedValue;
},
onKeyDown(event, rowIndex, colIndex) {
let newRow = rowIndex;
let newCol = colIndex;
Expand Down Expand Up @@ -160,5 +192,8 @@ export default {
.table-cell-value {
padding: 10px !important;
}
s {
color: govuk-colour("mid-grey");
}
}
</style>
59 changes: 34 additions & 25 deletions src/helpers/exerciseHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ const CAPABILITIES = {
label: 'MWE',
description: 'Managing Work Efficiently',
},
WE: {
value: 'WE',
label: 'WE',
description: 'Working Effectively',
},
OVERALL: {
value: 'OVERALL',
label: 'OVERALL',
Expand Down Expand Up @@ -574,7 +579,8 @@ function previousTaskType(exercise, type) {
function taskEntryStatus(exercise, type) {
let status = '';
if (!exercise) return status;
if (type === TASK_TYPE.EMP_TIEBREAKER) return APPLICATION_STATUS.SCC_TO_RECONSIDER; // TODO: remove this eventually: override entry status for EMP tie-breakers
if (type === TASK_TYPE.EMP_TIEBREAKER) return APPLICATION_STATUS.SECOND_STAGE_INVITED; // TODO: remove this eventually: override entry status for EMP tie-breakers
if (type === TASK_TYPE.SELECTION_DAY) return APPLICATION_STATUS.SHORTLISTING_PASSED;
const prevTaskType = previousTaskType(exercise, type);
if (prevTaskType) {
switch (prevTaskType) {
Expand Down Expand Up @@ -1370,7 +1376,7 @@ function availableStatuses(exercise, stage) {
}
}

function availableReportLinks(exercise) {
function availableReportLinks(exercise) { // TODO this code is a bit specific to Admin UI so not sure it should be in this helper
const path = `/exercise/${exercise.id}/reports`;
const links = [
{
Expand Down Expand Up @@ -1419,35 +1425,38 @@ function availableReportLinks(exercise) {
},
];

if (exercise.shortlistingMethods && exercise.shortlistingMethods.length) {
if (
(exercise.shortlistingMethods.indexOf('paper-sift') >= 0 && exercise.siftStartDate)
|| (exercise.shortlistingMethods.indexOf('name-blind-paper-sift') >= 0 && exercise.nameBlindSiftStartDate)
) {
if (exercise._processingVersion < 3) {
if (exercise.shortlistingMethods && exercise.shortlistingMethods.length) {
if (
(exercise.shortlistingMethods.indexOf('paper-sift') >= 0 && exercise.siftStartDate)
|| (exercise.shortlistingMethods.indexOf('name-blind-paper-sift') >= 0 && exercise.nameBlindSiftStartDate)
) {
links.push(
{
title: 'Sift',
path: `${path}/sift`,
}
);
}
}
if (exercise.scenarioTestDate) { // TODO: remove this when we have better support for scenarios
links.push(
{
title: 'Sift',
path: `${path}/sift`,
title: 'Scenario Responses',
path: `${path}/scenario`,
}
);
}
if (exercise.selectionDays) {
links.push(
{
title: 'Selection day',
path: `${path}/selection`,
}
);
}
}
if (exercise.scenarioTestDate) { // TODO: remove this when we have better support for scenarios
links.push(
{
title: 'Scenario Responses',
path: `${path}/scenario`,
}
);
}
if (exercise.selectionDays) {
links.push(
{
title: 'Selection day',
path: `${path}/selection`,
}
);
}

if (exercise?._applicationContent?.registration?.commissionerConflicts) {
links.push(
{
Expand Down
Loading
Loading