<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#instalments{{$id}}">
    <i class="fa fa-info"></i> 
</button>

<div class="modal fade" id="instalments{{$id}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
          <?php 
            $installments=App\Models\Installment::where('transfer_id',$id)->get();
          ?>
          <div class="modal-body">
             <table class="table">
                <tr>
                  <th scope="col">#</th>
                  <th scope="col">number</th>
                  <th scope="col">price</th>
       
                </tr>
              <tbody>
                  @foreach($installments as $installment)
                    <tr>
                      <th scope="row">{{$loop->iteration}}</th>
                      <td>{{$installment->number}}</td>
                      <td>{{formatPrice2($installment->amount)}}</td>
             
                    </tr>
                   @endforeach
              
              </tbody>
            </table>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          </div>
    </div>
  </div>
</div>


@if($status=='pending')
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal{{$id}}">
  add 
</button>


<!-- Modal -->
<div class="modal fade" id="exampleModal{{$id}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
     <form action="{{route('installments.store') }}" method="post"> 
       @csrf
          <div class="modal-body">
                  <input type="hidden" name="transfer_id" value="{{$id}}"/>
                  <div class="form-group">
                      <labale>payment</lable>
                      <input type="number" name="installments" required/>
                  </div>
                  <div class="form-group">
                      <labale>number</lable>
                      <input type="text" name="number" required/>
                  </div>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
            <button type="submit" class="btn btn-primary">Save changes</button>
          </div>
     </form>
    </div>
  </div>
</div>
@endif