Compare commits

..

No commits in common. "ca283fc9a9efc7192dac1b4ee38acf30d4232805" and "a139353a2fbc14be8141bafc22d1cbec286bbb5d" have entirely different histories.

2 changed files with 6 additions and 18 deletions

View File

@ -82,7 +82,6 @@ class RegularContractCreateController extends Controller
// 並び替えパラメータ取得 // 並び替えパラメータ取得
$sort = request()->input('sort', 'park_id'); $sort = request()->input('sort', 'park_id');
$order = request()->input('order', 'asc'); $order = request()->input('order', 'asc');
\Log::info('sort param: ' . $sort);
$sortable = [ $sortable = [
'park_ruby' => 'park.park_ruby', 'park_ruby' => 'park.park_ruby',
'city_id' => 'city.city_id', 'city_id' => 'city.city_id',
@ -99,13 +98,14 @@ class RegularContractCreateController extends Controller
$parks_table = $query->skip(($page - 1) * $perPage)->take($perPage)->get(); $parks_table = $query->skip(($page - 1) * $perPage)->take($perPage)->get();
if ($sort === 'park_ruby' || $sort === 'station_name_ruby') { if ($sort === 'park_ruby' || $sort === 'station_name_ruby') {
$collator = new \Collator('ja_JP'); setlocale(LC_COLLATE, 'ja_JP.UTF-8');
$parks_table = $parks_table->sort(function ($a, $b) use ($order, $sort, $collator) { $parks_table = $parks_table->sort(function ($a, $b) use ($order, $sort) {
// null対策
$a_val = $a->$sort ?? ''; $a_val = $a->$sort ?? '';
$b_val = $b->$sort ?? ''; $b_val = $b->$sort ?? '';
return $order === 'asc' return $order === 'asc'
? $collator->compare($a_val, $b_val) ? strcoll($a_val, $b_val)
: $collator->compare($b_val, $a_val); : strcoll($b_val, $a_val);
})->values(); })->values();
} }

View File

@ -54,7 +54,7 @@
</div> </div>
</form> </form>
<div style="overflow-x: auto; width: 100%;"> <div style="overflow-x: auto; width: 100%;">
<table id="searchTable" class="tablesorter table table-striped"> <table id="searchTable" class="table table-striped">
<thead> <thead>
<tr> <tr>
<th class="header"> <th class="header">
@ -202,16 +202,4 @@
</div> </div>
</div> </div>
</div> </div>
<script>
document.querySelectorAll('#searchTable th a, #searchTable .header a').forEach(function(el) {
el.addEventListener('click', function(e) {
// サーバーに遷移させる
window.location.href = el.href;
// 既存のJSによるイベントを止める
e.stopImmediatePropagation();
e.preventDefault();
return false;
}, true); // trueでキャプチャフェーズに
});
</script>
@endsection @endsection