2021-05-19 04:39:27 +02:00
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
2020-07-19 23:51:45 +02:00
|
|
|
// initialize timezone offset value if field is present in page
|
|
|
|
var timezoneOffset = new Date().getTimezoneOffset();
|
|
|
|
$("#TimezoneOffset").val(timezoneOffset);
|
|
|
|
|
|
|
|
// localize all elements that have localizeDate class
|
2018-05-26 16:32:20 +02:00
|
|
|
$(".localizeDate").each(function (index) {
|
|
|
|
var serverDate = $(this).text();
|
|
|
|
var localDate = new Date(serverDate);
|
|
|
|
|
|
|
|
var dateString = localDate.toLocaleDateString() + " " + localDate.toLocaleTimeString();
|
|
|
|
$(this).text(dateString);
|
|
|
|
});
|
2020-06-24 10:23:16 +02:00
|
|
|
|
|
|
|
function updateTimeAgo(){
|
|
|
|
var timeagoElements = $("[data-timeago-unixms]");
|
|
|
|
timeagoElements.each(function () {
|
|
|
|
var elem = $(this);
|
|
|
|
elem.text(moment(elem.data("timeago-unixms")).fromNow());
|
|
|
|
});
|
|
|
|
setTimeout(updateTimeAgo, 1000);
|
|
|
|
}
|
|
|
|
updateTimeAgo();
|
|
|
|
|
2019-05-12 00:13:16 +02:00
|
|
|
// intializing date time pickers throughts website
|
2019-05-11 21:07:13 +02:00
|
|
|
$(".flatdtpicker").each(function () {
|
|
|
|
var element = $(this);
|
2019-05-12 01:31:52 +02:00
|
|
|
var fdtp = element.attr("data-fdtp");
|
|
|
|
|
|
|
|
// support for initializing with special options per instance
|
|
|
|
if (fdtp) {
|
|
|
|
var parsed = JSON.parse(fdtp);
|
|
|
|
element.flatpickr(parsed);
|
|
|
|
} else {
|
|
|
|
var min = element.attr("min");
|
|
|
|
var max = element.attr("max");
|
|
|
|
var defaultDate = element.attr("value");
|
|
|
|
element.flatpickr({
|
|
|
|
enableTime: true,
|
|
|
|
enableSeconds: true,
|
|
|
|
dateFormat: 'Z',
|
|
|
|
altInput: true,
|
|
|
|
altFormat: 'Y-m-d H:i:S',
|
|
|
|
minDate: min,
|
|
|
|
maxDate: max,
|
|
|
|
defaultDate: defaultDate,
|
|
|
|
time_24hr: true,
|
2021-07-30 07:31:44 +02:00
|
|
|
defaultHour: 0,
|
|
|
|
static: true
|
2019-05-12 01:31:52 +02:00
|
|
|
});
|
|
|
|
}
|
2019-05-11 21:07:13 +02:00
|
|
|
});
|
|
|
|
|
2019-01-14 22:43:29 +01:00
|
|
|
|
2019-03-07 06:29:29 +01:00
|
|
|
$(".input-group-clear").on("click", function () {
|
2019-01-14 22:43:29 +01:00
|
|
|
$(this).parents(".input-group").find("input").val(null);
|
2019-03-07 06:29:29 +01:00
|
|
|
handleInputGroupClearButtonDisplay(this);
|
2019-01-14 22:43:29 +01:00
|
|
|
});
|
|
|
|
|
2019-03-07 06:29:29 +01:00
|
|
|
$(".input-group-clear").each(function () {
|
|
|
|
var inputGroupClearBtn = this;
|
|
|
|
handleInputGroupClearButtonDisplay(inputGroupClearBtn);
|
|
|
|
$(this).parents(".input-group").find("input").on("change input", function () {
|
|
|
|
handleInputGroupClearButtonDisplay(inputGroupClearBtn);
|
2019-05-11 21:07:13 +02:00
|
|
|
});
|
2019-03-07 06:29:29 +01:00
|
|
|
});
|
|
|
|
|
2021-05-19 04:39:27 +02:00
|
|
|
$('[data-bs-toggle="tooltip"]').tooltip();
|
2020-04-27 12:55:46 +02:00
|
|
|
|
2019-03-07 06:29:29 +01:00
|
|
|
function handleInputGroupClearButtonDisplay(element) {
|
2019-05-11 21:07:13 +02:00
|
|
|
var inputs = $(element).parents(".input-group").find("input");
|
2019-05-07 10:01:37 +02:00
|
|
|
|
|
|
|
$(element).hide();
|
|
|
|
for (var i = 0; i < inputs.length; i++) {
|
|
|
|
var el = inputs.get(i);
|
2019-05-11 21:07:13 +02:00
|
|
|
if ($(el).val() || el.attributes.value) {
|
2019-05-07 10:01:37 +02:00
|
|
|
$(element).show();
|
|
|
|
break;
|
|
|
|
}
|
2019-03-07 06:29:29 +01:00
|
|
|
}
|
|
|
|
}
|
2020-07-13 21:29:42 +02:00
|
|
|
|
2020-10-13 09:58:46 +02:00
|
|
|
$('[data-clipboard]').on('click', window.copyToClipboard);
|
2021-06-06 13:44:54 +02:00
|
|
|
|
|
|
|
$('[data-toggle="password"]').each(function () {
|
|
|
|
var input = $(this);
|
|
|
|
var eye_btn = $(this).parent().find('.input-group-text');
|
|
|
|
eye_btn.css('cursor', 'pointer').addClass('input-password-hide');
|
|
|
|
eye_btn.on('click', function () {
|
|
|
|
if (eye_btn.hasClass('input-password-hide')) {
|
|
|
|
eye_btn.removeClass('input-password-hide').addClass('input-password-show');
|
|
|
|
eye_btn.find('.fa').removeClass('fa-eye').addClass('fa-eye-slash')
|
|
|
|
input.attr('type', 'text');
|
|
|
|
} else {
|
|
|
|
eye_btn.removeClass('input-password-show').addClass('input-password-hide');
|
|
|
|
eye_btn.find('.fa').removeClass('fa-eye-slash').addClass('fa-eye')
|
|
|
|
input.attr('type', 'password');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2018-05-26 16:32:20 +02:00
|
|
|
});
|
2019-04-26 01:22:04 +02:00
|
|
|
|
|
|
|
function switchTimeFormat() {
|
|
|
|
$(".switchTimeFormat").each(function (index) {
|
|
|
|
var htmlVal = $(this).html();
|
|
|
|
var switchVal = $(this).attr("data-switch");
|
|
|
|
|
|
|
|
$(this).html(switchVal);
|
|
|
|
$(this).attr("data-switch", htmlVal);
|
|
|
|
});
|
|
|
|
}
|