feat: Remove PDF field and upload functionality from ata creation and update.
This commit is contained in:
@@ -38,7 +38,6 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Document state
|
// Document state
|
||||||
let mainPdfFile: File | null = $state(null);
|
|
||||||
let attachmentFiles: File[] = $state([]);
|
let attachmentFiles: File[] = $state([]);
|
||||||
let attachments = $state<Array<{ _id: Id<'atasDocumentos'>; nome: string; url: string | null }>>(
|
let attachments = $state<Array<{ _id: Id<'atasDocumentos'>; nome: string; url: string | null }>>(
|
||||||
[]
|
[]
|
||||||
@@ -73,7 +72,6 @@
|
|||||||
selectedObjetos = [];
|
selectedObjetos = [];
|
||||||
attachments = [];
|
attachments = [];
|
||||||
}
|
}
|
||||||
mainPdfFile = null;
|
|
||||||
attachmentFiles = [];
|
attachmentFiles = [];
|
||||||
searchObjeto = '';
|
searchObjeto = '';
|
||||||
showModal = true;
|
showModal = true;
|
||||||
@@ -111,19 +109,13 @@
|
|||||||
}
|
}
|
||||||
saving = true;
|
saving = true;
|
||||||
try {
|
try {
|
||||||
let pdfStorageId = undefined;
|
|
||||||
if (mainPdfFile) {
|
|
||||||
pdfStorageId = await uploadFile(mainPdfFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
numero: formData.numero,
|
numero: formData.numero,
|
||||||
numeroSei: formData.numeroSei,
|
numeroSei: formData.numeroSei,
|
||||||
empresaId: formData.empresaId as Id<'empresas'>,
|
empresaId: formData.empresaId as Id<'empresas'>,
|
||||||
dataInicio: formData.dataInicio || undefined,
|
dataInicio: formData.dataInicio || undefined,
|
||||||
dataFim: formData.dataFim || undefined,
|
dataFim: formData.dataFim || undefined,
|
||||||
objetosIds: selectedObjetos,
|
objetosIds: selectedObjetos
|
||||||
pdf: pdfStorageId
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let ataId: Id<'atas'>;
|
let ataId: Id<'atas'>;
|
||||||
@@ -189,13 +181,6 @@
|
|||||||
return empresas.find((e) => e._id === id)?.razao_social || 'Empresa não encontrada';
|
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) {
|
function handleAttachmentsSelect(e: Event) {
|
||||||
const input = e.target as HTMLInputElement;
|
const input = e.target as HTMLInputElement;
|
||||||
if (input.files && input.files.length > 0) {
|
if (input.files && input.files.length > 0) {
|
||||||
@@ -372,19 +357,6 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
|
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ export const create = mutation({
|
|||||||
dataInicio: v.optional(v.string()),
|
dataInicio: v.optional(v.string()),
|
||||||
dataFim: v.optional(v.string()),
|
dataFim: v.optional(v.string()),
|
||||||
empresaId: v.id('empresas'),
|
empresaId: v.id('empresas'),
|
||||||
pdf: v.optional(v.id('_storage')),
|
|
||||||
numeroSei: v.string(),
|
numeroSei: v.string(),
|
||||||
objetosIds: v.array(v.id('objetos'))
|
objetosIds: v.array(v.id('objetos'))
|
||||||
},
|
},
|
||||||
@@ -76,7 +75,6 @@ export const create = mutation({
|
|||||||
empresaId: args.empresaId,
|
empresaId: args.empresaId,
|
||||||
dataInicio: args.dataInicio,
|
dataInicio: args.dataInicio,
|
||||||
dataFim: args.dataFim,
|
dataFim: args.dataFim,
|
||||||
pdf: args.pdf,
|
|
||||||
criadoPor: user._id,
|
criadoPor: user._id,
|
||||||
criadoEm: Date.now(),
|
criadoEm: Date.now(),
|
||||||
atualizadoEm: Date.now()
|
atualizadoEm: Date.now()
|
||||||
@@ -102,7 +100,6 @@ export const update = mutation({
|
|||||||
empresaId: v.id('empresas'),
|
empresaId: v.id('empresas'),
|
||||||
dataInicio: v.optional(v.string()),
|
dataInicio: v.optional(v.string()),
|
||||||
dataFim: v.optional(v.string()),
|
dataFim: v.optional(v.string()),
|
||||||
pdf: v.optional(v.id('_storage')),
|
|
||||||
objetosIds: v.array(v.id('objetos'))
|
objetosIds: v.array(v.id('objetos'))
|
||||||
},
|
},
|
||||||
handler: async (ctx, args) => {
|
handler: async (ctx, args) => {
|
||||||
@@ -115,7 +112,6 @@ export const update = mutation({
|
|||||||
empresaId: args.empresaId,
|
empresaId: args.empresaId,
|
||||||
dataInicio: args.dataInicio,
|
dataInicio: args.dataInicio,
|
||||||
dataFim: args.dataFim,
|
dataFim: args.dataFim,
|
||||||
pdf: args.pdf,
|
|
||||||
atualizadoEm: Date.now()
|
atualizadoEm: Date.now()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ export const atasTables = {
|
|||||||
dataInicio: v.optional(v.string()),
|
dataInicio: v.optional(v.string()),
|
||||||
dataFim: v.optional(v.string()),
|
dataFim: v.optional(v.string()),
|
||||||
empresaId: v.id('empresas'),
|
empresaId: v.id('empresas'),
|
||||||
pdf: v.optional(v.id('_storage')),
|
|
||||||
numeroSei: v.string(),
|
numeroSei: v.string(),
|
||||||
criadoPor: v.id('usuarios'),
|
criadoPor: v.id('usuarios'),
|
||||||
criadoEm: v.number(),
|
criadoEm: v.number(),
|
||||||
|
|||||||
Reference in New Issue
Block a user