att
This commit is contained in:
+80
-49
@@ -13,61 +13,91 @@ function validateForm(form) {
|
||||
|
||||
switch (atividade) {
|
||||
case EMISSAO:
|
||||
|
||||
// log.info("Abertura de Chamado CAERN - Área do Solicitante: " + form.getValue("areaSolicitante"));
|
||||
// if (form.getValue("areaSolicitante") == "") {
|
||||
// message += getMessage("Área do Solicitante", 2, form);
|
||||
// hasErros = true;
|
||||
// }
|
||||
|
||||
log.info("Por favor, anexar a nota fiscal" + form.getValue("fnAnexo_Nfe"));
|
||||
if (form.getValue("fnAnexo_Nfe") == "") {
|
||||
message += getMessage("Nota Fiscal", 3, form);
|
||||
log.info("Validando rastreabilidade da emissao da NFe");
|
||||
var chaveNfe = String(form.getValue("chaveNfe") || "").replace(/\D/g, "");
|
||||
if (chaveNfe == "") {
|
||||
message += getMessage("Chave de acesso da NFe", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
|
||||
// var tabelaAnexos = form.getChildrenIndexes("tabelaAnexoOcorrencia")
|
||||
|
||||
// if (tabelaAnexos.length > 0) {
|
||||
|
||||
// for (var i = 0; i < tabelaAnexos.length; i++) {
|
||||
|
||||
// if (form.getValue("fnAnexoOcorrencia" + "" + tabelaAnexos[i]) == null || form.getValue("fnAnexoOcorrencia" + "" + tabelaAnexos[i]) == "") {
|
||||
// message += getMessage("Anexo " + tabelaAnexos[i], 1, form)
|
||||
// hasErros = true;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// } else {
|
||||
|
||||
// message += getMessage("A tabela de Anexos esta vazia", 0, form)
|
||||
// hasErros = true;
|
||||
|
||||
// }
|
||||
|
||||
break;
|
||||
|
||||
if (chaveNfe != "" && chaveNfe.length != 44) {
|
||||
message += "Campo \"Chave de acesso da NFe\" deve conter 44 digitos.<br>";
|
||||
hasErros = true;
|
||||
}
|
||||
if (form.getValue("invoiceIdNfeConsulta") == "") {
|
||||
message += "Consulte a chave da NFe antes de enviar esta etapa.<br>";
|
||||
hasErros = true;
|
||||
}
|
||||
var qtdDivergenciasNfe = parseInt(String(form.getValue("qtdDivergenciasNfe") || "0"), 10);
|
||||
if (!isNaN(qtdDivergenciasNfe) && qtdDivergenciasNfe > 0) {
|
||||
message += "Existem " + qtdDivergenciasNfe + " divergencia(s) entre a solicitacao e a NFe.<br>";
|
||||
hasErros = true;
|
||||
}
|
||||
if (form.getValue("usuarioEmissorNfe") == "") {
|
||||
message += getMessage("Usuário emissor da NFe", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
if (form.getValue("dataEmissaoNfe") == "") {
|
||||
message += getMessage("Data da emissão", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case COLETA:
|
||||
log.info("Por favor, registre o momento da coleta" + form.getValue("fdAnexo_Coleta"));
|
||||
if (form.getValue("fdAnexo_Coleta") == "") {
|
||||
message += getMessage("Coleta", 3, form);
|
||||
hasErros = true;
|
||||
}
|
||||
log.info("Validando dados da coleta");
|
||||
if (form.getValue("motoristaColetaNome") == "") {
|
||||
message += getMessage("Motorista responsável pela coleta", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
if (form.getValue("dataColeta") == "") {
|
||||
message += getMessage("Data da coleta", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
var tipoMotoristaEntregaColeta = String(form.getValue("tipoMotoristaEntrega") || "");
|
||||
if (tipoMotoristaEntregaColeta == "") {
|
||||
message += getMessage("Quem vai fazer a entrega", 2, form);
|
||||
hasErros = true;
|
||||
}
|
||||
if (tipoMotoristaEntregaColeta == "outro" && form.getValue("motoristaEntregaLogin") == "") {
|
||||
message += getMessage("Selecionar outro motorista", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
if (tipoMotoristaEntregaColeta == "mesmo" && form.getValue("motoristaColetaLogin") == "") {
|
||||
message += getMessage("Login do motorista da coleta", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case ENTREGA:
|
||||
log.info("Por favor, registre o momento da entrega" + form.getValue("fdAnexo_Entrega"));
|
||||
if (form.getValue("fdAnexo_Entrega") == "") {
|
||||
message += getMessage("Entrega", 3, form);
|
||||
hasErros = true;
|
||||
}
|
||||
log.info("Validando dados da entrega");
|
||||
if (form.getValue("motoristaEntregaLogin") == "") {
|
||||
message += getMessage("Motorista da entrega definido na coleta", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
if (form.getValue("motoristaEntregaNome") == "") {
|
||||
message += getMessage("Motorista responsável pela entrega", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
if (form.getValue("dataEntrega") == "") {
|
||||
message += getMessage("Data da entrega", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case RECEBIMENTO:
|
||||
log.info("Por favor, registre o recebimento do material" + form.getValue("fdAnexo_recebimento"));
|
||||
if (form.getValue("fdAnexo_recebimento") == "") {
|
||||
message += getMessage("Recebimento", 3, form);
|
||||
hasErros = true;
|
||||
}
|
||||
log.info("Validando recebimento e conferencia dos itens");
|
||||
var validacaoItens = String(form.getValue("validacaoItens") || "");
|
||||
if (validacaoItens == "") {
|
||||
message += getMessage("Validação do recebimento", 2, form);
|
||||
hasErros = true;
|
||||
}
|
||||
if (
|
||||
(validacaoItens == "divergencia" || validacaoItens == "naoEntregue" || validacaoItens == "incorreto") &&
|
||||
form.getValue("justificativaDecisaoItens") == ""
|
||||
) {
|
||||
message += getMessage("Descreva a divergência encontrada", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -99,4 +129,5 @@ function getMessage(texto, tipo, form) {
|
||||
} else {
|
||||
return 'A quantidade existente de campos "' + texto + '" deve ser maior do que 0.'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user