【定期契約マスタ】【タグ発行キュー処理、履歴表示】画面修正
All checks were successful
Deploy main / deploy (push) Successful in 22s
All checks were successful
Deploy main / deploy (push) Successful in 22s
This commit is contained in:
parent
c25833562c
commit
d7b4e10459
@ -54,6 +54,10 @@ class TagissueController extends Controller
|
|||||||
'user.user_regident_pre',
|
'user.user_regident_pre',
|
||||||
'user.user_regident_city',
|
'user.user_regident_city',
|
||||||
'user.user_regident_add',
|
'user.user_regident_add',
|
||||||
|
'user.user_relate_zip',
|
||||||
|
'user.user_relate_pre',
|
||||||
|
'user.user_relate_city',
|
||||||
|
'user.user_relate_add',
|
||||||
'operator_que.que_id',
|
'operator_que.que_id',
|
||||||
'operator_que.que_class',
|
'operator_que.que_class',
|
||||||
'operator_que.que_status'
|
'operator_que.que_status'
|
||||||
@ -125,9 +129,7 @@ class TagissueController extends Controller
|
|||||||
{
|
{
|
||||||
$ids = $request->input('ids', []); // チェックされたuser_id配列
|
$ids = $request->input('ids', []); // チェックされたuser_id配列
|
||||||
$action = $request->input('action'); // 'to_issued' or 'to_unissued'
|
$action = $request->input('action'); // 'to_issued' or 'to_unissued'
|
||||||
if (empty($ids) || !is_array($ids)) {
|
|
||||||
return back()->with('error', 'チェックボックスを選択してください。');
|
|
||||||
}
|
|
||||||
$operatorId = auth()->id();
|
$operatorId = auth()->id();
|
||||||
$now = now();
|
$now = now();
|
||||||
// 対象ユーザーのoperator_queを取得
|
// 対象ユーザーのoperator_queを取得
|
||||||
|
|||||||
@ -379,9 +379,7 @@
|
|||||||
@endphp
|
@endphp
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="text-right {{ $sortClass('contract_id') }}" sort="contract_id" style="white-space:nowrap;">
|
<th style="width:50px; text-align:right;"></th>
|
||||||
契約ID {!! $renderSortIcon('contract_id') !!}
|
|
||||||
</th>
|
|
||||||
{{-- 操作列(チェック+編集。背景色を付与) --}}
|
{{-- 操作列(チェック+編集。背景色を付与) --}}
|
||||||
<th style="width:120px">
|
<th style="width:120px">
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
@ -389,7 +387,9 @@
|
|||||||
<span></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
|
<th class="text-right {{ $sortClass('contract_id') }}" sort="contract_id" style="white-space:nowrap;">
|
||||||
|
契約ID {!! $renderSortIcon('contract_id') !!}
|
||||||
|
</th>
|
||||||
{{-- 表頭(要件に合わせて網羅) --}}
|
{{-- 表頭(要件に合わせて網羅) --}}
|
||||||
<th class="text-right {{ $sortClass('contract_qr_id') }}" sort="contract_qr_id">
|
<th class="text-right {{ $sortClass('contract_qr_id') }}" sort="contract_qr_id">
|
||||||
定期契約ID {!! $renderSortIcon('contract_qr_id') !!}
|
定期契約ID {!! $renderSortIcon('contract_qr_id') !!}
|
||||||
@ -523,8 +523,8 @@
|
|||||||
@endphp
|
@endphp
|
||||||
@foreach($list as $item)
|
@foreach($list as $item)
|
||||||
<tr>
|
<tr>
|
||||||
{{-- 先頭の並び替え列(行の contract_id を表示) --}}
|
|
||||||
<td class="text-right">{{ $item->contract_id }}</td>
|
<td class="text-right">{{ $loop->iteration }}</td>
|
||||||
|
|
||||||
{{-- 操作列:チェック + 編集(背景色つき) --}}
|
{{-- 操作列:チェック + 編集(背景色つき) --}}
|
||||||
<td class="op-cell">
|
<td class="op-cell">
|
||||||
@ -535,6 +535,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
{{-- 先頭の並び替え列(行の contract_id を表示) --}}
|
||||||
|
<td class="text-right">{{ $item->contract_id }}</td>
|
||||||
{{-- データ列 --}}
|
{{-- データ列 --}}
|
||||||
<td class="text-right">{{ $item->contract_qr_id }}</td>
|
<td class="text-right">{{ $item->contract_qr_id }}</td>
|
||||||
<td>{{ $item->old_contract_id ?? '' }}</td>
|
<td>{{ $item->old_contract_id ?? '' }}</td>
|
||||||
|
|||||||
@ -23,10 +23,11 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 絞り込み -->
|
<!-- 絞り込みヘッダー -->
|
||||||
<div class="card mb-3">
|
<div class="card mb-3">
|
||||||
<div class="card-body">
|
<div class="card-body py-2">
|
||||||
<!-- 1行目:印刷処理 -->
|
|
||||||
|
{{-- 印刷処理 --}}
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="col-md-12 font-weight-bold mb-1">印刷処理</div>
|
<div class="col-md-12 font-weight-bold mb-1">印刷処理</div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@ -34,73 +35,45 @@
|
|||||||
<div class="col-md-2 mb-1">
|
<div class="col-md-2 mb-1">
|
||||||
<button type="button" class="btn btn-outline-secondary btn-xs w-100 py-1 px-2"
|
<button type="button" class="btn btn-outline-secondary btn-xs w-100 py-1 px-2"
|
||||||
style="font-size:0.85rem;" onclick="handlePrintLabels()">タグ発送宛名印刷</button>
|
style="font-size:0.85rem;" onclick="handlePrintLabels()">タグ発送宛名印刷</button>
|
||||||
<script>
|
|
||||||
function handlePrintLabels() {
|
|
||||||
var checkboxes = document.querySelectorAll('input[name="ids[]"]:checked');
|
|
||||||
if (checkboxes.length === 0) {
|
|
||||||
alert('1件以上選択してください。');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (confirm('タグ発送用宛名を印刷してよろしいですか?')) {
|
|
||||||
// 送信用form生成
|
|
||||||
var form = document.createElement('form');
|
|
||||||
form.method = 'POST';
|
|
||||||
form.action = '/tagissue/print-unissued-labels';
|
|
||||||
form.target = '_blank';
|
|
||||||
// CSRF
|
|
||||||
var csrf = document.createElement('input');
|
|
||||||
csrf.type = 'hidden';
|
|
||||||
csrf.name = '_token';
|
|
||||||
csrf.value = '{{ csrf_token() }}';
|
|
||||||
form.appendChild(csrf);
|
|
||||||
// ids
|
|
||||||
checkboxes.forEach(function(cb) {
|
|
||||||
var input = document.createElement('input');
|
|
||||||
input.type = 'hidden';
|
|
||||||
input.name = 'ids[]';
|
|
||||||
input.value = cb.value;
|
|
||||||
form.appendChild(input);
|
|
||||||
});
|
|
||||||
document.body.appendChild(form);
|
|
||||||
form.submit();
|
|
||||||
document.body.removeChild(form);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-10 mb-1"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 2行目:絞り込みフィルター -->
|
|
||||||
|
{{-- 種別フィルター --}}
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="col-md-12 font-weight-bold mb-1">絞り込みフィルター</div>
|
<div class="col-md-12 font-weight-bold mb-1">種別フィルター</div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="row g-1">
|
<div class="row g-1">
|
||||||
<div class="col-md-2 mb-1">
|
<div class="col-md-2 mb-1">
|
||||||
<form method="GET" style="display:inline;">
|
<form method="GET">
|
||||||
@if(request('filter_type') == 'unissued_toggle')
|
@if(request('filter_type') == 'unissued_toggle')
|
||||||
<button type="submit" class="btn btn-warning btn-xs w-100 py-1 px-2" style="font-size:0.85rem;">タグ未発送解除</button>
|
<button type="submit" class="btn btn-warning btn-xs w-100 py-1 px-2"
|
||||||
|
style="font-size:0.85rem;">タグ未発送解除</button>
|
||||||
@else
|
@else
|
||||||
<input type="hidden" name="filter_type" value="unissued_toggle">
|
<input type="hidden" name="filter_type" value="unissued_toggle">
|
||||||
<button type="submit" class="btn btn-outline-secondary btn-xs w-100 py-1 px-2" style="font-size:0.85rem;">タグ発送未発送</button>
|
<button type="submit" class="btn btn-outline-secondary btn-xs w-100 py-1 px-2"
|
||||||
|
style="font-size:0.85rem;">タグ発送未発送</button>
|
||||||
@endif
|
@endif
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 mb-1">
|
<div class="col-md-2 mb-1">
|
||||||
<form method="GET" style="display:inline;">
|
<form method="GET">
|
||||||
@if(request('filter_type') == 'issued_toggle')
|
@if(request('filter_type') == 'issued_toggle')
|
||||||
<button type="submit" class="btn btn-warning btn-xs w-100 py-1 px-2" style="font-size:0.85rem;">タグ発送済み解除</button>
|
<button type="submit" class="btn btn-warning btn-xs w-100 py-1 px-2"
|
||||||
@else
|
style="font-size:0.85rem;">タグ発送済み解除</button>
|
||||||
<input type="hidden" name="filter_type" value="issued_toggle">
|
@else
|
||||||
<button type="submit" class="btn btn-outline-secondary btn-xs w-100 py-1 px-2" style="font-size:0.85rem;">タグ発送済み</button>
|
<input type="hidden" name="filter_type" value="issued_toggle">
|
||||||
@endif
|
<button type="submit" class="btn btn-outline-secondary btn-xs w-100 py-1 px-2"
|
||||||
</form>
|
style="font-size:0.85rem;">タグ発送済み</button>
|
||||||
|
@endif
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 3行目:タグシリアルフィルター -->
|
|
||||||
|
{{-- タグシリアルフィルター --}}
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="col-md-12 font-weight-bold mb-1">タグシリアルフィルター</div>
|
<div class="col-md-12 font-weight-bold mb-1">タグシリアルフィルター</div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@ -108,159 +81,252 @@
|
|||||||
<div class="row align-items-center g-1">
|
<div class="row align-items-center g-1">
|
||||||
<div class="col-auto font-weight-bold" style="padding-right:4px;">タグシリアル</div>
|
<div class="col-auto font-weight-bold" style="padding-right:4px;">タグシリアル</div>
|
||||||
<div class="col-auto" style="min-width:140px;">
|
<div class="col-auto" style="min-width:140px;">
|
||||||
<input type="text" name="tag_serial" value="{{ request('tag_serial') }}" class="form-control form-control-sm" style="font-size:0.85rem; padding:2px 6px;" placeholder="キーワード…">
|
<input type="text" name="tag_serial" value="{{ request('tag_serial') }}"
|
||||||
|
class="form-control form-control-sm" style="font-size:0.85rem; padding:2px 6px;"
|
||||||
|
placeholder="キーワード…">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto font-weight-bold" style="padding-right:4px; padding-left:8px;">タグシリアル64進</div>
|
<div class="col-auto font-weight-bold" style="padding-right:4px; padding-left:8px;">
|
||||||
|
タグシリアル64進</div>
|
||||||
<div class="col-auto" style="min-width:140px;">
|
<div class="col-auto" style="min-width:140px;">
|
||||||
<input type="text" name="tag_serial_64" value="{{ request('tag_serial_64') }}" class="form-control form-control-sm" style="font-size:0.85rem; padding:2px 6px;" placeholder="キーワード…">
|
<input type="text" name="tag_serial_64" value="{{ request('tag_serial_64') }}"
|
||||||
|
class="form-control form-control-sm" style="font-size:0.85rem; padding:2px 6px;"
|
||||||
|
placeholder="キーワード…">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto text-end" style="padding-left:8px;">
|
<div class="col-auto text-end" style="padding-left:8px;">
|
||||||
<button type="submit" class="btn btn-default btn-xs py-1 px-2 me-1" style="font-size:0.85rem; min-width:60px;">絞り込み</button>
|
<button type="submit" class="btn btn-default btn-xs py-1 px-2 me-1"
|
||||||
<a href="{{ route('tagissue') }}" class="btn btn-default btn-xs py-1 px-2" style="font-size:0.85rem; min-width:60px;">全表示</a>
|
style="font-size:0.85rem; min-width:60px;">絞り込み</button>
|
||||||
|
<a href="{{ route('tagissue') }}" class="btn btn-default btn-xs py-1 px-2"
|
||||||
|
style="font-size:0.85rem; min-width:60px;">全表示</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 4行目:タグ発送ステータス変更 -->
|
|
||||||
|
{{-- タグ発送ステータス変更 --}}
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="col-md-12 font-weight-bold mb-1">タグ発送ステータス変更</div>
|
<div class="col-md-12 font-weight-bold mb-1">タグ発送ステータス変更</div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
{{-- form 不包含表格 --}}
|
||||||
<form id="statusForm" method="POST" action="{{ route('tagissue.status') }}">
|
<form id="statusForm" method="POST" action="{{ route('tagissue.status') }}">
|
||||||
@csrf
|
@csrf
|
||||||
<input type="hidden" name="action" id="statusAction" value="">
|
<input type="hidden" name="action" id="statusAction" value="">
|
||||||
<div class="row g-1">
|
|
||||||
<div class="col-md-2 mb-1">
|
|
||||||
<button type="button" class="btn btn-outline-secondary btn-xs w-100 py-1 px-2"
|
|
||||||
style="font-size:0.85rem;" onclick="handleStatusChange('to_issued')">タグ発送済み</button>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2 mb-1">
|
|
||||||
<button type="button" class="btn btn-outline-secondary btn-xs w-100 py-1 px-2"
|
|
||||||
style="font-size:0.85rem;" onclick="handleStatusChange('to_unissued')">タグ未発送</button>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8 mb-1"></div>
|
|
||||||
</div>
|
|
||||||
<div class="mt-2">
|
|
||||||
<div style="overflow-x: auto;">
|
|
||||||
<table class="table table-bordered dataTable text-nowrap">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th style="width:40px;background-color:"><input type="checkbox" onclick="document.querySelectorAll('input[name=\'ids[]\']').forEach(cb => cb.checked = this.checked);"></th>
|
|
||||||
<th class="sorting {{ ($sort=='que_id') ? ($sortType=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="que_id" style="color:#212529;cursor:pointer;"><span>キューID</span></th>
|
|
||||||
<th class="sorting {{ ($sort=='user_tag_serial') ? ($sortType=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="user_tag_serial" style="color:#212529;cursor:pointer;"><span>タグシリアル</span></th>
|
|
||||||
<th class="sorting {{ ($sort=='user_tag_serial_64') ? ($sortType=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="user_tag_serial_64" style="color:#212529;cursor:pointer;"><span>タグシリアル64進</span></th>
|
|
||||||
<th class="sorting {{ ($sort=='user_tag_issue') ? ($sortType=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="user_tag_issue" style="color:#212529;cursor:pointer;"><span>タグ発送ステータス</span></th>
|
|
||||||
<th class="sorting {{ ($sort=='user_name') ? ($sortType=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="user_name" style="color:#212529;cursor:pointer;"><span>利用者名</span></th>
|
|
||||||
<th><span>携帯電話番号</span></th>
|
|
||||||
<th><span>自宅電話番号</span></th>
|
|
||||||
<th><span>居住所:郵便番号</span></th>
|
|
||||||
<th><span>居住所:都道府県</span></th>
|
|
||||||
<th><span>居住所:市区郡</span></th>
|
|
||||||
<th><span>居住所:住所</span></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach($users as $user)
|
|
||||||
<tr>
|
|
||||||
<td style="background-color:#faebd7;">
|
|
||||||
<input type="checkbox" name="ids[]" value="{{ $user->user_id }}">
|
|
||||||
</td>
|
|
||||||
@php
|
|
||||||
$que = \App\Models\OperatorQue::where('user_id', $user->user_id)->first();
|
|
||||||
@endphp
|
|
||||||
<td>{{ $que ? $que->que_id : '' }}</td>
|
|
||||||
<td>{{ $user->user_tag_serial }}</td>
|
|
||||||
<td>{{ $user->user_tag_serial_64 }}</td>
|
|
||||||
<td>{{ $user->user_tag_issue }}</td>
|
|
||||||
<td>
|
|
||||||
@if(!empty($user->user_seq))
|
|
||||||
<a href="{{ route('users_edit', ['seq' => $user->user_seq]) }}" target="_blank">
|
|
||||||
{{ $user->user_name }}
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
{{ $user->user_name }}
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>{{ $user->user_mobile }}</td>
|
|
||||||
<td>{{ $user->user_homephone }}</td>
|
|
||||||
<td>{{ $user->user_regident_zip }}</td>
|
|
||||||
<td>{{ $user->user_regident_pre }}</td>
|
|
||||||
<td>{{ $user->user_regident_city }}</td>
|
|
||||||
<td>{{ $user->user_regident_add }}</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex align-items-center mb-2">
|
|
||||||
<div class="ms-auto">
|
|
||||||
{{ $users->appends(request()->except('page'))->links('pagination') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
<script>
|
|
||||||
function handleStatusChange(actionType) {
|
<div class="row g-1 mb-2">
|
||||||
var form = document.getElementById('statusForm');
|
<div class="col-md-2 mb-1">
|
||||||
document.getElementById('statusAction').value = actionType;
|
<button type="button" class="btn btn-outline-secondary btn-xs w-100 py-1 px-2"
|
||||||
var checkboxes = document.querySelectorAll('input[name="ids[]"]:checked');
|
style="font-size:0.85rem;" onclick="handleStatusChange('to_issued')">タグ発送済み</button>
|
||||||
if (checkboxes.length === 0) {
|
</div>
|
||||||
alert('1件以上選択してください。');
|
<div class="col-md-2 mb-1">
|
||||||
return;
|
<button type="button" class="btn btn-outline-secondary btn-xs w-100 py-1 px-2"
|
||||||
}
|
style="font-size:0.85rem;" onclick="handleStatusChange('to_unissued')">タグ未発送</button>
|
||||||
var ids = Array.from(checkboxes).map(cb => cb.value);
|
</div>
|
||||||
var ajaxType = (actionType === 'to_issued') ? 'issued' : 'unissued';
|
</div>
|
||||||
fetch('/tagissue/check-status', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ ids: ids, type: ajaxType })
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (ajaxType === 'issued' && data.alreadyIssued.length > 0) {
|
|
||||||
alert('以下のユーザーはすでにタグ発送済みです:\n' + data.alreadyIssued.join('\n'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ajaxType === 'unissued' && data.alreadyUnissued && data.alreadyUnissued.length > 0) {
|
|
||||||
alert('以下のユーザーはすでにタグ未発送です:\n' + data.alreadyUnissued.join('\n'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var confirmMsg = (ajaxType === 'issued') ? 'ステータスをタグ発送済に変更してよろしいですか?' : 'ステータスをタグ未発送に変更してよろしいですか?';
|
|
||||||
if (confirm(confirmMsg)) {
|
|
||||||
form.submit();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
alert('ステータス確認に失敗しました。');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- 表格区域 --}}
|
||||||
|
<div class="mt-2">
|
||||||
|
<div class="d-flex justify-content-end mb-2">
|
||||||
|
<div class="ms-auto">
|
||||||
|
{{ $users->appends(request()->except('page'))->links('pagination') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="overflow-x: auto;">
|
||||||
|
<table class="table table-bordered dataTable text-nowrap">
|
||||||
|
<thead class="thead-light">
|
||||||
|
<tr>
|
||||||
|
<th style="width:40px;">
|
||||||
|
<input type="checkbox"
|
||||||
|
onclick="document.querySelectorAll('input[name=\'ids[]\']').forEach(cb => cb.checked = this.checked);">
|
||||||
|
</th>
|
||||||
|
<th sort="que_id">キューID</th>
|
||||||
|
<th sort="user_tag_serial">タグシリアル</th>
|
||||||
|
<th sort="user_tag_serial_64">タグシリアル64進</th>
|
||||||
|
<th sort="user_tag_issue">タグ発送ステータス</th>
|
||||||
|
<th sort="user_name">利用者名</th>
|
||||||
|
<th>携帯電話番号</th>
|
||||||
|
<th>自宅電話番号</th>
|
||||||
|
<th>居住所:郵便番号</th>
|
||||||
|
<th>居住所:都道府県</th>
|
||||||
|
<th>居住所:市区群</th>
|
||||||
|
<th>居住所:住所</th>
|
||||||
|
<th>関連住所:郵便番号</th>
|
||||||
|
<th>関連住所:都道府県</th>
|
||||||
|
<th>関連住所:市区群</th>
|
||||||
|
<th>関連住所:住所</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($users as $user)
|
||||||
|
<tr>
|
||||||
|
<td style="background-color:#faebd7;">
|
||||||
|
<input type="checkbox" name="ids[]" value="{{ $user->user_id }}">
|
||||||
|
</td>
|
||||||
|
@php
|
||||||
|
$que = \App\Models\OperatorQue::where('user_id', $user->user_id)->first();
|
||||||
|
@endphp
|
||||||
|
<td>{{ $que ? $que->que_id : '' }}</td>
|
||||||
|
<td>{{ $user->user_tag_serial }}</td>
|
||||||
|
<td>{{ $user->user_tag_serial_64 }}</td>
|
||||||
|
<td>{{ $user->user_tag_issue }}</td>
|
||||||
|
<td>
|
||||||
|
@if(!empty($user->user_seq))
|
||||||
|
<a href="{{ route('users_edit', ['seq' => $user->user_seq]) }}" target="_blank">
|
||||||
|
{{ $user->user_id }}: {{ $user->user_name }}
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
{{ $user->user_id }}: {{ $user->user_name }}
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td>{{ $user->user_mobile }}</td>
|
||||||
|
<td>{{ $user->user_homephone }}</td>
|
||||||
|
<td>{{ $user->user_regident_zip }}</td>
|
||||||
|
<td>{{ $user->user_regident_pre }}</td>
|
||||||
|
<td>{{ $user->user_regident_city }}</td>
|
||||||
|
<td>{{ $user->user_regident_add }}</td>
|
||||||
|
<td>{{ $user->user_relate_zip }}</td>
|
||||||
|
<td>{{ $user->user_relate_pre }}</td>
|
||||||
|
<td>{{ $user->user_relate_city }}</td>
|
||||||
|
<td>{{ $user->user_relate_add }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
|
||||||
// ソート挙動
|
{{-- 印刷処理用 JS --}}
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
<script>
|
||||||
document.querySelectorAll('th.sorting').forEach(function(th) {
|
// タグ発送宛名印刷
|
||||||
th.addEventListener('click', function() {
|
function handlePrintLabels() {
|
||||||
var sort = th.getAttribute('sort');
|
var checkboxes = document.querySelectorAll('input[name="ids[]"]:checked');
|
||||||
var currentSort = new URLSearchParams(window.location.search).get('sort');
|
if (checkboxes.length === 0) {
|
||||||
var currentType = new URLSearchParams(window.location.search).get('sort_type');
|
alert('1件以上選択してください。');
|
||||||
var nextType = 'asc';
|
return;
|
||||||
if (currentSort === sort) {
|
|
||||||
nextType = (currentType === 'asc') ? 'desc' : 'asc';
|
|
||||||
}
|
}
|
||||||
var params = new URLSearchParams(window.location.search);
|
if (confirm('タグ発送用宛名を印刷してよろしいですか?')) {
|
||||||
params.set('sort', sort);
|
var form = document.createElement('form');
|
||||||
params.set('sort_type', nextType);
|
form.method = 'POST';
|
||||||
window.location.search = params.toString();
|
form.action = '/tagissue/print-unissued-labels';
|
||||||
|
form.target = '_blank';
|
||||||
|
var csrf = document.createElement('input');
|
||||||
|
csrf.type = 'hidden';
|
||||||
|
csrf.name = '_token';
|
||||||
|
csrf.value = '{{ csrf_token() }}';
|
||||||
|
form.appendChild(csrf);
|
||||||
|
checkboxes.forEach(function (cb) {
|
||||||
|
var input = document.createElement('input');
|
||||||
|
input.type = 'hidden';
|
||||||
|
input.name = 'ids[]';
|
||||||
|
input.value = cb.value;
|
||||||
|
form.appendChild(input);
|
||||||
|
});
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
document.body.removeChild(form);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ステータス変更処理
|
||||||
|
function handleStatusChange(actionType) {
|
||||||
|
var checkboxes = document.querySelectorAll('input[name="ids[]"]:checked');
|
||||||
|
if (checkboxes.length === 0) {
|
||||||
|
$.alert({
|
||||||
|
title: '選択エラー',
|
||||||
|
content: '1件以上選択してください。'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ids = Array.from(checkboxes).map(cb => cb.value);
|
||||||
|
var ajaxType = (actionType === 'to_issued') ? 'issued' : 'unissued';
|
||||||
|
|
||||||
|
fetch('/tagissue/check-status', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ ids: ids, type: ajaxType })
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (ajaxType === 'issued' && data.alreadyIssued.length > 0) {
|
||||||
|
$.alert({
|
||||||
|
title: '確認エラー',
|
||||||
|
content: '以下のユーザーはすでにタグ発送済みです:<br>' + data.alreadyIssued.join('<br>')
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ajaxType === 'unissued' && data.alreadyUnissued && data.alreadyUnissued.length > 0) {
|
||||||
|
$.alert({
|
||||||
|
title: '確認エラー',
|
||||||
|
content: '以下のユーザーはすでにタグ未発送です:<br>' + data.alreadyUnissued.join('<br>')
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var confirmMsg = (ajaxType === 'issued')
|
||||||
|
? 'ステータスをタグ発送済に変更してよろしいですか?'
|
||||||
|
: 'ステータスをタグ未発送に変更してよろしいですか?';
|
||||||
|
|
||||||
|
$.confirm({
|
||||||
|
title: '確認ダイアログ',
|
||||||
|
content: confirmMsg,
|
||||||
|
buttons: {
|
||||||
|
はい: {
|
||||||
|
text: 'はい',
|
||||||
|
btnClass: 'btn-primary',
|
||||||
|
keys: ['enter'],
|
||||||
|
action: function () {
|
||||||
|
var form = document.getElementById('statusForm');
|
||||||
|
// 古い input 清除
|
||||||
|
form.querySelectorAll('input[name="ids[]"]').forEach(e => e.remove());
|
||||||
|
// 动态附加选中 ID
|
||||||
|
ids.forEach(id => {
|
||||||
|
var input = document.createElement('input');
|
||||||
|
input.type = 'hidden';
|
||||||
|
input.name = 'ids[]';
|
||||||
|
input.value = id;
|
||||||
|
form.appendChild(input);
|
||||||
|
});
|
||||||
|
document.getElementById('statusAction').value = actionType;
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
いいえ: function () { }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
$.alert({
|
||||||
|
title: '通信エラー',
|
||||||
|
content: 'ステータス確認に失敗しました。'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ソート挙動
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
document.querySelectorAll('th[sort]').forEach(function (th) {
|
||||||
|
th.addEventListener('click', function () {
|
||||||
|
var sort = th.getAttribute('sort');
|
||||||
|
var params = new URLSearchParams(window.location.search);
|
||||||
|
var currentSort = params.get('sort');
|
||||||
|
var currentType = params.get('sort_type');
|
||||||
|
var nextType = (currentSort === sort && currentType === 'asc') ? 'desc' : 'asc';
|
||||||
|
params.set('sort', sort);
|
||||||
|
params.set('sort_type', nextType);
|
||||||
|
window.location.search = params.toString();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
</script>
|
||||||
});
|
@endsection
|
||||||
</script>
|
|
||||||
@endsection
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user