Only one day needed to submit

This commit is contained in:
JosephK 2015-11-19 15:38:27 +01:00
parent f3ef1f9647
commit 801dc150e2

View File

@ -23,24 +23,18 @@ $(document).ready(function () {
var $selected_days = $('#selected-days'); var $selected_days = $('#selected-days');
var $removeaday_and_copyhours = $('#remove-a-day, #copyhours'); var $removeaday_and_copyhours = $('#remove-a-day, #copyhours');
// at least 1 day and 1 hour filled and you can submit // at least 1 day filled and you can submit
var submitDaysAvalaible = function () { var submitDaysAvalaible = function () {
var nb_filled_days = 0; var nb_filled_days = 0;
var nb_filled_hours = 0;
$selected_days.find('fieldset legend input').each(function () { $selected_days.find('fieldset legend input').each(function () {
if ($(this).val() != '') { if ($(this).val() != '') {
nb_filled_days++; nb_filled_days++;
} }
}); });
$selected_days.find('.hours').each(function () {
if ($(this).val() != '') {
nb_filled_hours++;
}
});
if (nb_filled_days >= 1 && nb_filled_hours >= 1) { if (nb_filled_days >= 1) {
$('button[name="choixheures"]').removeClass('disabled'); $('button[name="choixheures"]').removeClass('disabled');
return true; return true;
} else { } else {