| Server IP : 54.94.228.101 / 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/storage/framework/views/ |
Upload File : |
<?php $__env->startSection('content'); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Adegas Divergentes
<small>Listagem</small>
</h1>
<ol class="breadcrumb">
<li><a href="<?php echo e(url('admin')); ?>"><i class="fa fa-dashboard"></i> Dashboard</a></li>
<li class="active">Adegas Divergentes</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<button type="button" class="btn btn-primary" id="btn-atualizar-adegas"><i class="fa fa-fw fa-sync"></i> Atualizar Adegas</button>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-3">
<?php echo count($adegas) . " registro(s) encontrado(s)"; ?>
</div>
<div class="col-md-9">
<div class="row">
<form class="pull-right relatorio-pedidos-filtros" action="<?php echo url('admin/adega/divergente'); ?>" method="GET">
<div class="col-md-4">
</div>
<div class="col-md-4">
Data:
<input value="<?php echo (isset($_GET['term_data_inicio'])) ? $_GET['term_data_inicio'] : '' ?>" type="date" name="term_data_inicio">
a
<input value="<?php echo (isset($_GET['term_data_fim'])) ? $_GET['term_data_fim'] : '' ?>" type="date" name="term_data_fim">
</div>
<div class="col-md-4">
Cliente/Adega:
<input type="hidden" name="filtro" value="<?php echo (isset($_GET['filtro'])) ? $_GET['filtro'] : '' ?>">
<input value="<?php echo (isset($_GET['term'])) ? $_GET['term'] : '' ?>" type="text" name="term">
<button class="btn btn-primary">Buscar</button>
</div>
</form>
</div>
</div>
</div>
<table id="data-table" class="table table-bordered table-striped">
<thead>
<tr>
<th class="no-sort"><input type="checkbox" name="selecionar_todos"/></th>
<th>ID</th>
<th>Data Abertura</th>
<th>Status</th>
<th>Cliente</th>
<th>Observações</th>
<th>Quantidade Pedidos (Real)</th>
<th>Quantidade Produtos (Real)</th>
<th>Valor Total (Real)</th>
<th class="th-action">Ação</th>
</tr>
</thead>
<tbody>
<?php foreach ($adegas as $item): ?>
<?php $qtde_produtos = (!empty($item->qtde_produtos) ? $item->qtde_produtos : 0) + (!empty($item->qtde_produtos_combo) ? $item->qtde_produtos_combo : 0);
$qtde_produtos = number_format($qtde_produtos, 0, '','');
?>
<tr>
<td class="no-sort"><input type="checkbox" name="item_adega[]" value="<?php echo $item->id; ?>"/></td>
<td><?php echo $item->id; ?></td>
<td>
<?php
$dataAbertura = date_create_from_format('Y-m-d H:i:s', $item->data_abertura);
echo $item->data_abertura ? date_format($dataAbertura, 'd/m/Y H:i') : '-';
?>
</td>
<td><?php echo ($item->status == 'A') ? 'Aberta' : 'Fechada'; ?></td>
<td><a href="<?php echo e(url('admin/cadastro/detalhe/' . $item->cliente_slug)); ?>" target="_blank"><?php echo $item->nome . " " . $item->sobrenome; ?></a></td>
<td><?php echo $item->observacoes; ?></td>
<td><span id="adega_quantidade_pedidos_<?php echo $item->id;?>"><?php echo $item->quantidade_pedidos; ?> <?php echo ($item->quantidade_pedidos != $item->qtde_pedidos ? "<span class='red-label'>({$item->qtde_pedidos})</span>" : ''); ?></span></td>
<td><span id="adega_quantidade_produtos_<?php echo $item->id;?>"><?php echo $item->quantidade_produtos; ?> <?php echo ($item->quantidade_produtos != $qtde_produtos ? "<span class='red-label'>({$qtde_produtos})</span>" : ''); ?></span></td>
<td><span id="adega_valor_total_<?php echo $item->id;?>"><?php echo $item->valor_total; ?> <?php echo ($item->valor_total != $item->total_pedidos ? "<span class='red-label'>({$item->total_pedidos})</span>" : ''); ?></span></td>
<td>
<?php if($current_role->hasAccess($current_module->nome_tabela.'.update')){ ?>
<button type="button" class="btn btn-primary btn-sm btn-atualizar-adega" data-adega-id="<?php echo e($item->id); ?>" data-cliente-id="<?php echo e($item->id_cliente); ?>"><i class="fa fa-fw fa-sync"></i> Atualizar Adega</button>
<?php } ?>
</td>
</tr>
<?php endforeach ?>
</tbody>
<tfoot>
<tr>
<th class="no-sort"></th>
<th>ID</th>
<th>Data Abertura</th>
<th>Status</th>
<th>Cliente</th>
<th>Observações</th>
<th>Quantidade Pedidos (Real)</th>
<th>Quantidade Produtos (Real)</th>
<th>Valor Total (Real)</th>
<th class="th-action">Ação</th>
</tr>
</tfoot>
</table>
<div class="text-center">
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
</div>
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<script type="text/javascript">
$(document).on('click', '.btn-atualizar-adega', function(){
var id_adega = $(this).data('adega-id');
var id_cliente = $(this).data('cliente-id');
var $button = $(this);
$.ajax({
url:'/admin/adega/atualiza-adega',
type:'POST',
data : {id_adega : id_adega, id_cliente : id_cliente},
beforeSend:function(){
$('.carregando').fadeIn();
},
success:function(data){
$('.carregando').fadeOut();
if(data.status){
alertUtil.alertSuccess(data.message);
$button.hide();
$('#adega_quantidade_pedidos_' + id_adega).text(data.quantidade_pedidos);
$('#adega_quantidade_produtos_' + id_adega).text(data.quantidade_produtos);
$('#adega_valor_total_' + id_adega).text(data.valor_total);
}else{
alertUtil.alertWarning(data.message);
}
}
});
});
$('#btn-atualizar-adegas').click(function(e){
if(!confirm('Você tem certeza?')){
e.preventDefault();
}else{
var adegas_selecionadas = [];
$('[name="item_adega[]"]:checked').each(function(){
adegas_selecionadas.push($(this).val());
});
if(adegas_selecionadas.length > 0){
$.ajax({
url:'/admin/adega/atualiza-adegas',
type:'POST',
data:{
ids_adega:adegas_selecionadas
},
beforeSend:function(){
$('.carregando').fadeIn();
},
success:function(data){
if (data.status) {
alertUtil.alertSuccess(data.message);
setTimeout(function(){
window.location.href = window.location.href;
}, 1500);
}else{
alertUtil.alertWarning(data.message);
}
$('.carregando').fadeOut();
}
});
}else{
alertUtil.alertError('Você deve selecionar ao menos uma adega');
}
}
});
$('[name="selecionar_todos"]').click(function(){
if($(this).is(':checked')){
$('[name="item_adega[]"]').prop('checked', true);
}else{
$('[name="item_adega[]"]').prop('checked', false);
}
});
</script>
<!-- /.content-wrapper -->
<?php $__env->stopSection(); ?>
<?php echo $__env->make($current_template, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>