@extends('layouts.app')
@section('title', '[東京都|〇〇駐輪場]利用者マスタ')
@section('content')
    <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')}}">XX様info(ホーム)</a></li>
                        <li class="breadcrumb-item"><a href="./index3.html">[東京都|〇〇駐輪場]</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">
                    <div class="card">
                        <div class="card-header">
                            <h3 class="card-title">{{__('絞り込み')}}</h3>
                        </div>
                        <div class="card-body">
                            <form action="{{route('users')}}" method="post" id="list-form">
                                <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                <input type="hidden" value="{{$sort}}" name="sort" id="sort">
                                <input type="hidden" value="{{$sort_type}}" name="sort_type" id="sort_type">
                                <div class="row">
                                    <div class="form-group col-4">
                                        <label>{{__('利用者ID')}}</label>
                                        <div class="input-group">
                                            <input type="text" class="form-control"
                                                   placeholder="123456" id="user_id"
                                                   name="user_id" value="{{$user_id}}"/>
                                        </div>
                                    </div><!-- /.form group -->
                                    <div class="form-group col-4">
                                        <label>{{__('validation.attributes.member_id')}}</label>
                                        <div class="input-group">
                                            <input type="text" class="form-control"
                                                   placeholder="123456"
                                                   id="member_id"
                                                   name="member_id" value="{{$member_id}}"/>
                                        </div>
                                    </div><!-- /.form group -->
                                    <div class="form-group col-4">
                                        <label>{{__('validation.attributes.user_tag_serial')}}</label>
                                        <div class="input-group">
                                            <input type="text" class="form-control"
                                                   placeholder="{{__('キーワード…')}}"
                                                   id="user_tag_serial" name="user_tag_serial"
                                                   value="{{$user_tag_serial}}"/>
                                        </div>
                                    </div><!-- /.form group -->
                                    <div class="form-group col-4">
                                        <label>{{__('フリガナ（あいまい検索）')}}</label>
                                        <div class="input-group">
                                            <input type="text" class="form-control"
                                                   placeholder="{{__('キーワード…')}}"
                                                   id="user_phonetic"
                                                   name="user_phonetic" value="{{$user_phonetic}}"/>
                                        </div>
                                    </div><!-- /.form group -->
                                    <div class="form-group col-4">
                                        <label>{{__('validation.attributes.phone')}}</label>
                                        <div class="input-group">
                                            <input type="text" class="form-control"
                                                   placeholder="{{__('012-3456-7890')}}" id="phone"
                                                   name="phone"
                                                   value="{{$phone}}"/>
                                        </div>
                                    </div><!-- /.form group -->
                                    <div class="form-group col-4">
                                        <label>{{__('validation.attributes.crime_prevention_registration_number')}}</label>
                                        <div class="input-group">
                                            <input type="text" class="form-control"
                                                   placeholder="{{__('validation.attributes.crime_prevention_registration_number')}}"
                                                   id="crime" name="crime" value="{{$crime}}"/>
                                        </div>
                                    </div><!-- /.form group -->
                                </div>
                                <input type="submit" class="btn btn-default" value="{{__('絞り込みを実行')}}">
                            </form>
                        </div>
                    </div>
                </div>

                <div class="container-fluid mb20">
                    <button type="submit" class="btn btn-sm btn-default mr10" id="delete">{{__('削除')}}</button>
                    <button type="submit" class="btn btn-sm btn-default mr10" id="import_csv"
                            action="{{route('users_import')}}">{{__('インポート')}}</button>
                    <button type="submit" class="btn btn-sm btn-default mr10" id="export_csv"
                            action="{{route('users_export')}}">{{__('CSV出力')}}</button>
                    {{ $list->appends(['sort' => $sort,'sort_type'=>$sort_type])->links('pagination') }}
                </div>
                <div class="form col-lg-12">
                    @if(Session::has('success'))
                        <div class="alert alert-success alert-dismissible" role="alert">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            {!! Session::get('success') !!}
                        </div>
                    @elseif(Session::has('error'))
                        <div class="alert alert-danger alert-dismissible">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            <h4><i class="icon fa fa-ban"></i> {{__('誤差')}}:</h4>
                            {!! Session::get('error') !!}
                        </div>
                    @elseif(isset($errorMsg))
                        <div class="alert alert-danger alert-dismissible">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            <h4><i class="icon fa fa-ban"></i> {{__('誤差')}}:</h4>
                            {!! $errorMsg !!}
                        </div>
                    @endif
                </div>
                <div class="col-lg-12 row sample03-wrapper no_padding_right mb20">
                    <div class="col-xl-2 col-lg-2 col-md-2 col-sm-3 col-xs-3 table_left">
                        <form action="{{route('users_delete')}}" method="post" id="form_delete">
                            <input type="hidden" name="_token" value="{{ csrf_token() }}">
                            <table class="table dataTable">
                                <thead>
                                <tr>
                                    <th>
                                        <input type="checkbox" class="minimal m-0" id="checkbox_all">
                                    </th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $item)
                                    <tr role="row">
                                        <td>
                                            <input type="checkbox" class="minimal m-0 checkbox"
                                                   value="{{$item->user_seq}}" name="seq[]">
                                            <div class="btn_action">
                                                {{--<a href="{{route('user_add')}}" class="btn btn-sm btn-default">詳細</a>--}}
                                                <a href="{{route('user_info',['seq'=>$item->user_seq])}}"
                                                   class="btn btn-sm btn-default ml10">{{__('編集')}}</a>
                                            </div>
                                        </td>

                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </form>
                    </div>
                    <div class="col-lg-10 col-xl-10 col-md-10 col-sm-9 col-xs-9 table_right no_padding_right">
                        <div class="scroll">
                            <table class="table dataTable">
                                <thead>
                                <tr>
                                    <th class="sorting @if($sort=="user_seq"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_seq"><span>{{__('validation.attributes.user_seq')}}</span>
                                    </th>
                                    <th class="sorting @if($sort=="user_id"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_id"><span>{{__('validation.attributes.user_id')}}</span></th>

                                    <th class="sorting @if($sort=="member_id"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="member_id"><span>{{__('validation.attributes.member_id')}}</span>
                                    </th>
                                    <th><span>{{__('validation.attributes.user_pass')}}</span></th>
                                    <th><span>{{__('validation.attributes.user_manual_regist_flag')}}</span></th>
                                    <th><span>{{__('validation.attributes.user_mailing_flag')}}</span></th>
                                    <th class="sorting @if($sort=="contract_number"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="contract_number">
                                        <span>{{__('validation.attributes.contract_number')}}</span></th>
                                    <th class="sorting @if($sort=="user_tag_serial"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_tag_serial">
                                        <span>{{__('validation.attributes.user_tag_serial')}}</span></th>
                                    <th class="sorting @if($sort=="user_tag_serial_64"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_tag_serial_64">
                                        <span>{{__('validation.attributes.user_tag_serial_64')}}</span></th>
                                    <th class="sorting @if($sort=="qr_code"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="qr_code"><span>{{__('validation.attributes.qr_code')}}</span></th>
                                    <th class="sorting @if($sort=="tag_qr_flag"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="tag_qr_flag">
                                        <span>{{__('validation.attributes.tag_qr_flag')}}</span>
                                    </th>
                                    <th class="sorting @if($sort=="user_aid"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_aid"><span>{{__('validation.attributes.user_aid')}}</span>
                                    </th>
                                    {{--<th class="sorting @if($sort=="user_park_number"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"--}}
                                    {{--sort="user_park_number">--}}
                                    {{--<span>{{__('validation.attributes.user_park_number')}}</span></th>--}}
                                    <th class="sorting @if($sort=="user_place_qrid"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_place_qrid">
                                        <span>{{__('validation.attributes.user_place_qrid')}}</span></th>
                                    <th class="sorting @if($sort=="user_categoryid"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_categoryid">
                                        <span>{{__('validation.attributes.user_categoryid')}}</span></th>
                                    <th class="sorting @if($sort=="user_name"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_name">
                                        <span>{{__('validation.attributes.user_name')}}</span></th>
                                    {{--<th class="sorting @if($sort=="user_phonetic"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"--}}
                                    {{--sort="user_phonetic">--}}
                                    {{--<span>{{__('validation.attributes.user_phonetic')}}</span></th>--}}
                                    <th>
                                        <span>{{__('validation.attributes.user_gender')}}</span>
                                    </th>
                                    <th class="sorting @if($sort=="user_birthdate"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_birthdate">
                                        <span>{{__('validation.attributes.user_birthdate')}}</span></th>
                                    <th class="sorting @if($sort=="user_age"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_age">
                                        <span>{{__('validation.attributes.user_age')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_mobile')}}</span>
                                    </th>
                                    <th class="sorting @if($sort=="user_homephone"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_homephone">
                                        <span>{{__('validation.attributes.user_homephone')}}</span></th>
                                    <th class="sorting @if($sort=="user_primemail"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_primemail">
                                        <span>{{__('validation.attributes.user_primemail')}}</span></th>
                                    <th class="sorting @if($sort=="user_submail"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_submail">
                                        <span>{{__('validation.attributes.user_submail')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_regident_zip')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_regident_pre')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_regident_city')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_regident_add')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_relate_zip')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_relate_pre')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_relate_city')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_relate_add')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.ward_residents')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_workplace')}}</span></th>
                                    <th class="sorting @if($sort=="user_school"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="user_school">
                                        <span>{{__('validation.attributes.user_school')}}</span>
                                    </th>
                                    <th>
                                        <span>{{__('validation.attributes.user_graduate')}}</span></th>
                                    {{--<th>--}}
                                    {{--<span>{{__('validation.attributes.user_reduction')}}</span></th>--}}
                                    <th>
                                        <span>{{__('validation.attributes.user_idcard')}}</span>
                                    </th>
                                    <th>
                                        <span>{{__('validation.attributes.user_idcard_chk_flag')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_chk_day')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_chk_opeid')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_tag_issue')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.issue_permission')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_quit_flag')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_quitday')}}</span></th>
                                    <th>
                                        <span>{{__('validation.attributes.user_remarks')}}</span></th>
                                    {{--<th class="sorting @if($sort=="created_at"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"--}}
                                    {{--sort="created_at">--}}
                                    {{--<span>{{__('validation.attributes.created_at')}}</span>--}}
                                    {{--</th>--}}
                                    {{--<th class="sorting @if($sort=="updated_at"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"--}}
                                    {{--sort="updated_at">--}}
                                    {{--<span>{{__('validation.attributes.updated_at')}}</span>--}}
                                    {{--</th>--}}
                                    {{--<th class="sorting @if($sort=="edit_oprator_id"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"--}}
                                    {{--sort="edit_oprator_id">--}}
                                    {{--<span>{{__('validation.attributes.edit_oprator_id')}}</span>--}}
                                    {{--</th>--}}
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $item)
                                    <tr>
                                        <td class='sm-item text-left'><span>{{mb_substr($item->user_seq, 0, 10)}}</span>
                                        </td>
                                        <td class='sm-item text-left'><span>{{mb_substr($item->user_id, 0, 10)}}</span>
                                        </td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->member_id, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_pass, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{$item->user_manual_regist_flag?__("はい"):__("いいえ")}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{$item->user_mailing_flag?__("はい"):__("いいえ")}}</span></td>
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->contract_number, 0, 10)}}</span></td>
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->user_tag_serial, 0, 10)}}</span></td>
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->user_tag_serial_64, 0, 10)}}</span></td>
                                        <td class='sm-item text-left'><span>{{mb_substr($item->qr_code, 0, 10)}}</span>
                                        </td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->tag_qr_flag?__('ＱＲコード'):__('タグ'), 0, 10)}}</span>
                                        </td>
                                        <td class='sm-item text-left'><span>{{mb_substr($item->user_aid, 0, 10)}}</span>
                                        </td>
                                        {{--<td class='sm-item text-left'>--}}
                                        {{--<span>{{mb_substr($item->user_park_number, 0, 10)}}</span></td>--}}
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->user_place_qrid, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_categoryid, 0, 10)}}</span>
                                            {{--<span>{{mb_substr($item->getUserType()->print_name, 0, 10)}}</span>--}}
                                        </td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_name, 0, 10)}}</span></td>
                                        {{--<td class='sm-item text-left'>--}}
                                        {{--<span>{{mb_substr($item->user_phonetic, 0, 10)}}</span></td>--}}
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_gender, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            @if($item->user_birthdate)
                                                <span class="text-muted"><i class="fa fa-clock-o mr-1"></i>
                                                    {{mb_substr($item->user_birthdate, 0, 10)}}
                                                </span>
                                            @endif
                                        </td>
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->user_age, 0, 10)}}</span></td>
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->user_mobile, 0, 10)}}</span></td>
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->user_homephone, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_primemail, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_submail, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_regident_zip, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_regident_pre, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_regident_city, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_regident_add, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_relate_zip, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_relate_pre, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_relate_city, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_relate_add, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->ward_residents, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_workplace, 0, 10)}}</span></td>
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->user_school, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_graduate, 0, 10)}}</span></td>
                                        {{--<td class='sm-item text-right'>--}}
                                        {{--<span>{{mb_substr($item->user_reduction, 0, 10)}}</span></td>--}}
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr(__($item->user_idcard), 0, 10)}}</span></td>
                                        <td class='sm-item text-right'><span>{{mb_substr(__(\App\User::USER_ID_CARD_CHK_FLG[$item->user_idcard_chk_flag]), 0, 10)}}
                                               </span></td>
                                        <td class='sm-item text-right'>
                                            @if($item->user_chk_day)
                                                <span class="text-muted"><i class="fa fa-clock-o mr-1"></i>
                                                    {{mb_substr($item->user_chk_day, 0, 10)}}
                                                </span>
                                            @endif
                                        </td>
                                        {{--TODO user_chk_opeid get name ope_name--}}
                                        <td class='sm-item text-left'>
                                            <span> {{mb_substr($item->user_chk_opeid, 0, 10)}}</span></td>
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->user_tag_issue, 0, 10)}}</span></td>
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->issue_permission, 0, 10)}}</span></td>
                                        <td class='sm-item text-right'>
                                            <span>{{$item->user_quit_flag?__("はい"):__("いいえ")}}</span></td>
                                        <td class='sm-item text-right'>
                                            @if($item->user_quitday)
                                                <span class="text-muted"><i class="fa fa-clock-o mr-1"></i>
                                                    {{mb_substr($item->user_quitday, 0, 10)}}
                                                </span>
                                            @endif
                                        </td>
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->user_remarks, 0, 10)}}</span></td>
                                        {{--<td>--}}
                                        {{--@if($item->created_at)--}}
                                        {{--<span class="text-muted"><i class="fa fa-clock-o mr-1"></i>--}}
                                        {{--{{$item->created_at}}</span>--}}
                                        {{--@endif--}}
                                        {{--</td>--}}
                                        {{--<td>--}}
                                        {{--@if($item->updated_at)--}}
                                        {{--<span class="text-muted"><i class="fa fa-clock-o mr-1"></i>--}}
                                        {{--{{$item->updated_at}}</span>--}}
                                        {{--@endif--}}
                                        {{--</td>--}}
                                        {{--<td><span>{{$item->edit_oprator_id}}</span></td>--}}
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

            </div>
            <!-- /.row -->
        </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->

@endsection
