2022-01-29 06:00:11 +09:00
|
|
|
import $ from 'jquery';
|
|
|
|
|
2021-10-13 03:11:35 +09:00
|
|
|
export function initAdminUserListSearchForm() {
|
2021-10-15 11:35:26 +09:00
|
|
|
const searchForm = window.config.pageData.adminUserListSearchForm;
|
2021-10-13 03:11:35 +09:00
|
|
|
if (!searchForm) return;
|
|
|
|
|
|
|
|
const $form = $('#user-list-search-form');
|
|
|
|
if (!$form.length) return;
|
|
|
|
|
|
|
|
$form.find(`button[name=sort][value=${searchForm.SortType}]`).addClass('active');
|
|
|
|
|
|
|
|
if (searchForm.StatusFilterMap) {
|
|
|
|
for (const [k, v] of Object.entries(searchForm.StatusFilterMap)) {
|
|
|
|
if (!v) continue;
|
|
|
|
$form.find(`input[name="status_filter[${k}]"][value=${v}]`).prop('checked', true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$form.find(`input[type=radio]`).click(() => {
|
|
|
|
$form.submit();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
$form.find('.j-reset-status-filter').click(() => {
|
|
|
|
$form.find(`input[type=radio]`).each((_, e) => {
|
|
|
|
const $e = $(e);
|
|
|
|
if ($e.attr('name').startsWith('status_filter[')) {
|
|
|
|
$e.prop('checked', false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$form.submit();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|