types
This commit is contained in:
parent
6847ae083e
commit
509daeac1b
5 changed files with 15 additions and 9 deletions
|
@ -106,14 +106,15 @@ export default defineComponent({
|
|||
default: {},
|
||||
},
|
||||
status: {
|
||||
type: [
|
||||
null,
|
||||
String as PropType<"loading">,
|
||||
Object as PropType<{ status: "success" | "failed"; message?: string }>,
|
||||
],
|
||||
type: [Object, String, null] as PropType<null | "loading" | { status: "success" | "failed"; message?: string }>,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
permissions() {
|
||||
this.permissionUpdate = cloneDeep(this.permissions);
|
||||
},
|
||||
},
|
||||
emits: ["savePermissions"],
|
||||
data() {
|
||||
return {
|
||||
|
@ -141,6 +142,9 @@ export default defineComponent({
|
|||
const target = e.target as HTMLInputElement;
|
||||
this.isAdmin = target.checked ?? false;
|
||||
this.permissionUpdate.admin = this.isAdmin;
|
||||
if (!this.isAdmin) {
|
||||
delete this.permissionUpdate.admin;
|
||||
}
|
||||
},
|
||||
togglePermission(type: PermissionType, section: PermissionSection, modul?: PermissionModule) {
|
||||
let permissions = [] as Array<PermissionType> | "*";
|
||||
|
|
|
@ -82,6 +82,7 @@ import { useCommunicationTypeStore } from "@/stores/admin/communicationType";
|
|||
import type { CreateCommunicationTypeViewModel } from "@/viewmodels/admin/communicationType.models";
|
||||
import { Listbox, ListboxButton, ListboxOptions, ListboxOption, ListboxLabel } from "@headlessui/vue";
|
||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||
import type { CommunicationFieldType } from "@/types/fieldTypes";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
@ -90,7 +91,7 @@ export default defineComponent({
|
|||
return {
|
||||
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||
timeout: undefined as any,
|
||||
selectedFields: [] as Array<string>,
|
||||
selectedFields: [] as Array<CommunicationFieldType>,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
||||
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
|
||||
<p>{{ role.role }} <small v-if="role.permissions?.isAdmin">(Admin)</small></p>
|
||||
<p>{{ role.role }} <small v-if="role.permissions.admin">(Admin)</small></p>
|
||||
<div class="flex flex-row">
|
||||
<RouterLink
|
||||
v-if="can('admin', 'user', 'role')"
|
||||
|
|
|
@ -6,12 +6,13 @@ import type {
|
|||
} from "@/viewmodels/admin/communicationType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { CommunicationFieldType } from "../../types/fieldTypes";
|
||||
|
||||
export const useCommunicationTypeStore = defineStore("communicationType", {
|
||||
state: () => {
|
||||
return {
|
||||
communicationTypes: [] as Array<CommunicationTypeViewModel>,
|
||||
availableFields: [] as Array<string>,
|
||||
availableFields: [] as Array<CommunicationFieldType>,
|
||||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
loadingFields: "loading" as "loading" | "fetched" | "failed",
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { PermissionObject } from "@/type/permissionTypes";
|
||||
import type { PermissionObject } from "@/types/permissionTypes";
|
||||
|
||||
export interface RoleViewModel {
|
||||
id: number;
|
||||
|
|
Loading…
Reference in a new issue