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