krgm.so-manager-dev.com/resources/views/admin/tax/list.blade.php
kin.rinzen ef4c9fe57c
All checks were successful
Deploy preview (main_kin) / deploy (push) Successful in 12s
画面エラー修正
2025-08-25 20:00:10 +09:00

154 lines
7.3 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">
{{-- 並び替え用 hidden --}}
<form action="{{ route('tax') }}" 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('tax_add') }}'">新規</button>
<button type="button" class="btn btn-sm btn-default mr10" id="delete">削除</button>
<button type="submit" class="btn btn-sm btn-default mr10" form="form_export">{{ __('CSV出力') }}</button>
<div class="d-flex justify-content-end">
{{ $taxes->appends(['sort' => $sort ?? '', 'sort_type' => $sort_type ?? ''])->links('pagination') }}
</div>
</div>
<!-- メッセージ表示 -->
<div class="form col-lg-12">
@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>
@endif
</div>
<!-- 単一テーブル構成 ----------------------------------------- -->
<div class="col-lg-12 mb20">
<div class="table-responsive">
<form action="{{ route('tax_delete') }}" method="POST" id="form_delete">
@csrf
<table class="table table-bordered table-striped dataTable text-nowrap">
<thead>
<tr>
{{-- チェック + 編集 --}}
<th style="width:120px;" class="text-left">
<input type="checkbox" class="minimal m-0" id="checkbox_all">
</th>
<th class="sorting {{ ($sort=='tax_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="tax_id">
<span>消費税ID</span>
</th>
<th class="sorting {{ ($sort=='tax_percent') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="tax_percent">
<span>消費税率</span>
</th>
<th class="sorting {{ ($sort=='tax_day') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="tax_day">
<span>適用日</span>
</th>
</tr>
</thead>
<tbody>
@foreach($taxes as $tax)
<tr>
{{-- 同じセルに チェック + 編集ボタン --}}
<td class="table-warning align-middle">
<div class="d-flex align-items-center">
<input type="checkbox" class="minimal m-0 checkbox" name="id[]" value="{{ $tax->tax_id }}">
<a href="{{ route('tax_edit', ['id' => $tax->tax_id]) }}" class="btn btn-sm btn-default ml-2">編集</a>
</div>
</td>
<td class="sm-item text-left align-middle">{{ $tax->tax_id }}</td>
<td class="sm-item text-left align-middle">
@php
$val = is_numeric($tax->tax_percent)
? number_format((float)$tax->tax_percent, 2, '.', '')
: (string)$tax->tax_percent;
@endphp
{{ $val }}%
</td>
<td class="sm-item text-left align-middle">{{ optional($tax->tax_day)->format('Y-m-d') }}</td>
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
</div>
<!-- 単一テーブル構成ここまで ----------------------------------------- -->
</div>
</section>
<form action="{{ route('tax_export') }}" method="GET" id="form_export"></form>
@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();
}
});
// ヘッダクリックでソート
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