@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">

    {{-- 決済トランザクションID（編集/参照のみ） --}}
    @if($isInfo || $isEdit)
      <div class="form-group col-3">
          <label>{{ __('決済トランザクションID') }}</label>
      </div>
      <div class="form-group col-9">
          <div class="input-group">
              <input type="text"
                     value="{{ $transaction->settlement_transaction_id ?? '' }}"
                     placeholder="{{ __('validation.attributes.settlement_transaction_id') }}"
                     class="form-control form-control-lg"
                     readonly/>
          </div>
      </div>
    @endif

    {{-- 定期契約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" name="contract_id"
                   value="{{ old('contract_id', $transaction->contract_id ?? '') }}"
                   placeholder="{{ __('validation.attributes.contract_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" name="status"
                   value="{{ old('status', $transaction->status ?? '') }}"
                   placeholder="{{ __('validation.attributes.status') }}"
                   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" name="pay_code"
                   value="{{ old('pay_code', $transaction->pay_code ?? '') }}"
                   placeholder="{{ __('validation.attributes.pay_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" name="contract_payment_number"
                   value="{{ old('contract_payment_number', $transaction->contract_payment_number ?? '') }}"
                   placeholder="{{ __('validation.attributes.contract_payment_number') }}"
                   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" name="corp_code"
                   value="{{ old('corp_code', $transaction->corp_code ?? '') }}"
                   placeholder="{{ __('validation.attributes.corp_code') }}"
                   class="form-control form-control-lg"
                   @if($isInfo) readonly @endif />
        </div>
    </div>

    {{-- MMS予約照会日時 --}}
    <div class="form-group col-3">
        <label>{{ __('MMS予約照会日時') }}</label>
    </div>
    <div class="form-group col-9">
        <div class="input-group">
            <input type="text" name="mms_date"
                   value="{{ old('mms_date', $transaction->mms_date ?? '') }}"
                   placeholder="{{ __('validation.attributes.mms_date') }}"
                   class="form-control form-control-lg"
                   @if($isInfo) readonly @endif />
        </div>
    </div>

    {{-- CVS本部コード --}}
    <div class="form-group col-3">
        <label>{{ __('CVS本部コード') }}</label>
    </div>
    <div class="form-group col-9">
        <div class="input-group">
            <input type="text" name="cvs_code"
                   value="{{ old('cvs_code', $transaction->cvs_code ?? '') }}"
                   placeholder="{{ __('validation.attributes.cvs_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" name="shop_code"
                   value="{{ old('shop_code', $transaction->shop_code ?? '') }}"
                   placeholder="{{ __('validation.attributes.shop_code') }}"
                   class="form-control form-control-lg"
                   @if($isInfo) readonly @endif />
        </div>
    </div>

    {{-- 入金日時（DBはdatetime。画面はdateで日付入力を想定） --}}
    <div class="form-group col-3">
        <label>{{ __('入金日時') }}</label>
    </div>
    <div class="form-group col-9">
        <div class="input-group">
            <input type="date" name="pay_date"
                   value="{{ old('pay_date', isset($transaction->pay_date) ? \Carbon\Carbon::parse($transaction->pay_date)->format('Y-m-d') : '') }}"
                   placeholder="{{ __('validation.attributes.pay_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="input-group">
            <input type="text" name="settlement_amount"
                   value="{{ old('settlement_amount', $transaction->settlement_amount ?? '') }}"
                   placeholder="{{ __('validation.attributes.settlement_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="text" name="stamp_flag"
                   value="{{ old('stamp_flag', $transaction->stamp_flag ?? '') }}"
                   placeholder="{{ __('validation.attributes.stamp_flag') }}"
                   class="form-control form-control-lg"
                   @if($isInfo) readonly @endif />
        </div>
    </div>

    {{-- MD5ハッシュ値 --}}
    <div class="form-group col-3">
        <label>{{ __('MD5ハッシュ値') }}</label>
    </div>
    <div class="form-group col-9">
        <div class="input-group">
            <input type="text" name="md5_string"
                   value="{{ old('md5_string', $transaction->md5_string ?? '') }}"
                   placeholder="{{ __('validation.attributes.md5_string') }}"
                   class="form-control form-control-lg"
                   @if($isInfo) readonly @endif />
        </div>
    </div>

  </div>

  {{-- 下部ボタン --}}
  @if($isEdit)
    <button type="submit" class="btn btn-lg btn-success register">{{ __('登録') }}</button>
    <button type="submit" class="btn btn-lg btn-danger register">{{ __('削除') }}</button>
  @else
    <button type="submit" class="btn btn-lg btn-success register">{{ __('登録') }}</button>

  @endif    
      
</div>
