2022-11-11 08:28:46 +00:00
|
|
|
window.addEventListener("load", function() {
|
|
|
|
(function($) {
|
|
|
|
$(function() {
|
2022-11-21 13:09:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
// selfbuy section
|
|
|
|
|
2022-11-11 11:54:26 +00:00
|
|
|
var selectField_selfbuy = $('#id_selfbuy'),
|
|
|
|
verified_selfbuy_div = $('#id_selfbuy_give_data').parent().parent(),
|
2022-11-21 15:30:01 +00:00
|
|
|
verified_selfbuy = $('#id_selfbuy_give_data'),
|
|
|
|
data_selfbuy_div = $('#id_selfbuy_data').parent().parent(),
|
|
|
|
data_selfbuy = $('#id_selfbuy_data');
|
|
|
|
|
|
|
|
|
2022-11-21 13:09:12 +00:00
|
|
|
|
|
|
|
// make checked to get through the required
|
2022-11-11 11:54:26 +00:00
|
|
|
function toggleVerified_selfbuy(value) {
|
|
|
|
if (value === "FALSE") {
|
|
|
|
verified_selfbuy_div.show();
|
2022-11-21 15:30:01 +00:00
|
|
|
data_selfbuy_div.show();
|
|
|
|
data_selfbuy.val("");
|
2022-11-11 11:54:26 +00:00
|
|
|
verified_selfbuy.prop("checked", false);
|
|
|
|
} else {
|
|
|
|
verified_selfbuy_div.hide();
|
2022-11-21 15:30:01 +00:00
|
|
|
data_selfbuy_div.hide();
|
|
|
|
data_selfbuy.val("NONE");
|
2022-11-11 11:54:26 +00:00
|
|
|
verified_selfbuy.prop("checked", true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// show/hide on load based on existing value of selectField
|
|
|
|
toggleVerified_selfbuy(selectField_selfbuy.val());
|
|
|
|
|
|
|
|
// show/hide on change
|
|
|
|
selectField_selfbuy.change(function() {
|
|
|
|
toggleVerified_selfbuy($(this).val());
|
|
|
|
});
|
|
|
|
|
2022-11-11 08:28:46 +00:00
|
|
|
var selectField = $('#id_variant'),
|
2022-11-11 09:34:09 +00:00
|
|
|
verified = $('#id_url_of_pic').parent().parent();
|
2022-11-11 11:54:26 +00:00
|
|
|
|
2022-11-11 08:28:46 +00:00
|
|
|
function toggleVerified(value) {
|
|
|
|
if (value === 'PIC') {
|
|
|
|
verified.show();
|
|
|
|
} else {
|
|
|
|
verified.hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// show/hide on load based on existing value of selectField
|
|
|
|
toggleVerified(selectField.val());
|
|
|
|
|
|
|
|
// show/hide on change
|
|
|
|
selectField.change(function() {
|
|
|
|
toggleVerified($(this).val());
|
|
|
|
});
|
2022-12-05 10:19:03 +00:00
|
|
|
|
2022-11-11 08:28:46 +00:00
|
|
|
});
|
|
|
|
})(django.jQuery);
|
|
|
|
});
|