fix(tickets): filtra templates de checklist por empresa selecionada
All checks were successful
All checks were successful
- Remove templates incompativeis quando empresa do ticket muda - Limpa selecao de template ao mudar empresa - Remove texto "(opcional)" do titulo da secao de checklist 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
fffc3f553c
commit
d12dcf9512
1 changed files with 16 additions and 1 deletions
|
|
@ -548,6 +548,21 @@ export function NewTicketDialog({
|
|||
}
|
||||
}, [open, queues, form])
|
||||
|
||||
// Limpar templates de checklist incompatíveis quando a empresa muda
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
if (!checklistTemplates) return
|
||||
if (appliedChecklistTemplateIds.length === 0) return
|
||||
|
||||
const validTemplateIds = new Set(checklistTemplates.map((tpl) => String(tpl.id)))
|
||||
const invalidIds = appliedChecklistTemplateIds.filter((id) => !validTemplateIds.has(id))
|
||||
|
||||
if (invalidIds.length > 0) {
|
||||
setAppliedChecklistTemplateIds((prev) => prev.filter((id) => validTemplateIds.has(id)))
|
||||
setChecklistTemplateToApply("")
|
||||
}
|
||||
}, [open, companyValue, checklistTemplates, appliedChecklistTemplateIds])
|
||||
|
||||
const handleCategoryChange = (value: string) => {
|
||||
const previous = form.getValues("categoryId") ?? ""
|
||||
const next = value ?? ""
|
||||
|
|
@ -1352,7 +1367,7 @@ export function NewTicketDialog({
|
|||
<div>
|
||||
<p className="flex items-center gap-2 text-sm font-semibold text-neutral-900">
|
||||
<ListChecks className="size-4 text-neutral-700" />
|
||||
Checklist (opcional)
|
||||
Checklist
|
||||
</p>
|
||||
<p className="mt-1 text-xs text-neutral-500">
|
||||
Itens obrigatórios bloqueiam o encerramento do ticket até serem concluídos.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue