<form action="{{ route('member.update', $data->id) }}" method="POST">
    @csrf
    @method('PUT')
    <div class="form-group row">
        <div class="col-md-6">
            <label>Nama Member</label>
            <input type="text" name="nama" class="form-control @error('nama') is-invalid @enderror"
                placeholder="Nama Member" value="{{ old('nama', $data->nama) }}">
            @error('nama')
                <div class="invalid-feedback">
                    {{ $message }}
                </div>
            @enderror
        </div>
        <div class="col-md-6">
            <label>Email Member</label>
            <input type="text" name="email" class="form-control @error('email') is-invalid @enderror"
                placeholder="Email Member" value="{{ old('email', $data->email) }}">
            @error('email')
                <div class="invalid-feedback">
                    {{ $message }}
                </div>
            @enderror
        </div>
    </div>
    <div class="form-group row">
        <div class="col-md-6">
            <label>No Telepon Member</label>
            <input type="number" name="phone" class="form-control @error('phone') is-invalid @enderror"
                placeholder="No Telepon Member" value="{{ old('phone', $data->phone) }}">
            @error('phone')
                <div class="invalid-feedback">
                    {{ $message }}
                </div>
            @enderror
        </div>
        <div class="col-md-6">
            <label for="">Tanggal Lahir</label>
            <div class="input">
                <!--<span class="fa fa-calendar mr-2"></span>-->
                <input type="date" class="form-control @error('tgl_lahir') is-invalid @enderror"
                    id="tgl_lahir" name="tgl_lahir" value="{{ old('tgl_lahir',$data->tgl_lahir) }}"
                    placeholder="Tanggal Lahir">
            </div>
            @error('tgl_lahir')
                <div class="invalid-feedback">
                    {{ $message }}
                </div>
            @enderror
            <br>
        </div>
        <div class="col-md-6">
            <label>Gerai</label>
            <select class="form-control @error('id_branch') is-invalid @enderror" name="id_branch">
                <option value=''>---Pilih Gerai---</option>
                @foreach($branch as $item)
                    <option value='{{$item->id}}' {{old('id_branch',$data->id_branch) == $item->id ? 'selected' : ''}}>{{$item->cabang}}</option>
                @endforeach
            </select>
            @error('id_branch')
                <div class="invalid-feedback">
                    {{ $message }}
                </div>
            @enderror
        </div>
        <div class="col-md-6">
            <label for="">Poin</label>
            <div class="input">
                <!--<span class="fa fa-calendar mr-2"></span>-->
                <input type="number" class="form-control @error('poin') is-invalid @enderror"
                    id="poin" name="poin" value="{{ old('poin',$data->poin) }}"
                    placeholder="Point">
            </div>
            @error('poin')
                <div class="invalid-feedback">
                    {{ $message }}
                </div>
            @enderror
            <br>
        </div>
        <div class="col-md-6">
            <label>Kategori Member</label>
            <select class="select2 form-control @error('category_id') is-invalid @enderror" name="category_id">
                <option value=''>---Pilih Kategori---</option>
                @foreach($categories as $item)
                    <option value='{{$item->id}}' {{old('category_id',$data->category_id) == $item->id ? 'selected' : ''}}>{{$item->category}} ({{$item->percent}}%)</option>
                @endforeach
            </select>
            @error('category_id')
                <div class="invalid-feedback">
                    {{ $message }}
                </div>
            @enderror
        </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>
