Skip to content

Commit

Permalink
Merge branch 'bcgov:main' into feat-map
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanBirtch-aot authored Aug 20, 2024
2 parents 89fa94a + 5b398c6 commit d23d0fd
Show file tree
Hide file tree
Showing 82 changed files with 3,620 additions and 422 deletions.
55 changes: 36 additions & 19 deletions app/frontend/src/components/admin/AdminAPIsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { i18n } from '~/internationalization';
import { useAdminStore } from '~/store/admin';
import { useFormStore } from '~/store/form';
import { Ministries } from '~/utils/constants';
import BaseDialog from '~/components/base/BaseDialog.vue';
export default {
Expand Down Expand Up @@ -35,33 +34,40 @@ export default {
computed: {
...mapState(useAdminStore, ['externalAPIList', 'externalAPIStatusCodes']),
...mapState(useFormStore, ['isRTL', 'lang']),
ministryList() {
return Ministries.map((ministry) => ({
id: ministry.id,
text: i18n.t(`trans.ministries.${ministry.id}`),
}));
},
headers() {
return [
{
title: i18n.t('trans.adminAPIsTable.ministry'),
align: 'start',
key: 'ministry',
},
{
title: i18n.t('trans.adminAPIsTable.ministryName'),
align: 'start',
key: 'ministryName',
// we don't want to see this (too long)
// but we need it for searching, so it needs to be in the DOM
headerProps: {
class: 'hidden',
},
cellProps: {
class: 'hidden',
},
},
{
title: i18n.t('trans.adminAPIsTable.formName'),
align: 'start',
key: 'formName',
},
{
title: i18n.t('trans.adminAPIsTable.name'),
title: i18n.t('trans.adminAPIsTable.formId'),
align: 'start',
key: 'name',
key: 'formId',
},
{
title: i18n.t('trans.adminAPIsTable.endpointUrl'),
title: i18n.t('trans.adminAPIsTable.name'),
align: 'start',
key: 'endpointUrl',
key: 'name',
},
{
title: i18n.t('trans.adminAPIsTable.display'),
Expand All @@ -77,6 +83,13 @@ export default {
},
];
},
items() {
// add ministry name to objects so we can search on them
return this.externalAPIList.map((x) => ({
...x,
ministryName: this.getMinistryName(x),
}));
},
},
async mounted() {
await this.getExternalAPIStatusCodes();
Expand All @@ -89,6 +102,9 @@ export default {
'updateExternalAPI',
'getExternalAPIStatusCodes',
]),
getMinistryName(item) {
return item.ministry ? i18n.t(`trans.ministries.${item.ministry}`) : '';
},
resetEditDialog() {
this.editDialog = {
title: '',
Expand All @@ -107,9 +123,7 @@ export default {
handleEdit(item) {
this.resetEditDialog();
this.editDialog.item = { ...item };
this.editDialog.item.ministryText = this.ministryList.find(
(x) => x.id === item.ministry
)['text'];
this.editDialog.item.ministryText = this.getMinistryName(item);
this.editDialog.title = i18n.t('trans.adminAPIsTable.editTitle');
this.editDialog.show = true;
},
Expand Down Expand Up @@ -162,24 +176,27 @@ export default {
hover
:headers="headers"
item-key="title"
:items="externalAPIList"
:items="items"
:search="search"
:loading="loading"
:loading-text="$t('trans.adminAPIsTable.loadingText')"
:lang="lang"
>
<template #item.ministry="{ item }">
{{ ministryList.find((x) => x.id === item.ministry)['text'] }}
{{ item.ministry }}
</template>
<template #item.ministryName="{ item }">
{{ getMinistryName(item) }}
</template>
<template #item.formName="{ item }">
{{ item.formName }}
</template>
<template #item.endpointUrl="{ item }">
{{ item.formId }}
</template>
<template #item.name="{ item }">
{{ item.name }}
</template>
<template #item.endpointUrl="{ item }">
{{ item.endpointUrl }}
</template>
<template #item.display="{ item }">
{{ item.display }}
</template>
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/components/base/BaseFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const inputFilter = ref('');
const inputFilterPlaceholder =
properties.inputFilterPlaceholder || t('trans.baseFilter.exampleText2');
const inputSaveButtonText =
properties.inputFilterPlaceholder || t('trans.baseFilter.filter');
properties.inputSaveButtonText || t('trans.baseFilter.filter');
const selectedData = ref([]);
const { isRTL } = storeToRefs(useFormStore());
Expand Down
49 changes: 33 additions & 16 deletions app/frontend/src/components/designer/FormViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export default {
submissionRecord: {},
version: 0,
versionIdToSubmitTo: this.versionId,
isAuthorized: true,
};
},
computed: {
Expand All @@ -130,6 +131,9 @@ export default {
formScheduleExpireMessage() {
return this.$t('trans.formViewer.formScheduleExpireMessage');
},
formUnauthorizedMessage() {
return this.$t('trans.formViewer.formUnauthorizedMessage');
},
NOTIFICATIONS_TYPES() {
return NotificationTypes;
},
Expand Down Expand Up @@ -190,7 +194,6 @@ export default {
this.showModal = true;
await this.getFormSchema();
}
window.addEventListener('beforeunload', this.beforeWindowUnload);
this.reRenderFormIo += 1;
Expand Down Expand Up @@ -403,19 +406,22 @@ export default {
}
} catch (error) {
if (this.authenticated) {
this.isFormScheduleExpired = true;
this.isLateSubmissionAllowed = false;
this.formScheduleExpireMessage = error.message;
this.addNotification({
text: this.$t('trans.formViewer.fecthingFormErrMsg'),
consoleError: this.$t(
'trans.formViewer.fecthingFormConsoleErrMsg',
{
versionId: this.versionId,
error: error,
}
),
});
// if 401 error, the user is not authorized to view the form
if (error.response && error.response.status === 401) {
this.isAuthorized = false;
} else {
// throw a generic error message
this.addNotification({
text: this.$t('trans.formViewer.fecthingFormErrMsg'),
consoleError: this.$t(
'trans.formViewer.fecthingFormConsoleErrMsg',
{
versionId: this.versionId,
error: error,
}
),
});
}
}
}
},
Expand Down Expand Up @@ -1144,7 +1150,18 @@ export default {
<template>
<v-skeleton-loader :loading="loadingSubmission" type="article, actions">
<v-container fluid>
<div v-if="isFormScheduleExpired">
<div v-if="!isAuthorized">
<v-alert
:text="formUnauthorizedMessage"
prominent
type="error"
:class="{ 'dir-rtl': isRTL }"
:lang="locale"
>
</v-alert>
</div>
<div v-else-if="isFormScheduleExpired">
<v-alert
:text="
isLateSubmissionAllowed
Expand All @@ -1159,7 +1176,7 @@ export default {
</v-alert>
<div v-if="isLateSubmissionAllowed">
<v-col cols="3" md="2">
<v-col cols="12" md="6">
<v-btn
color="primary"
:class="{ 'dir-rtl': isRTL }"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,21 @@ defineExpose({ idpType, userTypeChanged, updateLoginType });
</v-expand-transition>
<v-radio :value="ID_MODE.TEAM">
<template #label>
<span :class="{ 'mr-2': isRTL }" :lang="locale">
{{ $t('trans.formSettings.specificTeamMembers') }}
</span>
<v-tooltip location="bottom">
<template #activator="{ props }">
<span :class="{ 'mr-2': isRTL }" :lang="locale">
{{ $t('trans.formSettings.specificTeamMembers') }}
</span>
<v-icon
color="primary"
class="ml-3"
:class="{ 'mr-2': isRTL }"
v-bind="props"
icon="mdi:mdi-help-circle-outline"
/>
</template>
<span>{{ $t('trans.formSettings.teamMemberTooltip') }}</span>
</v-tooltip>
</template>
</v-radio>
</v-radio-group>
Expand Down
15 changes: 14 additions & 1 deletion app/frontend/src/components/forms/PrintOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default {
defaultReportname: '',
displayTemplatePrintButton: false,
isValidFile: true,
fileInputKey: 0,
validFileExtensions: ['txt', 'docx', 'html', 'odt', 'pptx', 'xlsx'],
defaultExportFileTypes: ['pdf'],
uploadExportFileTypes: ['pdf'],
Expand Down Expand Up @@ -184,6 +185,7 @@ export default {
? disposition.substring(disposition.indexOf('filename=') + 9)
: undefined;
},
createDownload(blob, filename = undefined) {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
Expand Down Expand Up @@ -256,6 +258,7 @@ export default {
this.loading = false;
}
},
createBody(content, contentFileType, outputFileName, outputFileType) {
return {
options: {
Expand All @@ -270,6 +273,7 @@ export default {
},
};
},
async fetchDefaultTemplate() {
// Calling the API to check whether the form has any uploaded document templates
this.loading = true;
Expand Down Expand Up @@ -313,6 +317,7 @@ export default {
this.loading = false;
}
},
validateFileExtension(event) {
if (event.length > 0) {
const fileExtension = event[0].name.split('.').pop();
Expand All @@ -325,6 +330,7 @@ export default {
this.uploadExportFileTypes = ['pdf'];
// reset the v-select value
this.templateForm.outputFileType = null;
if (this.validFileExtensions.includes(fileExtension)) {
this.isValidFile = true;
} else {
Expand All @@ -341,6 +347,12 @@ export default {
this.isValidFile = true;
}
},
handleFileUpload(event) {
this.fileInputKey += 1;
this.templateForm.files = event;
this.validateFileExtension(event);
},
},
};
</script>
Expand Down Expand Up @@ -475,6 +487,7 @@ export default {
value="upload"
></v-radio>
<v-file-input
:key="fileInputKey"
v-model="templateForm.files"
:class="{ label: isRTL }"
:style="isRTL ? { gap: '10px' } : null"
Expand All @@ -489,7 +502,7 @@ export default {
:lang="locale"
:rules="validationRules"
:disabled="selectedOption !== 'upload'"
@update:model-value="validateFileExtension($event)"
@update:model-value="handleFileUpload"
/>
<v-select
v-if="selectedOption === 'upload'"
Expand Down
4 changes: 3 additions & 1 deletion app/frontend/src/internationalization/trans/chefs/ar/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"referenceGuideB": "دليل المستخدم",
"referenceGuideC": "لمزيد من التفاصيل",
"specificTeamMembers": "أعضاء الفريق المحدد",
"teamMemberTooltip": "أضف أعضاء الفريق من إعدادات إدارة الفريق بعد إنشاء هذا النموذج.",
"formFunctionality": "وظيفة الشكل",
"formSubmissinScheduleMsg": "سيكون جدول تقديم النموذج متاحًا في \"إعدادات النموذج\" بعد نشر النموذج.",
"formSubmissionsSchedule": "جدول تقديم النموذج",
Expand Down Expand Up @@ -829,7 +830,8 @@
"errorSavingFile": "خطأ في حفظ الملفات. اسم الملف: {fileName}. خطأ: {error}",
"submittingDraftErrMsg": "حدث خطأ أثناء حفظ المسودة",
"submittingDraftConsErrMsg": "خطأ في حفظ المسودة. معرف التقديم: {submitId}. خطأ: {error}",
"formDraftAccessErrMsg": "تم إرسال طلب التقديم بالفعل ، مع إعادة التوجيه إلى صفحة العرض"
"formDraftAccessErrMsg": "تم إرسال طلب التقديم بالفعل ، مع إعادة التوجيه إلى صفحة العرض",
"formUnauthorizedMessage": "غير مخول لك مشاهدة هذا النموذج، يرجى الاتصال بمالك النموذج للحصول على الوصول."
},
"bCGovFooter": {
"home": "بيت",
Expand Down
4 changes: 3 additions & 1 deletion app/frontend/src/internationalization/trans/chefs/de/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"referenceGuideB": "Benutzerhandbuch",
"referenceGuideC": "für mehr Details",
"specificTeamMembers": "Spezifische Teammitglieder",
"teamMemberTooltip": "Fügen Sie Teammitglieder aus den Teamverwaltungseinstellungen hinzu, nachdem Sie dieses Formular erstellt haben.",
"formFunctionality": "Formularfunktionalität",
"formSubmissinScheduleMsg": "Der Formulareinreichungsplan ist in den Formulareinstellungen verfügbar, nachdem das Formular veröffentlicht wurde.",
"formSubmissionsSchedule": "Zeitplan für Formulareinreichungen",
Expand Down Expand Up @@ -830,7 +831,8 @@
"errorSavingFile": "Fehler beim Speichern der Dateien. Dateiname: {fileName}. Fehler: {error}",
"submittingDraftErrMsg": "Beim Speichern eines Entwurfs ist ein Fehler aufgetreten",
"submittingDraftConsErrMsg": "Fehler beim Speichern des Entwurfs. Einreichungs-ID: {submissionId}. Fehler: {error}",
"formDraftAccessErrMsg": "Die angeforderte Übermittlung wurde bereits übermittelt und wird zur Ansichtsseite weitergeleitet"
"formDraftAccessErrMsg": "Die angeforderte Übermittlung wurde bereits übermittelt und wird zur Ansichtsseite weitergeleitet",
"formUnauthorizedMessage": "Sie sind nicht berechtigt, dieses Formular anzusehen. Bitte kontaktieren Sie den Formulareigentümer für den Zugang."
},
"bCGovFooter": {
"home": "Heim",
Expand Down
6 changes: 5 additions & 1 deletion app/frontend/src/internationalization/trans/chefs/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"referenceGuideB": "user guide",
"referenceGuideC": "for more details",
"specificTeamMembers": "Specific Team Members",
"teamMemberTooltip": "Add team members from the Team Management settings after creating this form.",
"formFunctionality": "Form Functionality",
"formSubmissinScheduleMsg": "The Form Submissions Schedule will be available in the Form Settings after the form is published.",
"formSubmissionsSchedule": "Form Submissions Schedule",
Expand Down Expand Up @@ -376,7 +377,9 @@
"search": "Search",
"loadingText": "Loading... Please wait",
"ministry": "Ministry",
"ministryName": "Ministry Name",
"formName": "Form",
"formId": "Form ID",
"name": "API Name",
"endpointUrl": "Endpoint URL",
"display": "Status",
Expand Down Expand Up @@ -880,7 +883,8 @@
"errorSavingFile": "Error saving files. Filename: {fileName}. Error: {error}",
"submittingDraftErrMsg": "An error occurred while saving a draft",
"submittingDraftConsErrMsg": "Error saving draft. SubmissionId: {submissionId}. Error: {error}",
"formDraftAccessErrMsg": "Requested submission is already submitted, redirecting to View page"
"formDraftAccessErrMsg": "Requested submission is already submitted, redirecting to View page",
"formUnauthorizedMessage": "You are not authorized to view this form, please contact the form owner for access."
},
"bCGovFooter": {
"home": "Home",
Expand Down
Loading

0 comments on commit d23d0fd

Please sign in to comment.