krgm.so-manager-dev.com/resources/views/admin/settings/list.blade.php
kin.rinzen 6019e68da7
All checks were successful
Deploy preview (main_kin) / deploy (push) Successful in 13s
画面追加(zones)
2025-08-29 16:32:45 +09:00

163 lines
8.9 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')
<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 active">{{ __('設定マスタ') }}</li>
</ol>
</div>
</div>
</div>
</div>
<section class="content">
<div class="container-fluid">
{{-- ソート用フォーム --}}
<form action="{{ route('settings') }}" method="post" id="list-form" class="d-none">
@csrf
<input type="hidden" name="sort" id="sort" value="{{ $sort }}">
<input type="hidden" name="sort_type" id="sort_type" value="{{ $sort_type }}">
</form>
<!-- ツールバー -->
<div class="container-fluid mb20 d-flex justify-content-between align-items-center">
<div>
<button type="button" class="btn btn-sm btn-default mr10" onclick="location.href='{{ route('settings_add') }}'">
{{ __('新規') }}
</button>
<button type="button" class="btn btn-sm btn-default mr10" id="delete">{{ __('削除') }}</button>
</div>
<div>
{{ $list->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>
@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>
<!-- 単一テーブル構成 ----------------------------------------- -->
<div class="col-lg-12 mb20">
<div class="table-responsive">
<form action="{{ route('settings_delete') }}" method="POST" id="form_delete">
@csrf
<table class="table table-bordered table-striped dataTable text-nowrap">
<thead>
<tr>
<th style="width:140px;" class="text-left">
<input type="checkbox" onclick="$('input[name*=\'pk\']').prop('checked', this.checked);">
</th>
<th sort="setting_id" class="sorting {{ ($sort=='setting_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"><span>{{ __('設定ID') }}</span></th>
<th sort="edit_master" class="sorting {{ ($sort=='edit_master') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"><span>{{ __('編集マスタ') }}</span></th>
<th sort="web_master" class="sorting {{ ($sort=='web_master') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"><span>{{ __('ウェブ参照マスタ') }}</span></th>
<th sort="auto_change_date" class="sorting {{ ($sort=='auto_change_date') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"><span>{{ __('自動切替日時') }}</span></th>
<th><span>{{ __('自動切換え参照マスタ') }}</span></th>
<th sort="printable_alert_flag" class="sorting {{ ($sort=='printable_alert_flag') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"><span>{{ __('印字残警告') }}</span></th>
<th class="text-right"><span>{{ __('ロール紙印字可能数') }}</span></th>
<th class="text-right"><span>{{ __('ロール紙印字残警告数') }}</span></th>
<th class="text-right"><span>{{ __('キープアライブ(分)') }}</span></th>
</tr>
</thead>
<tbody>
@foreach($list as $row)
<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="{{ $row->setting_id }}">
<a href="{{ route('settings_edit',['id'=>$row->setting_id]) }}" class="btn btn-sm btn-default ml-2">{{ __('編集') }}</a>
</div>
</td>
<td class="sm-item text-right align-middle">{{ $row->setting_id }}</td>
<td class="sm-item text-left align-middle">{{ $row->edit_master }}</td>
<td class="sm-item text-left align-middle">{{ $row->web_master }}</td>
<td class="sm-item text-right align-middle">
@php
$dt = $row->auto_change_date instanceof \Carbon\Carbon
? $row->auto_change_date->format('Y/m/d H:i')
: ($row->auto_change_date ? \Carbon\Carbon::parse($row->auto_change_date)->format('Y/m/d H:i') : '');
@endphp
{{ $dt }}
</td>
<td class="sm-item text-left align-middle">{{ $row->auto_chage_master }}</td>
<td class="sm-item text-left align-middle">{{ $row->printable_alert_flag ? '○' : '' }}</td>
<td class="sm-item text-right align-middle">{{ $row->printable_number }}</td>
<td class="sm-item text-right align-middle">{{ $row->printable_alert_number }}</td>
<td class="sm-item text-right align-middle">{{ $row->printer_keep_alive }}</td>
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
</div>
<!-- 単一テーブル構成ここまで ----------------------------------------- -->
</div>
</section>
{{-- 一括削除 & ソート --}}
@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