Skip to content

Commit f091187

Browse files
Merge branch 'main' into FORMS-2538-pagination-errors
2 parents 592f7fb + cc0454e commit f091187

52 files changed

Lines changed: 2537 additions & 87 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/frontend/src/components/designer/FormDesigner.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ async function schemaCreateNew() {
396396
enableCopyExistingSubmission: form.value.enableCopyExistingSubmission,
397397
wideFormLayout: form.value.wideFormLayout,
398398
enableStatusUpdates: form.value.enableStatusUpdates,
399+
enableSubmitterRevision: form.value.enableSubmitterRevision,
399400
showAssigneeInSubmissionsTable: form.value.showAssigneeInSubmissionsTable,
400401
showSubmissionConfirmation: form.value.showSubmissionConfirmation,
401402
submissionReceivedEmails: form.value.submissionReceivedEmails,

app/frontend/src/components/designer/FormViewerActions.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { computed, inject, ref, watch } from 'vue';
44
import { useI18n } from 'vue-i18n';
55
66
import ManageSubmissionUsers from '~/components/forms/submission/ManageSubmissionUsers.vue';
7+
import SubmitterRevision from '~/components/forms/submission/SubmitterRevision.vue';
78
import PrintOptions from '~/components/forms/PrintOptions.vue';
89
import { FormPermissions } from '~/utils/constants';
910
@@ -148,7 +149,8 @@ watch(
148149
}}</span>
149150
</v-tooltip>
150151
</span>
151-
152+
<!-- Submitter Revision -->
153+
<SubmitterRevision :submission-id="submissionId" class="ml-2" />
152154
<!-- Wide layout button -->
153155
<span>
154156
<v-tooltip location="bottom">
@@ -168,7 +170,7 @@ watch(
168170
<span>{{ $t('trans.formViewerActions.wideLayout') }}</span>
169171
</v-tooltip>
170172
</span>
171-
173+
<!-- Print options -->
172174
<span class="ml-2 d-print-none">
173175
<PrintOptions
174176
:submission="submission"
@@ -220,7 +222,7 @@ watch(
220222
</router-link>
221223
</span>
222224

223-
<!-- Go to draft edit -->
225+
<!-- Manage submission users -->
224226
<span v-if="submissionId && draftEnabled && !publicForm" class="ml-2">
225227
<ManageSubmissionUsers
226228
:is-draft="isDraft"

app/frontend/src/components/designer/settings/FormAccessSettings.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function userTypeChanged() {
7979
enableSubmitterDraft: false,
8080
enableCopyExistingSubmission: false,
8181
allowSubmitterToUploadFile: false,
82+
enableSubmitterRevision: false,
8283
};
8384
}
8485
if (form.value.userType !== 'team') {

app/frontend/src/components/designer/settings/FormFunctionalitySettings.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,22 @@ defineExpose({
9999
</template>
100100
</v-checkbox>
101101
<v-checkbox
102-
v-if="form.enableStatusUpdates"
102+
v-model="form.enableSubmitterRevision"
103+
data-test="canSubmitterRevisionFormCheckbox"
104+
hide-details="auto"
105+
class="my-0"
106+
:disabled="form.userType === ID_MODE.PUBLIC"
107+
>
108+
<template #label>
109+
<span
110+
:class="{ 'mr-2': isRTL }"
111+
:lang="locale"
112+
v-html="$t('trans.formSettings.enableSubmitterRevision')"
113+
></span>
114+
</template>
115+
</v-checkbox>
116+
<v-checkbox
117+
v-if="form.enableStatusUpdates || form.enableSubmitterRevision"
103118
v-model="form.showAssigneeInSubmissionsTable"
104119
data-test="showAssigneeInSubmissionsTableCheckbox"
105120
hide-details="auto"

app/frontend/src/components/forms/FormSubmission.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ defineExpose({
176176
<v-row>
177177
<!-- Status updates and notes -->
178178
<v-col
179-
v-if="form.enableStatusUpdates"
179+
v-if="form.enableStatusUpdates || form.enableSubmitterRevision"
180180
cols="12"
181181
class="pl-0 pt-0 d-print-none"
182182
order="first"
@@ -185,21 +185,28 @@ defineExpose({
185185
<v-card
186186
variant="outlined"
187187
class="review-form"
188+
data-test="status-panel-card"
188189
:disabled="!submissionReadOnly"
189190
>
190191
<StatusPanel
191192
:submission-id="submissionId"
192193
:form-id="form.id"
194+
data-test="status-panel"
193195
@note-updated="refreshNotes"
194196
@draft-enabled="setDraft"
195197
/>
196198
</v-card>
197199
<v-card
198200
variant="outlined"
199201
class="review-form"
202+
data-test="notes-panel-card"
200203
:disabled="!submissionReadOnly"
201204
>
202-
<NotesPanel ref="notesPanel" :submission-id="submissionId" />
205+
<NotesPanel
206+
ref="notesPanel"
207+
:submission-id="submissionId"
208+
data-test="notes-panel"
209+
/>
203210
</v-card>
204211
</v-col>
205212
</v-row>
@@ -228,7 +235,7 @@ defineExpose({
228235
</v-col>
229236
<v-spacer />
230237
<v-col
231-
v-if="form.enableStatusUpdates"
238+
v-if="form.enableStatusUpdates || form.enableSubmitterRevision"
232239
:class="isRTL ? 'text-left' : 'text-right'"
233240
class="d-print-none"
234241
cols="2"

app/frontend/src/components/forms/SubmissionsTable.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const showSubmissionsExport = computed(() =>
110110
const showAssigneeColumn = computed(() => {
111111
return (
112112
form.value &&
113-
form.value.enableStatusUpdates &&
113+
(form.value.enableStatusUpdates || form.value.enableSubmitterRevision) &&
114114
form.value.showAssigneeInSubmissionsTable
115115
);
116116
});
@@ -155,7 +155,7 @@ const BASE_HEADERS = computed(() => {
155155
];
156156
if (
157157
form.value &&
158-
form.value.enableStatusUpdates &&
158+
(form.value.enableStatusUpdates || form.value.enableSubmitterRevision) &&
159159
form.value.showAssigneeInSubmissionsTable
160160
) {
161161
headers.push({
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<script setup>
2+
import { storeToRefs } from 'pinia';
3+
import { computed, ref, onMounted, watch } from 'vue';
4+
import { useI18n } from 'vue-i18n';
5+
import { useRouter } from 'vue-router';
6+
7+
import { useFormStore } from '~/store/form';
8+
import { formService } from '~/services';
9+
import { useNotificationStore } from '~/store/notification';
10+
11+
const { t, locale } = useI18n({ useScope: 'global' });
12+
13+
const properties = defineProps({
14+
submissionId: {
15+
type: String,
16+
required: true,
17+
},
18+
class: {
19+
type: String,
20+
default: '',
21+
},
22+
});
23+
24+
const { isRTL } = storeToRefs(useFormStore());
25+
26+
// Computed class binding that combines RTL and passed-in class
27+
const spanClass = computed(() => ({
28+
'dir-rtl': isRTL,
29+
[properties.class]: properties.class,
30+
}));
31+
32+
// Reactive ref to store the result of the async check
33+
const canReviseSubmission = ref(false);
34+
35+
// Loading state to prevent multiple clicks
36+
const isEnablingRevision = ref(false);
37+
38+
// Async function to check if submission can be revised
39+
async function checkCanReviseSubmission() {
40+
try {
41+
const result = await formService.checkSubmitterRevision(
42+
properties.submissionId
43+
);
44+
canReviseSubmission.value = result.data;
45+
} catch {
46+
canReviseSubmission.value = false;
47+
}
48+
}
49+
50+
const router = useRouter();
51+
const notificationStore = useNotificationStore();
52+
53+
async function handleRevision() {
54+
// Prevent multiple clicks while request is in progress
55+
if (isEnablingRevision.value) {
56+
return;
57+
}
58+
59+
isEnablingRevision.value = true;
60+
61+
try {
62+
const response = await formService.performSubmitterRevision(
63+
properties.submissionId
64+
);
65+
66+
// If response is 200, navigate to Edit Revision
67+
if (response.status === 200) {
68+
router.push({
69+
name: 'UserFormDraftEdit',
70+
query: {
71+
s: properties.submissionId,
72+
},
73+
});
74+
} else if (response.status === 400) {
75+
// If response is 400, failed the check, so hide the button
76+
canReviseSubmission.value = false;
77+
}
78+
// Any other error will be caught by the catch block
79+
} catch (error) {
80+
notificationStore.addNotification({
81+
text: t('trans.submitterRevision.recallErrMsg'),
82+
consoleError: t('trans.submitterRevision.recallConsErrMsg', {
83+
submissionId: properties.submissionId,
84+
error: error,
85+
}),
86+
});
87+
} finally {
88+
// Always reset loading state when request completes
89+
isEnablingRevision.value = false;
90+
}
91+
}
92+
93+
// Watch for changes in submissionId or formId and re-check
94+
watch(
95+
() => [properties.submissionId],
96+
() => {
97+
if (properties.submissionId) {
98+
checkCanReviseSubmission();
99+
}
100+
},
101+
{ immediate: true }
102+
);
103+
104+
// Also check when component mounts
105+
onMounted(() => {
106+
if (properties.submissionId) {
107+
checkCanReviseSubmission();
108+
}
109+
});
110+
111+
defineExpose({
112+
handleRevision,
113+
canReviseSubmission,
114+
isEnablingRevision,
115+
});
116+
</script>
117+
118+
<template>
119+
<span v-if="canReviseSubmission" :class="spanClass">
120+
<v-btn
121+
color="primary"
122+
variant="outlined"
123+
:title="$t('trans.submitterRevision.recall')"
124+
:loading="isEnablingRevision"
125+
:disabled="isEnablingRevision"
126+
@click="handleRevision"
127+
><span :lang="locale">{{
128+
$t('trans.submitterRevision.recall')
129+
}}</span></v-btn
130+
>
131+
</span>
132+
</template>

app/frontend/src/internationalization/trans/chefs/ar/ar.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
"loginRequired": "تسجيل الدخول مطلوب",
117117
"canSaveAndEditDraftLabel": "يمكن للمرسلين <strong>حفظ المسودات وتحريرها</strong>",
118118
"canUpdateStatusAsReviewer": "يمكن للمراجعين <strong>تحديث حالة</strong> هذا النموذج (أي مُرسَل ، مُعين ، مكتمل)",
119+
"enableSubmitterRevision": "يمكن للمرسلين <strong>مراجعة إرسالاتهم الخاصة</strong> وإعادة إرسالها",
119120
"submitterCanCopyExistingSubmissn": "يمكن للمرسلين <strong>نسخ إرسال موجود</strong>",
120121
"submissionConfirmationToolTip": "يتحكم تحديد هذا الخيار في ما سيراه المستخدم المرسل لهذا النموذج عند الإرسال الناجح.<br /> إذا تم تحديده ، فسيتم عرضه",
121122
"emailNotificatnToTeam": "أرسل إلى فريقي إشعارًا بالبريد الإلكتروني",

app/frontend/src/internationalization/trans/chefs/de/de.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"referenceGuideB": "Benutzerhandbuch",
104104
"referenceGuideC": "für weitere Details",
105105
"specificTeamMembers": "Spezifische Teammitglieder",
106-
"teamMemberTooltip": "Nachdem Sie das Formular erstellt haben, haben Sie Zugriff auf die Teamverwaltungsseite, auf der Sie Benutzer hinzufügen und Rollen zuweisen können. Suchen Sie nach dem Personen-Symbol auf der Seite Formular verwalten ",
106+
"teamMemberTooltip": "Nachdem Sie das Formular erstellt haben, haben Sie Zugriff auf die Teamverwaltungsseite, auf der Sie Benutzer hinzufügen und Rollen zuweisen können. Suchen Sie nach dem Personen-Symbol auf der Seite \"Formular verwalten\" ",
107107
"formFunctionality": "Formularfunktionalität",
108108
"formSubmissinScheduleMsg": "Der Formulareinreichungsplan ist in den Formulareinstellungen verfügbar, nachdem das Formular veröffentlicht wurde.",
109109
"formSubmissionsSchedule": "Zeitplan für Formulareinreichungen",
@@ -115,7 +115,8 @@
115115
"infoB": "die Option für den Benutzer, sich selbst eine Übermittlungsbestätigung per E-Mail zu senden",
116116
"loginRequired": "Anmeldung erforderlich",
117117
"canSaveAndEditDraftLabel": "Einreicher können <strong>Entwürfe speichern und bearbeiten</strong>",
118-
"canUpdateStatusAsReviewer": "Prüfer können <strong>den Status dieses Formulars aktualisieren</strong> (z. B. „Eingereicht“, „Zugewiesen“, „Abgeschlossen“).",
118+
"canUpdateStatusAsReviewer": "Prüfer können <strong>den Status dieses Formulars aktualisieren</strong> (z. B. \"Eingereicht\", \"Zugewiesen\", \"Abgeschlossen\").",
119+
"enableSubmitterRevision": "Einreicher können <strong>ihre eigenen Einreichungen überarbeiten</strong> und erneut einreichen",
119120
"submitterCanCopyExistingSubmissn": "Einreicher können <strong>eine vorhandene Einreichung kopieren</strong>",
120121
"submissionConfirmationToolTip": "Durch Auswahl dieser Option wird gesteuert, was der einreichende Benutzer dieses Formulars bei erfolgreicher Übermittlung sieht.<br /> Wenn aktiviert, wird es angezeigt",
121122
"emailNotificatnToTeam": "Senden Sie meinem Team eine Benachrichtigungs-E-Mail",

app/frontend/src/internationalization/trans/chefs/en/en.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
"loginRequired": "Log-in Required",
179179
"canSaveAndEditDraftLabel": "Submitters can <strong>Save and Edit Drafts</strong>",
180180
"canUpdateStatusAsReviewer": "Reviewers can <strong>Update the Status</strong> of this form (i.e. Submitted, Assigned, Completed)",
181+
"enableSubmitterRevision": "Submitters can <strong>Revise their own submissions</strong> and resubmit",
181182
"displayAssigneeColumn": "Display assignee column for reviewers",
182183
"submitterCanCopyExistingSubmissn": "Submitters can<strong> Copy an existing submission</strong>",
183184
"submissionConfirmationToolTip": "Selecting this option controls what the submitting user of this form will see on successful submission. <br /> If checked, it will display",
@@ -782,7 +783,8 @@
782783
"dateStatusChanged": "Date Status Changed",
783784
"updatedBy": "Updated By",
784785
"getSubmissionStatusErr": "An error occurred while trying to fetch statuses.",
785-
"getSubmissionStatusConsErr": "Error adding note:"
786+
"getSubmissionStatusConsErr": "Error adding note:",
787+
"assignee": "Assignee"
786788
},
787789
"exportSubmissions": {
788790
"exportSubmissionsToFile": "Export Submissions to File",
@@ -1247,5 +1249,10 @@
12471249
"shuttingDown": "CHEFS is shutting down.",
12481250
"notReady": "CHEFS cannot connect to all required services.",
12491251
"unableToReachBackend": "Unable to reach backend service."
1252+
},
1253+
"submitterRevision": {
1254+
"recall": "Recall Submission",
1255+
"recallErrMsg": "An error occurred while recalling this submission",
1256+
"recallConsErrMsg": "Error recalling submission {submissionId}: {error}"
12501257
}
12511258
}

0 commit comments

Comments
 (0)