bacd6a1d72
・検索と通常表示のオプションを追加 ・項目の表示順を修正 ・選択値によって表示/非表示の切り替えやフォームをDisabledにする等修正 ・アンインストーラーを追加
164 lines
5.6 KiB
JavaScript
164 lines
5.6 KiB
JavaScript
jQuery(function ($) {
|
|
|
|
//tab menu
|
|
change_tab_menu();
|
|
|
|
//custom orders
|
|
order_list();
|
|
|
|
//order type
|
|
change_search_order();
|
|
change_normal_order();
|
|
|
|
en_search_normal_sort_btn()
|
|
|
|
//per page
|
|
disp_tax_per_page();
|
|
change_normal_per_page();
|
|
change_search_per_page();
|
|
change_cat_per_page();
|
|
change_tag_per_page();
|
|
change_tax_per_page();
|
|
|
|
|
|
function change_tab_menu() {
|
|
let submit_type = $('.post-order-box-outer').data('submit_type');
|
|
let order_nav_list = $('.post-order-nav li');
|
|
let order_box = $('.post-order-box');
|
|
|
|
order_nav_list.removeClass('en');
|
|
order_box.hide();
|
|
$('.post-order-nav li:eq(' + submit_type + ')').addClass('en');
|
|
$('.post-order-box:eq(' + submit_type + ')').show()
|
|
|
|
order_nav_list.click(function () {
|
|
if (!$(this).hasClass('en')) {
|
|
let target_index = $(this).index();
|
|
order_nav_list.removeClass('en');
|
|
$(this).addClass('en');
|
|
order_box.hide();
|
|
$('.post-order-box:eq(' + target_index + ')').show();
|
|
}
|
|
});
|
|
}
|
|
|
|
function order_list() {
|
|
let cat_ul_count = $('.post-order-list').length; //カテゴリ総数
|
|
for (let i = 0; i < cat_ul_count; i++) {
|
|
let my_list = $('.post-order-list:eq(' + i + ')');
|
|
my_list.sortable(
|
|
{
|
|
update: function () {
|
|
let list_count = $('.product-list', my_list).length;
|
|
for (let j = 0; j < list_count; j++) {
|
|
let list_order = j + 1;
|
|
$('.list_order:eq(' + j + ')', my_list).val(list_order);
|
|
$('.list_order:eq(' + j + ')', my_list).siblings('.sort-num-label').text(list_order);
|
|
}
|
|
}
|
|
}
|
|
);
|
|
my_list.disableSelection();
|
|
}
|
|
}
|
|
|
|
function change_normal_order() {
|
|
let s_radio = $('.apop_normal_order');
|
|
let s_box = $('.normal_sort_box');
|
|
let default_index = $('.apop_normal_order_target').data('normal_order_target') - 1;
|
|
|
|
s_box.hide().find('input').each(function () {
|
|
$(this).prop('disabled', true);
|
|
});
|
|
$('.normal_sort_box:eq(' + default_index + ')').show().find('input').prop('disabled', false);
|
|
|
|
s_radio.click(function () {
|
|
let target_index = $(this).val() - 1;
|
|
s_box.hide().find('input').each(function () {
|
|
$(this).prop('disabled', true);
|
|
});
|
|
$('.normal_sort_box:eq(' + target_index + ')').show().find('input').prop('disabled', false);
|
|
})
|
|
}
|
|
|
|
function change_search_order() {
|
|
let s_radio = $('.apop_search_order');
|
|
let s_box = $('.search_sort_box');
|
|
let default_index = $('.apop_search_order_target').data('search_order_target') - 1;
|
|
|
|
s_box.hide().find('input').each(function () {
|
|
$(this).prop('disabled', true);
|
|
});
|
|
|
|
$('.search_sort_box:eq(' + default_index + ')').show().find('input').prop('disabled', false);
|
|
|
|
s_radio.click(function () {
|
|
let target_index = $(this).val() - 1;
|
|
s_box.hide().find('input').each(function () {
|
|
$(this).prop('disabled', true);
|
|
});
|
|
$('.search_sort_box:eq(' + target_index + ')').show().find('input').prop('disabled', false);
|
|
})
|
|
}
|
|
|
|
function disp_tax_per_page() {
|
|
let box_count = $('.order_setting_list').length;
|
|
for (let i = 0; i < box_count; i++) {
|
|
$('.order_setting_list:eq(' + i + ')').click(function () {
|
|
let en_count = $('.order_setting_list:eq(' + i + ') [name^="_apop_"]:checked').length;
|
|
if (en_count == 0) {
|
|
$(this).parent().next('dt').addClass('hide_list').next('dd').addClass('hide_list');
|
|
} else {
|
|
$(this).parent().next('dt').removeClass('hide_list').next('dd').removeClass('hide_list');
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function change_normal_per_page() {
|
|
let per_page_cat = $('.per_page_normal');
|
|
let per_page_input = $('.per_page_normal_input');
|
|
change_per_page(per_page_cat, per_page_input);
|
|
}
|
|
|
|
function change_search_per_page() {
|
|
let per_page_cat = $('.per_page_search');
|
|
let per_page_input = $('.per_page_search_input');
|
|
change_per_page(per_page_cat, per_page_input);
|
|
}
|
|
|
|
function change_cat_per_page() {
|
|
let per_page_cat = $('.per_page_cat');
|
|
let per_page_input = $('.per_page_cat_input');
|
|
change_per_page(per_page_cat, per_page_input);
|
|
}
|
|
|
|
function change_tag_per_page() {
|
|
let per_page_cat = $('.per_page_tag');
|
|
let per_page_input = $('.per_page_tag_input');
|
|
change_per_page(per_page_cat, per_page_input);
|
|
}
|
|
|
|
function change_tax_per_page() {
|
|
let per_page_cat = $('.per_page_tax');
|
|
let per_page_input = $('.per_page_tax_input');
|
|
change_per_page(per_page_cat, per_page_input);
|
|
}
|
|
|
|
function change_per_page(per_page_cat, per_page_input) {
|
|
if (per_page_input.val() == '') {
|
|
per_page_input.prop('disabled', true);
|
|
} else {
|
|
per_page_input.prop('disabled', false);
|
|
}
|
|
per_page_cat.click(function () {
|
|
if ($(this).val() != 'default' && $(this).val() != '-1' && $(this).val() != 'all') {
|
|
per_page_input.prop('disabled', false);
|
|
} else {
|
|
per_page_input.val('');
|
|
per_page_input.prop('disabled', true);
|
|
}
|
|
})
|
|
}
|
|
|
|
}); |