@layout('layouts/dashboard')
@set('title', 'Package Dracma')
@section('body')

<div class="grid-menu">
  <div class="content-wrapper">
    @include('partials/dashboard/messages')
    <div style="padding:10px;text-align:center;background-color:rgba(0,0,0,0.2);" class="row text-center py-2 mb-3 justify-content-center">
      <a style="padding:10px;" class="btn btn-primary" href="{{ route('admin.create.packagesdonate') }}">
        Create package Dracma
      </a>
    </div>
    <div class="row">
      <div class="col-lg-12 grid-margin stretch-card">
        <div class="card">
          <div class="card-body">
            <h4 class="card-title">
              Package Dracma
            </h4>
          </div>
          <div class="table-responsive p-4">
            <table style="" class="table table-bordered text-center">
              <thead>
                <tr>
                  <th>Name</th>
                  <th>Value</th>
                  <th>Dracma</th>
                  <th>Bonus</th>
                  <th>Total</th>
                  <th>Paypal</th>
                  <th>Itens</th>
                  <th colspan="3">Actions</th>
                </tr>
              </thead>
              <tbody>
                @each(package in data.rows)
                  <tr>
                    <td style="padding:2px;">{{ package.name }}</td>
                    <td style="padding:2px;">${{ package.price }}</td>
                    <td style="padding:2px;">{{ package.donate }}</td>
                    <td style="padding:2px;">{{ package.percent }}%</td>
                    <td style="padding:2px;">{{ Math.ceil(package.donate + package.donate * package.percent / 100) }}</td>
                    <td style="padding:2px;">{{ package.url }}</td>
                    <td style="padding:2px;" class="p-0 m-0">
                      @if(package.items.length > 0)
                        <div class="row m-0 p-0">
                          @each(item in package.items)
                          <div class="border-right border-left col m-0 py-2">
                            {{ item.slug }}
                          </div>
                          @endeach
                        </div>
                      @else
                      -
                      @endif
                    </td>
                    <td style="padding:0px;" class="m-0 p-0">
                      <a style="padding:0;" href="{{ route('admin.packageitems', { slug: package.slug }) }}" class="m-0 px-3 py-1 btn btn-primary">Itens   </a> </br></br>
                      <a style="padding:0;" href="{{ route('admin.update.packagedonate', { slug: package.slug }) }}" class="m-0 px-3 py-1 btn btn-warning text-dark">Change   </a></br></br>
                      <a style="padding:0;" href="{{ route('auth.admin.delete.packagedonate', { slug: package.slug }) }}" class="m-0 px-3 py-1 btn btn-danger">Delete   </a></br></br>
                    </td>
                    
                  </tr>
                @endeach
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
    @include('partials/dashboard/pagination')
  </div>
  </div>
@end
