var selectelement = document.getElementById('elex_mv_order_status_radios');
jQuery(document).ready(function ($) {
			// Initialize Select2
			jQuery('.order-status-selection').select2();
});
validation_for_forms_func_select('#elex_mv_order_status_radios', /^.+$/,'#elex_mv_order_status_radios-error', 'Select atleast one order status');
validation_for_forms_func('#elex_mv_date_of_month_pay_settle', /^(2[0-8]|[1-9])$/,'#elex_mv_date_of_month_pay_settle-error', 'Enter a date between 1 and 28');
	
function validation_for_forms_func(id_for_input_element, regex_for_string, id_for_error_element, error_string){
	jQuery(id_for_input_element).keyup(function(){
	const regex = regex_for_string;
	if(! regex.test(this.value)){
		jQuery(id_for_error_element).html(`<div class="text-danger">${error_string}</div>`);
	}else{
		jQuery(id_for_error_element).html('');

	}
	});
}
function validation_for_forms_func_select(id_for_input_element, regex_for_string, id_for_error_element, error_string){
	jQuery(id_for_input_element).on('change',function(){
	const regex = regex_for_string;
	if(! regex.test(this.value)){
		jQuery(id_for_error_element).html(`<div class="text-danger">${error_string}</div>`);
	}else{
		jQuery(id_for_error_element).html('');

	}
	});
}
