-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timepicker issue #1288
base: development
Are you sure you want to change the base?
Timepicker issue #1288
Changes from all commits
7d14078
b7a9913
a627a1d
a4fead6
5b24afb
0f3bb83
09ce0ed
4258732
6bd4e81
9ff6473
c4dbceb
540b3ee
048d527
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ let pendingmultipleEvents = [] | |
// updates max and min dates of the datepickers as the other datepicker changes | ||
// No need for / for Firefox compatiblity | ||
function updateDate(obj) { | ||
var selectedDate = $(obj).datepicker("getDate"); | ||
var selectedDate = $(obj).datepicker("getDate"); // No need for / for Firefox compatibility | ||
|
||
var newMonth = selectedDate.getMonth(); | ||
var newYear = selectedDate.getFullYear(); | ||
var newDay = selectedDate.getDate(); | ||
|
@@ -88,16 +89,13 @@ function calculateRecurringEventFrequency(){ | |
|
||
for(let i = 0; i < startTimeInputs.length; i++){ | ||
if(startTimeInputs[i].value >= endTimeInputs[i].value){ | ||
console.log(startTimeInputs[i]); | ||
console.log(endTimeInputs[i]); | ||
$(startTimeInputs[i]).addClass('border-red'); | ||
$(endTimeInputs[i]).addClass('border-red'); | ||
timeCheck = true; | ||
}else{ | ||
$(startTimeInputs[i]).removeClass('border-red'); | ||
$(endTimeInputs[i]).removeClass('border-red'); | ||
} | ||
console.log(timeCheck); | ||
} | ||
if (isEmpty){ | ||
$('#textNotifierPadding').addClass('pt-5'); | ||
|
@@ -136,7 +134,23 @@ function storeMultipleOfferingEventAttributes() { | |
let entries = []; | ||
$(".extraSlots").children().each(function(index, element) { | ||
let rowData = $.map($(element).find("input"), (el) => $(el).val()); | ||
// Initialize timepicker | ||
$('.timepicker').timepicker({ | ||
timeFormat: 'h:mm p', | ||
interval: 15, | ||
minTime: '12:00am', | ||
maxTime: '11:45pm', | ||
defaultTime: '11:00am', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am now hitting errors, but before I was I saw that the time for both time pickers was 11:00 am. We want to by default have the times an hour apart. For instance start time is noon and end time is 1pm. |
||
startTime: '8:00am', | ||
dynamic: false, | ||
dropdown: true, | ||
scrollbar: true | ||
}); | ||
|
||
|
||
// Update datepicker min and max dates on change | ||
$(".startDatePicker, .endDatePicker").change(function () { | ||
updateDate(this); | ||
entries.push({ | ||
eventName: rowData[0], | ||
eventDate: rowData[1], | ||
|
@@ -327,32 +341,6 @@ $(".startDatePicker, .endDatePicker").change(function () { | |
$("#startDatePicker-main").datepicker("option", "minDate", minDate) | ||
}) | ||
|
||
// everything except Chrome | ||
if (navigator.userAgent.indexOf("Chrome") == -1) { | ||
$('input.timepicker').timepicker({ | ||
timeFormat: 'hh:mm p', | ||
scrollbar: true, | ||
dropdown: true, | ||
dynamic: true, | ||
minTime: "08:00am", | ||
maxTime: "10:00pm" | ||
}); | ||
$(".timepicker").prop("type", "text"); | ||
$(".timeIcons").prop("hidden", false); | ||
|
||
var formattedStartTime = format24to12HourTime($(".startTime").prop("defaultValue")); | ||
var formattedEndTime = format24to12HourTime($(".endTime").prop("defaultValue")); | ||
$(".startTime").val(formattedStartTime); | ||
$(".endTime").val(formattedEndTime); | ||
} else { | ||
$(".timepicker").prop("type", "time"); | ||
$(".timeIcons").prop("hidden", true); | ||
} | ||
|
||
if ($(".datePicker").is("readonly")) { | ||
$(".datePicker").datepicker("option", "disabled", true); | ||
} | ||
|
||
$(".readonly").on('keydown paste', function (e) { | ||
if (e.keyCode != 9) // ignore tab | ||
e.preventDefault(); | ||
|
@@ -370,6 +358,27 @@ $(".startDatePicker, .endDatePicker").change(function () { | |
if ($(this).val() && $("#endDatePicker-" + $(this).data("page-location")).val()) { | ||
calculateRecurringEventFrequency(); | ||
} | ||
}) | ||
// Time picker click events | ||
$(".timeIcons").on("click", function(e) { | ||
e.stopPropagation() | ||
|
||
|
||
if ($(this).siblings(".timepicker").timepicker("closed")) { | ||
$(this).siblings(".timepicker").timepicker("open"); | ||
} | ||
|
||
else { | ||
$(this).siblings(".timepicker").timepicker("close"); | ||
} | ||
}) | ||
|
||
$("#checkRSVP").click(function () { | ||
if ($("input[name='isRsvpRequired']:checked").val() == 'on') { | ||
$("#checkFood").prop('checked', true); | ||
} else { | ||
$("#checkFood").prop('disabled', false); | ||
} | ||
}); | ||
|
||
var facilitatorArray = [] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,6 @@ | |
{% set eventPast = event.isPastEnd if not isNewEvent else False %} | ||
{% set tabName = 'edit' %} | ||
|
||
|
||
{% block scripts %} | ||
{{super()}} | ||
<script type="module" src="/static/js/createEvents.js"></script> | ||
|
@@ -452,6 +451,7 @@ <h5 class="modal-title" id="renewModel">Renew Event</h5> | |
</div> | ||
</div> | ||
</form> | ||
{% endblock %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This endblock is messing up styling on the page. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was initially just styling but now it is breaking completely for me |
||
<!--multiple offering event modal--> | ||
<div class="modal modalMultipleOfferingEvent fade float-start col" data-bs-backdrop='static' id="modalMultipleOffering"> | ||
<div class="modal-dialog modal-lg modal-dialog-scrollable"> | ||
|
@@ -541,4 +541,4 @@ <h5 class="modal-title">This is an event with multiple time offerings.</h5> | |
</div> | ||
</div> | ||
|
||
{% endblock %} | ||
{% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation on this timepicker block of code is weird and the .extraSlots function does not close, causing some errors on my end.