@php
$ad_conf = [
    ['code' => 0, 'name' => ''],
    ['code' => 1, 'name' => '未'],
    ['code' => 2, 'name' => '可'],
    ['code' => 3, 'name' => '不可'],
];

$blood = [
    ['code' => 0, 'name' => ''],
    ['code' => 1, 'name' => 'A'],
    ['code' => 2, 'name' => 'B'],
    ['code' => 3, 'name' => 'O'],
    ['code' => 4, 'name' => 'AB'],
];

$birth_month = [
    ['code' => 1, 'name' => 1],
    ['code' => 2, 'name' => 2],
    ['code' => 3, 'name' => 3],
    ['code' => 4, 'name' => 4],
    ['code' => 5, 'name' => 5],
    ['code' => 6, 'name' => 6],
    ['code' => 7, 'name' => 7],
    ['code' => 8, 'name' => 8],
    ['code' => 9, 'name' => 9],
    ['code' => 10, 'name' => 10],
    ['code' => 11, 'name' => 11],
    ['code' => 12, 'name' => 12],
];

$birth_day = [
    ['code' => 1, 'name' => 1],
['code' => 2, 'name' => 2],
['code' => 3, 'name' => 3],
['code' => 4, 'name' => 4],
['code' => 5, 'name' => 5],
['code' => 6, 'name' => 6],
['code' => 7, 'name' => 7],
['code' => 8, 'name' => 8],
['code' => 9, 'name' => 9],
['code' => 10, 'name' => 10],
['code' => 11, 'name' => 11],
['code' => 12, 'name' => 12],
['code' => 13, 'name' => 13],
['code' => 14, 'name' => 14],
['code' => 15, 'name' => 15],
['code' => 16, 'name' => 16],
['code' => 17, 'name' => 17],
['code' => 18, 'name' => 18],
['code' => 19, 'name' => 19],
['code' => 20, 'name' => 20],
['code' => 21, 'name' => 21],
['code' => 22, 'name' => 22],
['code' => 23, 'name' => 23],
['code' => 24, 'name' => 24],
['code' => 25, 'name' => 25],
['code' => 26, 'name' => 26],
['code' => 27, 'name' => 27],
['code' => 28, 'name' => 28],
['code' => 29, 'name' => 29],
['code' => 30, 'name' => 30],
['code' => 31, 'name' => 31],
];



@endphp
@extends('admin.layouts.base')

@section('contents')

