642 lines
29 KiB
Vue
642 lines
29 KiB
Vue
<script setup lang="ts">
|
|
import { Form, Head, Link } from '@inertiajs/vue3';
|
|
import ProjectTicketMetadataSettingsController from '@/actions/App/Http/Controllers/ProjectTicketMetadataSettingsController';
|
|
import Heading from '@/components/Heading.vue';
|
|
import InputError from '@/components/InputError.vue';
|
|
import { Badge } from '@/components/ui/badge';
|
|
import { Button } from '@/components/ui/button';
|
|
import {
|
|
Card,
|
|
CardContent,
|
|
CardDescription,
|
|
CardHeader,
|
|
CardTitle,
|
|
} from '@/components/ui/card';
|
|
import { Input } from '@/components/ui/input';
|
|
import { Label } from '@/components/ui/label';
|
|
import AppLayout from '@/layouts/AppLayout.vue';
|
|
import { index, show } from '@/routes/projects/index';
|
|
import {
|
|
board as boardSettings,
|
|
general as generalSettings,
|
|
metadata as metadataSettings,
|
|
repositories as repositorySettings,
|
|
} from '@/routes/projects/settings';
|
|
import type {
|
|
BreadcrumbItem,
|
|
ProjectTicketMetadataSettingsPageProps,
|
|
} from '@/types';
|
|
|
|
const props = defineProps<ProjectTicketMetadataSettingsPageProps>();
|
|
|
|
const breadcrumbs: BreadcrumbItem[] = [
|
|
{
|
|
title: 'Projects',
|
|
href: index(),
|
|
},
|
|
{
|
|
title: props.project.name,
|
|
href: show(props.project.id),
|
|
},
|
|
{
|
|
title: 'Ticket settings',
|
|
href: metadataSettings(props.project.id),
|
|
},
|
|
];
|
|
</script>
|
|
|
|
<template>
|
|
<AppLayout :breadcrumbs="breadcrumbs">
|
|
<Head :title="`${project.name} ticket settings`" />
|
|
|
|
<div class="flex flex-1 flex-col gap-6 p-4">
|
|
<div
|
|
class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between"
|
|
>
|
|
<div class="space-y-3">
|
|
<Badge variant="outline" class="px-3 py-1">
|
|
{{ project.key }}
|
|
</Badge>
|
|
<Heading
|
|
:title="`${project.name} ticket settings`"
|
|
description="Configure project-specific ticket types, priorities, custom field definitions, and ticket link labels."
|
|
/>
|
|
</div>
|
|
|
|
<div class="flex flex-wrap gap-3">
|
|
<Button
|
|
v-if="$page.props.auth.permissions.globalAdmin"
|
|
as-child
|
|
variant="outline"
|
|
>
|
|
<Link :href="generalSettings(project.id)">
|
|
General settings
|
|
</Link>
|
|
</Button>
|
|
|
|
<Button as-child variant="outline">
|
|
<Link :href="boardSettings(project.id)">
|
|
Board settings
|
|
</Link>
|
|
</Button>
|
|
|
|
<Button as-child variant="outline">
|
|
<Link :href="repositorySettings(project.id)">
|
|
Repository settings
|
|
</Link>
|
|
</Button>
|
|
|
|
<Button as-child variant="outline">
|
|
<Link :href="show(project.id)">Back to project</Link>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
|
|
<div
|
|
v-if="status"
|
|
class="rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-900 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-100"
|
|
>
|
|
{{ status }}
|
|
</div>
|
|
|
|
<div class="grid gap-6 xl:grid-cols-2">
|
|
<Card class="gap-0 overflow-hidden">
|
|
<CardHeader class="border-b">
|
|
<CardTitle>Ticket types</CardTitle>
|
|
<CardDescription>
|
|
Built-in Task and Parent always exist. Custom types
|
|
can be added and reordered per project.
|
|
</CardDescription>
|
|
</CardHeader>
|
|
|
|
<CardContent class="space-y-4 p-6">
|
|
<Form
|
|
v-bind="
|
|
ProjectTicketMetadataSettingsController.storeType.form(
|
|
project.id,
|
|
)
|
|
"
|
|
class="border-border space-y-4 rounded-xl border border-dashed p-4"
|
|
v-slot="{ errors, processing }"
|
|
>
|
|
<div class="grid gap-2">
|
|
<Label for="type-name">New type name</Label>
|
|
<Input
|
|
id="type-name"
|
|
name="name"
|
|
required
|
|
placeholder="Bug"
|
|
/>
|
|
<InputError :message="errors.name" />
|
|
</div>
|
|
|
|
<Button type="submit" :disabled="processing">
|
|
Add type
|
|
</Button>
|
|
</Form>
|
|
|
|
<div
|
|
v-for="ticketType in ticketTypes"
|
|
:key="ticketType.id"
|
|
class="border-border rounded-xl border p-4"
|
|
>
|
|
<Form
|
|
v-bind="
|
|
ProjectTicketMetadataSettingsController.updateType.form(
|
|
[project.id, ticketType.id],
|
|
)
|
|
"
|
|
class="grid gap-4"
|
|
v-slot="{ errors, processing }"
|
|
>
|
|
<div
|
|
class="flex items-center justify-between gap-3"
|
|
>
|
|
<Badge
|
|
:variant="
|
|
ticketType.is_builtin
|
|
? 'default'
|
|
: 'secondary'
|
|
"
|
|
>
|
|
{{
|
|
ticketType.is_builtin
|
|
? 'Built-in'
|
|
: 'Custom'
|
|
}}
|
|
</Badge>
|
|
<p
|
|
class="text-muted-foreground text-xs uppercase tracking-wide"
|
|
>
|
|
Position {{ ticketType.position }}
|
|
</p>
|
|
</div>
|
|
|
|
<div class="grid gap-2">
|
|
<Label :for="`type-name-${ticketType.id}`">
|
|
Name
|
|
</Label>
|
|
<Input
|
|
:id="`type-name-${ticketType.id}`"
|
|
name="name"
|
|
:default-value="ticketType.name"
|
|
required
|
|
/>
|
|
<InputError :message="errors.name" />
|
|
</div>
|
|
|
|
<div class="grid gap-2">
|
|
<Label
|
|
:for="`type-position-${ticketType.id}`"
|
|
>
|
|
Position
|
|
</Label>
|
|
<Input
|
|
:id="`type-position-${ticketType.id}`"
|
|
name="position"
|
|
type="number"
|
|
min="1"
|
|
:max="ticketTypes.length"
|
|
:default-value="ticketType.position"
|
|
required
|
|
/>
|
|
<InputError :message="errors.position" />
|
|
</div>
|
|
|
|
<div
|
|
class="flex flex-wrap justify-between gap-3"
|
|
>
|
|
<Button
|
|
type="submit"
|
|
variant="outline"
|
|
:disabled="processing"
|
|
>
|
|
Save
|
|
</Button>
|
|
</div>
|
|
</Form>
|
|
|
|
<Form
|
|
v-if="!ticketType.is_builtin"
|
|
v-bind="
|
|
ProjectTicketMetadataSettingsController.destroyType.form(
|
|
[project.id, ticketType.id],
|
|
)
|
|
"
|
|
class="mt-3 flex justify-end"
|
|
v-slot="{ processing: deleting }"
|
|
>
|
|
<Button
|
|
type="submit"
|
|
variant="destructive"
|
|
:disabled="deleting"
|
|
>
|
|
Delete
|
|
</Button>
|
|
</Form>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
|
|
<Card class="gap-0 overflow-hidden">
|
|
<CardHeader class="border-b">
|
|
<CardTitle>Priorities</CardTitle>
|
|
<CardDescription>
|
|
Priorities are fully project-specific and can be
|
|
reordered or removed.
|
|
</CardDescription>
|
|
</CardHeader>
|
|
|
|
<CardContent class="space-y-4 p-6">
|
|
<Form
|
|
v-bind="
|
|
ProjectTicketMetadataSettingsController.storePriority.form(
|
|
project.id,
|
|
)
|
|
"
|
|
class="border-border space-y-4 rounded-xl border border-dashed p-4"
|
|
v-slot="{ errors, processing }"
|
|
>
|
|
<div class="grid gap-2">
|
|
<Label for="priority-name"
|
|
>New priority name</Label
|
|
>
|
|
<Input
|
|
id="priority-name"
|
|
name="name"
|
|
required
|
|
placeholder="Urgent"
|
|
/>
|
|
<InputError :message="errors.name" />
|
|
</div>
|
|
|
|
<Button type="submit" :disabled="processing">
|
|
Add priority
|
|
</Button>
|
|
</Form>
|
|
|
|
<div
|
|
v-for="ticketPriority in ticketPriorities"
|
|
:key="ticketPriority.id"
|
|
class="border-border rounded-xl border p-4"
|
|
>
|
|
<Form
|
|
v-bind="
|
|
ProjectTicketMetadataSettingsController.updatePriority.form(
|
|
[project.id, ticketPriority.id],
|
|
)
|
|
"
|
|
class="grid gap-4"
|
|
v-slot="{ errors, processing }"
|
|
>
|
|
<div class="grid gap-2">
|
|
<Label
|
|
:for="`priority-name-${ticketPriority.id}`"
|
|
>
|
|
Name
|
|
</Label>
|
|
<Input
|
|
:id="`priority-name-${ticketPriority.id}`"
|
|
name="name"
|
|
:default-value="ticketPriority.name"
|
|
required
|
|
/>
|
|
<InputError :message="errors.name" />
|
|
</div>
|
|
|
|
<div class="grid gap-2">
|
|
<Label
|
|
:for="`priority-position-${ticketPriority.id}`"
|
|
>
|
|
Position
|
|
</Label>
|
|
<Input
|
|
:id="`priority-position-${ticketPriority.id}`"
|
|
name="position"
|
|
type="number"
|
|
min="1"
|
|
:max="ticketPriorities.length"
|
|
:default-value="ticketPriority.position"
|
|
required
|
|
/>
|
|
<InputError :message="errors.position" />
|
|
</div>
|
|
|
|
<div
|
|
class="flex flex-wrap justify-between gap-3"
|
|
>
|
|
<Button
|
|
type="submit"
|
|
variant="outline"
|
|
:disabled="processing"
|
|
>
|
|
Save
|
|
</Button>
|
|
</div>
|
|
</Form>
|
|
|
|
<Form
|
|
v-bind="
|
|
ProjectTicketMetadataSettingsController.destroyPriority.form(
|
|
[project.id, ticketPriority.id],
|
|
)
|
|
"
|
|
class="mt-3 flex justify-end"
|
|
v-slot="{ processing: deleting }"
|
|
>
|
|
<Button
|
|
type="submit"
|
|
variant="destructive"
|
|
:disabled="deleting"
|
|
>
|
|
Delete
|
|
</Button>
|
|
</Form>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
|
|
<Card class="gap-0 overflow-hidden">
|
|
<CardHeader class="border-b">
|
|
<CardTitle>Custom fields</CardTitle>
|
|
<CardDescription>
|
|
Define project-specific user or number fields for
|
|
upcoming ticket data.
|
|
</CardDescription>
|
|
</CardHeader>
|
|
|
|
<CardContent class="space-y-4 p-6">
|
|
<Form
|
|
v-bind="
|
|
ProjectTicketMetadataSettingsController.storeFieldDefinition.form(
|
|
project.id,
|
|
)
|
|
"
|
|
class="border-border space-y-4 rounded-xl border border-dashed p-4"
|
|
v-slot="{ errors, processing }"
|
|
>
|
|
<div class="grid gap-2">
|
|
<Label for="field-label">New field label</Label>
|
|
<Input
|
|
id="field-label"
|
|
name="label"
|
|
required
|
|
placeholder="Reviewer"
|
|
/>
|
|
<InputError :message="errors.label" />
|
|
</div>
|
|
|
|
<div class="grid gap-2">
|
|
<Label for="field-type">Field type</Label>
|
|
<select
|
|
id="field-type"
|
|
name="field_type"
|
|
class="border-input bg-background shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 rounded-md border px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px]"
|
|
>
|
|
<option
|
|
v-for="option in fieldTypeOptions"
|
|
:key="option.value"
|
|
:value="option.value"
|
|
>
|
|
{{ option.label }}
|
|
</option>
|
|
</select>
|
|
<InputError :message="errors.field_type" />
|
|
</div>
|
|
|
|
<Button type="submit" :disabled="processing">
|
|
Add field
|
|
</Button>
|
|
</Form>
|
|
|
|
<div
|
|
v-for="fieldDefinition in ticketFieldDefinitions"
|
|
:key="fieldDefinition.id"
|
|
class="border-border rounded-xl border p-4"
|
|
>
|
|
<Form
|
|
v-bind="
|
|
ProjectTicketMetadataSettingsController.updateFieldDefinition.form(
|
|
[project.id, fieldDefinition.id],
|
|
)
|
|
"
|
|
class="grid gap-4"
|
|
v-slot="{ errors, processing }"
|
|
>
|
|
<div class="grid gap-2">
|
|
<Label
|
|
:for="`field-label-${fieldDefinition.id}`"
|
|
>
|
|
Label
|
|
</Label>
|
|
<Input
|
|
:id="`field-label-${fieldDefinition.id}`"
|
|
name="label"
|
|
:default-value="fieldDefinition.label"
|
|
required
|
|
/>
|
|
<InputError :message="errors.label" />
|
|
</div>
|
|
|
|
<div class="grid gap-2">
|
|
<Label
|
|
:for="`field-type-${fieldDefinition.id}`"
|
|
>
|
|
Field type
|
|
</Label>
|
|
<select
|
|
:id="`field-type-${fieldDefinition.id}`"
|
|
name="field_type"
|
|
class="border-input bg-background shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 rounded-md border px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px]"
|
|
>
|
|
<option
|
|
v-for="option in fieldTypeOptions"
|
|
:key="option.value"
|
|
:value="option.value"
|
|
:selected="
|
|
option.value ===
|
|
fieldDefinition.field_type
|
|
"
|
|
>
|
|
{{ option.label }}
|
|
</option>
|
|
</select>
|
|
<InputError :message="errors.field_type" />
|
|
</div>
|
|
|
|
<div class="grid gap-2">
|
|
<Label
|
|
:for="`field-position-${fieldDefinition.id}`"
|
|
>
|
|
Position
|
|
</Label>
|
|
<Input
|
|
:id="`field-position-${fieldDefinition.id}`"
|
|
name="position"
|
|
type="number"
|
|
min="1"
|
|
:max="ticketFieldDefinitions.length"
|
|
:default-value="
|
|
fieldDefinition.position
|
|
"
|
|
required
|
|
/>
|
|
<InputError :message="errors.position" />
|
|
</div>
|
|
|
|
<div
|
|
class="flex flex-wrap justify-between gap-3"
|
|
>
|
|
<Button
|
|
type="submit"
|
|
variant="outline"
|
|
:disabled="processing"
|
|
>
|
|
Save
|
|
</Button>
|
|
</div>
|
|
</Form>
|
|
|
|
<Form
|
|
v-bind="
|
|
ProjectTicketMetadataSettingsController.destroyFieldDefinition.form(
|
|
[project.id, fieldDefinition.id],
|
|
)
|
|
"
|
|
class="mt-3 flex justify-end"
|
|
v-slot="{ processing: deleting }"
|
|
>
|
|
<Button
|
|
type="submit"
|
|
variant="destructive"
|
|
:disabled="deleting"
|
|
>
|
|
Delete
|
|
</Button>
|
|
</Form>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
|
|
<Card class="gap-0 overflow-hidden">
|
|
<CardHeader class="border-b">
|
|
<CardTitle>Link types</CardTitle>
|
|
<CardDescription>
|
|
Define project-specific labels for ticket-to-ticket
|
|
relationships.
|
|
</CardDescription>
|
|
</CardHeader>
|
|
|
|
<CardContent class="space-y-4 p-6">
|
|
<Form
|
|
v-bind="
|
|
ProjectTicketMetadataSettingsController.storeLinkType.form(
|
|
project.id,
|
|
)
|
|
"
|
|
class="border-border space-y-4 rounded-xl border border-dashed p-4"
|
|
v-slot="{ errors, processing }"
|
|
>
|
|
<div class="grid gap-2">
|
|
<Label for="link-type-name">
|
|
New link type name
|
|
</Label>
|
|
<Input
|
|
id="link-type-name"
|
|
name="name"
|
|
required
|
|
placeholder="Relates to"
|
|
/>
|
|
<InputError :message="errors.name" />
|
|
</div>
|
|
|
|
<Button type="submit" :disabled="processing">
|
|
Add link type
|
|
</Button>
|
|
</Form>
|
|
|
|
<div
|
|
v-for="ticketLinkType in ticketLinkTypes"
|
|
:key="ticketLinkType.id"
|
|
class="border-border rounded-xl border p-4"
|
|
>
|
|
<Form
|
|
v-bind="
|
|
ProjectTicketMetadataSettingsController.updateLinkType.form(
|
|
[project.id, ticketLinkType.id],
|
|
)
|
|
"
|
|
class="grid gap-4"
|
|
v-slot="{ errors, processing }"
|
|
>
|
|
<div class="grid gap-2">
|
|
<Label
|
|
:for="`link-type-name-${ticketLinkType.id}`"
|
|
>
|
|
Label
|
|
</Label>
|
|
<Input
|
|
:id="`link-type-name-${ticketLinkType.id}`"
|
|
name="name"
|
|
:default-value="ticketLinkType.label"
|
|
required
|
|
/>
|
|
<InputError :message="errors.name" />
|
|
</div>
|
|
|
|
<div class="grid gap-2">
|
|
<Label
|
|
:for="`link-type-position-${ticketLinkType.id}`"
|
|
>
|
|
Position
|
|
</Label>
|
|
<Input
|
|
:id="`link-type-position-${ticketLinkType.id}`"
|
|
name="position"
|
|
type="number"
|
|
min="1"
|
|
:max="ticketLinkTypes.length"
|
|
:default-value="ticketLinkType.position"
|
|
required
|
|
/>
|
|
<InputError :message="errors.position" />
|
|
</div>
|
|
|
|
<div
|
|
class="flex flex-wrap justify-between gap-3"
|
|
>
|
|
<Button
|
|
type="submit"
|
|
variant="outline"
|
|
:disabled="processing"
|
|
>
|
|
Save
|
|
</Button>
|
|
</div>
|
|
</Form>
|
|
|
|
<Form
|
|
v-bind="
|
|
ProjectTicketMetadataSettingsController.destroyLinkType.form(
|
|
[project.id, ticketLinkType.id],
|
|
)
|
|
"
|
|
class="mt-3 flex justify-end"
|
|
v-slot="{ processing: deleting }"
|
|
>
|
|
<Button
|
|
type="submit"
|
|
variant="destructive"
|
|
:disabled="deleting"
|
|
>
|
|
Delete
|
|
</Button>
|
|
</Form>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
</div>
|
|
</AppLayout>
|
|
</template>
|