<form action="{{ route('transaction.store') }}" method="POST">
    @csrf
    <div class="form-group row">
        <div class="col-md-6">
            <label>No Nota</label>
            <input type="text" name="trx_code" class="form-control @error('trx_code') is-invalid @enderror"
                placeholder="No Nota" value="{{ old('trx_code') }}">
            @error('trx_code')
                <div class="invalid-feedback">
                    {{ $message }}
                </div>
            @enderror
        </div>
        <div class="col-md-6">
            <label>Nama Member</label>
            <select type="text" name="id_cust" class="form-control select2 @error('id_cust') is-invalid @enderror">
                <option value="">---Pilih Member---</option>
                @foreach ($data as $item)
                    <option value="{{ $item->id }}">{{$item->poin}} Point - {{ $item->phone .' - '. $item->nama }}</option>
                @endforeach
            </select>
            @error('id_cust')
                <div class="invalid-feedback">
                    {{ $message }}
                </div>
            @enderror
        </div>
    </div>
    <div class="form-group row">
        <div class="col-md-6">
            <div class="row">
                <div class="col-md-8">
                    <label>Nominal Transaksi</label>
                    <input type="number" id="amount" onkeyup="getPoin()" name="amount" class="form-control @error('amount') is-invalid @enderror"
                        placeholder="Nominal Transaksi" value="{{ old('amount') }}">
                    @error('poin')
                        <div class="invalid-feedback">
                            {{ $message }}
                        </div>
                    @enderror
                </div>
                <div class="col-md-4">
                    <label>Persentase</label>
                    <input type="number" id="persentase" onkeyup="getPoin()" name="persentase" class="form-control @error('persentase') is-invalid @enderror"
                        placeholder="Persentase" value="{{ old('persentase',$persentase->percent) }}">
                    @error('persentase')
                        <div class="invalid-feedback">
                            {{ $message }}
                        </div>
                    @enderror
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <label>Poin Member</label>
            <input type="number" name="poin" id="poin_member" class="form-control @error('poin') is-invalid @enderror"
                placeholder="Poin Member" value="{{ old('poin') }}">
            @error('poin')
                <div class="invalid-feedback">
                    {{ $message }}
                </div>
            @enderror
        </div>
        <div class="col-md-3">
            <label>Pilih Tipe</label>
            <select name="tipe" id="" class="form-control select2">
                <option value="">---Pilih Tipe---</option>
                <option value="0">Penambahan</option>
                <option value="1">Pengurangan</option>
            </select>
        </div>
    </div>
    <div class="form-group row">
        <div class="col-md-6">
            <label>Tanggal Transaksi</label>
            <input type="date" name="tgl_trx" class="form-control @error('tgl_trx') is-invalid @enderror"
                placeholder="Tanggal Transaksi" value="{{ old('tgl_trx') }}">
            @error('tgl_trx')
                <div class="invalid-feedback">
                    {{ $message }}
                </div>
            @enderror
        </div>
        <div class="col-md-6">
            <label>Cabang</label>
            <select type="text" name="id_branch" class="form-control select2 @error('id_branch') is-invalid @enderror">
                <option value="">---Pilih Cabang---</option>
                @foreach ($cabang as $item)
                    <option value="{{ $item->id }}">{{ $item->cabang }}</option>
                @endforeach
            </select>
            @error('id_branch')
                <div class="invalid-feedback">
                    {{ $message }}
                </div>
            @enderror
        </div>
    </div>
    </div>


    <button type="submit" class="btn btn-primary mr-2"><i class="fa fa-save"></i> Simpan</button>
    <button type="reset" class="btn btn-default"><i class="fa fa-times"></i> Reset</button>
</form>
