Skip to content

Commit

Permalink
Merge pull request #158 from vsimakhin/feature/date-picker-start-week…
Browse files Browse the repository at this point in the history
…-settings

Date Range Picker first day of the week settings - Sunday or Monday
  • Loading branch information
vsimakhin authored Sep 17, 2023
2 parents 2f0dd65 + 75821cf commit 908b63d
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

- New: Date Range Picker first day of the week settings - Sunday or Monday.
- New: Attachments synchronization support for the mobile application.

## [2.25.0]
Expand Down
4 changes: 3 additions & 1 deletion cmd/web/templates/flight-record-js.partials.gohtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{define "flight-record-js"}}
{{$settings := index .Data "settings"}}
<script>

// WebLogbook FlightRecord Namespace
Expand Down Expand Up @@ -398,7 +399,8 @@ wlbFlightRecord = function () {
singleDatePicker: true,
showDropdowns: true,
locale: {
format: 'DD/MM/YYYY'
format: 'DD/MM/YYYY',
firstDay: parseInt({{if not $settings.DateRangePickerWeek}}"0"{{else}}{{$settings.DateRangePickerWeek}}{{end}})
},
autoApply: true,
}, function(start, end, label) {
Expand Down
4 changes: 4 additions & 0 deletions cmd/web/templates/license-record-js.partials.gohtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{define "license-record-js"}}
{{$settings := index .Data "settings"}}
<script>

// WebLogbook License Record Namespace
Expand Down Expand Up @@ -150,6 +151,7 @@ wlbLicenseRecord = function () {
showDropdowns: true,
locale: {
format: 'DD/MM/YYYY',
firstDay: parseInt({{if not $settings.DateRangePickerWeek}}"0"{{else}}{{$settings.DateRangePickerWeek}}{{end}})
},
autoUpdateInput: false,
autoApply: true,
Expand All @@ -171,6 +173,7 @@ wlbLicenseRecord = function () {
showDropdowns: true,
locale: {
format: 'DD/MM/YYYY',
firstDay: parseInt({{if not $settings.DateRangePickerWeek}}"0"{{else}}{{$settings.DateRangePickerWeek}}{{end}})
},
autoUpdateInput: false,
autoApply: true,
Expand All @@ -192,6 +195,7 @@ wlbLicenseRecord = function () {
showDropdowns: true,
locale: {
format: 'DD/MM/YYYY',
firstDay: parseInt({{if not $settings.DateRangePickerWeek}}"0"{{else}}{{$settings.DateRangePickerWeek}}{{end}})
},
autoUpdateInput: false,
autoApply: true,
Expand Down
3 changes: 2 additions & 1 deletion cmd/web/templates/logbook-js.partials.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ wlbLogbook = function () {
alwaysShowCalendars: true,
linkedCalendars: false,
locale: {
cancelLabel: 'Clear'
cancelLabel: 'Clear',
firstDay: parseInt({{if not $settings.DateRangePickerWeek}}"0"{{else}}{{$settings.DateRangePickerWeek}}{{end}})
}
}, function(start, end, label) {
startDate = start;
Expand Down
4 changes: 4 additions & 0 deletions cmd/web/templates/map-js.partials.gohtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{define "map-js"}}
{{$settings := index .Data "settings"}}
<script src="/static/js/ol.js"></script>
<script>

Expand Down Expand Up @@ -249,6 +250,9 @@ wlbMap = function () {
linkedCalendars: false,
startDate: start,
endDate: end,
locale: {
firstDay: parseInt({{if not $settings.DateRangePickerWeek}}"0"{{else}}{{$settings.DateRangePickerWeek}}{{end}})
}
});

$('input[name="daterange"]').on('apply.daterangepicker', function(ev, picker) {
Expand Down
1 change: 1 addition & 0 deletions cmd/web/templates/settings-js.partials.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ wlbSettings = function () {
logbook_font_size: document.getElementById("logbook_font").value,
logbook_rows: document.getElementById("logbook_rows").value,
licensing_rows: document.getElementById("licensing_rows").value,
datepicker_week: document.getElementById("datepicker_week").value,
sync_options: {
keep_deleted_records_days: parseInt(document.getElementById("keep_deleted_records_days").value)
}
Expand Down
9 changes: 9 additions & 0 deletions cmd/web/templates/settings-misc.partials.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@
<input type="number" class="form-control form-control-sm" id="stats_font" name="stats_font" value='{{if not $settings.StatsFontSize}}100{{else}}{{$settings.StatsFontSize}}{{end}}' min="50" max="100">
</div>
</div>
<div class="row mb-1">
<label for="datepicker_week" class="col-sm-9 col-form-label">Date range picker week starts on</label>
<div class="col-sm-3">
<select class="form-control form-control-sm" id="datepicker_week" name="datepicker_week" value="{{if not $settings.DateRangePickerWeek}}0{{else}}{{$settings.DateRangePickerWeek}}{{end}}">
<option value="0" {{if not $settings.DateRangePickerWeek}}selected{{else}}{{if eq $settings.DateRangePickerWeek "0"}}selected{{end}}{{end}}>Sunday</option>
<option value="1" {{if eq $settings.DateRangePickerWeek "1"}}selected{{end}}>Monday</option>
</select>
</div>
</div>
</div>
</div>
{{end}}
3 changes: 2 additions & 1 deletion cmd/web/templates/stats-js.partials.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ $(document).ready( function () {
alwaysShowCalendars: true,
linkedCalendars: false,
locale: {
cancelLabel: 'Clear'
cancelLabel: 'Clear',
firstDay: parseInt({{if not $settings.DateRangePickerWeek}}"0"{{else}}{{$settings.DateRangePickerWeek}}{{end}})
}
}, function(start, end, label) {
startDate = start;
Expand Down
11 changes: 6 additions & 5 deletions internal/models/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,12 @@ type Settings struct {
ExportXLS ExportXLS `json:"export_xls"`
ExportCSV ExportCSV `json:"export_csv"`

HideStatsFields HideFields `json:"hide_stats_fields"`
StatsFontSize string `json:"stats_font_size"`
LogbookFontSize string `json:"logbook_font_size"`
LogbookRows string `json:"logbook_rows"`
LicensingRows string `json:"licensing_rows"`
HideStatsFields HideFields `json:"hide_stats_fields"`
StatsFontSize string `json:"stats_font_size"`
LogbookFontSize string `json:"logbook_font_size"`
LogbookRows string `json:"logbook_rows"`
LicensingRows string `json:"licensing_rows"`
DateRangePickerWeek string `json:"datepicker_week"`

SyncOptions SyncOptions `json:"sync_options"`
}
Expand Down

0 comments on commit 908b63d

Please sign in to comment.