TRF Certest first commit

This commit is contained in:
2025-02-26 08:57:46 +01:00
commit 3ce064a108
2524 changed files with 475404 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
var as = {};
as.toggleSidebar = function () {
$(".sidebar").toggleClass('expanded');
};
as.hideNotifications = function () {
$(".alert-notification").slideUp(600, function () {
$(this).remove();
})
};
as.updateSidebarSize = function () {
if (window.innerWidth >= 992 && window.innerWidth <= 1199) {
window.document.body.classList.add("sidebar-collapsed");
} else {
window.document.body.classList.remove("sidebar-collapsed");
}
};
as.init = function () {
$.ajaxSetup({
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }
});
$("#sidebar-toggle").click(as.toggleSidebar);
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="popover"]').popover();
$(".alert-notification .close").click(as.hideNotifications);
setTimeout(as.hideNotifications, 3500);
$("a[data-toggle=loader], button[data-toggle=loader]").click(function () {
if ($(this).parents('form').valid()) {
as.btn.loading($(this), $(this).data('loading-text'));
$(this).parents('form').submit();
}
});
$(window).resize(as.updateSidebarSize);
};
as.updateSidebarSize();
$(document).ready(as.init);
+19
View File
@@ -0,0 +1,19 @@
as.btn = {};
as.btn.loading = function(button, text) {
var oldText = button.text();
var newText = typeof text == "undefined" ? '' : text;
var html = '<i class="fa fa-spinner fa-spin"></i> ' + newText;
button.data("old-text", oldText)
.html(html)
.addClass("disabled")
.attr('disabled', "disabled");
};
as.btn.stopLoading = function (button) {
var oldText = button.data('old-text');
button.text(oldText)
.removeClass("disabled")
.removeAttr("disabled");
};
+62
View File
@@ -0,0 +1,62 @@
as.dashboard = {};
as.dashboard.initChart = function () {
var data = {
labels: months,
datasets: [
{
label: trans.chartLabel,
backgroundColor: "transparent",
borderColor: "#179970",
pointBackgroundColor: "#179970",
data: users
}
]
};
var ctx = document.getElementById("myChart").getContext("2d");
var myLineChart = new Chart(ctx, {
type: 'line',
data: data,
options: {
scales: {
xAxes: [{
gridLines: {
display: false,
}
}],
yAxes: [{
gridLines: {
color: "#f6f6f6",
zeroLineColor: '#f6f6f6',
drawBorder: false
},
ticks: {
beginAtZero: true,
callback: function(value) {if (value % 1 === 0) {return value;}}
}
}]
},
responsive: true,
legend: {
display: false
},
maintainAspectRatio: false,
tooltips: {
titleMarginBottom: 15,
callbacks: {
label: function(tooltipItem, data) {
var value = tooltipItem.yLabel,
suffix = trans.new + " " + (value == 1 ? trans.user : trans.users);
return " " + value + " " + suffix;
}
}
}
}
})
};
$(document).ready(function () {
as.dashboard.initChart();
});
+62
View File
@@ -0,0 +1,62 @@
as.dashboard = {};
as.dashboard.initChart = function () {
var data = {
labels: labels,
datasets: [
{
label: trans.chartLabel,
backgroundColor: "transparent",
borderColor: "#179970",
pointBackgroundColor: "#179970",
data: activities
}
]
};
var ctx = document.getElementById("myChart").getContext("2d");
var myLineChart = new Chart(ctx, {
type: 'line',
data: data,
options: {
scales: {
xAxes: [{
gridLines: {
display: false,
}
}],
yAxes: [{
gridLines: {
color: "#f6f6f6",
zeroLineColor: '#f6f6f6',
drawBorder: false
},
ticks: {
beginAtZero: true,
callback: function(value) {if (value % 1 === 0) {return value;}}
}
}]
},
responsive: true,
legend: {
display: false
},
maintainAspectRatio: false,
tooltips: {
titleMarginBottom: 15,
callbacks: {
label: function(tooltipItem, data) {
var value = tooltipItem.yLabel,
suffix = value == 1 ? trans.action : trans.actions;
return " " + value + " " + suffix;
}
}
}
}
})
};
$(document).ready(function () {
as.dashboard.initChart();
});
+13
View File
@@ -0,0 +1,13 @@
var valid = false;
$("#login-form").submit(function (e) {
var $form = $(this);
if (! $form.valid()) {
return false;
}
as.btn.loading($("#btn-login"));
return true;
});
+174
View File
@@ -0,0 +1,174 @@
$("#avatar-form").submit(function () {
$(".avatar-controls .btn").attr('disabled', 'disabled');
as.btn.loading($("#save-photo"), 'Saving...');
var points = $("#avatar").croppie('get').points;
$("#points_x1").val(points[0]);
$("#points_y1").val(points[1]);
$("#points_x2").val(points[2]);
$("#points_y2").val(points[3]);
});
$('#birthday').datepicker({
orientation: 'bottom',
startView: 'years',
format: 'yyyy-mm-dd'
});
var vHeight = 202,
image = null,
croppie = null;
function initCroppie() {
var avatar = $('#avatar');
var width = $(".avatar-wrapper").width(),
bWidth = width * 82/100,
vWidth = bWidth * 53/100;
if (vWidth > 160) {
vWidth = 160;
}
avatar.croppie('destroy');
croppie = avatar.croppie({
viewport: {
width: vWidth,
height: vWidth,
type: 'circle'
},
boundary: {
width: bWidth,
height: vHeight
}
});
if (image) {
croppie.croppie('bind', {
url: image
});
}
};
var timer;
$(window).resize(function () {
if (croppie) {
timer && clearTimeout(timer);
timer = setTimeout(initCroppie, 100);
}
});
function readFile(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
image = e.target.result;
hideCurrentImage();
initCroppie();
hideSpinner();
}
closeChooseModal();
makeCurrentImageInvisible();
hideChangePictureButton();
showAvatarControlButtons();
showSpinner();
reader.readAsDataURL(input.files[0]);
}
else {
swal("Sorry - you're browser doesn't support the FileReader API");
}
}
$("#cancel-upload").click(function () {
croppie = null;
$('#avatar').croppie('destroy');
$("#avatar").removeClass('croppie-container');
hideAvatarControlButtons();
showChangePictureButton();
makeCurrentImageVisible();
showCurrentImage();
});
function showAvatarControlButtons() {
$(".avatar-controls").removeClass('d-none').addClass('d-flex');
}
function hideAvatarControlButtons() {
$(".avatar-controls").removeClass('d-flex').addClass('d-none');
}
function showChangePictureButton() {
$("#change-picture").show();
}
function hideChangePictureButton() {
$("#change-picture").hide();
}
function closeChooseModal() {
$("#choose-modal").modal('hide');
}
function hideCurrentImage() {
$(".avatar-wrapper .avatar-preview").hide();
}
function showCurrentImage() {
$(".avatar-wrapper .avatar-preview").show();
}
function makeCurrentImageInvisible() {
$(".avatar-wrapper .avatar-preview").css({visibility: 'hidden'});
}
function makeCurrentImageVisible() {
$(".avatar-wrapper .avatar-preview").css({visibility: 'visible'});
}
function showSpinner() {
$(".avatar-wrapper .spinner").css({opacity: 1});
}
function hideSpinner() {
$(".avatar-wrapper .spinner").css({opacity: 0});
}
function updateAvatarFromSource(url, imageUrl) {
var form =
$('<form>', {
'method': 'POST',
'action': url
});
var hiddenInput =
$('<input>', {
'name': 'url',
'type': 'hidden',
'value': imageUrl
});
var token =
$("<input>", {
'name': '_token',
'type': 'hidden',
'value': $('meta[name="csrf-token"]').attr('content')
});
form.append(token, hiddenInput)
.appendTo('body')
.submit();
}
$('#avatar-upload').on('change', function () { readFile(this); });
$(".source-external img").click(function () {
var imageUrl = $(this).attr('src');
updateAvatarFromSource($(this).parent().data('url'), imageUrl);
});
$("#no-photo img").click(function () {
updateAvatarFromSource($(this).parent().data('url'), null);
});
+36
View File
@@ -0,0 +1,36 @@
var timer;
var $btn = $("#resend-token");
/**
* Start timeout which will show the "Resend Token" button
* after 60 seconds.
*/
function startTimer() {
timer = setTimeout(function () {
$btn.removeClass('d-none');
}, 60 * 1000);
}
/**
* Resend phone verification token.
*/
function resendToken() {
as.btn.loading($btn, $btn.data('loading-text'));
$.post("/two-factor/resend", user ? {user: user} : {})
.then(handleResendResponse)
.catch(handleResendResponse);
}
/**
* Handle response received from the server after
* resend token request was sent.
*/
function handleResendResponse() {
as.btn.stopLoading($btn);
$btn.addClass('d-none');
startTimer();
}
$btn.click(resendToken);
startTimer();