feat: KAN-30
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
<script setup lang="ts">
|
||||
import InputError from '@/components/InputError.vue';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
id: string;
|
||||
label: string;
|
||||
kind?: 'text' | 'number' | 'textarea' | 'select';
|
||||
options?: { value: string | number; label: string }[];
|
||||
error?: string;
|
||||
hint?: string;
|
||||
disabled?: boolean;
|
||||
required?: boolean;
|
||||
autofocus?: boolean;
|
||||
placeholder?: string;
|
||||
rows?: number;
|
||||
min?: number;
|
||||
step?: string;
|
||||
}>(),
|
||||
{ kind: 'text', rows: 5 },
|
||||
);
|
||||
|
||||
const model = defineModel<string | number | null>({ required: true });
|
||||
const controlClass =
|
||||
'min-h-control border-input bg-card focus-visible:border-ring focus-visible:ring-ring/35 w-full min-w-0 rounded-md border px-3 py-2 text-base shadow-xs outline-none transition-[border-color,box-shadow] hover:border-primary/45 focus-visible:ring-2 disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-60 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/25 md:text-body';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="grid min-w-0 content-start gap-2">
|
||||
<Label :for="id">{{ label }}</Label>
|
||||
<select
|
||||
v-if="kind === 'select'"
|
||||
:id="id"
|
||||
v-model="model"
|
||||
:name="id"
|
||||
:disabled="disabled"
|
||||
:required="required"
|
||||
:aria-invalid="Boolean(error)"
|
||||
:aria-describedby="`${id}-hint ${id}-error`"
|
||||
:class="controlClass"
|
||||
>
|
||||
<option
|
||||
v-for="option in options"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
>
|
||||
{{ option.label }}
|
||||
</option>
|
||||
</select>
|
||||
<textarea
|
||||
v-else-if="kind === 'textarea'"
|
||||
:id="id"
|
||||
v-model="model"
|
||||
:name="id"
|
||||
:rows="rows"
|
||||
:disabled="disabled"
|
||||
:required="required"
|
||||
:placeholder="placeholder"
|
||||
:aria-invalid="Boolean(error)"
|
||||
:aria-describedby="`${id}-hint ${id}-error`"
|
||||
:class="controlClass"
|
||||
/>
|
||||
<Input
|
||||
v-else
|
||||
:id="id"
|
||||
v-model="model"
|
||||
:name="id"
|
||||
:type="kind"
|
||||
:disabled="disabled"
|
||||
:required="required"
|
||||
:autofocus="autofocus"
|
||||
:placeholder="placeholder"
|
||||
:min="min"
|
||||
:step="step"
|
||||
:maxlength="kind === 'text' ? 255 : undefined"
|
||||
:invalid="Boolean(error)"
|
||||
:aria-describedby="`${id}-hint ${id}-error`"
|
||||
/>
|
||||
<p
|
||||
:id="`${id}-hint`"
|
||||
class="text-muted-foreground text-xs empty:hidden"
|
||||
>
|
||||
{{ hint }}
|
||||
</p>
|
||||
<InputError :id="`${id}-error`" :message="error" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,157 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import TicketFormField from '@/components/tickets/TicketFormField.vue';
|
||||
import { useLocalization } from '@/composables/useLocalization';
|
||||
import { ticketStatusLabel } from '@/lib/tickets';
|
||||
import type { ProjectTicketCreatePageProps } from '@/types';
|
||||
|
||||
const props = defineProps<
|
||||
Pick<
|
||||
ProjectTicketCreatePageProps,
|
||||
| 'project'
|
||||
| 'ticketTypes'
|
||||
| 'ticketPriorities'
|
||||
| 'users'
|
||||
| 'parentTicketOptions'
|
||||
> & {
|
||||
errors: Record<string, string>;
|
||||
disabled?: boolean;
|
||||
autofocus?: boolean;
|
||||
ticketStatusOptions?: ProjectTicketCreatePageProps['ticketStatusOptions'];
|
||||
}
|
||||
>();
|
||||
const title = defineModel<string>('title', { required: true });
|
||||
const description = defineModel<string>('description', { required: true });
|
||||
const type = defineModel<string | number>('type', { required: true });
|
||||
const priority = defineModel<string | number>('priority', { required: true });
|
||||
const assignee = defineModel<string | number>('assignee', { required: true });
|
||||
const parent = defineModel<string | number>('parent', { required: true });
|
||||
const points = defineModel<string | number | null>('points', {
|
||||
required: true,
|
||||
});
|
||||
const status = defineModel<string | number>('status');
|
||||
const { t } = useLocalization();
|
||||
const typeOptions = computed(() =>
|
||||
props.ticketTypes.map((item) => ({ value: item.id, label: item.name })),
|
||||
);
|
||||
const priorityOptions = computed(() =>
|
||||
props.ticketPriorities.map((item) => ({
|
||||
value: item.id,
|
||||
label: item.name,
|
||||
})),
|
||||
);
|
||||
const userOptions = computed(() => [
|
||||
{ value: '', label: t('tickets.unassigned') },
|
||||
...props.users.map((item) => ({ value: item.id, label: item.name })),
|
||||
]);
|
||||
const parentOptions = computed(() => [
|
||||
{ value: '', label: t('ticketDetail.noParent') },
|
||||
...props.parentTicketOptions.map((item) => ({
|
||||
value: item.id,
|
||||
label: `${item.ticket_key} - ${item.title}`,
|
||||
})),
|
||||
]);
|
||||
const statusOptions = computed(
|
||||
() =>
|
||||
props.ticketStatusOptions?.map((item) => ({
|
||||
value: item.id,
|
||||
label: ticketStatusLabel(item, t('ticketDetail.notSet')),
|
||||
})) ?? [],
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="grid min-w-0 gap-6">
|
||||
<TicketFormField
|
||||
id="title"
|
||||
v-model="title"
|
||||
:label="t('ticketDetail.title')"
|
||||
:error="errors.title"
|
||||
:disabled="disabled"
|
||||
:autofocus="autofocus"
|
||||
:placeholder="t('ticketForm.titlePlaceholder')"
|
||||
required
|
||||
/>
|
||||
<TicketFormField
|
||||
id="description"
|
||||
v-model="description"
|
||||
kind="textarea"
|
||||
:label="t('ticketDetail.description')"
|
||||
:error="errors.description"
|
||||
:disabled="disabled"
|
||||
:placeholder="t('ticketForm.descriptionPlaceholder')"
|
||||
/>
|
||||
<slot name="content" />
|
||||
<fieldset
|
||||
class="bg-muted/20 grid min-w-0 gap-5 rounded-xl border p-4 sm:p-5"
|
||||
:disabled="disabled"
|
||||
>
|
||||
<legend class="px-2 text-sm font-semibold">
|
||||
{{ t('ticketDetail.metadata') }}
|
||||
</legend>
|
||||
<div class="grid min-w-0 gap-5 sm:grid-cols-2">
|
||||
<TicketFormField
|
||||
id="ticket_type_id"
|
||||
v-model="type"
|
||||
kind="select"
|
||||
:label="t('ticketDetail.type')"
|
||||
:options="typeOptions"
|
||||
:error="errors.ticket_type_id"
|
||||
:disabled="disabled"
|
||||
required
|
||||
/>
|
||||
<TicketFormField
|
||||
id="ticket_priority_id"
|
||||
v-model="priority"
|
||||
kind="select"
|
||||
:label="t('ticketDetail.priority')"
|
||||
:options="priorityOptions"
|
||||
:error="errors.ticket_priority_id"
|
||||
:disabled="disabled"
|
||||
required
|
||||
/>
|
||||
<TicketFormField
|
||||
v-if="ticketStatusOptions && status !== undefined"
|
||||
id="ticket_status_id"
|
||||
v-model="status"
|
||||
kind="select"
|
||||
:label="t('ticketDetail.status')"
|
||||
:options="statusOptions"
|
||||
:error="errors.ticket_status_id"
|
||||
:disabled="disabled"
|
||||
required
|
||||
/>
|
||||
<TicketFormField
|
||||
id="assignee_user_id"
|
||||
v-model="assignee"
|
||||
kind="select"
|
||||
:label="t('ticketDetail.assignee')"
|
||||
:options="userOptions"
|
||||
:error="errors.assignee_user_id"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
<TicketFormField
|
||||
id="parent_ticket_id"
|
||||
v-model="parent"
|
||||
kind="select"
|
||||
:label="t('ticketDetail.parent')"
|
||||
:options="parentOptions"
|
||||
:error="errors.parent_ticket_id"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
<TicketFormField
|
||||
v-if="project.show_story_points"
|
||||
id="story_points"
|
||||
v-model="points"
|
||||
kind="number"
|
||||
:label="t('ticketDetail.storyPoints')"
|
||||
:error="errors.story_points"
|
||||
:disabled="disabled"
|
||||
:min="0"
|
||||
step="1"
|
||||
/>
|
||||
<slot name="metadata" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</template>
|
||||
@@ -8,7 +8,8 @@ import ProjectTicketController from '@/actions/App/Http/Controllers/ProjectTicke
|
||||
import InputError from '@/components/InputError.vue';
|
||||
import FormFeedback from '@/components/FormFeedback.vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import TicketFormField from '@/components/tickets/TicketFormField.vue';
|
||||
import TicketFormFields from '@/components/tickets/TicketFormFields.vue';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { useFormProtection } from '@/composables/useFormProtection';
|
||||
import {
|
||||
@@ -45,7 +46,7 @@ const savedAcceptanceCriteria = ref(
|
||||
const isPersistingAcceptanceCriteriaToggle = ref(false);
|
||||
const acceptanceCriteriaToggleError = ref('');
|
||||
|
||||
const form = useForm(draftKey, {
|
||||
const savedFormData = () => ({
|
||||
acceptance_criteria: buildAcceptanceCriteria(
|
||||
acceptanceCriteriaChecklist.value,
|
||||
),
|
||||
@@ -74,6 +75,8 @@ const form = useForm(draftKey, {
|
||||
story_points: props.ticket.story_points,
|
||||
});
|
||||
|
||||
const form = useForm(draftKey, savedFormData());
|
||||
|
||||
const acceptanceCriteriaPreviewItems = computed(
|
||||
() => savedAcceptanceCriteria.value,
|
||||
);
|
||||
@@ -84,11 +87,27 @@ const hasUnsavedAcceptanceCriteriaDraft = computed(
|
||||
formatChecklistLines(savedAcceptanceCriteria.value),
|
||||
);
|
||||
|
||||
const protection = useFormProtection(form, {
|
||||
isDirty: () =>
|
||||
const isDirty = computed(
|
||||
() =>
|
||||
props.canEditTicket &&
|
||||
(form.isDirty || hasUnsavedAcceptanceCriteriaDraft.value),
|
||||
});
|
||||
);
|
||||
const protection = useFormProtection(form, { isDirty: () => isDirty.value });
|
||||
const reset = (): void => {
|
||||
if (
|
||||
form.processing ||
|
||||
isPersistingAcceptanceCriteriaToggle.value ||
|
||||
!protection.confirmLeave()
|
||||
) {
|
||||
return;
|
||||
}
|
||||
form.reset();
|
||||
form.clearErrors();
|
||||
acceptanceCriteriaChecklist.value = formatChecklistLines(
|
||||
savedAcceptanceCriteria.value,
|
||||
);
|
||||
protection.clearFeedback();
|
||||
};
|
||||
|
||||
const acceptanceCriteriaError = computed(() => {
|
||||
return (
|
||||
@@ -140,6 +159,7 @@ const persistAcceptanceCriteriaToggle = async (
|
||||
): Promise<void> => {
|
||||
if (
|
||||
!props.canEditTicket ||
|
||||
form.processing ||
|
||||
isPersistingAcceptanceCriteriaToggle.value ||
|
||||
hasUnsavedAcceptanceCriteriaDraft.value
|
||||
) {
|
||||
@@ -191,6 +211,8 @@ const persistAcceptanceCriteriaToggle = async (
|
||||
|
||||
if (acceptanceCriteriaChecklist.value === previousChecklist) {
|
||||
acceptanceCriteriaChecklist.value = nextChecklist;
|
||||
form.acceptance_criteria = nextAcceptanceCriteria;
|
||||
form.defaults('acceptance_criteria', nextAcceptanceCriteria);
|
||||
}
|
||||
} catch (_error) {
|
||||
acceptanceCriteriaToggleError.value = t(
|
||||
@@ -216,7 +238,11 @@ const onAcceptanceCriteriaCheckboxChange = async (
|
||||
};
|
||||
|
||||
const submit = (): void => {
|
||||
if (!props.canEditTicket) {
|
||||
if (
|
||||
!props.canEditTicket ||
|
||||
form.processing ||
|
||||
isPersistingAcceptanceCriteriaToggle.value
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -236,6 +262,8 @@ const submit = (): void => {
|
||||
acceptanceCriteriaChecklist.value = formatChecklistLines(
|
||||
savedAcceptanceCriteria.value,
|
||||
);
|
||||
Object.assign(form, savedFormData());
|
||||
form.defaults();
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -359,339 +387,224 @@ const submit = (): void => {
|
||||
>
|
||||
{{ t('ticketDetail.edit') }}
|
||||
</summary>
|
||||
<div class="border-t p-6">
|
||||
<div class="border-t p-4 sm:p-6">
|
||||
<p class="text-muted-foreground mb-6 text-sm">
|
||||
{{ t('ticketDetail.editDescription') }}
|
||||
</p>
|
||||
<form class="grid gap-6" @submit.prevent="submit">
|
||||
<form class="grid min-w-0 gap-6" @submit.prevent="submit">
|
||||
<FormFeedback
|
||||
:state="protection.state.value"
|
||||
@retry="submit"
|
||||
/>
|
||||
<div class="grid min-w-0 gap-2">
|
||||
<Label for="title">{{ t('ticketDetail.title') }}</Label>
|
||||
<Input
|
||||
id="title"
|
||||
v-model="form.title"
|
||||
:invalid="Boolean(form.errors.title)"
|
||||
aria-describedby="title-error"
|
||||
:disabled="!canEditTicket || form.processing"
|
||||
/>
|
||||
<InputError
|
||||
id="title-error"
|
||||
:message="form.errors.title"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2 md:grid-cols-2 md:gap-6">
|
||||
<div class="grid min-w-0 gap-2">
|
||||
<Label for="ticket_type_id">{{
|
||||
t('ticketDetail.type')
|
||||
}}</Label>
|
||||
<select
|
||||
id="ticket_type_id"
|
||||
v-model="form.ticket_type_id"
|
||||
:disabled="!canEditTicket || form.processing"
|
||||
class="min-h-control border-input bg-background shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 w-full min-w-0 rounded-md border px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
<option
|
||||
v-for="ticketType in ticketTypes"
|
||||
:key="ticketType.id"
|
||||
:value="ticketType.id"
|
||||
>
|
||||
{{ ticketType.name }}
|
||||
</option>
|
||||
</select>
|
||||
<InputError :message="form.errors.ticket_type_id" />
|
||||
</div>
|
||||
|
||||
<div class="grid min-w-0 gap-2">
|
||||
<Label for="ticket_priority_id">{{
|
||||
t('ticketDetail.priority')
|
||||
}}</Label>
|
||||
<select
|
||||
id="ticket_priority_id"
|
||||
v-model="form.ticket_priority_id"
|
||||
:disabled="!canEditTicket || form.processing"
|
||||
class="min-h-control border-input bg-background shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 w-full min-w-0 rounded-md border px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
<option
|
||||
v-for="ticketPriority in ticketPriorities"
|
||||
:key="ticketPriority.id"
|
||||
:value="ticketPriority.id"
|
||||
>
|
||||
{{ ticketPriority.name }}
|
||||
</option>
|
||||
</select>
|
||||
<InputError
|
||||
:message="form.errors.ticket_priority_id"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2 md:grid-cols-2 md:gap-6">
|
||||
<div class="grid min-w-0 gap-2">
|
||||
<Label for="assignee_user_id">{{
|
||||
t('ticketDetail.assignee')
|
||||
}}</Label>
|
||||
<select
|
||||
id="assignee_user_id"
|
||||
v-model="form.assignee_user_id"
|
||||
:disabled="!canEditTicket || form.processing"
|
||||
class="min-h-control border-input bg-background shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 w-full min-w-0 rounded-md border px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
<option value="">
|
||||
{{ t('tickets.unassigned') }}
|
||||
</option>
|
||||
<option
|
||||
v-for="user in users"
|
||||
:key="user.id"
|
||||
:value="user.id"
|
||||
>
|
||||
{{ user.name }}
|
||||
</option>
|
||||
</select>
|
||||
<InputError
|
||||
:message="form.errors.assignee_user_id"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="canViewAuthor" class="grid min-w-0 gap-2">
|
||||
<Label for="author_user_id">{{
|
||||
t('ticketDetail.author')
|
||||
}}</Label>
|
||||
<select
|
||||
id="author_user_id"
|
||||
v-model="form.author_user_id"
|
||||
:disabled="!canEditAuthor || form.processing"
|
||||
class="min-h-control border-input bg-background shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 w-full min-w-0 rounded-md border px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
<option value="">
|
||||
{{ t('ticketDetail.noAuthor') }}
|
||||
</option>
|
||||
<option
|
||||
v-for="user in users"
|
||||
:key="user.id"
|
||||
:value="user.id"
|
||||
>
|
||||
{{ user.name }}
|
||||
</option>
|
||||
</select>
|
||||
<InputError :message="form.errors.author_user_id" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="grid min-w-0 gap-2"
|
||||
v-if="project.show_story_points"
|
||||
<TicketFormFields
|
||||
v-model:title="form.title"
|
||||
v-model:description="form.description"
|
||||
v-model:type="form.ticket_type_id"
|
||||
v-model:priority="form.ticket_priority_id"
|
||||
v-model:assignee="form.assignee_user_id"
|
||||
v-model:parent="form.parent_ticket_id"
|
||||
v-model:points="form.story_points"
|
||||
:project="project"
|
||||
:ticket-types="ticketTypes"
|
||||
:ticket-priorities="ticketPriorities"
|
||||
:users="users"
|
||||
:parent-ticket-options="parentTicketOptions"
|
||||
:errors="form.errors"
|
||||
:disabled="
|
||||
form.processing ||
|
||||
isPersistingAcceptanceCriteriaToggle
|
||||
"
|
||||
>
|
||||
<Label for="story_points">{{
|
||||
t('ticketDetail.storyPoints')
|
||||
}}</Label>
|
||||
<Input
|
||||
id="story_points"
|
||||
name="story_points"
|
||||
:disabled="!canEditTicket || form.processing"
|
||||
v-model="form.story_points"
|
||||
type="number"
|
||||
step="1"
|
||||
/>
|
||||
<InputError :message="form.errors.story_points" />
|
||||
</div>
|
||||
|
||||
<div class="grid min-w-0 gap-2">
|
||||
<Label for="parent_ticket_id">{{
|
||||
t('ticketDetail.parent')
|
||||
}}</Label>
|
||||
<select
|
||||
id="parent_ticket_id"
|
||||
v-model="form.parent_ticket_id"
|
||||
:disabled="!canEditTicket || form.processing"
|
||||
class="min-h-control border-input bg-background shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 w-full min-w-0 rounded-md border px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
<option value="">
|
||||
{{ t('ticketDetail.noParent') }}
|
||||
</option>
|
||||
<option
|
||||
v-for="parentTicketOption in parentTicketOptions"
|
||||
:key="parentTicketOption.id"
|
||||
:value="parentTicketOption.id"
|
||||
>
|
||||
{{
|
||||
`${parentTicketOption.ticket_key} - ${parentTicketOption.title}`
|
||||
}}
|
||||
</option>
|
||||
</select>
|
||||
<InputError :message="form.errors.parent_ticket_id" />
|
||||
</div>
|
||||
|
||||
<div class="grid min-w-0 gap-2">
|
||||
<Label for="description">{{
|
||||
t('ticketDetail.description')
|
||||
}}</Label>
|
||||
<textarea
|
||||
id="description"
|
||||
v-model="form.description"
|
||||
rows="5"
|
||||
:disabled="!canEditTicket || form.processing"
|
||||
class="min-h-control border-input bg-background shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 w-full min-w-0 rounded-md border px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
/>
|
||||
<InputError :message="form.errors.description" />
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4">
|
||||
<div class="grid min-w-0 gap-2">
|
||||
<Label for="acceptance_criteria_checklist">{{
|
||||
t('ticketDetail.checklistEditor')
|
||||
}}</Label>
|
||||
<textarea
|
||||
<template #content>
|
||||
<TicketFormField
|
||||
id="acceptance_criteria_checklist"
|
||||
v-model="acceptanceCriteriaChecklist"
|
||||
rows="5"
|
||||
:disabled="!canEditTicket || form.processing"
|
||||
class="min-h-control border-input bg-background shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 w-full min-w-0 rounded-md border px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
kind="textarea"
|
||||
:label="t('ticketDetail.checklistEditor')"
|
||||
:hint="t('ticketForm.checklistHelp')"
|
||||
:placeholder="
|
||||
t('ticketDetail.checklistPlaceholder')
|
||||
"
|
||||
:error="acceptanceCriteriaError"
|
||||
:disabled="
|
||||
form.processing ||
|
||||
isPersistingAcceptanceCriteriaToggle
|
||||
"
|
||||
/>
|
||||
<p class="text-muted-foreground text-xs">
|
||||
{{ t('ticketDetail.checklistHelp') }}
|
||||
</p>
|
||||
<p
|
||||
v-if="hasUnsavedAcceptanceCriteriaDraft"
|
||||
class="text-muted-foreground text-xs"
|
||||
>
|
||||
{{ t('ticketDetail.saveChecklistFirst') }}
|
||||
</p>
|
||||
<InputError :message="acceptanceCriteriaError" />
|
||||
<InputError
|
||||
:message="acceptanceCriteriaToggleError"
|
||||
</template>
|
||||
<template #metadata>
|
||||
<TicketFormField
|
||||
v-if="canViewAuthor"
|
||||
id="author_user_id"
|
||||
v-model="form.author_user_id"
|
||||
kind="select"
|
||||
:label="t('ticketDetail.author')"
|
||||
:hint="
|
||||
!canEditAuthor
|
||||
? t('ticketForm.authorRestricted')
|
||||
: undefined
|
||||
"
|
||||
:options="[
|
||||
{
|
||||
value: '',
|
||||
label: t('ticketDetail.noAuthor'),
|
||||
},
|
||||
...users.map((user) => ({
|
||||
value: user.id,
|
||||
label: user.name,
|
||||
})),
|
||||
]"
|
||||
:error="form.errors.author_user_id"
|
||||
:disabled="!canEditAuthor || form.processing"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="border-border grid gap-3 rounded-xl border p-4">
|
||||
<div class="flex items-center gap-3">
|
||||
</template>
|
||||
</TicketFormFields>
|
||||
<fieldset
|
||||
class="grid min-w-0 gap-4 rounded-xl border p-4 sm:p-5"
|
||||
:disabled="
|
||||
form.processing ||
|
||||
isPersistingAcceptanceCriteriaToggle
|
||||
"
|
||||
>
|
||||
<legend class="px-2 text-sm font-semibold">
|
||||
{{ t('ticketForm.blocker') }}
|
||||
</legend>
|
||||
<div class="min-h-control flex items-center gap-3">
|
||||
<input
|
||||
id="is_blocked"
|
||||
v-model="form.is_blocked"
|
||||
type="checkbox"
|
||||
:disabled="!canEditTicket || form.processing"
|
||||
class="border-input text-primary focus:ring-ring size-4 rounded"
|
||||
:aria-invalid="Boolean(form.errors.is_blocked)"
|
||||
aria-describedby="is_blocked-error"
|
||||
class="border-input text-primary focus-visible:ring-ring size-4 rounded focus-visible:ring-2"
|
||||
/>
|
||||
<Label for="is_blocked">{{
|
||||
t('ticketDetail.blocked')
|
||||
}}</Label>
|
||||
</div>
|
||||
|
||||
<div class="grid min-w-0 gap-2">
|
||||
<Label for="blocked_comment">{{
|
||||
t('ticketDetail.blockerComment')
|
||||
}}</Label>
|
||||
<textarea
|
||||
id="blocked_comment"
|
||||
v-model="form.blocked_comment"
|
||||
rows="3"
|
||||
:disabled="!canEditTicket || form.processing"
|
||||
class="min-h-control border-input bg-background shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 w-full min-w-0 rounded-md border px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:placeholder="
|
||||
t('ticketDetail.blockerPlaceholder')
|
||||
"
|
||||
/>
|
||||
<InputError
|
||||
:message="form.errors.blocked_comment"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4">
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-sm font-semibold">
|
||||
{{ t('ticketDetail.customFields') }}
|
||||
</h3>
|
||||
<p class="text-muted-foreground text-sm">
|
||||
{{ t('ticketDetail.customFieldsDescription') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="ticketFieldDefinitions.length === 0"
|
||||
class="border-border text-muted-foreground rounded-xl border border-dashed px-4 py-6 text-sm"
|
||||
<InputError
|
||||
id="is_blocked-error"
|
||||
:message="form.errors.is_blocked"
|
||||
/>
|
||||
<TicketFormField
|
||||
id="blocked_comment"
|
||||
v-model="form.blocked_comment"
|
||||
kind="textarea"
|
||||
:rows="3"
|
||||
:label="t('ticketDetail.blockerComment')"
|
||||
:placeholder="t('ticketDetail.blockerPlaceholder')"
|
||||
:error="form.errors.blocked_comment"
|
||||
:required="form.is_blocked"
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset
|
||||
class="grid min-w-0 gap-4 rounded-xl border p-4 sm:p-5"
|
||||
:disabled="
|
||||
form.processing ||
|
||||
isPersistingAcceptanceCriteriaToggle
|
||||
"
|
||||
>
|
||||
<legend class="px-2 text-sm font-semibold">
|
||||
{{ t('ticketDetail.customFields') }}
|
||||
</legend>
|
||||
<p class="text-muted-foreground text-sm">
|
||||
{{ t('ticketDetail.customFieldsDescription') }}
|
||||
</p>
|
||||
<InputError :message="form.errors.field_values" />
|
||||
<p
|
||||
v-if="!ticketFieldDefinitions.length"
|
||||
class="text-muted-foreground text-sm"
|
||||
>
|
||||
{{ t('ticketDetail.noCustomFields') }}
|
||||
</div>
|
||||
|
||||
<div v-else class="grid gap-4 md:grid-cols-2">
|
||||
<div
|
||||
</p>
|
||||
<div v-else class="grid min-w-0 gap-5 sm:grid-cols-2">
|
||||
<template
|
||||
v-for="(
|
||||
ticketFieldDefinition, index
|
||||
definition, index
|
||||
) in ticketFieldDefinitions"
|
||||
:key="ticketFieldDefinition.id"
|
||||
class="grid min-w-0 gap-2"
|
||||
:key="definition.id"
|
||||
>
|
||||
<Label
|
||||
:for="`field-${ticketFieldDefinition.id}`"
|
||||
>
|
||||
{{ ticketFieldDefinition.label }}
|
||||
</Label>
|
||||
|
||||
<select
|
||||
v-if="
|
||||
ticketFieldDefinition.field_type ===
|
||||
'user'
|
||||
"
|
||||
:id="`field-${ticketFieldDefinition.id}`"
|
||||
<TicketFormField
|
||||
v-if="definition.field_type === 'user'"
|
||||
:id="`field-${definition.id}`"
|
||||
v-model="
|
||||
form.field_values[index].value_user_id
|
||||
"
|
||||
:disabled="
|
||||
!canEditTicket || form.processing
|
||||
"
|
||||
class="min-h-control border-input bg-background shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 w-full min-w-0 rounded-md border px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
<option value="">
|
||||
{{ t('tickets.unassigned') }}
|
||||
</option>
|
||||
<option
|
||||
v-for="user in users"
|
||||
:key="user.id"
|
||||
:value="user.id"
|
||||
>
|
||||
{{ user.name }}
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<Input
|
||||
v-else
|
||||
:id="`field-${ticketFieldDefinition.id}`"
|
||||
v-model="
|
||||
form.field_values[index].value_number
|
||||
"
|
||||
type="number"
|
||||
step="0.1"
|
||||
:disabled="
|
||||
!canEditTicket || form.processing
|
||||
"
|
||||
/>
|
||||
|
||||
<InputError
|
||||
:message="
|
||||
kind="select"
|
||||
:label="definition.label"
|
||||
:options="[
|
||||
{
|
||||
value: '',
|
||||
label: t('tickets.unassigned'),
|
||||
},
|
||||
...users.map((user) => ({
|
||||
value: user.id,
|
||||
label: user.name,
|
||||
})),
|
||||
]"
|
||||
:error="
|
||||
form.errors[
|
||||
`field_values.${index}.value_user_id`
|
||||
] ??
|
||||
form.errors[
|
||||
`field_values.${index}.value_number`
|
||||
`field_values.${index}.ticket_field_definition_id`
|
||||
]
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<TicketFormField
|
||||
v-else
|
||||
:id="`field-${definition.id}`"
|
||||
v-model="
|
||||
form.field_values[index].value_number
|
||||
"
|
||||
kind="number"
|
||||
step="0.1"
|
||||
:label="definition.label"
|
||||
:error="
|
||||
form.errors[
|
||||
`field_values.${index}.value_number`
|
||||
] ??
|
||||
form.errors[
|
||||
`field_values.${index}.ticket_field_definition_id`
|
||||
]
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="canEditTicket" class="flex items-center gap-3">
|
||||
<Button type="submit" :disabled="form.processing">{{
|
||||
t('ticketDetail.saveChanges')
|
||||
}}</Button>
|
||||
</fieldset>
|
||||
<div
|
||||
class="flex flex-wrap items-center gap-3 border-t pt-5"
|
||||
>
|
||||
<Button
|
||||
type="submit"
|
||||
:disabled="
|
||||
form.processing ||
|
||||
isPersistingAcceptanceCriteriaToggle
|
||||
"
|
||||
>{{
|
||||
form.processing
|
||||
? t('ticketForm.saving')
|
||||
: t('ticketDetail.saveChanges')
|
||||
}}</Button
|
||||
>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
:disabled="
|
||||
form.processing ||
|
||||
isPersistingAcceptanceCriteriaToggle ||
|
||||
!isDirty
|
||||
"
|
||||
@click="reset"
|
||||
>{{ t('ticketForm.reset') }}</Button
|
||||
>
|
||||
<p role="status" class="text-muted-foreground text-sm">
|
||||
{{
|
||||
isDirty
|
||||
? t('ticketForm.unsaved')
|
||||
: t('ticketForm.saved')
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user