利用者分類マスタ画面修正
This commit is contained in:
parent
e26790c578
commit
43be1d5ba7
@ -27,29 +27,48 @@ class UsertypeController extends Controller
|
||||
if (!in_array($sort, $allowSort, true)) {
|
||||
$sort = 'user_categoryid';
|
||||
}
|
||||
|
||||
$sortType = strtolower($request->input('sort_type', 'asc'));
|
||||
if (!in_array($sortType, ['asc', 'desc'], true)) {
|
||||
$sortType = 'asc';
|
||||
}
|
||||
|
||||
$action = $request->input('action');
|
||||
if ($action === 'unlink') {
|
||||
$request->merge([
|
||||
'filter_sort_order' => '',
|
||||
'filter_usertype_subject1' => '',
|
||||
'filter_usertype_subject2' => '',
|
||||
'filter_usertype_subject3' => '',
|
||||
'page' => 1,
|
||||
]);
|
||||
}
|
||||
|
||||
$inputs = [
|
||||
'isMethodPost' => $request->isMethod('post') ? 1 : 0,
|
||||
'isExport' => 0,
|
||||
'sort' => $sort,
|
||||
'sort_type' => $sortType,
|
||||
'page' => (int) $request->get('page', 1),
|
||||
'isExport' => 0,
|
||||
'sort' => $sort,
|
||||
'sort_type' => $sortType,
|
||||
'page' => (int) $request->get('page', 1),
|
||||
'action' => $action,
|
||||
];
|
||||
|
||||
$filters = [
|
||||
'filter_sort_order' => $request->input('filter_sort_order', ''),
|
||||
'filter_usertype_subject1' => $request->input('filter_usertype_subject1', ''),
|
||||
'filter_usertype_subject2' => $request->input('filter_usertype_subject2', ''),
|
||||
'filter_usertype_subject3' => $request->input('filter_usertype_subject3', ''),
|
||||
'filter_sort_order' => $request->input('filter_sort_order', ''),
|
||||
'filter_usertype_subject1'=> $request->input('filter_usertype_subject1', ''),
|
||||
'filter_usertype_subject2'=> $request->input('filter_usertype_subject2', ''),
|
||||
'filter_usertype_subject3'=> $request->input('filter_usertype_subject3', ''),
|
||||
];
|
||||
|
||||
$searchParams = array_merge($inputs, $filters);
|
||||
|
||||
$viewData = $searchParams;
|
||||
$viewData['list'] = Usertype::search($searchParams);
|
||||
|
||||
if ($viewData['list']->total() > 0 && $viewData['page'] > $viewData['list']->lastPage()) {
|
||||
return redirect()->route('usertypes');
|
||||
}
|
||||
|
||||
return view('admin.usertypes.list', $viewData);
|
||||
}
|
||||
|
||||
@ -82,17 +101,24 @@ class UsertypeController extends Controller
|
||||
|
||||
// バリデーションルール(最小限)
|
||||
$rules = [
|
||||
'sort_order' => 'nullable|integer',
|
||||
'usertype_subject1' => 'nullable|string|max:255',
|
||||
'usertype_subject2' => 'nullable|string|max:255',
|
||||
'usertype_subject3' => 'nullable|string|max:255',
|
||||
'print_name' => 'required|string|max:255',
|
||||
'usertype_money' => 'nullable|string|max:255',
|
||||
'usertype_remarks' => 'nullable|string|max:255',
|
||||
'sort_order' => 'required|integer',
|
||||
'usertype_subject1' => 'required|string|max:10',
|
||||
'usertype_subject2' => 'required|string|max:10',
|
||||
'usertype_subject3' => 'nullable|string|max:10',
|
||||
'print_name' => 'nullable|string|max:20',
|
||||
'usertype_money' => 'nullable|string|max:10',
|
||||
'usertype_remarks' => 'nullable|string|max:85',
|
||||
];
|
||||
|
||||
|
||||
$messages = [
|
||||
'print_name.required' => '印字名は必須です。',
|
||||
'sort_order.integer' => 'ソートオーダーは数値で入力してください。',
|
||||
'sort_order.required' => 'ソートオーダーは必須です。',
|
||||
'sort_order.integer' => 'ソートオーダーは数値で入力してください。',
|
||||
|
||||
'usertype_subject1.required' => '分類名1は必須です。',
|
||||
'usertype_subject2.required' => '分類名2は必須です。',
|
||||
|
||||
// 'print_name.required' => '印字名は必須です。',
|
||||
];
|
||||
|
||||
$validator = Validator::make($inputs, $rules, $messages);
|
||||
@ -110,7 +136,7 @@ class UsertypeController extends Controller
|
||||
});
|
||||
|
||||
if ($ok) {
|
||||
return redirect()->route('usertypes')->with('success', '登録しました。');
|
||||
return redirect()->route('usertypes')->with('success', '登録が完了しました。');
|
||||
}
|
||||
return back()->with('error', '登録に失敗しました。')->withInput();
|
||||
}
|
||||
@ -122,65 +148,66 @@ class UsertypeController extends Controller
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
$usertype = Usertype::findOrFail($id);
|
||||
$record = Usertype::findOrFail($id);
|
||||
|
||||
$data = [
|
||||
'record' => $record,
|
||||
'isEdit' => true,
|
||||
'isInfo' => false,
|
||||
];
|
||||
|
||||
// 画面に渡す初期データ(既存の構成に合わせて attributes を使う)
|
||||
$data = $usertype->getAttributes();
|
||||
if (method_exists($this, 'getDataDropList')) {
|
||||
$dataList = $this->getDataDropList();
|
||||
$data = array_merge($data, $dataList);
|
||||
$data = array_merge($data, $this->getDataDropList());
|
||||
}
|
||||
|
||||
// POST:更新処理
|
||||
if ($request->isMethod('POST')) {
|
||||
$type = false;
|
||||
|
||||
// ▼ 内蔵バリデーション(FormRequest を使わない)
|
||||
$rules = [
|
||||
'sort_order' => 'nullable|integer',
|
||||
'usertype_subject1' => 'nullable|string|max:255',
|
||||
'usertype_subject2' => 'nullable|string|max:255',
|
||||
'usertype_subject3' => 'nullable|string|max:255',
|
||||
'print_name' => 'required|string|max:255',
|
||||
'usertype_money' => 'nullable|string|max:255',
|
||||
'usertype_remarks' => 'nullable|string|max:255',
|
||||
'sort_order' => 'required|integer',
|
||||
'usertype_subject1' => 'required|string|max:10',
|
||||
'usertype_subject2' => 'required|string|max:10',
|
||||
'usertype_subject3' => 'nullable|string|max:10',
|
||||
'print_name' => 'nullable|string|max:20',
|
||||
'usertype_money' => 'nullable|string|max:10',
|
||||
'usertype_remarks' => 'nullable|string|max:85',
|
||||
];
|
||||
|
||||
|
||||
$messages = [
|
||||
'print_name.required' => '印字名は必須です。',
|
||||
'sort_order.integer' => 'ソートオーダーは数値で入力してください。',
|
||||
'sort_order.required' => 'ソートオーダーは必須です。',
|
||||
'sort_order.integer' => 'ソートオーダーは数値で入力してください。',
|
||||
|
||||
'usertype_subject1.required' => '分類名1は必須です。',
|
||||
'usertype_subject2.required' => '分類名2は必須です。',
|
||||
'usertype_subject3.required' => '分類名3は必須です。',
|
||||
|
||||
];
|
||||
|
||||
|
||||
$validator = Validator::make($request->all(), $rules, $messages);
|
||||
|
||||
// 入力値を $data にマージ(既存ロジック踏襲)
|
||||
$requestAll = $request->all();
|
||||
$data = array_merge($data, $requestAll);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
\DB::transaction(function () use ($data, &$type, $usertype) {
|
||||
// fill するフィールドだけを明示したい場合は only(...) で絞ってもOK
|
||||
$usertype->fill([
|
||||
'sort_order' => $data['sort_order'] ?? null,
|
||||
'usertype_subject1' => $data['usertype_subject1'] ?? null,
|
||||
'usertype_subject2' => $data['usertype_subject2'] ?? null,
|
||||
'usertype_subject3' => $data['usertype_subject3'] ?? null,
|
||||
'print_name' => $data['print_name'] ?? null,
|
||||
'usertype_money' => $data['usertype_money'] ?? null,
|
||||
'usertype_remarks' => $data['usertype_remarks'] ?? null,
|
||||
\DB::transaction(function () use ($request, $record) {
|
||||
$record->fill([
|
||||
'sort_order' => $request->sort_order,
|
||||
'usertype_subject1' => $request->usertype_subject1,
|
||||
'usertype_subject2' => $request->usertype_subject2,
|
||||
'usertype_subject3' => $request->usertype_subject3,
|
||||
'print_name' => $request->print_name,
|
||||
'usertype_money' => $request->usertype_money,
|
||||
'usertype_remarks' => $request->usertype_remarks,
|
||||
]);
|
||||
$usertype->save();
|
||||
$type = true;
|
||||
$record->save();
|
||||
});
|
||||
|
||||
if ($type) {
|
||||
return redirect()->route('usertypes')->with('success', '更新しました。');
|
||||
}
|
||||
return back()->with('error', '更新に失敗しました。')->withInput();
|
||||
return redirect()->route('usertypes')->with('success', '更新が完了しました。');
|
||||
}
|
||||
|
||||
// GET: 画面表示(既存のビューに合わせて返す)
|
||||
// GET:画面表示
|
||||
return view('admin.usertypes.edit', $data);
|
||||
}
|
||||
|
||||
@ -196,7 +223,7 @@ class UsertypeController extends Controller
|
||||
$arr_pk = [$arr_pk];
|
||||
}
|
||||
if (empty($arr_pk)) {
|
||||
return redirect()->route('usertypes')->with('error', '削除するユーザーを選択してください。');
|
||||
return redirect()->route('usertypes')->with('error', '削除対象を1件以上選択してください。');
|
||||
}
|
||||
|
||||
if (Usertype::deleteByPk($arr_pk)) {
|
||||
@ -219,16 +246,10 @@ class UsertypeController extends Controller
|
||||
|
||||
public function export(Request $request)
|
||||
{
|
||||
$timestamp = now()->format('YmdHis');
|
||||
$filename = "利用者分類マスタ{$timestamp}.csv";
|
||||
$filePath = storage_path("app/{$filename}");
|
||||
$headers = [
|
||||
'Content-Type' => 'text/csv; charset=UTF-8',
|
||||
'Content-Encoding' => 'UTF-8',
|
||||
'Pragma' => 'no-cache',
|
||||
'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0',
|
||||
'Expires' => '0',
|
||||
];
|
||||
// ファイル名
|
||||
$filename = '利用者分類マスタ_' . now()->format('YmdHis') . '.csv';
|
||||
|
||||
// 検索条件(一覧と同じ)
|
||||
$inputs = [
|
||||
'isMethodPost' => 0,
|
||||
'isExport' => 1,
|
||||
@ -241,29 +262,34 @@ class UsertypeController extends Controller
|
||||
];
|
||||
|
||||
$dataExport = Usertype::search($inputs);
|
||||
$columns = array(
|
||||
__('利用者分類ID'),// 0
|
||||
__('分類名'),// 1
|
||||
__('適用料率'),// 2
|
||||
__('備考'),// 3
|
||||
);
|
||||
$file = fopen($filePath, 'w+');
|
||||
fputcsv($file, $columns);
|
||||
foreach ($dataExport as $items) {
|
||||
fputcsv(
|
||||
$file,
|
||||
array(
|
||||
$items->user_categoryid,
|
||||
$items->print_name,
|
||||
$items->usertype_money,
|
||||
$items->usertype_remarks, // 3
|
||||
)
|
||||
);
|
||||
}
|
||||
fclose($file);
|
||||
return Response::download($filePath, $filename, $headers)->deleteFileAfterSend(true);
|
||||
|
||||
return response()->streamDownload(function () use ($dataExport) {
|
||||
|
||||
// Excel用 UTF-8 BOM
|
||||
echo "\xEF\xBB\xBF";
|
||||
|
||||
// ヘッダー行
|
||||
echo "利用者分類ID,ソートオーダー,分類名1,分類名2,分類名3,適用料率,備考\n";
|
||||
|
||||
// データ行
|
||||
foreach ($dataExport as $item) {
|
||||
echo implode(',', [
|
||||
$item->user_categoryid,
|
||||
$item->sort_order,
|
||||
$item->usertype_subject1,
|
||||
$item->usertype_subject2,
|
||||
$item->usertype_subject3,
|
||||
$item->usertype_money,
|
||||
$item->usertype_remarks,
|
||||
]) . "\n";
|
||||
}
|
||||
|
||||
}, $filename, [
|
||||
'Content-Type' => 'text/csv; charset=UTF-8',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function import(Request $request)
|
||||
{
|
||||
$file = $request->file('file');
|
||||
|
||||
@ -20,8 +20,7 @@ use Illuminate\Support\Facades\Hash;
|
||||
class Utils
|
||||
{
|
||||
// ページあたりのアイテム数(旧システムから継承)
|
||||
// const item_per_page = 50;
|
||||
const item_per_page = 20;
|
||||
const item_per_page = 50;
|
||||
|
||||
// 画像保存パス(旧システムから継承)
|
||||
const image_path = 'storage/images/';
|
||||
|
||||
@ -142,34 +142,72 @@ $('#import_csv').on('click', function () {
|
||||
}
|
||||
});
|
||||
});
|
||||
/** * CSV出力確認ダイアログ 以前のバージョン */
|
||||
|
||||
// $('#export_csv').on('click', function () {
|
||||
// var _action = $(this).attr('action'),
|
||||
// user_id = $('#user_id').length ? $('#user_id').val() : '',
|
||||
// member_id = $('#member_id').length ? $('#member_id').val() : '',
|
||||
// user_tag_serial = $('#user_tag_serial').length ? $('#user_tag_serial').val() : '',
|
||||
// user_phonetic = $('#user_phonetic').length ? $('#user_phonetic').val() : '',
|
||||
// phone = $('#phone').length ? $('#phone').val() : '',
|
||||
// crime = $('#crime').length ? $('#crime').val() : '',
|
||||
// sort = $('#sort').length ? $('#sort').val() : '',
|
||||
// sort_type = $('#sort_type').length ? $('#sort_type').val() : '';
|
||||
|
||||
// $.confirm({
|
||||
// title: '確認ダイアログ。',
|
||||
// content: '!CSVファイルを出力します。よろしいですか?はい/いいえ',
|
||||
// buttons: {
|
||||
// ok: {
|
||||
// text: "はい",
|
||||
// btnClass: 'btn-primary',
|
||||
// keys: ['enter'],
|
||||
// action: function action() {
|
||||
// window.location.href = _action + '?user_id=' + user_id + '&member_id=' + member_id + '&user_tag_serial=' + user_tag_serial + '&user_phonetic=' + user_phonetic + '&phone=' + phone + '&crime=' + crime + '&sort=' + sort + '&sort_type=' + sort_type + '&isExport=1';
|
||||
// }
|
||||
// },
|
||||
// いいえ: function _() {}
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
$(document).on('click', '#export_csv, [data-export-csv="1"]', function () {
|
||||
var action = $(this).attr('action') || $(this).data('action');
|
||||
var formSelector = $(this).data('form') || '#list-form';
|
||||
|
||||
if (!action) return;
|
||||
|
||||
|
||||
var query = '';
|
||||
if (formSelector && $(formSelector).length) {
|
||||
query = $(formSelector).serialize();
|
||||
query = query
|
||||
.split('&')
|
||||
.filter(function (p) { return p && p.indexOf('_token=') !== 0; })
|
||||
.join('&');
|
||||
}
|
||||
|
||||
$('#export_csv').on('click', function () {
|
||||
var _action = $(this).attr('action'),
|
||||
user_id = $('#user_id').val(),
|
||||
member_id = $('#member_id').val(),
|
||||
user_tag_serial = $('#user_tag_serial').val(),
|
||||
user_phonetic = $('#user_phonetic').val(),
|
||||
phone = $('#phone').val(),
|
||||
crime = $('#crime').val(),
|
||||
sort = $('#sort').val(),
|
||||
sort_type = $('#sort_type').val();
|
||||
$.confirm({
|
||||
title: '確認ダイアログ。',
|
||||
content: '!CSVファイルを出力します。よろしいですか?はい/いいえ',
|
||||
content: 'CSVファイルを出力します。よろしいですか?はい/いいえ',
|
||||
buttons: {
|
||||
ok: {
|
||||
text: "はい",
|
||||
text: 'はい',
|
||||
btnClass: 'btn-primary',
|
||||
keys: ['enter'],
|
||||
action: function action() {
|
||||
window.location.href = _action + '?user_id=' + user_id + '&member_id=' + member_id + '&user_tag_serial=' + user_tag_serial + '&user_phonetic=' + user_phonetic + '&phone=' + phone + '&crime=' + crime + '&sort=' + sort + '&sort_type=' + sort_type + '&isExport=1';
|
||||
action: function () {
|
||||
var url = action + (query ? ('?' + query + '&isExport=1') : '?isExport=1');
|
||||
window.location.href = url;
|
||||
}
|
||||
},
|
||||
いいえ: function _() {}
|
||||
いいえ: function () {}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
// for sorting
|
||||
$('.table thead th.sorting').on('click', function (e) {
|
||||
var sort = $(this).attr('sort');
|
||||
@ -1612,6 +1650,23 @@ $('#delete_edit').on('click', function (e) {
|
||||
});
|
||||
});
|
||||
|
||||
// 共通 戻るボタン
|
||||
$(document).on('click', '#btn_back', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// data-back-url があれば優先
|
||||
var backUrl = $(this).data('back-url');
|
||||
if (backUrl) {
|
||||
window.location.href = backUrl;
|
||||
return;
|
||||
}
|
||||
|
||||
// fallback:直前の画面
|
||||
window.history.back();
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(function () {
|
||||
// ▼ 「アップロード」ボタンを押すと、ファイル選択ダイアログを開く
|
||||
$(document).on('click', '.upload-file', function () {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,207 +1,189 @@
|
||||
<div class="card-body rv-usertype-form">
|
||||
<div class="col-12 px-0">
|
||||
@if(Session::has('success'))
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
{{ Session::get('success') }}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
|
||||
{{-- アラート(成功) --}}
|
||||
@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>
|
||||
@endif
|
||||
|
||||
{{-- アラート(エラー:Session) --}}
|
||||
@if(Session::has('error'))
|
||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
{!! Session::get('error') !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- アラート(任意エラー) --}}
|
||||
@if(isset($errorMsg))
|
||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
{!! $errorMsg !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- バリデーションエラー --}}
|
||||
@if($errors->any())
|
||||
<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>
|
||||
<ul>
|
||||
@foreach($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
|
||||
{{-- ▼ 利用者分類ID(編集時のみ表示) --}}
|
||||
@if(!empty($isEdit) || !empty($isInfo))
|
||||
<div class="form-group col-3">
|
||||
<label>{{ __('validation.attributes.user_categoryid') }}</label>
|
||||
</div>
|
||||
@elseif(Session::has('error'))
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
{!! Session::get('error') !!}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
@elseif(isset($errorMsg))
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
{!! $errorMsg !!}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<div class="form-group col-9">
|
||||
<div class="input-group">
|
||||
<input type="text"
|
||||
class="form-control form-control-lg bg-light"
|
||||
value="{{ old('user_categoryid', $record->user_categoryid ?? '') }}"
|
||||
readonly>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- ▼ ソートオーダー --}}
|
||||
<div class="form-group col-3">
|
||||
<label class="form-label required">{{ __('ソートオーダー') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="input-group">
|
||||
<input type="text"
|
||||
name="sort_order"
|
||||
class="form-control form-control-lg"
|
||||
placeholder="{{ __('ソートオーダー') }}"
|
||||
value="{{ old('sort_order', $record->sort_order ?? ($sort_order ?? '')) }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ▼ 分類名1 --}}
|
||||
<div class="form-group col-3">
|
||||
<label class="form-label required">{{ __('分類名1') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="input-group">
|
||||
<input type="text"
|
||||
name="usertype_subject1"
|
||||
class="form-control form-control-lg"
|
||||
placeholder="{{ __('分類名1') }}"
|
||||
value="{{ old('usertype_subject1', $record->usertype_subject1 ?? ($usertype_subject1 ?? '')) }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ▼ 分類名2 --}}
|
||||
<div class="form-group col-3">
|
||||
<label class="form-label required">{{ __('分類名2') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="input-group">
|
||||
<input type="text"
|
||||
name="usertype_subject2"
|
||||
class="form-control form-control-lg"
|
||||
placeholder="{{ __('分類名2') }}"
|
||||
value="{{ old('usertype_subject2', $record->usertype_subject2 ?? ($usertype_subject2 ?? '')) }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ▼ 分類名3 --}}
|
||||
<div class="form-group col-3">
|
||||
<label class="form-label required">{{ __('分類名3') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="input-group">
|
||||
<input type="text"
|
||||
name="usertype_subject3"
|
||||
class="form-control form-control-lg"
|
||||
placeholder="{{ __('分類名3') }}"
|
||||
value="{{ old('usertype_subject3', $record->usertype_subject3 ?? ($usertype_subject3 ?? '')) }}">
|
||||
</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="print_name"
|
||||
class="form-control form-control-lg"
|
||||
placeholder="{{ __('印字名') }}"
|
||||
value="{{ old('print_name', $record->print_name ?? ($print_name ?? '')) }}">
|
||||
</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="usertype_money"
|
||||
class="form-control form-control-lg"
|
||||
placeholder="{{ __('適用料率') }}"
|
||||
value="{{ old('usertype_money', $record->usertype_money ?? ($usertype_money ?? '')) }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ▼ 備考 --}}
|
||||
<div class="form-group col-3">
|
||||
<label>{{ __('備考') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="input-group">
|
||||
<textarea class="form-control form-control-lg"
|
||||
rows="5"
|
||||
placeholder="{{ __('備考') }}"
|
||||
name="usertype_remarks">{{ old('usertype_remarks', $record->usertype_remarks ?? ($usertype_remarks ?? '')) }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@if($isInfo || $isEdit)
|
||||
<div class="rv-usertype-form__actions-top">
|
||||
@if($isInfo)
|
||||
<a href="{{ route('usertype_add') }}" class="btn btn-default btn-sm px-4">{{ __('登録') }}</a>
|
||||
<a href="{{ route('usertype_edit', ['id' => $user_categoryid]) }}" class="btn btn-default btn-sm px-4">{{ __('編集') }}</a>
|
||||
{{-- ▼ 下部ボタン --}}
|
||||
<div class="row mt-4">
|
||||
<div class="form-group col-md-10 d-flex align-items-center gap-2 justify-content-start">
|
||||
|
||||
{{-- 登録ボタン --}}
|
||||
@if(!empty($isEdit))
|
||||
<button type="button" id="register_edit" class="btn btn-lg btn-success mr-2">
|
||||
{{ __('登録') }}
|
||||
</button>
|
||||
@else
|
||||
<button type="button" class="btn btn-default btn-sm px-4 register">{{ __('登録') }}</button>
|
||||
@if($isEdit)<button type="button" class="btn btn-default btn-sm px-4 js-inline-delete">{{ __('削除') }}</button>@endif
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="rv-usertype-form__container">
|
||||
<div class="rv-usertype-form__panel">
|
||||
@if($isInfo || $isEdit)
|
||||
<div class="form-group row align-items-center">
|
||||
<label class="col-sm-4 col-form-label font-weight-semibold text-sm-left">{{ __('validation.attributes.user_categoryid') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" value="{{ $user_categoryid }}" class="form-control-plaintext" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" id="register" class="btn btn-lg btn-success mr-2 register">
|
||||
{{ __('登録') }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
<div class="form-group row align-items-center">
|
||||
<label class="col-sm-4 col-form-label font-weight-semibold text-sm-left">
|
||||
{{ __('ソートオーダー') }}<span class="text-danger">*</span>
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="sort_order" value="{{ old('sort_order', $sort_order ?? '') }}" class="form-control" placeholder="{{ __('ソートオーダー') }}">
|
||||
</div>
|
||||
</div>
|
||||
{{-- 削除ボタン(編集時のみ表示) --}}
|
||||
@if(!empty($isEdit))
|
||||
<button type="button" id="delete_edit" class="btn btn-lg btn-danger js-inline-delete mr-2">
|
||||
{{ __('削除') }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
<div class="form-group row align-items-center">
|
||||
<label class="col-sm-4 col-form-label font-weight-semibold text-sm-left">
|
||||
{{ __('分類名1') }}<span class="text-danger">*</span>
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="usertype_subject1" value="{{ old('usertype_subject1', $usertype_subject1 ?? '') }}" class="form-control" placeholder="{{ __('分類名1') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row align-items-center">
|
||||
<label class="col-sm-4 col-form-label font-weight-semibold text-sm-left">
|
||||
{{ __('分類名2') }}<span class="text-danger">*</span>
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="usertype_subject2" value="{{ old('usertype_subject2', $usertype_subject2 ?? '') }}" class="form-control" placeholder="{{ __('分類名2') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row align-items-center">
|
||||
<label class="col-sm-4 col-form-label font-weight-semibold text-sm-left">{{ __('分類名3') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="usertype_subject3" value="{{ old('usertype_subject3', $usertype_subject3 ?? '') }}" class="form-control" placeholder="{{ __('分類名3') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row align-items-center">
|
||||
<label class="col-sm-4 col-form-label font-weight-semibold text-sm-left">{{ __('印字名') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="print_name" value="{{ old('print_name', $print_name ?? '') }}" class="form-control" placeholder="{{ __('印字名') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row align-items-center">
|
||||
<label class="col-sm-4 col-form-label font-weight-semibold text-sm-left">{{ __('適用料率') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="usertype_money" value="{{ old('usertype_money', $usertype_money ?? '') }}" class="form-control" placeholder="{{ __('適用料率') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row align-items-center mb-0">
|
||||
<label class="col-sm-4 col-form-label font-weight-semibold text-sm-left">{{ __('備考') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="usertype_remarks" rows="2" class="form-control" placeholder="{{ __('備考') }}">{{ old('usertype_remarks', $usertype_remarks ?? '') }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rv-usertype-form__actions-bottom">
|
||||
@if($isInfo)
|
||||
<a href="{{ route('usertype_add') }}" class="btn btn-default btn-sm px-4">{{ __('登録') }}</a>
|
||||
<a href="{{ route('usertype_edit', ['id' => $user_categoryid]) }}" class="btn btn-default btn-sm px-4">{{ __('編集') }}</a>
|
||||
@else
|
||||
<button type="button" class="btn btn-default btn-sm px-4 register">
|
||||
{{ $isEdit ? __('登録') : __('登録') }}
|
||||
{{-- 戻るボタン(一覧状態保持) --}}
|
||||
<button type="button"
|
||||
id="btn_back"
|
||||
class="btn btn-lg btn-secondary mr-2"
|
||||
data-back-url="{{ request('back') }}">
|
||||
{{ __('戻る') }}
|
||||
</button>
|
||||
@if($isEdit)
|
||||
<button type="button" class="btn btn-default btn-sm px-4 js-inline-delete">{{ __('削除') }}</button>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@push('styles')
|
||||
<style>
|
||||
.rv-usertype-form .font-weight-semibold{font-weight:600;}
|
||||
.rv-usertype-form .form-group{margin-bottom:1.25rem;}
|
||||
.rv-usertype-form .form-control{border-radius:.4rem;}
|
||||
.rv-usertype-form__actions-top,
|
||||
.rv-usertype-form__actions-bottom{display:flex;align-items:center;gap:.75rem;margin-bottom:1.5rem;}
|
||||
.rv-usertype-form__container{display:flex;justify-content:flex-end;}
|
||||
.rv-usertype-form__panel{
|
||||
width:100%;
|
||||
max-width:520px;
|
||||
background:#fff;
|
||||
border:1px solid #dee2e6;
|
||||
border-radius:.5rem;
|
||||
padding:2rem 2.5rem;
|
||||
}
|
||||
.rv-usertype-form__panel .col-form-label{font-size:.95rem;color:#555;}
|
||||
.rv-usertype-form__panel .col-form-label{text-align:left;}
|
||||
.rv-usertype-form__panel .form-control{font-size:.95rem;}
|
||||
.rv-usertype-form__actions-bottom{margin-top:2rem;}
|
||||
.rv-usertype-form .btn{min-width:90px;}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
@once
|
||||
<script>
|
||||
(function ($) {
|
||||
$(function () {
|
||||
var $form = $('#usertype-form');
|
||||
if (!$form.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('.register').off('click.usertypeConfirm').on('click.usertypeConfirm', function (e) {
|
||||
e.preventDefault();
|
||||
var submitForm = function () { $form.trigger('submit'); };
|
||||
if (typeof $.confirm === 'function') {
|
||||
$.confirm({
|
||||
title: '確認ダイアログ。',
|
||||
content: '登録してよろしいですか?はい/いいえ',
|
||||
buttons: {
|
||||
ok: {
|
||||
text: 'はい',
|
||||
btnClass: 'btn-primary',
|
||||
keys: ['enter'],
|
||||
action: submitForm
|
||||
},
|
||||
いいえ: function () {}
|
||||
}
|
||||
});
|
||||
} else if (window.confirm('登録してよろしいですか?')) {
|
||||
submitForm();
|
||||
}
|
||||
});
|
||||
|
||||
var $deleteBtn = $('#btnDeleteInline');
|
||||
var $deleteForm = $('#usertype-delete-form');
|
||||
if ($deleteBtn.length && $deleteForm.length) {
|
||||
$deleteBtn.off('click.usertypeDelete').on('click.usertypeDelete', function (e) {
|
||||
e.preventDefault();
|
||||
var submitDelete = function () { $deleteForm.trigger('submit'); };
|
||||
if (typeof $.confirm === 'function') {
|
||||
$.confirm({
|
||||
title: '確認ダイアログ。',
|
||||
content: '削除してよろしいですか?はい/いいえ',
|
||||
buttons: {
|
||||
ok: {
|
||||
text: 'はい',
|
||||
btnClass: 'btn-primary',
|
||||
keys: ['enter'],
|
||||
action: submitDelete
|
||||
},
|
||||
いいえ: function () {}
|
||||
}
|
||||
});
|
||||
} else if (window.confirm('削除してよろしいですか?')) {
|
||||
submitDelete();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})(window.jQuery);
|
||||
</script>
|
||||
@endonce
|
||||
@endpush
|
||||
@ -1,5 +1,5 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', '利用者分類マスタ')
|
||||
@section('title', '新規')
|
||||
|
||||
@section('content')
|
||||
<!-- Content Header (Page header) -->
|
||||
@ -8,74 +8,47 @@
|
||||
<div class="row mb-2">
|
||||
<div class="col-lg-6">
|
||||
<h1 class="m-0 text-dark">新規</h1>
|
||||
</div><!-- /.col -->
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<ol class="breadcrumb float-sm-right text-sm">
|
||||
<li class="breadcrumb-item"><a href="{{route('home')}}">ホーム</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('usertypes') }}">利用者分類マスタ</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('home') }}">ホーム</a></li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{{ route('usertypes') }}">利用者分類マスタ</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">新規</li>
|
||||
</ol>
|
||||
</div><!-- /.col -->
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.content-header -->
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<!-- SELECT2 EXAMPLE -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form id="usertype-form" method="post" action="{{ route('usertype_add')}}" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between">
|
||||
<button type="button" class="btn btn-default btn-sm px-4 register">{{ __('登録') }}</button>
|
||||
</div>
|
||||
@include('admin.usertypes._form',['isEdit'=>0,'isInfo'=>0])
|
||||
</div>
|
||||
</form>
|
||||
<div class="card">
|
||||
|
||||
<form id="form_add"
|
||||
method="post"
|
||||
action="{{ route('usertype_add') }}"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
|
||||
@include('admin.usertypes._form', [
|
||||
'isEdit' => false,
|
||||
'isInfo' => false
|
||||
])
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
(function ($) {
|
||||
$(function () {
|
||||
var $form = $('#usertype-form');
|
||||
if (!$form.length) {
|
||||
return;
|
||||
}
|
||||
$('.register').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
if (typeof $.confirm === 'function') {
|
||||
$.confirm({
|
||||
title: '確認ダイアログ。',
|
||||
content: '登録してよろしいですか?はい/いいえ',
|
||||
buttons: {
|
||||
ok: {
|
||||
text: 'はい',
|
||||
btnClass: 'btn-primary',
|
||||
keys: ['enter'],
|
||||
action: function () {
|
||||
$form.trigger('submit');
|
||||
}
|
||||
},
|
||||
いいえ: function () {}
|
||||
}
|
||||
});
|
||||
} else if (window.confirm('登録してよろしいですか?')) {
|
||||
$form.trigger('submit');
|
||||
}
|
||||
});
|
||||
});
|
||||
})(window.jQuery);
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
@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') }}">ホーム</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('usertypes') }}">利用者分類マスタ</a></li>
|
||||
<li class="breadcrumb-item active">削除確認</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="alert alert-danger">
|
||||
<strong>本当にこの利用者分類を削除しますか?</strong>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('usertype_delete', ['id' => $user_categoryid]) }}">
|
||||
@csrf
|
||||
<div class="mb-3">
|
||||
<label class="form-label">{{__('利用者分類ID')}}</label>
|
||||
<div>{{ $user_categoryid }}</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">{{__('分類名')}}</label>
|
||||
<div>{{ $print_name ?? '' }}</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">{{__('適用料率')}}</label>
|
||||
<div>{{ $usertype_money ?? '' }}</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">{{__('備考')}}</label>
|
||||
<div>{{ $usertype_remarks ?? '' }}</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-danger btn-sm px-4 mr-2"
|
||||
onclick="return confirm('削除してよろしいですか?');">削除</button>
|
||||
<a href="{{ route('usertypes') }}" class="btn btn-secondary btn-sm px-4">キャンセル</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
@ -1,8 +1,8 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', '編集 | 利用者分類マスタ')
|
||||
@section('title', '編集')
|
||||
|
||||
@section('content')
|
||||
<!-- Content Header -->
|
||||
<!-- Content Header (Page header) -->
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
@ -12,91 +12,53 @@
|
||||
<div class="col-lg-6">
|
||||
<ol class="breadcrumb float-sm-right text-sm">
|
||||
<li class="breadcrumb-item"><a href="{{ route('home') }}">ホーム</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('usertypes') }}">利用者分類マスタ</a></li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{{ route('usertypes') }}">利用者分類マスタ</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">編集</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.content-header -->
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
|
||||
{{-- カード本体 --}}
|
||||
<div class="card">
|
||||
<form id="usertype-form" method="post" action="{{ route('usertype_edit', ['id' => $user_categoryid]) }}">
|
||||
@csrf
|
||||
@include('admin.usertypes._form', ['isEdit' => 1, 'isInfo' => 0])
|
||||
</form>
|
||||
<form id="usertype-delete-form" method="post" action="{{ route('usertypes_delete', ['id' => $user_categoryid]) }}" class="d-none">
|
||||
@csrf
|
||||
<input type="hidden" name="pk[]" value="{{ $user_categoryid }}">
|
||||
</form>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
|
||||
{{-- 編集フォーム --}}
|
||||
<form id="form_edit"
|
||||
action="{{ route('usertype_edit', ['id' => $record->user_categoryid]) }}"
|
||||
method="POST"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
|
||||
@include('admin.usertypes._form', [
|
||||
'isEdit' => true,
|
||||
'record' => $record
|
||||
])
|
||||
</form>
|
||||
|
||||
|
||||
{{-- 削除フォーム(非表示) --}}
|
||||
<form id="form_delete"
|
||||
action="{{ route('usertypes_delete') }}"
|
||||
method="POST"
|
||||
style="display:none;">
|
||||
@csrf
|
||||
<input type="hidden" name="pk" value="{{ $record->user_categoryid }}">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
(function ($) {
|
||||
$(function () {
|
||||
var $registerBtn = $('.register');
|
||||
var $editForm = $('#usertype-form');
|
||||
if ($registerBtn.length && $editForm.length) {
|
||||
$registerBtn.off('click.usertypeConfirm').on('click.usertypeConfirm', function (e) {
|
||||
e.preventDefault();
|
||||
var submitEdit = function () { $editForm.trigger('submit'); };
|
||||
if (typeof $.confirm === 'function') {
|
||||
$.confirm({
|
||||
title: '確認ダイアログ。',
|
||||
content: '登録してよろしいですか?はい/いいえ',
|
||||
buttons: {
|
||||
ok: {
|
||||
text: 'はい',
|
||||
btnClass: 'btn-primary',
|
||||
keys: ['enter'],
|
||||
action: submitEdit
|
||||
},
|
||||
いいえ: function () {}
|
||||
}
|
||||
});
|
||||
} else if (window.confirm('登録してよろしいですか?')) {
|
||||
submitEdit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var $deleteBtn = $('.js-inline-delete');;
|
||||
var $deleteForm = $('#usertype-delete-form');
|
||||
if ($deleteBtn.length && $deleteForm.length) {
|
||||
$deleteBtn.off('click.usertypeDelete').on('click.usertypeDelete', function (e) {
|
||||
e.preventDefault();
|
||||
var submitDelete = function () { $deleteForm.trigger('submit'); };
|
||||
if (typeof $.confirm === 'function') {
|
||||
$.confirm({
|
||||
title: '確認ダイアログ。',
|
||||
content: '削除してよろしいですか?はい/いいえ',
|
||||
buttons: {
|
||||
ok: {
|
||||
text: 'はい',
|
||||
btnClass: 'btn-primary',
|
||||
keys: ['enter'],
|
||||
action: submitDelete
|
||||
},
|
||||
いいえ: function () {}
|
||||
}
|
||||
});
|
||||
} else if (window.confirm('削除してよろしいですか?')) {
|
||||
submitDelete();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})(window.jQuery);
|
||||
</script>
|
||||
@endpush
|
||||
@ -1,122 +0,0 @@
|
||||
@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"><a href="javascript: void(0);">[東京都|〇〇駐輪場]</a></li>
|
||||
<li class="breadcrumb-item active">{{__('利用者分類マスタ')}}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.content-header -->
|
||||
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<form action="{{route('usertypes')}}" method='post' id='list-form'>
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||
<input type="hidden" value="{{$sort ?? ''}}" name="sort" id="sort">
|
||||
<input type="hidden" value="{{$sort_type ?? ''}}" name="sort_type" id="sort_type">
|
||||
</form>
|
||||
|
||||
<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 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('usertypes_delete')}}" method="post" id="form_delete">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||
<table class="table dataTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<input type="checkbox" class="minimal m-0" id="checkbox_all">
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($list as $item)
|
||||
<tr role="row">
|
||||
<td>
|
||||
<input type="checkbox" class="minimal m-0 checkbox"
|
||||
value="{{$item->user_categoryid}}" name="pk[]">
|
||||
<div class="btn_action">
|
||||
{{--<a href="{{route('usertype_add')}}" class="btn btn-sm btn-default">詳細</a>--}}
|
||||
<a href="{{ route('usertype_info', ['id' => $item->user_categoryid]) }}"
|
||||
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 @if(($sort ?? '')=="user_categoryid"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
|
||||
sort="user_categoryid">
|
||||
<span>{{__('validation.attributes.user_categoryid')}}</span>
|
||||
</th>
|
||||
<th class="sorting @if(($sort ?? '')=="print_name"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
|
||||
sort="print_name"><span>{{__('validation.attributes.print_name')}}</span>
|
||||
</th>
|
||||
<th>
|
||||
<span>{{__('validation.attributes.usertype_money')}}</span>
|
||||
</th>
|
||||
<th>
|
||||
<span>{{__('validation.attributes.usertype_remarks')}}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($list as $item)
|
||||
<tr>
|
||||
<td class='sm-item text-left'>
|
||||
<span>{{mb_substr($item->user_categoryid, 0, 10)}}</span></td>
|
||||
<td class='sm-item text-right'>
|
||||
<span>{{mb_substr($item->print_name, 0, 10)}}</span></td>
|
||||
<td class='sm-item text-right'>
|
||||
<span>{{mb_substr($item->usertype_money, 0, 10)}}</span></td>
|
||||
<td class='sm-item text-right'>
|
||||
<span>{{mb_substr($item->usertype_remarks, 0, 20)}}</span></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
@ -1,360 +1,259 @@
|
||||
@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')}}">ホーム</a></li>
|
||||
<li class="breadcrumb-item active">{{__('利用者分類マスタ')}}</li>
|
||||
</ol>
|
||||
</div>
|
||||
<!-- 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') }}">ホーム</a></li>
|
||||
<li class="breadcrumb-item active">利用者分類マスタ</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.rv-filter-card .form-label{font-weight:600;color:#555;font-size:.85rem;}
|
||||
.rv-filter-card .form-control-sm{border-radius:.25rem;}
|
||||
.rv-toolbar .btn{min-width:82px;}
|
||||
.rv-table-wrapper{background:#fff;border:1px solid #dee2e6;border-radius:.25rem;}
|
||||
.rv-table tbody tr td{vertical-align:middle;}
|
||||
.rv-table .op-cell{background:#f8f1e4;min-width:140px;}
|
||||
.rv-table thead th{
|
||||
white-space:nowrap;
|
||||
background:#eeeeee;
|
||||
text-decoration:none;
|
||||
}
|
||||
.rv-table thead th span,
|
||||
.rv-table thead th .rv-sort-arrows,
|
||||
.rv-table thead th .rv-sort-arrows .rv-arrow{
|
||||
text-decoration:none !important;
|
||||
}
|
||||
.rv-table thead th.sortable{cursor:pointer;}
|
||||
.rv-sort-arrows{
|
||||
display:inline-flex;
|
||||
align-items:center;
|
||||
margin-left:4px;
|
||||
gap:0;
|
||||
letter-spacing:-3px; /* ↑↓を詰める */
|
||||
font-size:16px;
|
||||
}
|
||||
.rv-sort-arrows .rv-arrow{
|
||||
color:#b5b5b5;
|
||||
font-size:16px;
|
||||
line-height:1;
|
||||
display:inline-block;
|
||||
}
|
||||
.rv-sort-arrows .rv-arrow.is-active{color:#000;}
|
||||
.rv-table thead th a{color:#000 !important;}
|
||||
@media (max-width: 767.98px){
|
||||
.rv-toolbar{flex-direction:column;align-items:flex-start;gap:.5rem;}
|
||||
}
|
||||
</style>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<form action="{{ route('usertypes') }}" method="post" id="list-form" class="w-100">
|
||||
@csrf
|
||||
<input type="hidden" name="sort" id="sort" value="{{ $sort }}">
|
||||
<input type="hidden" name="sort_type" id="sort_type" value="{{ $sort_type }}">
|
||||
<div class="card rv-filter-card mb-3">
|
||||
<div class="card-header bg-white font-weight-bold text-muted">
|
||||
{{ __('絞り込み') }}
|
||||
</div>
|
||||
<div class="card-body pt-3 pb-2">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-xl-4 col-lg-4 col-md-6">
|
||||
<label class="form-label">{{ __('ソートオーダー') }}</label>
|
||||
<input type="text" name="filter_sort_order" class="form-control form-control-sm"
|
||||
value="{{ $filter_sort_order ?? '' }}" placeholder="123456">
|
||||
</div>
|
||||
<div class="form-group col-xl-4 col-lg-4 col-md-6">
|
||||
<label class="form-label">{{ __('分類名1') }}</label>
|
||||
<input type="text" name="filter_usertype_subject1" class="form-control form-control-sm"
|
||||
value="{{ $filter_usertype_subject1 ?? '' }}" placeholder="{{ __('キーワード...') }}">
|
||||
</div>
|
||||
<div class="form-group col-xl-4 col-lg-4 col-md-6">
|
||||
<label class="form-label">{{ __('分類名2') }}</label>
|
||||
<input type="text" name="filter_usertype_subject2" class="form-control form-control-sm"
|
||||
value="{{ $filter_usertype_subject2 ?? '' }}" placeholder="{{ __('キーワード...') }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-xl-4 col-lg-4 col-md-6">
|
||||
<label class="form-label">{{ __('分類名3') }}</label>
|
||||
<input type="text" name="filter_usertype_subject3" class="form-control form-control-sm"
|
||||
value="{{ $filter_usertype_subject3 ?? '' }}" placeholder="{{ __('キーワード...') }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-start">
|
||||
<button type="submit" class="btn btn-default btn-sm mr-2" id="btnFilterSubmit">{{ __('絞り込み') }}</button>
|
||||
<button type="button" class="btn btn-default btn-sm" id="btnFilterReset">{{ __('解除') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form action="{{ route('usertypes_export') }}" method="post" id="form_export" class="d-none">
|
||||
@csrf
|
||||
<input type="hidden" name="sort" value="{{ $sort }}">
|
||||
<input type="hidden" name="sort_type" value="{{ $sort_type }}">
|
||||
<input type="hidden" name="filter_sort_order" value="{{ $filter_sort_order ?? '' }}">
|
||||
<input type="hidden" name="filter_usertype_subject1" value="{{ $filter_usertype_subject1 ?? '' }}">
|
||||
<input type="hidden" name="filter_usertype_subject2" value="{{ $filter_usertype_subject2 ?? '' }}">
|
||||
<input type="hidden" name="filter_usertype_subject3" value="{{ $filter_usertype_subject3 ?? '' }}">
|
||||
</form>
|
||||
<div class="w-100 rv-toolbar mb-3 d-flex justify-content-between align-items-center">
|
||||
<div class="btn-group" role="group" aria-label="toolbar-actions">
|
||||
<a href="{{ route('usertype_add') }}" class="btn btn-default mr-2">{{ __('新規') }}</a>
|
||||
<button type="button" class="btn btn-default mr-2" id="btnDeleteSelected">{{ __('削除') }}</button>
|
||||
<button type="button" class="btn btn-default" id="btnExportCsv">{{ __('CSV出力') }}</button>
|
||||
</div>
|
||||
<div class="pagination-wrapper">
|
||||
{{ $list->appends([
|
||||
'sort' => $sort,
|
||||
'sort_type' => $sort_type,
|
||||
'filter_sort_order' => $filter_sort_order ?? '',
|
||||
'filter_usertype_subject1' => $filter_usertype_subject1 ?? '',
|
||||
'filter_usertype_subject2' => $filter_usertype_subject2 ?? '',
|
||||
'filter_usertype_subject3' => $filter_usertype_subject3 ?? '',
|
||||
])->links('pagination') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<!-- ▼ 絞り込みフィルター -->
|
||||
<div class="col-lg-12 px-0">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">絞り込みフィルター</h3>
|
||||
</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 sample03-wrapper no_padding_right mb20">
|
||||
<form action="{{route('usertypes_delete')}}" method="post" id="form_delete">
|
||||
|
||||
<div class="card-body">
|
||||
<form action="{{ route('usertypes') }}" method="POST" id="list-form">
|
||||
@csrf
|
||||
<div class="table-responsive rv-table-wrapper">
|
||||
@php
|
||||
$currentSort = $sort ?? '';
|
||||
$currentDir = strtolower($sort_type ?? 'asc');
|
||||
if (!in_array($currentDir, ['asc', 'desc'], true)) {
|
||||
$currentDir = 'asc';
|
||||
}
|
||||
<input type="hidden" name="sort" id="sort" value="{{ $sort ?? '' }}">
|
||||
<input type="hidden" name="sort_type" id="sort_type" value="{{ $sort_type ?? '' }}">
|
||||
|
||||
$sortClass = static function (string $key) use ($currentSort, $currentDir): string {
|
||||
return $currentSort === $key
|
||||
? 'sortable sorting_' . $currentDir
|
||||
: 'sortable sorting';
|
||||
};
|
||||
{{-- 1行目:ソートオーダー / 分類名1 / 分類名2(ラベル上・入力下) --}}
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4">
|
||||
<div class="font-weight-bold mb-2">ソートオーダー</div>
|
||||
<input type="text"
|
||||
name="filter_sort_order"
|
||||
class="form-control"
|
||||
value="{{ $filter_sort_order ?? '' }}"
|
||||
placeholder="123456">
|
||||
</div>
|
||||
|
||||
$arrowState = static function (string $key) use ($currentSort, $currentDir): array {
|
||||
$state = ['up' => '', 'down' => ''];
|
||||
if ($currentSort === $key) {
|
||||
if ($currentDir === 'asc') {
|
||||
$state['up'] = 'is-active';
|
||||
} elseif ($currentDir === 'desc') {
|
||||
$state['down'] = 'is-active';
|
||||
}
|
||||
}
|
||||
return $state;
|
||||
};
|
||||
<div class="col-md-4">
|
||||
<div class="font-weight-bold mb-2">分類名1</div>
|
||||
<input type="text"
|
||||
name="filter_usertype_subject1"
|
||||
class="form-control"
|
||||
value="{{ $filter_usertype_subject1 ?? '' }}"
|
||||
placeholder="キーワード...">
|
||||
</div>
|
||||
|
||||
$renderSortIcon = static function (array $state): string {
|
||||
$up = $state['up'] ?? '';
|
||||
$down = $state['down'] ?? '';
|
||||
return '<span class="rv-sort-arrows"><span class="rv-arrow ' . $up . '">↑</span><span class="rv-arrow ' . $down . '">↓</span></span>';
|
||||
};
|
||||
$queryParams = [
|
||||
'filter_sort_order' => $filter_sort_order ?? null,
|
||||
'filter_usertype_subject1' => $filter_usertype_subject1 ?? null,
|
||||
'filter_usertype_subject2' => $filter_usertype_subject2 ?? null,
|
||||
'filter_usertype_subject3' => $filter_usertype_subject3 ?? null,
|
||||
];
|
||||
$queryParams = array_filter($queryParams, static function ($value) {
|
||||
return !is_null($value) && $value !== '';
|
||||
});
|
||||
$buildSortUrl = static function (string $column, string $currentSort, string $currentDir, array $baseParams): string {
|
||||
$nextDir = ($currentSort === $column && $currentDir === 'asc') ? 'desc' : 'asc';
|
||||
return route('usertypes', array_merge($baseParams, [
|
||||
'sort' => $column,
|
||||
'sort_type' => $nextDir,
|
||||
'page' => 1,
|
||||
]));
|
||||
};
|
||||
@endphp
|
||||
<table class="table table-striped table-hover rv-table mb-0 text-nowrap">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:80px;">
|
||||
<input type="checkbox" id="chkAll">
|
||||
<span class="ml-1"></span>
|
||||
</th>
|
||||
@php $state = $arrowState('user_categoryid'); @endphp
|
||||
<th class="{{ $sortClass('user_categoryid') }}">
|
||||
<a href="{{ $buildSortUrl('user_categoryid', $currentSort, $currentDir, $queryParams) }}" class="d-inline-flex align-items-center text-reset">
|
||||
<span>{{ __('利用者分類ID') }}</span>
|
||||
{!! $renderSortIcon($state) !!}
|
||||
</a>
|
||||
</th>
|
||||
@php $state = $arrowState('sort_order'); @endphp
|
||||
<th class="{{ $sortClass('sort_order') }}">
|
||||
<a href="{{ $buildSortUrl('sort_order', $currentSort, $currentDir, $queryParams) }}" class="d-inline-flex align-items-center text-reset">
|
||||
<span>{{ __('ソートオーダー') }}</span>
|
||||
{!! $renderSortIcon($state) !!}
|
||||
</a>
|
||||
</th>
|
||||
@php $state = $arrowState('usertype_subject1'); @endphp
|
||||
<th class="{{ $sortClass('usertype_subject1') }}">
|
||||
<a href="{{ $buildSortUrl('usertype_subject1', $currentSort, $currentDir, $queryParams) }}" class="d-inline-flex align-items-center text-reset">
|
||||
<span>{{ __('分類名1') }}</span>
|
||||
{!! $renderSortIcon($state) !!}
|
||||
</a>
|
||||
</th>
|
||||
@php $state = $arrowState('usertype_subject2'); @endphp
|
||||
<th class="{{ $sortClass('usertype_subject2') }}">
|
||||
<a href="{{ $buildSortUrl('usertype_subject2', $currentSort, $currentDir, $queryParams) }}" class="d-inline-flex align-items-center text-reset">
|
||||
<span>{{ __('分類名2') }}</span>
|
||||
{!! $renderSortIcon($state) !!}
|
||||
</a>
|
||||
</th>
|
||||
@php $state = $arrowState('usertype_subject3'); @endphp
|
||||
<th class="{{ $sortClass('usertype_subject3') }}">
|
||||
<a href="{{ $buildSortUrl('usertype_subject3', $currentSort, $currentDir, $queryParams) }}" class="d-inline-flex align-items-center text-reset">
|
||||
<span>{{ __('分類名3') }}</span>
|
||||
{!! $renderSortIcon($state) !!}
|
||||
</a>
|
||||
</th>
|
||||
@php $state = $arrowState('print_name'); @endphp
|
||||
<th class="{{ $sortClass('print_name') }}">
|
||||
<a href="{{ $buildSortUrl('print_name', $currentSort, $currentDir, $queryParams) }}" class="d-inline-flex align-items-center text-reset">
|
||||
<span>{{ __('印字名') }}</span>
|
||||
{!! $renderSortIcon($state) !!}
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<span>{{__('適用料率')}}</span>
|
||||
</th>
|
||||
<th>
|
||||
<span>{{__('備考')}}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($list as $item)
|
||||
<tr>
|
||||
<td class="op-cell">
|
||||
<div class="d-flex align-items-center">
|
||||
<input type="checkbox" class="mr-2 chkRow" name="pk[]" value="{{ $item->user_categoryid }}">
|
||||
<a href="{{ route('usertype_edit', ['id' => $item->user_categoryid]) }}" class="btn btn-xs btn-default">{{ __('編集') }}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-left">{{ $item->user_categoryid }}</td>
|
||||
<td class="text-left">{{ $item->sort_order }}</td>
|
||||
<td class="text-left">{{ $item->usertype_subject1 }}</td>
|
||||
<td class="text-left">{{ $item->usertype_subject2 }}</td>
|
||||
<td class="text-left">{{ $item->usertype_subject3 }}</td>
|
||||
<td class="text-left">{{ $item->print_name }}</td>
|
||||
<td class="text-right">{{ $item->usertype_money }}</td>
|
||||
<td class="text-left">{{ $item->usertype_remarks }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="9" class="text-center text-muted py-4">{{ __('データが存在しません。') }}</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="col-md-4">
|
||||
<div class="font-weight-bold mb-2">分類名2</div>
|
||||
<input type="text"
|
||||
name="filter_usertype_subject2"
|
||||
class="form-control"
|
||||
value="{{ $filter_usertype_subject2 ?? '' }}"
|
||||
placeholder="キーワード...">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 2行目:分類名3(左寄せ、幅は1/3) --}}
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4">
|
||||
<div class="font-weight-bold mb-2">分類名3</div>
|
||||
<input type="text"
|
||||
name="filter_usertype_subject3"
|
||||
class="form-control"
|
||||
value="{{ $filter_usertype_subject3 ?? '' }}"
|
||||
placeholder="キーワード...">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ボタン --}}
|
||||
<div class="mt-2">
|
||||
<button type="submit" name="action" value="filter" class="btn btn-success mr-2">
|
||||
絞り込み
|
||||
</button>
|
||||
<button type="submit" name="action" value="unlink" class="btn btn-outline-secondary">
|
||||
解除
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- ▲ 絞り込みフィルター -->
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var chkAll = document.getElementById('chkAll');
|
||||
var chks = document.getElementsByClassName('chkRow');
|
||||
if (chkAll) {
|
||||
chkAll.addEventListener('change', function () {
|
||||
Array.prototype.forEach.call(chks, function (c) { c.checked = chkAll.checked; });
|
||||
});
|
||||
}
|
||||
|
||||
var filterReset = document.getElementById('btnFilterReset');
|
||||
if (filterReset) {
|
||||
filterReset.addEventListener('click', function () {
|
||||
var form = document.getElementById('list-form');
|
||||
if (!form) { return; }
|
||||
Array.prototype.forEach.call(form.querySelectorAll('input[type="text"]'), function (input) {
|
||||
input.value = '';
|
||||
});
|
||||
form.submit();
|
||||
});
|
||||
}
|
||||
|
||||
var deleteBtn = document.getElementById('btnDeleteSelected');
|
||||
if (deleteBtn) {
|
||||
deleteBtn.addEventListener('click', function () {
|
||||
var anyChecked = false;
|
||||
Array.prototype.forEach.call(chks, function (c) { if (c.checked) { anyChecked = true; } });
|
||||
if (!anyChecked) {
|
||||
alert('削除対象の行を選択してください。');
|
||||
return;
|
||||
}
|
||||
if (window.jQuery && typeof window.jQuery.confirm === 'function') {
|
||||
window.jQuery.confirm({
|
||||
title: '確認ダイアログ。',
|
||||
content: '削除してよろしいですか?はい/いいえ',
|
||||
buttons: {
|
||||
ok: {
|
||||
text: 'はい',
|
||||
btnClass: 'btn-primary',
|
||||
keys: ['enter'],
|
||||
action: function () {
|
||||
document.getElementById('form_delete').submit();
|
||||
}
|
||||
},
|
||||
いいえ: function () {}
|
||||
}
|
||||
});
|
||||
} else if (window.confirm('削除してよろしいですか?')) {
|
||||
document.getElementById('form_delete').submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
{{-- 並び替え用 hidden --}}
|
||||
<form action="{{ route('usertypes') }}" method="POST" id="list-form">
|
||||
@csrf
|
||||
<input type="hidden" name="sort" value="{{ $sort ?? '' }}">
|
||||
<input type="hidden" name="sort_type" value="{{ $sort_type ?? '' }}">
|
||||
</form>
|
||||
|
||||
var exportBtn = document.getElementById('btnExportCsv');
|
||||
if (exportBtn) {
|
||||
exportBtn.addEventListener('click', function () {
|
||||
var exportForm = document.getElementById('form_export');
|
||||
var filterForm = document.getElementById('list-form');
|
||||
if (!exportForm || !filterForm) { return; }
|
||||
['filter_sort_order', 'filter_usertype_subject1', 'filter_usertype_subject2', 'filter_usertype_subject3', 'sort', 'sort_type'].forEach(function (name) {
|
||||
var source = filterForm.querySelector('[name="' + name + '"]');
|
||||
var target = exportForm.querySelector('[name="' + name + '"]');
|
||||
if (source && target) {
|
||||
target.value = source.value;
|
||||
}
|
||||
});
|
||||
exportForm.submit();
|
||||
});
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
{{-- ▼ ボタンエリア --}}
|
||||
<div class="col-lg-12 mb-3">
|
||||
|
||||
<button type="button"
|
||||
class="btn btn-sm btn-primary mr10"
|
||||
onclick="location.href='{{ route('usertype_add') }}?back={{ urlencode(request()->fullUrl()) }}'">
|
||||
新規
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-danger mr10" id="delete">削除</button>
|
||||
|
||||
<button type="submit" class="btn btn-sm btn-outline-success mr10" form="form_export">
|
||||
CSV出力
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{{-- ▼ ページネーション --}}
|
||||
<div class="col-lg-12">
|
||||
<div class="d-flex flex-column align-items-end mb-2 text-sm">
|
||||
{{-- 件数表示(上) --}}
|
||||
<div class="text-dark text-sm mb-1">
|
||||
@if ($list->total() > 0)
|
||||
全 {{ $list->total() }} 件中 {{ $list->firstItem() }}〜{{ $list->lastItem() }} 件を表示
|
||||
@else
|
||||
全0件
|
||||
@endif
|
||||
</div>
|
||||
|
||||
{{-- ページネーション(下) --}}
|
||||
<div>
|
||||
{{ $list->appends([
|
||||
'sort' => $sort ?? '',
|
||||
'sort_type' => $sort_type ?? ''
|
||||
])->links('pagination') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- ▲ ページネーション --}}
|
||||
|
||||
|
||||
|
||||
{{-- ▼ フラッシュメッセージ --}}
|
||||
<div class="form col-lg-12">
|
||||
@if(Session::has('success'))
|
||||
<div class="alert alert-success alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
{{ Session::get('success') }}
|
||||
</div>
|
||||
@elseif(Session::has('error'))
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
{!! Session::get('error') !!}
|
||||
</div>
|
||||
@elseif(isset($errorMsg))
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
{!! $errorMsg !!}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
{{-- ▼ テーブル --}}
|
||||
<div class="col-lg-12 mb20">
|
||||
<div class="table-responsive">
|
||||
<form action="{{ route('usertypes_delete') }}" method="POST" id="form_delete">
|
||||
@csrf
|
||||
<table class="table table-bordered dataTable text-nowrap">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
{{-- チェック + 編集 --}}
|
||||
<th style="width:140px;">
|
||||
<input type="checkbox"
|
||||
onclick="$('input[name*=\'pk\']').prop('checked', this.checked);">
|
||||
</th>
|
||||
|
||||
<th class="sorting {{ $sort=='user_categoryid' ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"
|
||||
sort="user_categoryid">
|
||||
<span>利用者分類ID</span>
|
||||
</th>
|
||||
|
||||
<th class="sorting {{ $sort=='sort_order' ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"
|
||||
sort="sort_order">
|
||||
<span>ソートオーダー</span>
|
||||
</th>
|
||||
|
||||
<th class="sorting {{ $sort=='usertype_subject1' ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"
|
||||
sort="usertype_subject1">
|
||||
<span>分類名1</span>
|
||||
</th>
|
||||
|
||||
<th class="sorting {{ $sort=='usertype_subject2' ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"
|
||||
sort="usertype_subject2">
|
||||
<span>分類名2</span>
|
||||
</th>
|
||||
|
||||
<th class="sorting {{ $sort=='usertype_subject3' ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"
|
||||
sort="usertype_subject3">
|
||||
<span>分類名3</span>
|
||||
</th>
|
||||
|
||||
<th class="sorting {{ $sort=='print_name' ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"
|
||||
sort="print_name">
|
||||
<span>印字名</span>
|
||||
</th>
|
||||
|
||||
<th><span>適用料率</span></th>
|
||||
<th><span>備考</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="bg-white">
|
||||
@foreach($list as $item)
|
||||
<tr>
|
||||
<td style="background-color:#faebd7;">
|
||||
<div class="d-flex align-items-center">
|
||||
<input type="checkbox" name="pk[]" value="{{ $item->user_categoryid }}">
|
||||
<a href="{{ route('usertype_edit', ['id' => $item->user_categoryid]) }}?back={{ urlencode(request()->fullUrl()) }}"
|
||||
class="btn btn-sm btn-outline-primary ml10">
|
||||
編集
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td>{{ $item->user_categoryid }}</td>
|
||||
<td>{{ $item->sort_order }}</td>
|
||||
<td>{{ $item->usertype_subject1 }}</td>
|
||||
<td>{{ $item->usertype_subject2 }}</td>
|
||||
<td>{{ $item->usertype_subject3 }}</td>
|
||||
<td>{{ $item->print_name }}</td>
|
||||
<td class="text-right">{{ $item->usertype_money }}</td>
|
||||
<td>{{ $item->usertype_remarks }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<!-- @if($list->isEmpty())
|
||||
<tr>
|
||||
<td colspan="9" class="text-center text-muted">
|
||||
データが存在しません。
|
||||
</td>
|
||||
</tr>
|
||||
@endif -->
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{{-- CSV --}}
|
||||
<form action="{{ route('usertypes_export') }}" method="POST" id="form_export">
|
||||
@csrf
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
Loading…
Reference in New Issue
Block a user