@extends('index')

@section('subtitle')
    Kelola Barcode
@endsection

@section('content')
    <h5> Tambah Barcode </h5>
    <div class="form-tambah">
        <form method="POST" action="{{url('kelola/barcode/tambah')}}" enctype="multipart/form-data">
            {{csrf_field()}}
            <div class="input-group">
                <input type="text" name="isiBarcode" placeholder="Isi Barcode">
            </div>
            <div class="input-group">
                Poin Barcode <input type="number" name="poin" placeholder="Poin">
            </div>
            
            <div class="input-group">
                <input type="submit" value="Tambah">
            </div>
        </form>    
    </div>
    
    <hr>
    
    <h4> Daftar Barcode </h4>
    <table class="table">
      <thead class="thead-dark">
        <tr>
            <th scope="col">Isi Barcode</th>
            <th scope="col"> Status </th>
            <th scope="col">Poin</th>
            <th scope="col">Scanned</th>
            <th scope="col">Action</th>
        </tr>
      </thead>
      <tbody>
         @foreach($barcodes as $barcode)
            <tr>
                <td>{{$barcode->instruksi}}</td>
                <td>{{$barcode->aktif}}</td>
                <td>{{$barcode->poin}}</td>
                <td>{{$barcode->discan}}</td>
                <td>
                    <a href="{{url('kelola/barcode/'.$barcode->id.'/aktifkan')}}" class="btn btn-success">Aktifkan</a>
                    <a href="{{url('kelola/barcode/'.$barcode->id.'/edit')}}" class="btn btn-warning">Edit</a>
                    <a href="{{url('kelola/barcode/'.$barcode->id.'/delete')}}" class="btn btn-danger">Delete</a>
                </td>
            </tr>
        @endforeach
      </tbody>
    </table>
@endsection