how to solve the modal problem by taking the last id

Asked

Viewed 79 times

-3

          <div class="panel-body">
              <table class="table table-striped task-table">
                  <thead>

                      <th class="col-sm-1">Sistema</th>
                      <th class="col-sm-1">Usuario</th>
                      <th class="col-sm-1">Label</th>
                      <th class="col-sm-2">Descrição</th>
                      <th class="col-sm-1">Atualizar</th>
                      <th class="col-sm-2">Data Cadastro</th>
                      <th class="col-sm-1">Situação</th>
                      <th class="col-sm-2">Ações</th>
                  </thead>
                  <tbody>
                      @if (count($versoes) > 0)
                          @foreach ($versoes as $versao)
                              <tr>
                                  <td>{{ $versao->sistema->descricao }}</td>
                                  <td>{{ $versao->usuario->usuario}}</td>
                                  <td>{{ $versao->label }}</td>
                                  <td>{{ $versao->descricao }}</td>
                                  <td>@if($versao->atualiza_db==0){{{'Não'}}}@else{{{'Sim'}}}@endif</td>
                                  <td>{{ $versao->data_versao }}</td>
                                  <td>@if($versao->situacao==0){{{'Inativo'}}}
                                      @elseif($versao->situacao==1){{{'Ativa Para Atualização'}}}
                                      @elseif($versao->situacao==2){{{'Em Desenvolvimento'}}}
                                      @elseif($versao->situacao==3){{{'Aguardando Teste'}}}
                                      @endif
                                    </td>

                                  <td>
                                  <form action="{{ route('v1.versoes.delete', $versao->id) }}" method="post">
                                  {!! csrf_field() !!}
                                  {!! method_field('delete') !!}
                                   <a rel="tooltip" href="{{ route('v1.versoes.editar', $versao->id) }}" data-original-title="Editar" title="Editar" style="float: right;
                                        margin-top: -2px;
                                        margin-right:30px;">
                                    <i class="fas fa-edit fa-2x"></i>
                                    <div class="ripple-container"></div>
                                  </a>
                                  <a rel="tooltip" data-original-title="Subir" title="Upload da Versão" style="float: right;
                                        margin-top: -2px;
                                        margin-right:5px;" data-id="{{ $versao->id }}" class="botao"data-toggle="modal" data-target="#myModal">
                                    <i class="fas fa-folder-plus fa-2x"></i>
                                    <div class="ripple-container"></div>
                                  </a>

                                  <button type="submit" data-original-title="Excluir" title="Excluir">
                                      <i class="fas fa-trash"></i>
                                      <div class="ripple-container"></div>
                                  </button>
                              </form>
                                  </td>
                              </tr>
                          @endforeach
                      @else
                          <tr><td colspan="7">Nenhum evento encontrado.</td></tr>
                      @endif
                  </tbody>
              </table>
          </div>
       </div>
     </div>
   </div>

     <!-- Modal -->
     <div class="modal fade" id="myModal" tabindex="-1" {{$versao->id}} role="dialog" aria-labelledby="myModalLabel">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="myModalLabel">Upload da Versão</h4>
          </div>
          <div class="modal-body">
          {{$versao->id}}
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            <button type="button" class="btn btn-primary">Upload</button>
          </div>
        </div>
      </div>
    </div>
  • Please [Dit] the question and elaborate a [mcve]. The way it is it is impossible to measure anything about the problem, because the question consists only of random HTML code.

  • it’s because I created the modal only that I put it out of the loop it takes the last one and if you put it inside the loop takes the first one

  • But there’s no tie to your question :(

  • it is pq would get too big the code

  • And that’s why we always request a [mcve], not the full code.

  • edited there, in pure php I’ve already used modal more with ta Aravel being the first time

  • I think documentation of modal bootstrap can help you, you will need to work on the events that the modal component triggers.

  • I don’t know exactly where your problem is and what you intend to do. Only the code won’t help me understand your situation.

Show 3 more comments

1 answer

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.