-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add project member role selection to create and update modals, fixes …
…ST-446
- Loading branch information
Showing
8 changed files
with
113 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
resources/js/Components/Common/ProjectMember/ProjectMemberRoleSelect.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<script setup lang="ts"> | ||
import SelectDropdown from '@/packages/ui/src/Input/SelectDropdown.vue'; | ||
import Badge from '@/packages/ui/src/Badge.vue'; | ||
import { ChevronDownIcon } from '@heroicons/vue/20/solid'; | ||
import type { ProjectMemberRole } from '@/utils/useProjectMembers'; | ||
type ProjectMemberRoleItem = { key: ProjectMemberRole; name: string }; | ||
const projectMemberRoles: ProjectMemberRoleItem[] = [ | ||
{ | ||
key: 'normal', | ||
name: 'Normal', | ||
}, | ||
{ | ||
key: 'manager', | ||
name: 'Manager', | ||
}, | ||
]; | ||
const model = defineModel<string>({ | ||
default: 'normal', | ||
}); | ||
function getKeyFromItem(item: ProjectMemberRoleItem) { | ||
return item.key; | ||
} | ||
function getNameFromItem(item: ProjectMemberRoleItem) { | ||
return item.name; | ||
} | ||
function getNameForKey(key: string | undefined) { | ||
return projectMemberRoles.find((item) => item.key === key)?.name ?? ''; | ||
} | ||
</script> | ||
|
||
<template> | ||
<SelectDropdown | ||
v-model="model" | ||
:get-key-from-item="getKeyFromItem" | ||
:get-name-for-item="getNameFromItem" | ||
:items="projectMemberRoles"> | ||
<template #trigger> | ||
<Badge size="xlarge" class="bg-input-background cursor-pointer"> | ||
<span> | ||
{{ getNameForKey(model) }} | ||
</span> | ||
<ChevronDownIcon class="text-muted w-5"></ChevronDownIcon> | ||
</Badge> | ||
</template> | ||
</SelectDropdown> | ||
</template> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters