@php
    $isShowOwnCompany = $isShowOwnCompany ?? false;

$target = [
  ['code' => '', 'name' => ''],
  ['code' => '1', 'name' => '未'],
  ['code' => '2', 'name' => '可'],
  ['code' => '3', 'name' => '不可'],
];
$show_form_check = isset($_GET['open']) && $_GET['open'] == '1';
@endphp
<div @if(isset($lot) && $lot->show_ite_lv_2 == true) class="p-form-check p-form-check-show_ite_lv_2" @else class="p-form-check " @endif @if(isset($show_form_check) && $show_form_check) style="display: block" @endif @if(isset($showFormCheck) && $showFormCheck) style="display: block" @endif>
<form id="@if(!empty($item['vendor_info'][0]))form-{{$item['vendor_info'][0]['vendor_id']}}@endif" class="frm-check1" data-check="{{ isset($lot) ? $lot->building_id : $item->building_id }}">
  <div class="d-flex">
  <div class="p-form-check__status d-flex flex-column justify-content-between">
      @if($isShowOwnCompany)
          <div class="article_conf d-flex w-100 justify-content-between align-items-center">
              <p class="fs-18">自社HP</p>
              <select class="c-selectbox" name="own_company" autocomplete="off">
                  @foreach(configProject('own_company_text') as $keyOC => $textOC)
                      <option value="{{ getConstant($keyOC) }}"
                          {{ getConstant($keyOC) == $item['own_company'] ? 'selected' : '' }}>{{ $textOC }}</option>
                  @endforeach
              </select>
          </div>
      @endif
      <div class="article_conf">
          <p class="fs-12">物件確認日</p>
          <div class="d-flex justify-content-between align-items-center w-100">
              @include('business.objects.components.input', [
                  'name' => 'conf_day',
                  'value' => $item['conf_day'],
                  'class' => 'cal_picker p-form-check__tbl-checked-day',
                  'btnCenter' => true,
                  'showBtnToday' => true,
              ])
          </div>
      </div>
    @if(!isset($print))
      @include('business.objects.components.btn', ['title' => '保存', 'class' => 'btn_pink btnSearchSave', 'id' => ''])
    @endif
  </div>

  <div class="p-form-check__div">
  @if(isset($item['vendor_info']))
  @foreach($item['vendor_info'] as $vendor)
  <table class="p-form-check__tbl">
    <tr>
      <th>業者名</th>
      <td colspan="3" class="p-form-check__tbl-name p-1">{{$vendor['name']}}
      @include('business.objects.components.hidden', ['name' => 'id[]', 'value' => $vendor['vendor_id']])
      </td>
      <th>業者ID</th><td class="p-form-check__tbl-person p-1">@include('business.objects.components.link', ['url' => '/admin/editVendor/'.$vendor['vendor_id'], 'title' => $vendor['vendor_id'], 'class' => 'p-form-check__tbl-link-id'])</td>
      <th>電話</th><td class="p-form-check__tbl-tel">@include('business.objects.components.input', ['name' => 'vender_tel[]', 'value' => $vendor['vendor_tel1'], 'class' => 'p-form-check__tbl-vender-tel'])</td>
    </tr>
    <tr>
      <th>態様</th><td colspan="3" class="p-form-check__tbl-name p-1">@include('business.objects.components.selectbox', ['name' => 'manner[]', 'options' => $manner, 'class' => 'ml-1', 'selected' => $vendor['manner']])</td>
      <th>担当</th><td class="p-form-check__tbl-person">@include('business.objects.components.input', ['name' => 'charge[]', 'value' => $vendor['charge'], 'class' => 'p-form-check__tbl-vender-person'])</td>
      <th>FAX</th><td>@include('business.objects.components.input', ['name' => 'vender_fax[]', 'value' => $vendor['vendor_fax'], 'class' => 'p-form-check__tbl-vender-tel'])</td>
    </tr>
    <tr class="p-form-check__etc">
      <td colspan="8" class="p-2" @if(isset($close)) {{"style= display:none"}} @endif>
        <ul class="d-flex p-form-check__tbl-list p-0">
          <li><p>チラシ</p>@include('business.objects.components.selectbox', ['name' => 'flyer[]', 'options' => $target, 'selected' => $vendor['flyer']])</li>
          <li><p>情報誌</p>@include('business.objects.components.selectbox', ['name' => 'freepaper[]', 'options' => $target, 'selected' => $vendor['freepaper']])</li>
          <li><p>自社HP</p>@include('business.objects.components.selectbox', ['name' => 'house_hp[]', 'options' => $target, 'selected' => $vendor['house_hp']])</li>
          <li><p>ポータル</p>@include('business.objects.components.selectbox', ['name' => 'portal[]', 'options' => $target, 'selected' => $vendor['portal']])</li>
          <li><p>現地看板</p>@include('business.objects.components.selectbox', ['name' => 'signboard[]', 'options' => $target, 'selected' => $vendor['signboard']])</li>
          <li class=" p-form-check__tbl-list-allx"><a href="javascript:void(0);" name="all_not"><p>全×</p></a></li>
        </ul>
        <ul class="d-flex p-form-check__tbl-list p-0">
          <li><p>確認手法</p>@include('business.objects.components.selectbox', ['name' => 'ad_conf[]', 'options' => $ad_conf, 'title' => '', 'selected' => $vendor['ad_conf']])</li>
          <li class="p-form-check__tbl-flyer-day"><p>広告確認日</p>
              <div class="d-flex">
                  @include('business.objects.components.input', ['name' => 'ad_conf_day[]', 'value' => $vendor['ad_conf_day'], 'class' => 'cal_picker p-form-check__tbl-flyer-day-txt', 'showBtnToday' => true])
              </div>
          </li>
        </ul>
      </td>
    </tr>
  </table>
  @endforeach
  @endif
  </div>
  <table class="p-form-check__tblsub">
    @if(isset($close))
    @else
    <tr>
      <td colspan="2" class="p-form-check__tbl-history">
        <div class="p-form-check__tbl-history-div">
            <span class="" @if(isset($close)) {{"style= display:none"}} @endif>
                @include('admin.objects.components.checkbox', ['name' => 'change_flag', 'checkbox' => [['code' => 1, 'name' => '価格変更', 'data_id' => $item['building_id']]]])
                <span class="box-price-history-{{$item['building_id']}}" style="display: none">
                @include('business.objects.components.input', ['name' => 'change_price', 'class' => 'p-form-check__tbl-txt-change-price','placeholder' => '価格変更'])<span>万円</span>
                <div>
                    <div class="d-flex">
                        @include('business.objects.components.input', ['name' => 'change_price_date', 'class' => 'cal_picker p-form-check__tbl-change-day','placeholder' => '価格変更日', 'showBtnToday' => true])
                    </div>
                </div>
                </span>
            </span>
            <span class="box-price-history-{{$item['building_id']}}" @if(!isset($close)) {{"style= display:none"}} @endif>
                @include('business.objects.components.link', ['url' => '', 'title' => '履歴('.($history_count?? 0).')', 'class' => 'modal-open-history p-form-check__tbl-link-history', 'data_num' => $data_num??'', 'history_price_change' => 'room_building_id'])
            </span>
        </div>
      </td>
    </tr>
    @endif
    <tr>
      <td colspan="2" class="p-form-check__tbl-closed">
      @include('business.objects.components.hidden', ['name' => 'article_id', 'value' => $item['building_id']])
        @include('business.objects.components.selectbox', ['name' => 'status', 'options' => $statuses, 'class' => 'ml-1', 'selected' => $item['status']])
        @include('business.objects.components.input', ['name' => 'price_closing', 'value' => $item['price_closing'], 'class' => 'p-form-check__tbl-txt-closed-price','placeholder' => '成約価格'])<span>万円</span>
        <div class="d-inline-block">
            <div class="d-flex">
                @include('business.objects.components.input', ['name' => 'close_date', 'value' => $item['close_date'], 'class' => 'cal_picker p-form-check__tbl-closed-day','placeholder' => '成約日', 'showBtnToday' => true])
            </div>
        </div>
        @if(isset($close))
        @include('business.objects.components.link', ['url' => '', 'title' => '履歴('.($history_count?? 0).')', 'class' => 'modal-open-history p-form-check__tbl-link-history', 'data_num' => $data_num??'', 'history_price_change' => 'room_building_id'])
        @endif
      </td>
    </tr>
    <tr class="p-form-check__etc">
      <td colspan="2" class="p-2">
      <dl class="p-form-check__dl">
        <dt>BK</dt><dd>@include('business.objects.components.input', ['name' => 'bk', 'value' => $item['bk'], 'class' => 'p-form-check__tbl-bk m-0'])</dd>
        <dt>鍵</dt><dd>@include('business.objects.components.input', ['name' => 'key_text', 'value' => $item['key_text'], 'class' => 'p-form-check__tbl-key m-0'])</dd>
      </dl>
      <dl class="p-form-check__dl mt-2">
        <dt>備考</dt><dd class="p-form-check__dl-long">@include('business.objects.components.input', ['name' => 'memo', 'value' => $item['memo1'] ?? "", 'class' => 'p-form-check__tbl-biko m-0'])</dd>
      </dl>
      </td>
    </tr>
  </table>

  </div>
  </form>
</div>
