OpenXE/classes/Modules/CopperSurcharge/www/js/copper_surcharge.js
2021-05-21 08:49:41 +02:00

53 lines
1.2 KiB
JavaScript

var CopperSurcharge = (function ($) {
'use strict';
var me = {
isInitialized: false,
selector: {
optional: '.surcharge-optional',
maintenanceType: 'surcharge-maintenance-type'
}
, init: function (){
me.checkOptional();
me.registerEvents();
}
, registerEvents: function () {
$('input[name=\''+me.selector.maintenanceType+'\']').on('click', me.selector.clickClass,
function (event) {
let maintenanceType = $(this).val();
me.showHideOptional(maintenanceType);
});
}
, checkOptional: function (){
let maintenanceType = $('input[name=\''+me.selector.maintenanceType+'\']:checked').val();
me.showHideOptional(maintenanceType);
}
,showHideOptional: function(maintenanceType){
if(maintenanceType === '1'){
$(me.selector.optional).show();
}
else {
$(me.selector.optional).hide();
}
}
};
return {
init: me.init
};
})(jQuery);
$(document).ready(function () {
CopperSurcharge.init();
});