att transf

This commit is contained in:
2026-03-18 10:17:16 -03:00
parent e8445fcf2f
commit 60a17ce6d9
10 changed files with 2586 additions and 1100 deletions
@@ -52,6 +52,7 @@ $(document).ready(function () {
if ($("#formMode").val() == "VIEW") {
showAndBlock(["all"]);
$("#btnConsultarChaveNfe").prop("disabled", true).hide();
updateConferenciaNfeVisibility($("#activity").val());
} else {
//show the right fields
var activity = $("#activity").val();
@@ -140,10 +141,11 @@ $(document).ready(function () {
}
updt_line();
} else if (activity == 18) {
if ($("justificativaValidaProblema") != "") {
showAndBlock([0, 4, 6, 24, 57, 31]);
var campoJustificativaProblema = $("#justificativaValidaProblema");
if (campoJustificativaProblema.length && campoJustificativaProblema.val() != "") {
showAndBlock([0, 4, 6, 24, 31, 57]);
} else {
showAndBlock([0, 4, 6, 31]);
showAndBlock([0, 4, 6, 31, 57]);
}
$("#userValidacaoItens").val($("#currentUserName").val());
$("#dataValidacaoItens").val(requestDate[0] + " - " + requestDate[1]);
@@ -186,6 +188,8 @@ $(document).ready(function () {
}
updt_line();
}
updateConferenciaNfeVisibility(activity);
}
formatarMoedasTabela("preco___");
@@ -197,6 +201,7 @@ $(document).ready(function () {
invisibleBtnUpload("fdAnexo_Coleta");
invisibleBtnUpload("fdAnexo_Entrega");
invisibleBtnUpload("fdAnexo_recebimento");
initAttachmentPlugins();
processarConferenciaNfe();
// gerarTabelaCotacaoIndica("tabelaCotacaoIndica", "tabelaItens");
@@ -494,6 +499,70 @@ function applySelectedMotoristaEntregaOption() {
$("#tipoMotoristaEntregaOutro").prop("checked", true);
}
function updateConferenciaNfeVisibility(activity) {
var activityValue = String(activity || $("#activity").val() || "");
var exibirConferencia = (activityValue === "6" || activityValue === "18");
$("#blocoConferenciaNfe").toggle(exibirConferencia);
}
var ATTACHMENT_PLUGIN_CONFIG = {
fnAnexo_Nfe: {
filename: "Nota Fiscal",
accept: ".pdf,.xml,image/*"
},
fdAnexo_Coleta: {
filename: "Comprovante de Coleta",
accept: ".pdf,image/*"
},
fdAnexo_Entrega: {
filename: "Comprovante de Entrega",
accept: ".pdf,image/*"
},
fdAnexo_recebimento: {
filename: "Comprovante de Recebimento",
accept: ".pdf,image/*"
}
};
function initAttachmentPlugins() {
var mode = getFormMode();
var allowedInputs = getAllowedAttachmentInputs();
var hasPlugin = typeof $.fn.fluigFormAttachment === "function";
if (!hasPlugin) {
console.warn("fluigFormAttachment.js nao carregado; campos de anexo sem botoes de upload.");
return;
}
Object.keys(ATTACHMENT_PLUGIN_CONFIG).forEach(function (inputId) {
var cfg = ATTACHMENT_PLUGIN_CONFIG[inputId];
var input = $("#" + inputId);
if (!input.length) return;
var canUploadHere = (mode !== "VIEW" && allowedInputs.indexOf(inputId) >= 0);
try {
if (!input.data("fluigFormAttachment")) {
input.fluigFormAttachment({
filename: cfg.filename,
accept: cfg.accept,
showActionButton: canUploadHere
});
} else {
input.fluigFormAttachment("filename", cfg.filename);
}
if (canUploadHere) {
input.fluigFormAttachment("showActionButton");
} else {
input.fluigFormAttachment("hideActionButton");
}
} catch (e) {
console.error("Falha ao inicializar anexo '" + inputId + "':", e);
}
});
}
function normalizeNfeKey(value) {
return String(value == null ? "" : value).replace(/\D/g, "").substring(0, 44);
}
@@ -952,6 +1021,12 @@ var beforeSendValidate = function (numState, nextState) {
if ($("#dataColeta").val() == "") {
throw "'Data da coleta' é obrigatória.";
}
if ($("#fdAnexo_Coleta").val() == "") {
throw "'Anexo da Coleta' é obrigatório.";
}
if (invalidFile("fdAnexo_Coleta")) {
throw "O arquivo informado em 'Anexo da Coleta' não foi encontrado na aba de anexos.";
}
var tipoMotoristaEntrega31 = $("input[name='tipoMotoristaEntrega']:checked").val();
if (!tipoMotoristaEntrega31) {
throw "Informe quem vai fazer a entrega (mesmo motorista da coleta ou outro).";