templates/admin/clientes_edit.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block pageTitle %}{% endblock %}
  3. {% block stylesheets %}
  4.     {{ parent() }}
  5.     <link rel="stylesheet" href="/plugins/dropzone/min/dropzone.min.css">
  6. {% endblock %}
  7. {% block content %}
  8.     <div class="row content-header">
  9.         {% if new==false %}
  10.             <div class="col-md-6"><h1>Editar imóvel #{{ data.id }} {{ data.status==false? '(inativo)': '' }}</h1></div>
  11.         {% else %}
  12.             <div class="col-md-6"><h1>Novo imóvel</h1></div>
  13.         {% endif %}
  14.         <div class="col-md-6 text-right"><a href="{{ path('admin_clientes_lista') }}">Voltar para lista</a></div>
  15.     </div>
  16.     {{ include('default/_flash_messages.html.twig') }}
  17.     {% if new==false %}
  18.         <div class="row">
  19.             <a class="btn btn-app" href="{{ path('admin_inventario_edit',{id:data.id}) }}" alt="Inventário" title="Inventário">
  20.                 <i class="fas fa-tasks"></i> Inventário
  21.             </a>
  22.             <a class="btn btn-app"  href="{{ path('admin_vistoria_list',{id:data.id}) }}" alt="Vistoria" title="Vistoria">
  23.                 <i class="fas fa-check"></i> Vistoria
  24.             </a>
  25.             <a class="btn btn-app" href="{{ path('admin_reserva_list',{id:data.id}) }}" alt="Reservas" title="Reservas">
  26.                 <i class="far fa-calendar-alt"></i> Reservas
  27.             </a>
  28.             <a class="btn btn-app" href="{{ path('admin_ocorrencia_list',{id:data.id}) }}" alt="Ocorrências" title="Ocorrências">
  29.                 <i class="fas fa-exclamation-triangle"></i> Ocorrências
  30.             </a>
  31.         </div>
  32.     {% endif %}
  33.     <div class="card card-primary">
  34.         <!-- /.card-header -->
  35.         <!-- form start -->
  36.         {{ form_start(form) }}
  37.             <div class="card-body">
  38.                 <div class="row">
  39.                     <div class="col-md-4">{{ form_row(form.nome) }}</div>
  40.                     <div class="col-md-4">{{ form_row(form.email) }}</div>
  41.                     <div class="col-md-4">{{ form_row(form.plano) }}</div>
  42.                     <div class="col-md-4">{{ form_row(form.cpf) }}</div>
  43.                     <div class="col-md-4">{{ form_row(form.codStays) }}</div>
  44.                     <div class="col-md-4">{{ form_row(form.celular) }}</div>
  45.                     <div class="col-md-4">{{ form_row(form.cidade) }}</div>
  46.                     <div class="col-md-4">{{ form_row(form.endereco) }}</div>
  47.                     <div class="col-md-4" id="div_contrato">
  48.                         {{ form_row(form.contrato) }}
  49.                         <div id="photo_preview" style="margin-top: -1em; display: inline-block">
  50.                             {% if data.contrato|default(false) %}
  51.                                 <i style="font-size: 34px" class="far fa-file-pdf"></i>
  52.                             {% endif %}
  53.                         </div>
  54.                         <a href="javascript:void(0)" id="change_contrato">Alterar</a>
  55.                         <a href="javascript:void(0)" id="download_pdf">Baixar</a>
  56.                         <a href="javascript:void(0)" id="remove_contrato" style="display: none">Remover</a>
  57.                     </div>
  58.                 </div>
  59.             </div>
  60.             <div class="card-footer row">
  61.                 <div class="col-md-6">
  62.                     <button type="submit" class="btn btn-primary">Salvar</button>
  63.                 </div>
  64.                 <div class="col-md-6 text-right">
  65.                     {% if new==false %}
  66.                         {%  if data.status==1 %}
  67.                             <button type="button" class="btn btn-danger" data-nome="{{ data.nome }}" data-id="{{ data.id }}" id="inativar"><i class="far fa-trash-alt"></i> Inativar</button>
  68.                         {% else %}
  69.                             <button type="button" class="btn btn-success" data-nome="{{ data.nome }}" data-id="{{ data.id }}" id="reativar"><i class="fa fa-plus-circle"></i> Reativar</button>
  70.                         {% endif %}
  71.                     {% endif %}
  72.                 </div>
  73.             </div>
  74.         {{ form_end(form) }}
  75.     </div>
  76.     <div class="modal fade" id="contratosUploadModal">
  77.         <div class="modal-dialog modal-md">
  78.             <div class="modal-content">
  79.                 <div class="modal-header">
  80.                     <h6 class="modal-title"></h6>
  81.                     <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  82.                         <span aria-hidden="true">&times;</span>
  83.                     </button>
  84.                 </div>
  85.                 <div class="modal-body">
  86.                     <form action="{{ path('admin_clientes_contrato')}}?id={{ data.id }}" class="dropzone" id="dropzonewidget" enctype="multipart/form-data"></form>
  87.                 </div>
  88.                 <div class="modal-footer justify-content-between">
  89.                     <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
  90.                 </div>
  91.             </div>
  92.         </div>
  93.     </div>
  94.     <div class="modal fade" id="modalAlert">
  95.         <div class="modal-dialog">
  96.             <div class="modal-content">
  97.                 <div class="modal-header">
  98.                     <h4 class="modal-title">Confirmação</h4>
  99.                     <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  100.                         <span aria-hidden="true">&times;</span>
  101.                     </button>
  102.                 </div>
  103.                 <div class="modal-body">
  104.                     <p></p>
  105.                 </div>
  106.                 <div class="modal-footer justify-content-between">
  107.                     <form method="post" action="{{ data.status==true? path('admin_clientes_inativos_inativar'): path('admin_clientes_inativos_reativar') }}">
  108.                         <input type="hidden" name="id" value="" />
  109.                         <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
  110.                         <button type="submit" class="btn btn-primary">OK</button>
  111.                     </form>
  112.                 </div>
  113.             </div>
  114.         </div>
  115.     </div>
  116. {% endblock %}
  117. {% block scripts %}
  118.     {{ parent() }}
  119.     <script src="/dist/js/adminlte.min.js"></script>
  120.     <script src="/plugins/dropzone/min/dropzone.min.js"></script>
  121.     <script>
  122.         var contrato = '';
  123.         Dropzone.autoDiscover = false;
  124.         $(".dropzone").dropzone({
  125.             addRemoveLinks: true,
  126.             maxFiles: 1,
  127.             acceptedFiles: '.pdf',
  128.             dictDefaultMessage: "Arraste ou selecione seu contrato aqui",
  129.             dictRemoveFile: "Remover",
  130.             removedfile: function(file) {
  131.                 var name = file.name;
  132.                 $('#client_contrato').attr('value','');
  133.                 $('#photo_preview').html('');
  134.                 verifica_contrato();
  135.                 var _ref;
  136.                 return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;
  137.             },
  138.             init: function () {
  139.                 this.on("success", function(file, response) {
  140.                     contrato = response.url;
  141.                     $('#client_contrato').attr('value',response.url);
  142.                     $('#photo_preview').html('<i style="font-size: 34px" class="far fa-file-pdf"></i>');
  143.                     verifica_contrato();
  144.                 });
  145.             }
  146.         });
  147.         jQuery(document).ready(function($) {
  148.             $('body').on('click','#change_contrato', function () {
  149.                 $('#contratosUploadModal').modal();
  150.             });
  151.             $('body').on('click','#download_pdf', function () {
  152.                 window.open($('#client_contrato').val());
  153.             });
  154.             $('body').on('click','#remove_contrato', function () {
  155.                 $('#client_contrato').attr('value','');
  156.                 $('#photo_preview').html('');
  157.                 $('.dz-preview').click();
  158.                 verifica_contrato();
  159.             });
  160.             verifica_contrato();
  161.             $('body').on('click','#inativar', function () {
  162.                 $('#modalAlert [name=id]').val($(this).data('id'));
  163.                 $('#modalAlert .modal-body p').html('Deseja realmente alterar o cliente: <b>'+$(this).data('nome')+'</b> para inativo?');
  164.                 $('#modalAlert').modal();
  165.             });
  166.             $('body').on('click','#reativar', function () {
  167.                 $('#modalAlert [name=id]').val($(this).data('id'));
  168.                 $('#modalAlert .modal-body p').html('Deseja realmente alterar o cliente: <b>'+$(this).data('nome')+'</b> para ativo?');
  169.                 $('#modalAlert').modal();
  170.             });
  171.         });
  172.         function verifica_contrato(){
  173.             if($('#client_contrato').val()!=''){
  174.                 $('#photo_preview').html('<i style="font-size: 34px" class="far fa-file-pdf"></i>');
  175.                 $('#download_pdf').show();
  176.                 $('#change_contrato').html('Alterar');
  177.                 $('#remove_contrato').show();
  178.             }
  179.             else{
  180.                 $('#photo_preview').html('');
  181.                 $('#download_pdf').hide();
  182.                 $('#change_contrato').html('Adicionar');
  183.                 $('#remove_contrato').hide();
  184.             }
  185.         }
  186.     </script>
  187. {% endblock %}