Skip to content
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

Datepicker issue multiple course offering #1341

Closed
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions app/static/css/createEvent.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.toggleHeader{
padding-bottom: 10px;
font-weight: bold;
font-weight: bold;
text-align: center;
margin-left: 50%; /* Position the header at 50% of the viewport width */
transform: translateX(-50%);
transform: translateX(-50%);
width: 170px
}
.columnDivide{
Expand All @@ -12,14 +12,14 @@
margin-left: 10px;
margin-right: -30px;
}.addMultipleBtn{
border-radius: 5px;
margin-left: auto;
border-radius: 5px;
margin-left: auto;
margin-right: auto;
}

.deleteRow{
border-radius: 5px;
position:relative;
border-radius: 5px;
position:relative;
top: 12px;
}
.invalidFeedback {
Expand Down Expand Up @@ -49,9 +49,12 @@
}
}
.border-red {
border: 2px solid red;
border: 2px solid red;
}
.divStripes {
background-color: #fff
}

#ui-datepicker-div {
z-index: 4000 !important;
}
16 changes: 16 additions & 0 deletions app/static/js/createEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,22 @@ $(document).ready(function() {
$("#checkBonners").prop('checked', true);
}
}

// Initialize datepicker for multiple offering modal
$(".multipleOfferingDatePicker").datepicker({
dateFormat: 'mm/dd/yy',
minDate: new Date(),
onSelect: function() {
$(this).focus();
}
});

$(document).on('click', '.input-group-text, .multipleOfferingDatePicker', function (e) {
// Prevent click from showing datepicker when it's not the datepicker or calendar icon
e.stopPropagation();
$(this).closest('.input-group').find('.multipleOfferingDatePicker').datepicker('show');
});

// Initialize datepicker with proper options
$.datepicker.setDefaults({
dateFormat: 'yy/mm/dd', // Ensures compatibility across browsers
Expand Down
15 changes: 10 additions & 5 deletions app/templates/admin/createEvent.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h1 id="pageTitle">{{page_title}}</h1>
<div class='input-group date startDate' id="startDate-{{pageLocation}}" data-page-location="{{pageLocation}}">
<input autocomplete="off" type='text' class="form-control datePicker startDatePicker readonly"
value="{{ eventData.startDate.strftime('%Y/%m/%d') if eventData.startDate and eventData.startDate.strftime else eventData.startDate}}"
name="startDate" placeholder="Pick a start date" id='startDatePicker-{{pageLocation}}'
name="startDate" placeholder="Pick a start date" id='startDatePicker-main'
data-page-location="{{pageLocation}}">
<div class="input-group-text" id="calendarIconStart-{{pageLocation}}"
onclick="$('#startDatePicker-{{pageLocation}}').datepicker('show')">
Expand All @@ -84,7 +84,7 @@ <h1 id="pageTitle">{{page_title}}</h1>
<label class="required form-label me-2" for="endDate-{{pageLocation}}"><strong>End Date</strong></label>
<div class='input-group date endDate' id="endDate-{{pageLocation}}" data-page-location="{{pageLocation}}">
<input autocomplete="off" type='text' class="form-control datePicker endDatePicker"
id='endDatePicker-{{pageLocation}}'
id='endDatePicker-main'
value="{{eventData.endDate.strftime('%Y-%m-%d') if eventData.endDate and eventData.endDate.strftime else eventData.endDate}}"
name="endDate" placeholder="Pick an end date" data-page-location="{{pageLocation}}">
<div class="input-group-text" id="calendarIconEnd-{{pageLocation}}">
Expand Down Expand Up @@ -480,12 +480,17 @@ <h5 class="modal-title">This is an event with multiple time offerings.</h5>
Date</strong></label>
<div class='input-group date multipleOfferingDate' id="multipleOfferingDate-{{pageLocation}}"
data-page-location="{{pageLocation}}">
<input autocomplete="off" type='date'
class="form-control datePicker multipleOfferingDatePicker readonly"
<input autocomplete="off" type='text'
class="form-control multipleOfferingDatePicker readonly"
value="{{ eventData.multipleOfferingDate.strftime('%m-%d-%Y') if eventData.multipleOfferingDate and eventData.multipleOfferingDate.strftime else eventData.multipleOfferingDate}}"
name="multipleOfferingDate" placeholder="Pick a start date"
id='multipleOfferingDatePicker-{{pageLocation}}' data-page-location="{{pageLocation}}" />
id='multipleOfferingDatePicker-modal' data-page-location="{{pageLocation}}">
<div class="input-group-text" id="calendarIconStart-{{pageLocation}}"
onclick="$('#multipleOfferingDatePicker-modal').datepicker('show')">
<span><i class="bi bi-calendar-plus-fill"></i></span>
</div>
</div>

</div>
<div class="form-group col-md-3">
<label class="form-label me-2" for="multipleOfferingStartTime-{{pageLocation}}"><strong>Start
Expand Down