Skip to content

Commit

Permalink
Merge branch 'main' into test/forms-1478
Browse files Browse the repository at this point in the history
  • Loading branch information
nimya-aot authored Oct 15, 2024
2 parents ff5e354 + 3e90c52 commit 4d10a95
Show file tree
Hide file tree
Showing 56 changed files with 7,761 additions and 3,422 deletions.
95 changes: 95 additions & 0 deletions app/frontend/package-lock.json

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

1 change: 1 addition & 0 deletions app/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@fortawesome/vue-fontawesome": "^3.0.3",
"@vueuse/core": "^11.1.0",
"axios": "^1.4.0",
"bootstrap-scss": "^5.3.1",
"crypto-js": "^4.1.1",
Expand Down
66 changes: 29 additions & 37 deletions app/frontend/src/components/admin/AddOwner.vue
Original file line number Diff line number Diff line change
@@ -1,48 +1,40 @@
<script>
import { mapActions } from 'pinia';
<script setup>
import { version as uuidVersion, validate as uuidValidate } from 'uuid';
import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import { useAdminStore } from '~/store/admin';
import { FormRoleCodes } from '~/utils/constants';
export default {
props: {
formId: {
type: String,
required: true,
},
},
setup() {
const { locale } = useI18n({ useScope: 'global' });
const { locale } = useI18n({ useScope: 'global' });
return { locale };
},
data() {
return {
userGuid: '',
valid: false,
userGuidRules: [
(v) => !!v || 'User ID required',
(v) =>
(uuidValidate(v) && uuidVersion(v) === 4) ||
'Enter a valid User ID GUID',
],
};
},
methods: {
...mapActions(useAdminStore, ['addFormUser', 'readRoles']),
async addOwner() {
if (this.$refs.addUserForm.validate()) {
await this.addFormUser({
userId: this.userGuid,
formId: this.formId,
roles: [FormRoleCodes.OWNER],
});
}
},
const properties = defineProps({
formId: {
type: String,
required: true,
},
};
});
const addUserForm = ref(null);
const userGuid = ref('');
const valid = ref(false);
const userGuidRules = ref([
(v) => !!v || 'User ID required',
(v) =>
(uuidValidate(v) && uuidVersion(v) === 4) || 'Enter a valid User ID GUID',
]);
const adminStore = useAdminStore();
async function addOwner() {
if (addUserForm.value.validate()) {
await adminStore.addFormUser({
userId: userGuid.value,
formId: properties.formId,
roles: [FormRoleCodes.OWNER],
});
}
}
</script>

<template>
Expand Down
Loading

0 comments on commit 4d10a95

Please sign in to comment.