| 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'); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Estoque
<small>Movimentação Produtos</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">Estoque/Movimentação Produtos</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<!-- /.box-header -->
<div class="box-body movimentacao-produtos">
<table class="table table-bordered table-striped" id="movimentacao-produtos">
<thead>
<tr>
<th width="15%">Data</th>
<th width="30%">Produto</th>
<th width="15%">Localização atual</th>
<th width="15%">Nova Localização</th>
<th width="15%" class="th-action"></th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo date('d/m/Y'); ?></td>
<td>
<select name="produto_id_1" id="produto_id_1" class="form-control select2-movimentacao">
<option></option>
</select>
</td>
<td><span id="local_atual_1"></span></td>
<td>
<input type="text" value="" class="form-control" name="local_novo_1" id="local_novo_1">
</td>
<td>
<button type="button" data-id="1" class="btn btn-primary btn-movimentacao" id="btn-movimentacao-1"><i class="fa fa-btn fa-pencil-alt"></i> Salvar</button>
</td>
</tr>
</tbody>
</table>
</div>
<!-- /.box-body -->
<div class="box-footer">
</div>
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script type="text/javascript">
function loadEvents(){
// $('.select2').select2();
$(".select2-movimentacao").select2({
minimumInputLength: 3,
placeholder: 'Procurar por produto',
language: {
inputTooShort: function(args) {
// args.minimum is the minimum required length
// args.input is the user-typed text
return "Digite pelo menos 2 caracteres";
},
inputTooLong: function(args) {
// args.maximum is the maximum allowed length
// args.input is the user-typed text
return "You typed too much";
},
noResults: function() {
return "Nenhum resultado encontrado";
},
searching: function() {
return "Procurando por resultados...";
},
},
ajax: {
url: '/admin/estoque/buscar-produtos',
dataType: 'json',
type: "POST",
data: function (term) {
return {
term: term
};
},
processResults: function (data, params) {
return {
results: $.map(data, function (item) {
return {
text: item.nome + `( ID Estoque ${item.id})`,
id: item.id,
}
})
};
}
}
});
$('.select2-movimentacao').on('select2:select', function(e){
var data = e.params.data;
var target = $(e.currentTarget).attr('name'); ;
target = target.split("_");
var produto_id = data.id;
$.ajax({
url: '/admin/produto/localizador/' + produto_id,
type: 'GET',
beforeSend:function(){
$('.carregando').fadeIn();
},
success:function(data){
$('.carregando').fadeOut();
$('#local_atual_' + target[2]).text(data.localizador);
console.log('#local_atual_' + target[2]);
console.log(data);
},
error:function(){
$('.carregando').fadeOut();
}
});
});
$('.btn-movimentacao').click(function(e){
var self = this;
var id = $(this).data('id');
var produto_id = $('#produto_id_' + id).val();
var local_novo = $('#local_novo_' + id).val();
$.ajax({
url: '/admin/estoque/movimentacao-produto',
type: 'POST',
data: {produto_id: produto_id, local_novo: local_novo},
beforeSend:function(){
$('.carregando').fadeIn();
},
success:function(data){
$('.carregando').fadeOut();
alertUtil.alertSuccess(data.message);
$('#btn-movimentacao-' + id).attr('disabled', true);
$('#produto_id_' + id).attr('disabled', true);
$('#local_novo_' + id).attr('disabled', true);
renderMovimentacaoProduto(id, data);
},
error:function(){
$('.carregando').fadeOut();
alertUtil.alertError('Erro durante movimentação produto!');
}
});
});
}
function renderMovimentacaoProduto(id, data){
var HTML = '';
id = parseInt(id) + 1;
HTML += '<tr>';
HTML += ' <td>' + data.data_movimentacao + '</td>';
HTML += ' <td>';
HTML += ' <select name="produto_id_' + id + '" id="produto_id_' + id + '" class="form-control select2-movimentacao">';
HTML += ' <option></option>';
<?php
$produtosHTML = "'";
foreach($listaProdutos as $produto):
$produtosHTML .= "<option value=\"{$produto->id}\">".str_replace(["'"], "", $produto->nome)." - {$produto->sku}</option>";
endforeach;
$produtosHTML .= "'";
?>
HTML += <?php echo trim($produtosHTML); ?>;
HTML += ' </select>';
HTML += ' </td>';
HTML += ' <td><span id="local_atual_' + id + '"></span></td>';
HTML += ' <td><input type="text" value="" class="form-control" name="local_novo_' + id + '" id="local_novo_' + id + '"></td>';
HTML += ' <td><button type="button" data-id="' + id + '" class="btn btn-primary btn-movimentacao" id="btn-movimentacao-' + id + '"><i class="fa fa-btn fa-pencil-alt"></i> Salvar</a></td>';
HTML += '</tr>';
$('#movimentacao-produtos').append(HTML);
loadEvents();
}
$(document).ready(function(){
loadEvents();
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make($current_template, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>