<?php $__env->startSection('titulo', 'Painel Produtos'); ?>
<?php $__env->startSection('conteudo'); ?>
  <style type="text/css">
    .btnremove {
      margin-top: -180px;
      margin-left: 30px;
      width: 100px;
      height: 30px;
      padding: 0;
      border: 0 none;
      background: transparent;
      color: transparent;
    }
    .btnremove:hover {
      visibility: visible;
      filter: opacity(75%) !important;
    }
  </style>
  <div class="content">
    <div class="container-fluid">
      <div class="row">
        <div class="col-lg-12">
          <div class="card">
            <div class="card-header border-0">
              <div class="d-flex justify-content-between">

                <?php if(Route::is('admin.manProdutos')): ?>
                  <h3 class="card-title">Editar Produto</h3>
                  <?php
                    $prod = $produtos->first();
                  ?>
                <?php else: ?>
                  <h3 class="card-title">Cadastrar Produto</h3>
                <?php endif; ?>
              </div>
            </div>
            <div class="card-body">
              <form id="formManProd" name="formManProd" novalidate="novalidate" action="<?php echo e(route('admin.saveprod')); ?>"
                    method="POST" enctype="multipart/form-data">

                <div class="card">
                  <div class="card-body">
                    <?php echo e(csrf_field()); ?>

                    <div class="row">
                      <input type="hidden" name="codigo" value="<?php echo e(isset($prod->codigo)  ? $prod->codigo : ''); ?>"/>

                      <div class="col-2">
                        <label>Descrição</label>
                      </div>
                      <div class="col">
                        <input class="form-control form-control-sm" type="text" name="descricao"
                               value="<?php echo e($prod->descricao  ?? ''); ?>">
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-2">
                        <label>Descrição Detalhada</label>
                      </div>
                      <div class="col">

<textarea class="form-control" id="story" name="descrideta" rows="5" cols="33">
<?php echo e($prod->descrideta  ?? ''); ?>

</textarea>
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-2">
                        <label>Estoque</label>
                      </div>
                      <div class="col">
                        <input class="form-control form-control-sm" type="text" name="estoqueeco"
                               value="<?php echo e(formataValor($prod->estoqueeco ?? '0', 13,3) ?? '0,000'); ?>">
                      </div>
                      <div class="col-2">
                        <label>Preço</label>
                      </div>
                      <div class="col">
                        <input class="form-control form-control-sm" type="text" name="precoeco"
                               value="<?php echo e(formataValor($prod->precoeco ?? '0', 13,3) ?? '0,000'); ?>">
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-2">
                        <label>Largura(cm)</label>
                      </div>
                      <div class="col">
                        <?php if(Route::is('admin.manProdutos')): ?>
                          <input class="form-control form-control-sm" type="text" name="largura"
                                 value="
<?php echo e(substr($prod->dimeneco,strpos($prod->dimeneco, 'L')+1,(strpos($prod->dimeneco, 'X')-strpos($prod->dimeneco, 'L')-1)) ?? ''); ?>

                                   ">
                        <?php else: ?>
                          <input class="form-control form-control-sm" type="text" name="largura" value="">
                        <?php endif; ?>
                      </div>
                      <div class="col-2">
                      <label>Altura(cm)</label>
                      </div>
                      <div class="col">
                        <?php if(Route::is('admin.manProdutos')): ?>
                          <input class="form-control form-control-sm" type="text" name="altura"
                                 value="
<?php echo e(substr($prod->dimeneco,strpos($prod->dimeneco, 'A')+1,(strpos($prod->dimeneco, 'P')-1-strpos($prod->dimeneco, 'A')-1))  ?? ''); ?>

                                   ">
                        <?php else: ?>
                          <input class="form-control form-control-sm" type="text" name="altura" value="">
                        <?php endif; ?>
                      </div>
                      <div class="col-2">
                        <label>Comprimento(cm)</label>
                      </div>
                      <div class="col">
                        <?php if(Route::is('admin.manProdutos')): ?>
                          <input class="form-control form-control-sm" type="text" name="comprimento"
                                 value="
