@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 class="card-body">
  <div class="row">

    @if($isEdit || $isInfo)
      {{-- 定期契約ID --}}
      <div class="form-group col-3">
        <label>定期契約ID</label>
      </div>
      <div class="form-group col-9">
        <div class="input-group">
          <input type="text" value="{{$contract_id}}"
                 placeholder="定期契約ID"
                 class="form-control form-control-lg" readonly/>
        </div>
      </div>
    @endif

    {{-- 定期契約QRID --}}
    <div class="form-group col-3">
      <label @if(!$isInfo) class="required" @endif>定期契約QRID</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contract_qr_id}}"
               @if(!$isInfo) placeholder="定期契約QRID" @endif name="contract_qr_id"
               class="form-control form-control-lg" @if($isEdit || $isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 利用者ID --}}
    <div class="form-group col-3">
      <label @if(!$isInfo) class="required" @endif>利用者ID</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$user_id}}" @if(!$isInfo) placeholder="利用者ID" @endif
               name="user_id" class="form-control form-control-lg" @if($isEdit || $isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 利用者分類ID --}}
    <div class="form-group col-3">
      <label @if(!$isInfo) class="required" @endif>利用者分類ID</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$user_categoryid}}"
               @if(!$isInfo) placeholder="利用者分類ID" @endif name="user_categoryid"
               class="form-control form-control-lg" @if($isEdit || $isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 定期予約ID --}}
    <div class="form-group col-3">
      <label @if(!$isInfo) class="required" @endif>定期予約ID</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$reserve_id}}" @if(!$isInfo) placeholder="定期予約ID" @endif
               name="reserve_id" class="form-control form-control-lg" @if($isEdit || $isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 駐輪場ID --}}
    <div class="form-group col-3">
      <label @if(!$isInfo) class="required" @endif>駐輪場ID</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$park_id}}" @if(!$isInfo) placeholder="駐輪場ID" @endif
               name="park_id" class="form-control form-control-lg" @if($isEdit || $isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 駐輪場所ID --}}
    <div class="form-group col-3">
      <label @if(!$isInfo) class="required" @endif>駐輪場所ID</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$price_parkplaceid}}"
               @if(!$isInfo) placeholder="駐輪場所ID" @endif name="price_parkplaceid"
               class="form-control form-control-lg" @if($isEdit || $isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 防犯登録番号 --}}
    <div class="form-group col-3">
      <label>防犯登録番号</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$user_securitynum}}"
               @if(!$isInfo) placeholder="防犯登録番号" @endif name="user_securitynum"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 予約日時 --}}
    <div class="form-group col-3">
      <label>予約日時</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="date" value="@if(!empty($reserve_date)){{date('Y-m-d',strtotime($reserve_date))}}@endif"
               @if(!$isInfo) placeholder="予約日時" @endif name="reserve_date"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 予約移行 --}}
    <div class="form-group col-3">
      <label>予約移行</label>
    </div>
    <div class="form-group col-9">
      <div class="row">
        <div class="col-4 offset-1 form-check">
          <input type="radio" class="minimal"
                 name="contract_reserve" @if($isInfo) disabled @endif
                 value="{{ '予約' }}" {{$contract_reserve == '予約'? 'checked':''}}>
          <label class="form-check-label">予約</label>
        </div>
        <div class="col-2 form-check">
          <input type="radio" class="minimal"
                 name="contract_reserve" @if($isInfo) disabled @endif
                 value="{{ '予約しない' }}" {{$contract_reserve == '予約しない'? 'checked':''}}>
          <label class="form-check-label">予約しない</label>
        </div>
      </div>
    </div>

    {{-- 契約日時 --}}
    <div class="form-group col-3">
      <label>契約日時</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="date" value="@if(!empty($created_at)){{date('Y-m-d',strtotime($created_at))}}@endif"
               @if(!$isInfo) placeholder="契約日時" @endif name="created_at"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 更新可能日 --}}
    <div class="form-group col-3">
      <label>更新可能日</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="date" value="@if(!empty($updated_at)){{date('Y-m-d',strtotime($updated_at))}}@endif"
               @if(!$isInfo) placeholder="更新可能日" @endif name="updated_at"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 解約日時 --}}
    <div class="form-group col-3">
      <label>解約日時</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="date"
               value="@if(!empty($contract_cancelday)){{date('Y-m-d',strtotime($contract_cancelday))}}@endif"
               @if(!$isInfo) placeholder="解約日時" @endif name="contract_cancelday"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 減免措置 --}}
    <div class="form-group col-3">
      <label>減免措置</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contract_reduction}}"
               @if(!$isInfo) placeholder="減免措置" @endif name="contract_reduction"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 有効期間S --}}
    <div class="form-group col-3">
      <label>有効期間S</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contract_periods}}"
               @if(!$isInfo) placeholder="有効期間S" @endif name="contract_periods"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 有効期間E --}}
    <div class="form-group col-3">
      <label>有効期間E</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contract_periode}}"
               @if(!$isInfo) placeholder="有効期間E" @endif name="contract_periode"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 消費税ID --}}
    <div class="form-group col-3">
      <label>消費税ID</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contract_taxid}}"
               @if(!$isInfo) placeholder="消費税ID" @endif name="contract_taxid"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 請求金額 --}}
    <div class="form-group col-3">
      <label>請求金額</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$billing_amount}}"
               @if(!$isInfo) placeholder="請求金額" @endif name="billing_amount"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 授受日時 --}}
    <div class="form-group col-3">
      <label>授受日時</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="date" value="@if(!empty($contract_payment_day)){{date('Y-m-d',strtotime($contract_payment_day))}}@endif"
               @if(!$isInfo) placeholder="授受日時" @endif name="contract_payment_day"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 授受金額 --}}
    <div class="form-group col-3">
      <label>授受金額</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contract_money}}"
               @if(!$isInfo) placeholder="授受金額" @endif name="contract_money"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 解約時返戻金 --}}
    <div class="form-group col-3">
      <label>解約時返戻金</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$refunds}}" @if(!$isInfo) placeholder="解約時返戻金" @endif
               name="refunds" class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 返戻金付随情報 --}}
    <div class="form-group col-3">
      <label>返戻金付随情報</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$refunds_comment}}"
               @if(!$isInfo) placeholder="返戻金付随情報" @endif name="refunds_comment"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 返金日 --}}
    <div class="form-group col-3">
      <label>返金日</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="date" value="@if(!empty($repayment_at)){{date('Y-m-d',strtotime($repayment_at))}}@endif"
               @if(!$isInfo) placeholder="返金日" @endif name="repayment_at"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 決済コード --}}
    <div class="form-group col-3">
      <label>決済コード</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contact_guid}}"
               @if(!$isInfo) placeholder="決済コード" @endif name="contact_guid"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 店舗コード --}}
    <div class="form-group col-3">
      <label>店舗コード</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contact_shop_code}}"
               @if(!$isInfo) placeholder="店舗コード" @endif name="contact_shop_code"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 授受種別 --}}
    <div class="form-group col-3">
      <label>授受種別</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contract_cvs_class}}"
               @if(!$isInfo) placeholder="授受種別" @endif name="contract_cvs_class"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 授受フラグ --}}
    <div class="form-group col-3">
      <label>授受フラグ</label>
    </div>
    <div class="form-group col-9">
      <div class="row">
        <div class="col-2 offset-1 form-check">
          <input type="radio" class="minimal" name="contract_flag" @if($isInfo) disabled @endif
                 value="1" {{$contract_flag? 'checked':''}}>
          <label class="form-check-label">はい</label>
        </div>
        <div class="col-2 form-check">
          <input type="radio" class="minimal" name="contract_flag" @if($isInfo) disabled @endif
                 value="0" {{!$contract_flag? 'checked':''}}>
          <label class="form-check-label">いいえ</label>
        </div>
      </div>
    </div>

    {{-- 決済トランザクションID --}}
    <div class="form-group col-3">
      <label>決済トランザクションID</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$settlement_transaction_id}}"
               @if(!$isInfo) placeholder="決済トランザクションID" @endif
               name="settlement_transaction_id"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- シール発行数 --}}
    <div class="form-group col-3">
      <label>シール発行数</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contract_seal_issue}}"
               @if(!$isInfo) placeholder="シール発行数" @endif name="contract_seal_issue"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- シール再発行リクエスト --}}
    <div class="form-group col-3">
      <label>シール再発行リクエスト</label>
    </div>
    <div class="form-group col-9">
      <div class="row">
        <div class="col-2 offset-1 form-check">
          <input type="radio" class="minimal" name="seal_reissue_request" @if($isInfo) disabled @endif
                 value="1" {{$seal_reissue_request? 'checked':''}}>
          <label class="form-check-label">はい</label>
        </div>
        <div class="col-2 form-check">
          <input type="radio" class="minimal" name="seal_reissue_request" @if($isInfo) disabled @endif
                 value="0" {{!$seal_reissue_request? 'checked':''}}>
          <label class="form-check-label">いいえ</label>
        </div>
      </div>
    </div>

    {{-- シール発行許可 --}}
    <div class="form-group col-3">
      <label>シール発行許可</label>
    </div>
    <div class="form-group col-9">
      <div class="row">
        <div class="col-3 offset-1 form-check">
          <input type="radio" class="minimal" name="contract_permission" @if($isInfo) disabled @endif
                 value="1" {{$contract_permission? 'checked':''}}>
          <label class="form-check-label">発行許可</label>
        </div>
        <div class="col-4 form-check">
          <input type="radio" class="minimal" name="contract_permission" @if($isInfo) disabled @endif
                 value="0" {{!$contract_permission? 'checked':''}}>
          <label class="form-check-label">発行許可しない</label>
        </div>
      </div>
    </div>

    {{-- 解約フラグ --}}
    <div class="form-group col-3">
      <label>解約フラグ</label>
    </div>
    <div class="form-group col-9">
      <div class="row">
        <div class="col-2 offset-1 form-check">
          <input type="radio" class="minimal" name="contract_cancel_flag" @if($isInfo) disabled @endif
                 value="1" {{$contract_cancel_flag? 'checked':''}}>
          <label class="form-check-label">解約</label>
        </div>
        <div class="col-3 form-check">
          <input type="radio" class="minimal" name="contract_cancel_flag" @if($isInfo) disabled @endif
                 value="0" {{!$contract_cancel_flag? 'checked':''}}>
          <label class="form-check-label">解約しない</label>
        </div>
      </div>
    </div>

    {{-- タグ・QR --}}
    <div class="form-group col-3">
      <label>タグ・QR</label>
    </div>
    <div class="form-group col-9">
      <div class="row">
        <div class="col-2 offset-1 form-check">
          <input type="radio" class="minimal" name="tag_qr_flag" @if($isInfo) disabled @endif
                 value="0" {{!$tag_qr_flag? 'checked':''}}>
          <label class="form-check-label">タグ</label>
        </div>
        <div class="col-2 form-check">
          <input type="radio" class="minimal" name="tag_qr_flag" @if($isInfo) disabled @endif
                 value="1" {{$tag_qr_flag? 'checked':''}}>
          <label class="form-check-label">QR</label>
        </div>
      </div>
    </div>

    {{-- オペレータータグ変更フラグ --}}
    <div class="form-group col-3">
      <label>オペレータータグ変更フラグ</label>
    </div>
    <div class="form-group col-9">
      <div class="row">
        <div class="col-5 offset-1 form-check">
          <input type="radio" class="minimal" name="tag_change_flag" @if($isInfo) disabled @endif
                 value="1" {{$tag_change_flag? 'checked':''}}>
          <label class="form-check-label">タグに変更する</label>
        </div>
        <div class="col-5 form-check">
          <input type="radio" class="minimal" name="tag_change_flag" @if($isInfo) disabled @endif
                 value="0" {{!$tag_change_flag? 'checked':''}}>
          <label class="form-check-label">タグに変更しない</label>
        </div>
      </div>
    </div>

    {{-- 駐輪位置番号 --}}
    <div class="form-group col-3">
      <label>駐輪位置番号</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$park_position}}"
               @if(!$isInfo) placeholder="駐輪位置番号" @endif name="park_position"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- オペレータID --}}
    <div class="form-group col-3">
      <label>オペレータID</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$ope_id}}" @if(!$isInfo) placeholder="オペレータID" @endif
               name="ope_id" class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 手動通知 --}}
    <div class="form-group col-3">
      <label>手動通知</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contract_manual}}"
               @if(!$isInfo) placeholder="手動通知" @endif name="contract_manual"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 通知方法 --}}
    <div class="form-group col-3">
      <label>通知方法</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contract_notice}}"
               @if(!$isInfo) placeholder="通知方法" @endif name="contract_notice"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

    {{-- 受付番号 --}}
    <div class="form-group col-3">
      <label>受付番号</label>
    </div>
    <div class="form-group col-9">
      <div class="input-group">
        <input type="text" value="{{$contract_payment_number}}"
               @if(!$isInfo) placeholder="受付番号" @endif name="contract_payment_number"
               class="form-control form-control-lg" @if($isInfo) readonly @endif/>
      </div>
    </div>

  </div>

  @if($isInfo)
    <a href="{{route('regular_contract_add')}}" class="btn btn-lg btn-default">登録</a>
    <a href="{{route('regular_contract_edit',['id'=>$contract_id])}}" class="btn btn-lg btn-default">編集</a>
  @else
    <div class="d-flex align-items-center justify-content-between">
      <button type="submit" class="btn btn-lg btn-default js-confirm-submit" @if(!$isEdit || !$isInfo) id="register" @endif>登録</button>
      @if($isEdit)
        <button type="submit" class="btn btn-lg btn-default" name="action" value="delete">削除</button>
      @endif
    </div>
  @endIf
</div>
