@php
    $type = [
        ['code' => 0, 'name' => '未選択'],
        ['code' => 1, 'name' => 'セレクトボックス'],
        ['code' => 2, 'name' => '入力エリア'],
    ];
@endphp
@extends('admin.layouts.base')

@section('contents')

    <div class="mt15">
        @include('admin.objects.components.regist-band', ['title' => 'お客様の声オリジナル項目設定'])
        <div class="user_list">
{{--            <div class="mt10">--}}
{{--                <p class="text-right">ex)趣味・特技、好きなこと、子供の時の夢、仕事のやりがい、将来の夢、お客様へのメッセージ</p>--}}
{{--            </div>--}}
            @if (session('message_modal'))
                <input type="hidden" name="" id="message" value="{{ session('message_modal') }}">
                @include('admin.objects.projects.modal-message', ['ok' => "OK"])
                <script type="text/javascript">
                    window.onload = function(){
                        var message = $("#message").val();
                        $('#saved_message').text(message);
                        openMessageModal();
                        $(".btn-close-modal").click(function () {
                            $("#modal-overlay").remove();
                            $("#modal-message-content").remove();
                        });
                    };
                </script>
            @endif
            <form method="POST" action="{{ route('custom-voice') }}">
                {{ csrf_field() }}
                <div>
                    <table>
                        <tr>
                            <th class="w50">No.</th>
                            <th class="">タイプ</th>
                            <th class="">項目名</th>
                            <th class="">項目内容</th>
                            <th class=""></th>
                        </tr>
                        @for($index = 1; $index <= Config::get('const.ITEM_NUM'); $index++)
                            <tr>
                                <td>{{sprintf("%02d", $index)}}</td>
                                <td>@include('admin.objects.components.selectbox', ['name' => 'type'.$index, 'options' => $type, 'selected' => isset(${'custom_type'.$index})?${'custom_type'.$index}: 0 ])</td>
                                <td>@include('admin.objects.components.input', ['name' => 'name'.$index,  'class' => 'w400', 'value' => isset(${'custom_name'.$index})?${'custom_name'.$index}:''])</td>
                                <td>@include('admin.objects.components.input', ['name' => 'contents'.$index, 'class' => 'w400', 'value' => isset(${'custom_contents'.$index})?${'custom_contents'.$index}:''])</td>
                                @if($index === 1)
                                    <td rowspan="6">
                                        セレクトボックスは項目を「,」で区切って記入
                                        <br/>
                                        ＜例１＞1,2,3,4
                                        <br/>
                                        ＜例２＞有,無,不明
                                    </td>
                                @endif
                            </tr>
                        @endfor
                    </table>
                </div>
                <div class="search_vendor__btn">
                    @include('admin.objects.components.regist-btn', ['class' => '', 'title' => '登録・保存'])
                </div>
            </form>

        </div>
    </div>
@endsection