<?php echo e(substr($prod->dimeneco,strpos($prod->dimeneco, 'P')+1,(strpos($prod->dimeneco, 'X')-strpos($prod->dimeneco, 'L')-1)) ?? ''); ?>

                                   ">
                        <?php else: ?>
                          <input class="form-control form-control-sm" type="text" name="comprimento" value="">
                        <?php endif; ?>
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-2">
                        <label>Entrega Gratis</label>
                      </div>
                      <div class="col">
                        <?php if(Route::is('admin.manProdutos')): ?>
                          <?php if($prod->entfreeeco == 1): ?>
                            <input class="form-control-sm" type="checkbox" name="entfreeeco" checked>
                          <?php else: ?>
                            <input class="form-control-sm" type="checkbox" name="entfreeeco">
                          <?php endif; ?>
                        <?php else: ?>
                          <input class="form-control-sm" type="checkbox" name="entfreeeco">
                        <?php endif; ?>
                      </div>
                      <div class="col-2">
                        <label>Destacar Produto</label>
                      </div>
                      <div class="col">
                        <?php if(Route::is('admin.manProdutos')): ?>
                          <?php if($prod->destproeco == 1): ?>
                            <input class="form-control-sm" type="checkbox" name="destproeco" checked>
                          <?php else: ?>
                            <input class="form-control-sm" type="checkbox" name="destproeco">
                          <?php endif; ?>
                        <?php else: ?>
                          <input class="form-control-sm" type="checkbox" name="destproeco">
                        <?php endif; ?>
                      </div>
                      <div class="col-2">
                        <label>Exibir Produto</label>
                      </div>
                      <div class="col">
                        <?php if(Route::is('admin.manProdutos')): ?>
                          <?php if($prod->exproeco == 1): ?>
                            <input class="form-control-sm" type="checkbox" name="exproeco" checked>
                          <?php else: ?>
                            <input class="form-control-sm" type="checkbox" name="exproeco">
                          <?php endif; ?>
                        <?php else: ?>
                          <input class="form-control-sm" type="checkbox" name="exproeco">
                        <?php endif; ?>
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-2">
                        <label>Imagem</label>
                      </div>
                      <div class="col">
                        <div class="input-group input-group-sm ">
                          <div class="custom-file small">
                            <input type="file" id="inputGroupFile04" name="caminho">
                          </div>
                        </div>
                      </div>
                    </div>
                    <br>
                    <div class="row">
                      <?php $__currentLoopData = $imagens; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $img): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php if(isset($img->codigo)): ?>
                          <div class="" style="height: 150px; width: 150px; margin-left: 3px; margin-top: 3px">
                            <a class="">
                              <img src="<?php echo e(asset($img->caminho ?? '' )); ?>"
                                   class="img-thumbnail"
                                   style="height: 150px; width: 150px; margin: 2px; border: 1px solid"
                                   alt="<?php echo e($prod->descricao ?? ''); ?>"
                                   data-toggle="modal" data-target="">
                              <button class="btn btn-sm btn-danger btnremove" type="button" data-toggle="modal"
                                      data-target="#modalDel<?php echo e($img->codseq??''); ?>">remover
                              </button>
                            </a>
                          </div>
                        <?php endif; ?>
                        
                        <div class="modal fade" id="modalDel<?php echo e($img->codseq??''); ?>" tabindex="-1"
                             role="dialog" aria-labelledby="modalDel<?php echo e($img->codseq??''); ?>"
                             aria-hidden="true">
                          <div class="modal-dialog modal-dialog" role="document">
                            <div class="modal-content">
                              <div class="modal-header text-right">
                                <h5 class="text-center">Deseja realmente excluir está foto?</h5>
                              </div>
                              <div class="modal-body">
                                <div class="card">
                                  <p></p>
                                  <div style="text-align: center;" class="align-content-center">
                                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button>
                                    <button type="button" class="btn btn-danger"
                                            onclick="location.href = '<?php echo e(route('admin.deleteFoto',['id' => $img->codigo??''  , 'seq'=> $img->seq??'', 'caminho'=>$img->caminho??'', 'codprod'=>$prod->codigo??'', 'tipo' => $img->tipo??''])); ?>'">
                                      Excluir
                                    </button>
                                  </div>
                                  <p></p>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                  </div>
                </div>
                <div class="row ">
                  <div class="col justify-content-center">
                    <button type="button" class="btn btn-secondary form-control-sm" onclick="location.href='<?php echo e(route('admin.produtos')); ?>'">Fechar</button>
                    <button type="submit" class="btn btn-success form-control-sm" id="btnModal">Salvar</button>
                  </div>

                </div>


              </form>
            </div>

          </div>
          <!-- /.card -->
        </div>
      </div>
      <!-- /.row -->
    </div>
    <!-- /.container-fluid -->
  </div>
<?php $__env->stopSection(); ?>



<?php echo $__env->make('painel.template.Layout.padrao', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\projects\lara\projectwix\resources\views/painel/produtos/manproduto.blade.php ENDPATH**/ ?>