| Server IP : 54.233.248.239 / Your IP : 172.28.1.13 Web Server : Apache System : Linux ip-172-28-29-189 6.5.0-1014-aws #14~22.04.1-Ubuntu SMP Thu Feb 15 15:27:06 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.2.34-43+ubuntu22.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/vinumday2_0/app/Modules/Confraria/Views/admin/ |
Upload File : |
<div class="minha-conta__right">
<div class="box">
<div class="spacer"></div>
<?php if(count($pagamentos)){ ?>
<div class="content-table">
<?php $tamanho = count($pagamentos); ?>
<?php foreach ($pagamentos as $key => $pagamento): ?>
<table class="tabela pagamento-item" data-pagamento="<?php echo $pagamento->id; ?>">
<?php if ($key == 0): ?>
<tr>
<th>Data</th>
<th>Pedido</th>
<th class="text-center">Qtd</th>
<th>Pagamento</th>
<th class="text-right">Valor</th>
<th class="text-center">Situação</th>
<th></th>
<th>Ação</th>
</tr>
<?php endif ?>
<tr style="<?php echo $key+1 == $tamanho ? '' : 'border-bottom:2px solid #e1e1e1;'; ?>">
<td width="15%"><?php echo strtoupper(strftime('%d %b %y', strtotime($pagamento->data_fechamento))); ?></td>
<td width="10%">
<?php if($pagamento->pedidoEntrega){ ?>
<a target="_blank" href="<?php echo url('admin/pedido-entrega/edit/'.$pagamento->pedidoEntrega->id); ?>"><?php echo $pagamento->pedidoEntrega->id; ?></a>
<?php }else{ ?>
<a target="_blank" href="<?php echo url('admin/pedido-venda/edit/'.$pagamento->id); ?>"><?php echo $pagamento->id; ?></a>
<?php } ?>
</td>
<td class="text-center" width="15%">
<?php if($pagamento->pedidoEntrega){ ?>
FRETE
<?php }else{ ?>
<?php echo $pagamento->nr_ofertas; ?> Un.
<?php } ?>
</td>
<td width="20%" class="comprovante-item">
<?php if($pagamento->transacao_id){ ?>
<?php echo ucfirst($pagamento->transaction->getCard()->brand); ?> *<?php echo $pagamento->transaction->getCard()->last_digits; ?>
<?php }else{ ?>
<?php echo $pagamento->tipo; ?>
<?php if($pagamento->comprovante){ ?>
<a target="_blank" class="comprovante" href="<?php echo get_file_s3($pagamento->comprovante, 'pedido-venda/comprovante'); ?>">Ver Comprovante</a>
<?php }elseif($pagamento->id_status_pedido_venda == 1){ ?>
Aguardando comprovante
<?php } ?>
<?php } ?>
</td>
<td class="valor text-right" width="15%">R$ <?php echo number_format($pagamento->total,2,',','.'); ?></td>
<td class="text-center status" width="15%">
<?php
echo ($pagamento->pedidoEntregaStatus && $pagamento->pedidoEntregaStatus->nome == 'Cancelado') ? 'Cancelado' : $pagamento->status->nome;
?>
</td>
<td width="5%">
<?php if($pagamento->pedidoEntrega){ ?>
<div class="tooltip">
<i class="fa fa-truck"></i>
<div class="tooltiptext">
Valor Frete
</div>
</div>
<?php }else{ ?>
<i class="fa fa-plus-circle ver-detalhes-pagamento"></i>
<?php } ?>
</td>
<td class="acao" width="5%">
<?php if ($pagamento->id_status_pedido_venda == 1): ?>
<button type="button" data-id="<?php echo $pagamento->id; ?>" class="btn btn-success btn-sm registrar-pagamento" data-toggle="modal" data-target="#modal-registrar-pagamento">Registrar Pagamento</button>
<button type="button" data-id="<?php echo $pagamento->id; ?>" data-status-id="5" class="btn btn-danger btn-sm cancelar-pedido">Cancelar</button>
<?php endif ?>
</td>
</tr>
</table>
<div class="detalhes-pagamento">
</div>
<?php endforeach ?>
<div class="text-center">
</div>
</div>
<?php }else{ ?>
<div class="spacer">
<h4><i>Você não possui pagamentos.</i></h4>
</div>
<?php } ?>
</div>
</div>
<script>
$(document).on('click', '.ver-detalhes-pagamento', function(){
pagamentoItem = $(this).closest('.pagamento-item');
$.ajax({
url:'/perfil/detalhes-pagamento',
type:'POST',
data:{
id:pagamentoItem.data('pagamento')
},
beforeSend:function(){
},
success:function(data){
if(data.status){
//console.log(data.html);
pagamentoItem.next().html(data.html);
pagamentoItem.next().slideDown();
pagamentoItem.find('i').removeClass('fa-plus-circle');
pagamentoItem.find('i').addClass('fa-minus-circle');
pagamentoItem.find('.ver-detalhes-pagamento').addClass('esconder-detalhes');
pagamentoItem.find('.ver-detalhes-pagamento').removeClass('ver-detalhes-pagamento');
}else{
alertUtil.alertError(data.message);
}
},
error:function(data){
alertUtil.alertError('Erro ao ver os detalhes do pagamento. Tente novamente mais tarde.');
}
});
});
$(document).on('click', '.esconder-detalhes', function(){
pagamentoItem = $(this).closest('.pagamento-item');
pagamentoItem.next().slideUp();
pagamentoItem.find('i').removeClass('fa-minus-circle');
pagamentoItem.find('i').addClass('fa-plus-circle');
pagamentoItem.find('.esconder-detalhes').addClass('expandir-detalhes');
pagamentoItem.find('.esconder-detalhes').removeClass('esconder-detalhes');
});
$(document).on('click', '.expandir-detalhes', function(){
pagamentoItem = $(this).closest('.pagamento-item');
pagamentoItem.next().slideDown();
pagamentoItem.find('i').removeClass('fa-plus-circle');
pagamentoItem.find('i').addClass('fa-minus-circle');
pagamentoItem.find('.expandir-detalhes').addClass('esconder-detalhes');
pagamentoItem.find('.expandir-detalhes').removeClass('expandir-detalhes');
});
$(document).on('click', '.enviarComprovanteButton', function(e){
e.preventDefault();
$(this).next().trigger('click');
});
$('[name="enviar-comprovante"]').change(function(){
var td = $(this).closest('td');
var form = new FormData($(this).closest('.form-comprovante')[0]);
form.append('fileUpload', $(this)[0].files[0]);
$.ajax({
url:'/perfil/enviar-comprovante',
type:'POST',
processData: false,
contentType: false,
data:form,
beforeSend:function(){
$('.carregando').fadeIn();
},
success:function(data){
if(data.status){
td.find('a').attr('href', data.url);
td.find('a').html('Ver comprovante');
td.find('a').removeClass('enviarComprovanteButton');
alertUtil.alertSuccess(data.message);
}else{
alertUtil.alertError(data.message);
}
$('.carregando').fadeOut();
},
error:function(data){
alertUtil.alertError('Erro ao processar a compra. Tente novamente mais tarde.');
}
});
});
</script>