<div class="mt5">
    @include('admin.objects.components.regist-band', ['title' => '社員情報'])
    <div class="user_regist">
        @if($errors->any())
        <div class="error">
        <ul>
            @foreach($errors->all() as $message)
            <li>{{ $message }}</li>
            @endforeach
        </ul>
        </div>
        @endif
        <form method="POST" action="{{ route('staff-edit', ['id'=>$user_detail['employee_number']]) }}" enctype="multipart/form-data">
        {{ csrf_field() }}
        @include('admin.objects.components.hidden', ['name' => 'role', 'value' => $type])
        @include('admin.objects.components.hidden', ['name' => 'company_id', 'value' => $user->company_id])
                            
            <div>
                <table>
                    <tr>
                        <th>社員番号</th>
                        <td>{{$user_detail['employee_number']}}</td>
                    </tr>
                    <tr>
                        <th>氏名</th>
                        <td>
                            @include('admin.objects.components.input', ['name' => 'last_name', 'class' => 'w200', 'placeholder' => '名字', 'value' => $user_detail['last_name']])
                            @include('admin.objects.components.input', ['name' => 'first_name', 'class' => 'w200', 'placeholder' => '名前', 'value' => $user_detail['first_name']])
                        </td>
                    </tr>
                    <tr>
                        <th>氏名(フリガナ)</th>
                        <td>
                        @include('admin.objects.components.input', ['name' => 'last_name_kana', 'class' => 'w200', 'placeholder' => '名字（フリガナ）', 'value' => $user_detail['last_name_kana']])
                            @include('admin.objects.components.input', ['name' => 'first_name_kana', 'class' => 'w200', 'placeholder' => '名字（フリガナ）', 'value' => $user_detail['first_name_kana']])
                        </td>
                    </tr>
                    <tr>
                        <th>メールアドレス</th>
                        <td>
                            @include('admin.objects.components.input', ['name' => 'email', 'class' => 'w200', 'placeholder' => 'メールアドレス', 'value' => $user_info[0]['email']])
                        </td>
                    </tr>
                    <tr>
                        <th>パスワード</th>
                        <td>
                            <input type="password" name="password" class="w200" placeholder="パスワード" >
                        </td>
                    </tr>
                    <tr>
                        <th>パスワード（確認用）</th>
                        <td>
                            <input type="password" name="password_confirmation" class="w200" placeholder="パスワード（確認用）" >
                        </td>
                    </tr>
                    <tr>
                        <th>店舗カテゴリ</th>
                        <td>
                        @include('admin.objects.components.selectbox', ['name' => 'store', 'class' => 'mb-2', 'options' => $store, 'selected' => $user_detail['store']])
                        </td>
                    </tr>
                    <tr>
                        <th>部署</th>
                        <td>
                            @include('admin.objects.components.input', ['name' => 'department', 'class' => 'w200', 'placeholder' => '部署', 'value' => $user_detail['department']])
                        </td>
                    </tr>
                    <tr>
                        <th>役職</th>
                        <td>
                            @include('admin.objects.components.input', ['name' => 'position', 'class' => 'w200', 'placeholder' => '役職', 'value' => $user_detail['position']])
                        </td>
                    </tr>
                    <tr>
                        <th>誕生日</th>
                        <td>
                        @include('admin.objects.components.selectbox', ['name' => 'birth_month', 'class' => 'mb-2', 'options' => $birth_month, 'selected' => $user_detail['birth_month']])月
                        @include('admin.objects.components.selectbox', ['name' => 'birth_day', 'class' => 'mb-2', 'options' => $birth_day, 'selected' => $user_detail['birth_day']])日
                        </td>
                    </tr>
                    <tr>
                        <th>血液型</th>
                        <td>
                        @include('admin.objects.components.selectbox', ['name' => 'blood', 'class' => 'mb-2', 'options' => $blood, 'selected' => $user_detail['blood_type']])
                        </td>
                    </tr>
                    <tr>
                        <th>顔写真</th>
                        <td class="d-flex">
                            <div class="p-imgupload__area">
                                <img src="{{$user_detail->file_path}}" width="200" />
                                <canvas name="canvas_floor" width="0" height="0"></canvas>
                                <p class="p-imgupload__text">クリックまたは<br>ドラッグ&amp;ドロップ</p>
                                <input id="fileSingleInput" type="file" name="file_single_input" style="display:none;">
                                <input type="hidden" name="file_path" value="{{$file_path??''}}">
                            </div>
                            <div class="ml10">
                            @include('admin.objects.components.hidden', ['name' => 'del_photo'])
                            @include('admin.objects.components.btn', ['name' => 'del_staff_photo', 'class' => '', 'title' => '削除', 'type' => 'button'])
                            </div>
                        </td>
                    </tr>
@foreach($customs as $custom)
    @if(isset($custom->name))
                    <tr>
                        <th>0{{$loop->iteration}}<br>{{$custom->name}}</th>
                        <td>
                        @include('admin.objects.components.textarea', ['name' => 'custom'.$loop->iteration, 'class' => 'w400', 'placeholder' => '2００文字以内で入力してください', 'count' => 200, 'value' => $custom->ans])                        </td>
                    </tr>
    @endif
@endforeach
                </table>
            </div>
            <div class="search_vendor__btn">
                @include('admin.objects.components.regist-btn', ['class' => '', 'title' => '登録・保存'])
            </div>
        </form>
        
       
    </div>
</div>
@endsection