krgm.so-manager-dev.com/resources/views/admin/payments/list.blade.php

162 lines
6.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@extends('layouts.app')
@section('title', '決済情報マスタ')
@section('content')
<!-- Content Header -->
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-lg-6">
<h1 class="m-0 text-dark">決済情報マスタ</h1>
</div>
<div class="col-lg-6">
<ol class="breadcrumb float-sm-right text-sm">
<li class="breadcrumb-item"><a href="{{ route('home') }}">XX様info(ホーム)</a></li>
<li class="breadcrumb-item"><a href="javascript:void(0);">[東京都|〇〇駐輪場]</a></li>
<li class="breadcrumb-item active">決済情報マスタ</li>
</ol>
</div>
</div>
</div>
</div>
<!-- Main Content -->
<section class="content">
<div class="container-fluid">
{{-- 一覧のソート用(既存規約踏襲) --}}
<form action="{{ route('payments') }}" method="POST" id="list-form">
@csrf
<input type="hidden" name="sort" value="{{ $sort ?? '' }}">
<input type="hidden" name="sort_type" value="{{ $sort_type ?? '' }}">
</form>
<div class="container-fluid mb20">
<button type="button" class="btn btn-sm btn-default mr10" onclick="location.href='{{ route('payments_add') }}'">新規</button>
<button type="button" class="btn btn-sm btn-default mr10" id="delete">削除</button>
{{ $payments->appends(['sort' => $sort ?? '', 'sort_type' => $sort_type ?? ''])->links('pagination') }}
</div>
<div class="col-lg-12">
@if(session('success'))
<div class="alert alert-success alert-dismissible">{{ session('success') }}</div>
@elseif(session('error'))
<div class="alert alert-danger alert-dismissible">{{ session('error') }}</div>
@endif
</div>
<div class="col-lg-12 row sample03-wrapper no_padding_right mb20">
<!-- 左側チェックボックス&編集ボタン -->
<div class="col-xl-2 col-lg-2 col-md-2 col-sm-3 col-xs-3 table_left">
<form action="{{ route('payments_delete') }}" method="POST" id="form_delete">
@csrf
<table class="table dataTable">
<thead>
<tr>
<th><input type="checkbox" class="minimal m-0" id="checkbox_all"></th>
</tr>
</thead>
<tbody>
@foreach($payments as $payment)
<tr>
<td>
<input type="checkbox" class="minimal m-0 checkbox" value="{{ $payment->payment_id }}" name="id[]">
<div class="btn_action">
<a href="{{ route('payments_edit', ['payment_id' => $payment->payment_id]) }}" class="btn btn-sm btn-default ml10">編集</a>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
<!-- 右側データテーブル -->
<div class="col-lg-10 col-xl-10 col-md-10 col-sm-9 col-xs-9 table_right no_padding_right">
<div class="scroll">
<table class="table dataTable">
<thead>
<tr>
<th class="sorting {{ ($sort=='payment_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="payment_id">
<span>決済情報ID</span>
</th>
<th class="sorting {{ ($sort=='payment_companyname') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="payment_companyname">
<span>会社名</span>
</th>
<th class="sorting {{ ($sort=='payment_inquirytel') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="payment_inquirytel">
<span>問い合わせ電話</span>
</th>
<th class="sorting {{ ($sort=='payment_inquiryname') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="payment_inquiryname">
<span>問い合わせ担当</span>
</th>
<th class="sorting {{ ($sort=='payment_time') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="payment_time">
<span>受付時間</span>
</th>
<th class="sorting {{ ($sort=='updated_at') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="updated_at">
<span>更新日時</span>
</th>
</tr>
</thead>
<tbody>
@foreach($payments as $payment)
<tr>
<td class="sm-item text-left">{{ $payment->payment_id }}</td>
<td class="sm-item text-left">{{ $payment->payment_companyname }}</td>
<td class="sm-item text-left">{{ $payment->payment_inquirytel }}</td>
<td class="sm-item text-left">{{ $payment->payment_inquiryname }}</td>
<td class="sm-item text-left">{{ $payment->payment_time }}</td>
<td class="sm-item text-left">{{ optional($payment->updated_at)->format('Y-m-d H:i') }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
<form action="{{ route('payments_export') }}" method="GET" id="form_export"></form>
{{-- 一括削除 & ソートのJS既存規約に合わせ最小限 --}}
@push('scripts')
<script>
// 全選択
document.getElementById('checkbox_all')?.addEventListener('change', function(e){
document.querySelectorAll('.checkbox').forEach(cb => cb.checked = e.target.checked);
});
// 削除確認
document.getElementById('delete')?.addEventListener('click', function(){
const anyChecked = Array.from(document.querySelectorAll('.checkbox')).some(cb => cb.checked);
if (!anyChecked) {
alert('削除対象が選択されていません。');
return;
}
if (confirm('削除してよろしいですか?')) {
document.getElementById('form_delete').submit();
}
});
// ヘッダクリックでソート変更(既存 list と同様のカスタム属性 "sort" を使用)
document.querySelectorAll('th.sorting').forEach(th => {
th.addEventListener('click', function(){
const form = document.getElementById('list-form');
const current = "{{ $sort ?? '' }}";
const currentType = "{{ $sort_type ?? '' }}";
const nextCol = this.getAttribute('sort');
let nextType = 'asc';
if (current === nextCol) {
nextType = (currentType === 'asc') ? 'desc' : 'asc';
}
form.querySelector('[name=sort]').value = nextCol;
form.querySelector('[name=sort_type]').value = nextType;
form.submit();
});
});
</script>
@endpush
@endsection