@extends('layouts.app')
@section('title', '利用者分類マスタ')

@section('content')
    <!-- Content Header (Page header) -->
    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-lg-6">
                    <h1 class="m-0 text-dark">新規</h1>
                </div><!-- /.col -->
                <div class="col-lg-6">
                    <ol class="breadcrumb float-sm-right text-sm">
                        <li class="breadcrumb-item"><a href="{{route('home')}}">ホーム</a></li>
                        <li class="breadcrumb-item"><a href="{{ route('usertypes') }}">利用者分類マスタ</a></li>
                        <li class="breadcrumb-item active">新規</li>
                    </ol>
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->

    <!-- Main content -->
    <section class="content">
        <div class="container-fluid">
            <!-- SELECT2 EXAMPLE -->

            <div class="row">
                <div class="col-lg-12">
                    <form id="usertype-form" method="post" action="{{ route('usertype_add')}}" enctype="multipart/form-data">
                        @csrf
                        <div class="card">
                            <div class="card-header d-flex justify-content-between">
                                <button type="button" class="btn btn-default btn-sm px-4 register">{{ __('登録') }}</button>
                            </div>
                            @include('admin.usertypes._form',['isEdit'=>0,'isInfo'=>0])
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
    <!-- /.content -->

@endsection

@push('scripts')
<script>
(function ($) {
    $(function () {
        var $form = $('#usertype-form');
        if (!$form.length) {
            return;
        }
        $('.register').on('click', function (e) {
            e.preventDefault();
            if (typeof $.confirm === 'function') {
                $.confirm({
                    title: '確認ダイアログ。',
                    content: '登録してよろしいですか？はい/いいえ',
                    buttons: {
                        ok: {
                            text: 'はい',
                            btnClass: 'btn-primary',
                            keys: ['enter'],
                            action: function () {
                                $form.trigger('submit');
                            }
                        },
                        いいえ: function () {}
                    }
                });
            } else if (window.confirm('登録してよろしいですか？')) {
                $form.trigger('submit');
            }
        });
    });
})(window.jQuery);
</script>
@endpush
