| Server IP : 54.94.228.101 / Your IP : 172.28.20.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'); ?>
<script>
$('.carregando').fadeIn();
</script>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Oferta
<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><a href="<?php echo e(url('admin/oferta/lista')); ?>"><i class="fa fa-dashboard"></i> Ofertas</a></li>
<li class="active">Monitoramento Ofertas</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
</div>
<!-- /.box-header -->
<div class="box-body">
<form method="/" id="formFiltros" type="POST">
<div class="row">
<div class="col-md-12">
<label for="fornecedor_id" class="control-label">FILTROS</label>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="row">
<div class="col-md-12">
<h6>Canal:</h6>
<select id="canal_id" required class="form-control select2" name="canal_id">
<option value="0">Selecione o canal</option>
<?php foreach ($listaCanais as $canal): ?>
<option <?php echo (isset($canal_id) && $canal_id == $canal->id) ? 'selected' : ''; ?> value="<?php echo $canal->id; ?>">
<?php echo e($canal->nome); ?> <?php echo e($canal->subtitulo); ?> (<?php echo date('d/m/Y H:i:s', strtotime($canal->data_inicio))?>)
<?php echo $canal->ativar_url ? ' - Privado' : '';?>
</option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<div class="col-md-3">
<div class="row">
<div class="col-md-12">
<h6>Oferta:</h6>
<input id="oferta" type="text" class="form-control" value="<?php echo isset($pesquisa) ? $pesquisa : ''?>" name="oferta">
</div>
</div>
</div>
<div class="col-md-3">
<div class="row">
<div class="col-md-12">
<h6> </h6>
<button type="button" class="btn btn-primary" id="btn-listar-ofertas">Listar Ofertas</button>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-12">
</div>
</div>
<br>
</form>
<!-- /.row -->
<div class="row">
<fieldset style="float:left; width: 100%" id="field-ofertas" class="hidden">
<legend>Ofertas Vendidas x Estoque</legend>
<div class="row">
<div class="col-md-12">
<button type="button" class="btn btn-danger btn-esgotar-ofertas">Esgotar Ofertas Selecionadas</button>
<br><br>
<table class="table table-bordered table-striped" id="ofertas-lista">
<thead>
<tr>
<th class="no-sort text-center"><input type="checkbox" name="selecionar_todos"/></th>
<th>Nome</th>
<th>Disp. Orig.</th>
<th>Qtde. Vendida</th>
<th>Estoque</th>
<th>Reservas</th>
<th>Diferença</th>
<th class="text-center">Ação</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<button type="button" class="btn btn-danger btn-esgotar-ofertas">Esgotar Ofertas Selecionadas</button>
</div>
</div>
</fieldset>
</div>
</div>
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<div id="modal-evento" class="modal fade">
<form method="/" id="formEvento" type="POST">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 id="time-label"></h4>
</div>
<div class="modal-body" id="conteudo-modal-evento">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
</div>
</div>
</div>
</form>
</div>
<script>
function esgotarOferta(id_oferta){
ajustarEstoqueOferta(id_oferta);
}
function ajustarEstoqueOferta(id_oferta){
var id_canal = $('#canal_id').val();
var ofertas_selecionadas = [];
ofertas_selecionadas.push(id_oferta);
$.ajax({
url:'/admin/oferta/monitoramento-ajustar-estoque',
type:'POST',
data:{
ids_oferta : ofertas_selecionadas, id_canal : id_canal
},
beforeSend:function(){
$('.carregando').fadeIn();
},
success:function(data){
if (data.status) {
alertUtil.alertSuccess(data.message);
setTimeout(function() {
listarOfertas();
}, 1000);
}else{
alertUtil.alertWarning(data.message);
}
$('.carregando').fadeOut();
}
});
}
function listarOfertas(){
var canal_id = $('#canal_id').val();
if(canal_id == 0){
alertUtil.alertWarning('Campo "Canal" Obrigatório');
}else{
$.ajax({
url: '/admin/oferta/monitoramento-lista-ofertas',
type: 'POST',
data: $('#formFiltros').serialize(), // serializes the form's elements.
dataType: 'json',
beforeSend:function(){
$('.carregando').fadeIn();
$('#field-ofertas').removeClass('hidden');
},
success:function(data){
$('.carregando').fadeOut();
$('#ofertas-lista tbody').html(data.html);
},
error:function(){
$('.carregando').fadeOut();
alertUtil.alertError('Erro durante listagem ofertas!');
}
});
}
}
$('[name="selecionar_todos"]').click(function(){
if($(this).is(':checked')){
$('[name="item_oferta[]"]').prop('checked', true);
}else{
$('[name="item_oferta[]"]').prop('checked', false);
}
});
$('#btn-listar-ofertas').click(function(e){
listarOfertas();
});
$('.btn-esgotar-ofertas').click(function(e){
var ofertas_selecionadas = [];
$('[name="item_oferta[]"]:checked').each(function(){
ofertas_selecionadas.push($(this).val());
});
var id_canal = $('#canal_id').val();
if(ofertas_selecionadas.length > 0){
$.ajax({
url:'/admin/oferta/monitoramento-ajustar-estoque',
type:'POST',
data:{
ids_oferta : ofertas_selecionadas, id_canal : id_canal
},
beforeSend:function(){
$('.carregando').fadeIn();
},
success:function(data){
if (data.status) {
alertUtil.alertSuccess(data.message);
setTimeout(function() {
listarOfertas();
}, 1000);
}else{
alertUtil.alertWarning(data.message);
}
$('.carregando').fadeOut();
}
});
}else{
alertUtil.alertError('Você deve selecionar ao menos uma oferta');
}
});
$(document).ready(function(){
<?php if(isset($_GET['canal_id'])): ?>
listarOfertas();
<?php endif; ?>
$('.select2').select2();
$('.carregando').fadeOut();
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make($current_template, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>