@extends('layouts.template')

@section('content')
    @include('components.notification')
    <form action="{{ url('settings') }}" method="POST">
        @method('put')
        @csrf
        <div class="form-group row">
            <div class="col-md-6">
                <label>Default Free Point</label>
                <input type="number" name="point" class="form-control @error('point') is-invalid @enderror"
                    placeholder="Kode Item" value="{{ old('point',$settings->default_point) }}">
                @error('percent')
                    <div class="invalid-feedback">
                        {{ $message }}
                    </div>
                @enderror
            </div>            
            @foreach($categories as $i => $item)
                <div class="col-md-6 mb-3">
                    <label>{{$item->category}}</label>
                    <input type="number" name="percent[]" class="form-control @error('percent.'.$i) is-invalid @enderror"
                        placeholder="Persentase" value="{{ old('percent.'.$i,$item->percent) }}">
                    @error('percent.'.$i)
                        <div class="invalid-feedback">
                            {{ $message }}
                        </div>
                    @enderror
                </div>
            @endforeach
        </div>
        <div class="form-group row">
            <div class="col-md-6 mt-2">
                <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>
            </div>
            </div>
    </form>
    
@endsection
