Skip to content

Commit

Permalink
BC-6391 - Fixing Datepicker Selection Issue in Bug Hunt Table #94 (#3084
Browse files Browse the repository at this point in the history
)

* fix datetimepicker selection error
* fix position of content menu
* reimplement consent-register method
  • Loading branch information
muratmerdoglu-dp authored Feb 12, 2024
1 parent 8d76c29 commit b5e54bb
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/components/organisms/DataTable/RowSelectionBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</v-btn>
<context-menu
v-model:show="actionsMenuOpen"
anchor="top-right"
anchor="top-left"
:actions="contextActions"
@action="fireAction"
/>
Expand Down
14 changes: 10 additions & 4 deletions src/pages/administration/StudentConsent.page.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<default-wireframe ref="main" :full-width="true" :breadcrumbs="breadcrumbs">
<default-wireframe ref="main" :full-width="false" :breadcrumbs="breadcrumbs">
<template #header>
<h1 class="mb--md h3">
{{ title }}
Expand Down Expand Up @@ -61,7 +61,7 @@
label=""
data-testid="birthday-input"
:birth-date="true"
@input="
@update:modelValue="
inputDate({
id: tableData[slotProps.rowindex]._id,
birthDate: inputDateFormat($event),
Expand All @@ -76,7 +76,7 @@
label=""
data-testid="password-input"
class="base-input"
@input="
@update:modelValue="
inputPass({
id: tableData[slotProps.rowindex]._id,
pass: $event,
Expand Down Expand Up @@ -222,7 +222,7 @@
{{ successMessage }}
</h4>
<img
class="mb--md"
class="mb--md success-image mb-4"
:src="image"
:alt="
$t('pages.administration.students.consent.steps.success.image.alt')
Expand Down Expand Up @@ -657,6 +657,12 @@ export default {
.warning {
color: rgba(var(--v-theme-error));
}
.success-image {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
}
:deep(.link) {
color: rgba(var(--v-theme-primary));
Expand Down
65 changes: 44 additions & 21 deletions src/store/bulkConsent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,55 @@ import generatePassword from "@/mixins/generatePassword";
import { $axios } from "@/utils/api";

export const actions = {
/**
* The register method is disabled and re-implemented simply below.
* The promiseResult.forEach is not working as expected and the errors are not being caught.
*/
// async register({ commit }, payload) {
// const registered = [];

// if (Array.isArray(payload)) {
// const errors = [];
// const promiseResult = await Promise.allSettled(
// payload.forEach((user) => {
// registered.push(user._id);
// $axios
// .patch("/v1/users/admin/students/" + user._id, {
// ...user,
// createAccount: true,
// })
// .catch((error) => errors.push({ updateError: error }));
// })
// );

// promiseResult.forEach((promise) => {
// if (promise.status !== "fulfilled") {
// errors.push(promise);
// }
// if (errors.length)
// commit("setRegisterError", { promiseErrors: errors });
// });

// commit("setRegisteredStudents", registered);
// } else {
// commit("setRegisterError", { mapError: true });
// }
// },

async register({ commit }, payload) {
const registered = [];

if (Array.isArray(payload)) {
const errors = [];
const promiseResult = await Promise.allSettled(
payload.forEach((user) => {
registered.push(user._id);
$axios
.patch("/v1/users/admin/students/" + user._id, {
...user,
createAccount: true,
})
.catch((error) => errors.push({ updateError: error }));
})
);

promiseResult.forEach((promise) => {
if (promise.status !== "fulfilled") {
errors.push(promise);
}
if (errors.length)
commit("setRegisterError", { promiseErrors: errors });

payload.forEach(async (user) => {
registered.push(user._id);
await $axios
.patch("/v1/users/admin/students/" + user._id, {
...user,
createAccount: true,
})
.catch((error) => errors.push({ updateError: error }));
});

commit("setRegisteredStudents", registered);
Expand All @@ -38,9 +64,6 @@ export const actions = {
const response = (
await $axios.get(`/v1/users/admin/students`, {
params: query,
// paramsSerializer: (params) => {
// return qs.stringify(params);
// },
})
).data;

Expand Down

0 comments on commit b5e54bb

Please sign in to comment.