feat: Remove PDF field and upload functionality from ata creation and update.

This commit is contained in:
2025-12-04 09:00:57 -03:00
parent 7746dce25a
commit 2cdf66375c
3 changed files with 1 additions and 34 deletions

View File

@@ -38,7 +38,6 @@
);
// Document state
let mainPdfFile: File | null = $state(null);
let attachmentFiles: File[] = $state([]);
let attachments = $state<Array<{ _id: Id<'atasDocumentos'>; nome: string; url: string | null }>>(
[]
@@ -73,7 +72,6 @@
selectedObjetos = [];
attachments = [];
}
mainPdfFile = null;
attachmentFiles = [];
searchObjeto = '';
showModal = true;
@@ -111,19 +109,13 @@
}
saving = true;
try {
let pdfStorageId = undefined;
if (mainPdfFile) {
pdfStorageId = await uploadFile(mainPdfFile);
}
const payload = {
numero: formData.numero,
numeroSei: formData.numeroSei,
empresaId: formData.empresaId as Id<'empresas'>,
dataInicio: formData.dataInicio || undefined,
dataFim: formData.dataFim || undefined,
objetosIds: selectedObjetos,
pdf: pdfStorageId
objetosIds: selectedObjetos
};
let ataId: Id<'atas'>;
@@ -189,13 +181,6 @@
return empresas.find((e) => e._id === id)?.razao_social || 'Empresa não encontrada';
}
function handleFileSelect(e: Event) {
const input = e.target as HTMLInputElement;
if (input.files && input.files.length > 0) {
mainPdfFile = input.files[0];
}
}
function handleAttachmentsSelect(e: Event) {
const input = e.target as HTMLInputElement;
if (input.files && input.files.length > 0) {
@@ -372,19 +357,6 @@
/>
</div>
</div>
<div class="mb-4">
<label class="mb-2 block text-sm font-bold text-gray-700" for="pdf">
PDF da Ata {editingId ? '(Deixe em branco para manter o atual)' : ''}
</label>
<input
class="focus:shadow-outline w-full appearance-none rounded border px-3 py-2 leading-tight text-gray-700 shadow focus:outline-none"
id="pdf"
type="file"
accept=".pdf"
onchange={handleFileSelect}
/>
</div>
</div>
<div class="flex flex-col">

View File

@@ -62,7 +62,6 @@ export const create = mutation({
dataInicio: v.optional(v.string()),
dataFim: v.optional(v.string()),
empresaId: v.id('empresas'),
pdf: v.optional(v.id('_storage')),
numeroSei: v.string(),
objetosIds: v.array(v.id('objetos'))
},
@@ -76,7 +75,6 @@ export const create = mutation({
empresaId: args.empresaId,
dataInicio: args.dataInicio,
dataFim: args.dataFim,
pdf: args.pdf,
criadoPor: user._id,
criadoEm: Date.now(),
atualizadoEm: Date.now()
@@ -102,7 +100,6 @@ export const update = mutation({
empresaId: v.id('empresas'),
dataInicio: v.optional(v.string()),
dataFim: v.optional(v.string()),
pdf: v.optional(v.id('_storage')),
objetosIds: v.array(v.id('objetos'))
},
handler: async (ctx, args) => {
@@ -115,7 +112,6 @@ export const update = mutation({
empresaId: args.empresaId,
dataInicio: args.dataInicio,
dataFim: args.dataFim,
pdf: args.pdf,
atualizadoEm: Date.now()
});

View File

@@ -7,7 +7,6 @@ export const atasTables = {
dataInicio: v.optional(v.string()),
dataFim: v.optional(v.string()),
empresaId: v.id('empresas'),
pdf: v.optional(v.id('_storage')),
numeroSei: v.string(),
criadoPor: v.id('usuarios'),
criadoEm: v.number(),