@extends('admin.layouts.app')

@section('content')
<div class="container-fluid">
    <h2>경험치</h2>
    <hr/>
    @include('admin.messages')
    @include('admin.config.setting.navTabs')

    <form name="f_admin_write" id="fAdminWrite" method="post" action="{{ route('admin.config.setting.exp.store') }}" enctype="multipart/form-data">
        @csrf
        <div class="row mb-3">
            <label for="useExp" class="col-sm-2">경험치 기능</label>
            <div class="col-sm-10">
                <div class="form-check">
                    <input type="checkbox" name="use_exp" id="useExp" class="form-check-input" value="1" {{ config('use_exp') ? 'checked' : '' }} />
                    <label for="useExp" class="form-check-label">
                        사용합니다.
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="expRegister" class="col-sm-2 col-form-label">회원가입 시 경험치</label>
            <div class="col-sm-10 form-inline">
                <input type="text" name="exp_register" id="expRegister" class="form-control only-digits-input" value="{{ config('exp_register') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="expLogin" class="col-sm-2 col-form-label">로그인 시 경험치</label>
            <div class="col-sm-10">
                <div class="form-inline">
                    <input type="text" name="exp_login" id="expLogin" class="form-control only-digits-input" value="{{ config('exp_login') }}" />
                </div>
                <div class="form-text text-muted">하루에 한번 적용</div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="expRecommended" class="col-sm-2 col-form-label">회원가입 시 추천인에게 경험치</label>
            <div class="col-sm-10 form-inline">
                <input type="text" name="exp_recommended" id="expRecommended" class="form-control only-digits-input" value="{{ config('exp_recommended') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="expRecommender" class="col-sm-2 col-form-label">추천인 존재 시 가입자에게 경험치</label>
            <div class="col-sm-10">
                <div class="form-inline">
                    <input type="text" name="exp_recommender" id="expRecommender" class="form-control only-digits-input" value="{{ config('exp_recommender') }}" />
                </div>
                <div class="form-text text-muted">회원가입 경험치와 별도로 적용됩니다.</div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="expAttendance" class="col-sm-2 col-form-label">출석 시 경험치</label>
            <div class="col-sm-10">
                <div class="form-inline">
                    <input type="text" name="exp_attendance" id="expAttendance" class="form-control only-digits-input" value="{{ config('exp_attendance') }}" />
                </div>
                <div class="form-text text-muted">하루에 한번 적용</div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="expPoll" class="col-sm-2 col-form-label">설문조사 시 경험치</label>
            <div class="col-sm-10">
                <div class="form-inline">
                    <input type="text" name="exp_poll" id="expPoll" class="form-control only-digits-input" value="{{ config('exp_poll') }}" />
                </div>
                <div class="form-text text-muted">설문조사당 한번 적용</div>
            </div>
        </div>
        <hr/>
        <div class="form-group text-end">
            <button type="submit" class="btn btn-success">저장하기</button>
        </div>
    </form>
</div>

<script type="module">
$("#fAdminWrite").validate({
    rules: {
        exp_register: {required: true, number: true},
        exp_login: {required: true, number: true},
        exp_recommended: {required: true, number: true},
        exp_recommender: {required: true, number: true},
        exp_attendance: {required: true, number: true},
        exp_poll: {required: true, number: true}
    }
});
</script>
@endsection
