Код: Выделить всё
/* Evento que abre o modal dinamicamente */
$(document).ready(function() {
$('.btnBatchModal').click(function() {
var cd_regiao = $(this).data("cd-regiao");
var nr_grupo = $(this).data("nr-grupo");
var cd_lote = $(this).data("cd-lote");
var ano_base = $(this).data("ano-base");
var urlBatch = 'show/' + cd_regiao + '/' + nr_grupo + '/' + cd_lote + '/' + ano_base;
$.ajax({
url: urlBatch,
method: "get",
success: function(data) {
var batch = JSON.parse(data);
var formData = null;
$('#tableAssoc').empty();
$('#showBatchHeader h1.modal-title').html('Lote ' + batch.showBatches[0].cd_capa_de_lote +
' - ' + 'Grupo ' + batch.showBatches[0].nr_grupo + '/' + batch.showBatches[0].cd_regiao);
var count = 0;
batch.showBatches.forEach(function(item) {
if (item.nr_cpf == null) {
item.nr_cpf = ' - ';
}
//ABA ASSOCIADOS
var htmlAssoc =
`
${item.nr_cpf}
${item.nr_registro}
${item.nm_associado}
${moment(item.dt_validade).format('DD/MM/YYYY')}
${item.fl_ativo}
`;
$('#tableAssoc').append(htmlAssoc);
count++;
});
//ABA INFORMACOES REGISTRO
$('#qt_inclusao').html(batch.showBatches[0].qt_inclusao);
$('#qt_renovacao').html(batch.showBatches[0].qt_renovacao);
$('#qt_retorno').html(batch.showBatches[0].qt_retorno);
$('#qt_transferido').html(batch.showBatches[0].qt_transferido);
$('#qt_segunda_via').html(batch.showBatches[0].qt_segunda_via);
$('#qt_credencial_pai_responsavel').html(batch.showBatches[0].qt_credencial_pai_responsavel);
$('#qt_credencial_mae').html(batch.showBatches[0].qt_credencial_mae);
//$('#qt_credencial_impressa').html(batch.showBatches[0].qt_credencial_impressa);
//ABA VALORES
$('#vl_desconto').html('R$ ' + batch.showBatches[0].vl_desconto);
$('#vl_cota_registro').html('R$ ' + batch.showBatches[0].vl_cota_registro);
$('#qt_distintivo_anual').html(batch.showBatches[0].qt_distintivo_anual);
$('#vl_distintivo_anual').html('R$ ' + batch.showBatches[0].vl_distintivo_anual);
//METODO DE PAGAMENTO
if (batch.showBatches[0].nr_boleto == null && batch.showBatches[0].dt_confirmacao_cartao == null) {
$('#accordionMtdPagamento').hide();
} else {
$('#accordionMtdPagamento').show();
}
if (batch.showBatches[0].nr_boleto) {
$('#nr_boleto').html(batch.showBatches[0].nr_boleto);
$('#vl_boleto').html('R$ ' + batch.showBatches[0].vl_boleto);
$('#dt_vencimento').html(moment(batch.showBatches[0].dt_vencimento).format('DD/MM/YYYY'));
$('#dt_pagamento').html(moment(batch.showBatches[0].dt_pagamento).format('DD/MM/YYYY'));
if (batch.showBatches[0].nr_parcelas == null) {
$('#nr_parcelas').html(' - ');
} else {
$('#nr_parcelas').html(batch.showBatches[0].nr_parcelas);
}
$('#rowBoleto').show();
$('#rowBoleto1').show();
} else {
$('#rowBoleto').hide();
$('#rowBoleto1').hide();
}
if (batch.showBatches[0].dt_confirmacao_cartao) {
$('#vl_cartao').html('R$ ' + batch.showBatches[0].vl_cartao);
$('#dt_confirmacao_cartao').html(moment(batch.showBatches[0].dt_confirmacao_cartao).format('DD/MM/YYYY'));
$('#rowCartao').show();
} else {
$('#rowCartao').hide();
}
if (batch.showBatches[0].ds_observacao_descontos) {
$('#ds_observacao_descontos').html(batch.showBatches[0].ds_observacao_descontos);
$('#accordionObs').show();
} else {
$('#accordionObs').hide();
}
$('#showBatchModal').modal("show"); //abrir modal
/* Evento que libera os lotes pelo botão */
$('#btnBatchUnlock').click(function(e) {
e.preventDefault();
formData = {
'cd_capa_de_lote': batch.showBatches[0].cd_capa_de_lote,
'nr_grupo': batch.showBatches[0].nr_grupo,
'cd_regiao': batch.showBatches[0].cd_regiao,
'dt_base_calculo': batch.showBatches[0].dt_base_calculo,
}
var urlBatchUnlock;
// $.ajax({
// url: urlBatchUnlock,
// method: "post",
// success: function(data) {}
// });
});
console.log(formData);
$("#showBatchModal").on("hidden.bs.modal", function() {
formData = null;
});
/* Fim evento que libera os lotes pelo botão */
},
});
});
});
/* Fim evento modal */
Подробнее здесь: https://stackoverflow.com/questions/783 ... countering
Мобильная версия