<?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],
];

$role=[
['code' => 0, 'name' => '選択してください'],
['code' => 1, 'name' => 'マスター管理者'],
['code' => 2, 'name' => 'ウェブ管理者'],
['code' => 3, 'name' => 'スタッフ'],
];


?>

<?php $__env->startSection('styles'); ?>
    <script src="/admin/js/upload-image.js"></script>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('contents'); ?>
<div class="mt5">
    <?php echo $__env->make('admin.objects.components.regist-band', ['title' => '社員情報', 'conf_url' => '/staff/'.$user_detail['employee_number'].'.html'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    <div class="user_regist">
        <?php if($errors->any()): ?>
        <div class="error">
        <ul>
            <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $message): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <li><?php echo e($message); ?></li>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </ul>
        </div>
        <?php endif; ?>
        <form method="POST" action="<?php echo e(route('staff-edit', ['id'=>$user_detail['employee_number']])); ?>" enctype="multipart/form-data" id="enter-off">
        <?php echo e(csrf_field()); ?>

        <?php echo $__env->make('admin.objects.components.hidden', ['name' => 'role', 'value' => $type], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
        <?php echo $__env->make('admin.objects.components.hidden', ['name' => 'company_id', 'value' => $user->company_id], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>

            <div>
                <table>
                    <tr>
                        <th>社員ID</th>
                        <td><?php echo e($user_detail['employee_number']); ?></td>
                    </tr>
                    <tr>
                        <th>データベース権限</th><!--下記要修正-->
                        <td>
                          <?php if($user['role']==1): ?>
                          <?php echo $__env->make('admin.objects.components.selectbox', ['name' => 'role', 'class' => 'mb-2', 'options' => $role, 'selected' => $user_info[0]['role']], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                          <!--<select class="c-selectbox  mb-2 " name="role">
                            <option value="">選択してください</option>
                            <option value="">----</option>
                            <option value="1" <?php echo e($user_info[0]["role"] == 1 ? "selected" : ""); ?>>マスター管理者</option>
                            <option value="2" <?php echo e($user_info[0]["role"] == 2 ? "selected" : ""); ?>>ウェブ管理者</option>
                            <option value="3" <?php echo e($user_info[0]["role"] == 3 ? "selected" : ""); ?>>スタッフ</option>
                          </select>-->
                          <?php elseif($user['role']==2): ?>
                          ウェブ管理者
                          <?php elseif($user['role']==3): ?>
                          スタッフ
                          <?php elseif($user['role']==null ||$user['role'] == 0 ): ?>
                            未選択
                          <?php endif; ?>
                        </td>
                    </tr>
                    <tr>
                        <th>氏名</th>
                        <td>
                            <?php echo $__env->make('admin.objects.components.input', ['name' => 'last_name', 'class' => 'w200', 'placeholder' => '名字', 'value' => $user_detail['last_name']], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                            <?php echo $__env->make('admin.objects.components.input', ['name' => 'first_name', 'class' => 'w200', 'placeholder' => '名前', 'value' => $user_detail['first_name']], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                        </td>
                    </tr>
                    <tr>
                        <th>氏名(フリガナ)</th>
                        <td>
                        <?php echo $__env->make('admin.objects.components.input', ['name' => 'last_name_kana', 'class' => 'w200', 'placeholder' => '名字（フリガナ）', 'value' => $user_detail['last_name_kana']], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                            <?php echo $__env->make('admin.objects.components.input', ['name' => 'first_name_kana', 'class' => 'w200', 'placeholder' => '名字（フリガナ）', 'value' => $user_detail['first_name_kana']], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                        </td>
                    </tr>
                    <tr>
                        <th>メールアドレス</th>
                        <td>
                            <?php echo $__env->make('admin.objects.components.input', ['name' => 'email', 'class' => 'w200', 'placeholder' => 'メールアドレス', 'value' => $user_info[0]['email']], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                        </td>
                    </tr>
                    <?php if(empty($user_info[0]['password'])): ?>
                        <tr style="display: table-row" id="password">
                            <th>パスワード</th>
                            <td>
                                <input type="password" name="password"  class="w200" placeholder="******" >
                            </td>
                        </tr>
                        <tr style="display: table-row" id="password_confirmation">
                            <th>パスワード（確認用）</th>
                            <td>
                                <input type="password" name="password_confirmation"  class="w200" placeholder="******" >
                            </td>
                        </tr>
                        <tr style="display: none" id="changePassword">
                            <th>パスワード</th>
                            <td>
                                <div>
                                    <h5 style="color: #3490dc;text-decoration: underline; cursor: pointer;">パスワード変更</h5>
                                </div>
                            </td>
                        </tr>
                    <?php else: ?>
                        <tr style="display: none" id="password">
                            <th>パスワード</th>
                            <td>
                                <input type="password" name="password"  class="w200" placeholder="******" >
                            </td>
                        </tr>
                        <tr style="display: none" id="password_confirmation">
                            <th>パスワード（確認用）</th>
                            <td>
                                <input type="password" name="password_confirmation"  class="w200" placeholder="******" >
                            </td>
                        </tr>
                        <tr style="display: table-row" id="changePassword">
                            <th>パスワード</th>
                            <td>
                                <div  id="changePasswordDiv" style="display: inline-block">
                                    <h5 style="color: #3490dc;
                                            cursor: pointer;
                                            margin: 0;
                                            padding: 3px;
                                            font-size: 15px;
                                            ">
                                        パスワード変更
                                    </h5>
                                </div>
                            </td>
                        </tr>
                    <?php endif; ?>
                    <tr>
                        <th>店舗カテゴリ</th>
                        <td>
                        <?php echo $__env->make('admin.objects.components.selectbox', ['name' => 'store', 'class' => 'mb-2', 'options' => $store, 'selected' => $user_detail['store']], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                        </td>
                    </tr>
                    <tr>
                        <th>部署</th>
                        <td>
                            <?php echo $__env->make('admin.objects.components.input', ['name' => 'department', 'class' => 'w200', 'placeholder' => '部署', 'value' => $user_detail['department']], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                        </td>
                    </tr>
                    <tr>
                        <th>役職</th>
                        <td>
                            <?php echo $__env->make('admin.objects.components.input', ['name' => 'position', 'class' => 'w200', 'placeholder' => '役職', 'value' => $user_detail['position']], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                        </td>
                    </tr>
                    <tr>
                        <th>誕生日</th>
                        <td>
                        <?php echo $__env->make('admin.objects.components.selectbox', ['name' => 'birth_month', 'class' => 'mb-2', 'options' => $birth_month, 'selected' => $user_detail['birth_month']], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>月
                        <?php echo $__env->make('admin.objects.components.selectbox', ['name' => 'birth_day', 'class' => 'mb-2', 'options' => $birth_day, 'selected' => $user_detail['birth_day']], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>日
                        </td>
                    </tr>
                    <tr>
                        <th>血液型</th>
                        <td>
                        <?php echo $__env->make('admin.objects.components.selectbox', ['name' => 'blood', 'class' => 'mb-2', 'options' => $blood, 'selected' => $user_detail['blood_type']], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                        </td>
                    </tr>
                    <?php if(auth()->user()->company_id === 3): ?>
                        <tr>
                            <th>資格</th>
                            <td>
                                <?php echo $__env->make('admin.objects.components.input', ['name' => 'certification', 'class' => 'w500', 'value' => $user_detail['certification'], 'placeholder' => '例：宅地建物取引士、３級ファイナンシャルプラナー技能士など'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                            </td>
                        </tr>
                        <tr>
                            <th>出身大学</th>
                            <td>
                                <?php echo $__env->make('admin.objects.components.input', ['name' => 'college', 'class' => 'w500','value' => $user_detail['college'], 'placeholder' => '出身大学を入力してください。'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                            </td>
                        </tr>
                        <tr>
                            <th>住まい</th>
                            <td>
                                <?php echo $__env->make('admin.objects.components.input', ['name' => 'residence', 'class' => 'w500', 'value' => $user_detail['residence'], 'placeholder' => 'OO市'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                            </td>
                        </tr>
                    <?php endif; ?>

                    <tr>
                        <th>顔写真</th>
                        <td class="d-flex">
                            <label class="p-imgupload__area flex-center" for="fileSingleInput">
                                <?php if(isset($user_detail->file_path) && $user_detail->file_path !== ''): ?>
                                    <img src="<?php echo e($user_detail->file_path . '?v=' . time()); ?>" width="200" />
                                <?php endif; ?>
                                <canvas style="display: none;" 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="<?php echo e($file_path??''); ?>">
                            </label>
                            <div class="ml10">
                            <?php echo $__env->make('admin.objects.components.hidden', ['name' => 'del_photo'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                            <?php echo $__env->make('admin.objects.components.btn', ['name' => 'del_staff_photo', 'class' => '', 'title' => '削除', 'type' => 'button'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                            </div>
                        </td>
                    </tr>
<?php $__currentLoopData = $customs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $custom): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <?php if(isset($custom->name)): ?>
                    <tr>
                        <th><?php echo e(sprintf("%02d", $loop->iteration)); ?><br><?php echo e($custom->name); ?></th>
                        <td>

                        <div class="d-flex">
                            <?php echo $__env->make('admin.objects.components.textarea', ['name' => 'custom'.$loop->iteration, 'class' => 'w500 h150', 'placeholder' => '2００文字以内で入力してください', 'value' => $custom->ans], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>

                                <div class="form-upload">
                                    <label id="imageArea<?php echo e($loop->iteration + 1); ?>" class="p-imgupload__area1 flex-center ml-2"
                                           for="fileSingleInput<?php echo e($loop->iteration + 1); ?>">
                                        <?php if(!empty($custom->file_path)): ?>
                                            <img src="<?php echo e($custom->file_path. '?v=' . time()); ?>" width="200" />
                                        <?php endif; ?>
                                        <canvas style="display: none;" name="canvas_floor<?php echo e($loop->iteration + 1); ?>" width="0"
                                                height="0"></canvas>
                                        <p class="p-imgupload__text">クリックまたは<br>ドラッグ&amp;ドロップ</p>
                                        <input class="file" id="fileSingleInput<?php echo e($loop->iteration + 1); ?>" type="file"
                                               name="file_single_input<?php echo e($loop->iteration + 1); ?>"
                                               style="display:none;">
                                        <input type="hidden" name="file_single_input2" value="<?php echo e($file_path??''); ?>">
                                        <input type="hidden" name="custom_file_path<?php echo e($loop->iteration + 1); ?>" value="<?php echo e(str_replace('/storage', 'public', $custom->file_path??'')); ?>">
                                    </label>
                                    <div class="ml10 text-center">
                                        <?php echo $__env->make('admin.objects.components.hidden', ['name' => 'del_photo'.($loop->iteration + 1)], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                                        <?php echo $__env->make('admin.objects.components.btn', ['name' => 'del_staff_photo_cus', 'dataPhoto' => "del_photo".($loop->iteration + 1), 'class' => 'btn-del', 'title' => '削除', 'type' => 'button'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                                    </div>
                                </div>


                        </div>

                    </tr>
    <?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </table>
            </div>
            <div class="search_vendor__btn">
                <?php echo $__env->make('admin.objects.components.regist-btn', ['class' => '', 'title' => '登録・保存'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                <a style="padding:10px;display: inline-block" href="<?php echo e($user->role == 1 ? '/admin/staffList' : '/admin/top'); ?>" class="site_reference">戻る</a>
            </div>
        </form>

    </div>
</div>
<?php if(session('message')): ?>
    <?php echo $__env->make('admin.objects.projects.modal-message', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    <script type="text/javascript">
        window.onload = function(){
            var message = '登録・保存しました';
            $('#saved_message').text(message);
            openMessageModal();
        };
    </script>
<?php endif; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('footer-script'); ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.base', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>