mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-27 07:00:29 +01:00
53 lines
1.2 KiB
JavaScript
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();
|
|
});
|