Last active
September 11, 2018 12:31
-
-
Save GiuMagnani/f3d4ce3339e38288d9453f7dd0f6d272 to your computer and use it in GitHub Desktop.
Sorint Clann
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PranzoTimes = [ | |
"12:30:00-13:00:00", | |
"12:30:00-12:45:00", | |
"13:00:00-13:30:00" | |
]; | |
PranzoTimes.map(function(time) { | |
$('#div-pranzo').append('<button class="my-custom-button-meal">' + time + '</button>'); | |
}); | |
$('.my-custom-button-meal').each(function(index) { | |
$(this).on('click', function(e) { | |
e.preventDefault(); | |
let times = $(this).text().split('-'); | |
$('#dateInizioPranzo').val(times[0]); | |
$('#dateFinePranzo').val(times[1]); | |
}); | |
}) | |
const PSMtimesIn = [ | |
"06:45:00-08:00:00", | |
"07:15:00-08:30:00" | |
]; | |
const PSMtimesOut = [ | |
"17:00:00-18:00:00", | |
"17:30:00-18:30:00", | |
"18:00:00-19:00:00" | |
]; | |
PSMtimesIn.map(function(time) { | |
$('#formAttivita').append('<button class="my-custom-button-psm-in">' + time + '</button>'); | |
}); | |
PSMtimesOut.map(function(time) { | |
$('#formAttivita').append('<button class="my-custom-button-psm-out">' + time + '</button>'); | |
}); | |
$('.my-custom-button-psm-in').each(function(index) { | |
$(this).on('click', function(e) { | |
e.preventDefault(); | |
const PSMday = $('#datePartenza').val().split(' ')[0]; | |
const times = $(this).text().split('-'); | |
$('#datePartenza').val(PSMday + ' ' + times[0]); | |
$('#dateInizio').val(PSMday + ' ' + times[1]); | |
}); | |
}) | |
$('.my-custom-button-psm-out').each(function(index) { | |
$(this).on('click', function(e) { | |
e.preventDefault(); | |
const PSMday = $('#datePartenza').val().split(' ')[0]; | |
const times = $(this).text().split('-'); | |
$('#dateFine').val(PSMday + ' ' + times[0]); | |
$('#dateRientro').val(PSMday + ' ' + times[1]); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment