. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 52.223.31.75 / Your IP : 172.31.32.98 [ Web Server : Apache/2.4.66 () OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux ip-172-31-14-81.eu-central-1.compute.internal 4.14.281-212.502.amzn2.x86_64 #1 SMP Thu May 26 09:52:17 UTC 2022 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE Domains : 4 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/ripara.co/admin/js/controllers/ |
Upload File : |
materialAdmin
// =========================================================================
// Base controller for common functions
// =========================================================================
.controller('materialadminCtrl', function($timeout, $state, $scope, $http, growlService){
//Welcome Message
growlService.growl('Bentornato '+userInfo.firstname+'!', 'info')
//informazioni utente
$scope.utente = userInfo;
$scope.inArray = function (needle, haystack) {
var length = haystack.length;
for(var i = 0; i < length; i++) {
if(haystack[i] == needle) return true;
}
return false;
}
// ACL
// Elenco nomi pagine accessibili
$scope.thisPagesNames = [];
// Messaggio di errore
$scope.outtaHere = 'Non si possiedono i diritti per accedere alla pagina';
// Get delle pagine
this.getThisPages = function(){
var y = $state.get();
for(var x = 0; x < y.length; x++){
//controllo che la pagina corrente รจ prensete nelle pagine dell'utente
if($scope.inArray(y[x].id,$scope.utente.accessPage)){
// abbotto l'array
$scope.thisPagesNames.push(y[x].nomePagina);
}
}
//console.log('pageNames', $scope.thisPagesNames);
}
this.getThisPages();
// Detact Mobile Browser
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
angular.element('html').addClass('ismobile');
}
// By default Sidbars are hidden in boxed layout and in wide layout only the right sidebar is hidden.
this.sidebarToggle = {
left: false,
right: false
}
//logout
$scope.logout = function(){
$http.get("./API/?method=logout")
.then(function(response) {
if(response.status){
location.href = "login.html";
}
});
};
// By default template has a boxed layout
this.layoutType = localStorage.getItem('ma-layout-status');
// For Mainmenu Active Class
this.$state = $state;
//Close sidebar on click
this.sidebarStat = function(event) {
if (!angular.element(event.target).parent().hasClass('active')) {
this.sidebarToggle.left = false;
}
}
//Listview Search (Check listview pages)
this.listviewSearchStat = false;
this.lvSearch = function() {
this.listviewSearchStat = true;
}
//Listview menu toggle in small screens
this.lvMenuStat = false;
//Blog
this.wallCommenting = [];
this.wallImage = false;
this.wallVideo = false;
this.wallLink = false;
//Skin Switch
this.currentSkin = 'blue';
this.skinList = [
'lightblue',
'bluegray',
'cyan',
'teal',
'green',
'orange',
'blue',
'purple'
]
this.skinSwitch = function (color) {
this.currentSkin = color;
}
})
// =========================================================================
// Header
// =========================================================================
.controller('headerCtrl', function($timeout, APIService, growlService, $scope, $state){
$scope.$watch('messageResult', function() {
console.log('hey, myVar has changed!',this.messageResult);
});
//getallarmigenerati
APIService.async({method: "getallarmigenerati"}).then(function(adata) {
if(adata.status && adata.message.length){
$scope.hctrl.messageResult = adata.message;
console.log("allarmigenrati___si_",adata.message)
}else{
$scope.hctrl.messageResult = [];
angular.element('#notifications').addClass('empty');
}
});
this.notificaAllarmi = function(){
growlService.growl('Ricevuti nuovi allarmi!', 'inverse');
}
this.aggiungiAllarme = function(){
if($scope.hctrl.messageResult.length<1){
$scope.hctrl.messageResult = [];
angular.element('#notifications').removeClass('empty');
angular.element('#bottoneCancellaAllarmi').fadeIn(500);
}
$scope.hctrl.messageResult.unshift(JSON.parse(angular.element('#aggiungiAllarmeOkInput')[0].value));
}
// Gets the pages to populate the upper search list
$scope.pages = [];
this.getPages = function(){
var y = $state.get();
//console.log(y);
for(var x = 0; x < y.length; x++){
//console.log('x', y[x]);
if(y[x].id){
$scope.pages.push(y[x]);
}
}
console.log('pages', $scope.pages);
}
this.getPages();
// CallBack once a page is selected
$scope.pageSelected = function(selected) {
if (selected) {
$state.go(selected.description.name);
//console.log(selected);
} else {
console.log('cleared');
}
};
// Top Search
this.openSearch = function(){
angular.element('#header').addClass('search-toggled');
angular.element('#top-search-wrap').find('input').focus();
}
this.closeSearch = function(){
angular.element('#header').removeClass('search-toggled');
}
//Clear Notification
this.clearNotification = function($event) {
$event.preventDefault();
var x = angular.element($event.target).closest('.listview');
var y = x.find('.lv-item');
var z = y.size();
angular.element($event.target).parent().fadeOut();
x.find('.list-group').prepend('<i class="grid-loading hide-it"></i>');
x.find('.grid-loading').fadeIn(1500);
var w = 0;
y.each(function(){
var z = $(this);
$timeout(function(){
z.addClass('animated fadeOutRightBig').delay(1000).queue(function(){
z.remove();
});
}, w+=150);
})
$timeout(function(){
angular.element('#notifications').addClass('empty');
//setto true su visualizzato in mogno
APIService.async({method: "falseallarmigenerati"}).then(function(adata) {});
$scope.hctrl.messageResult = [];
}, (z*150)+200);
}
// Clear Local Storage
this.clearLocalStorage = function() {
//Get confirmation, if confirmed clear the localStorage
swal({
title: "Sei sicuro?",
text: "Tutti i tuoi dati salvati nel localStorage saranno rimossi!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#F44336",
confirmButtonText: "Si, cancellalo!",
closeOnConfirm: false
}, function(){
localStorage.clear();
swal("Completato!", "localStorage ripulito", "success");
});
}
//Fullscreen View
this.fullScreen = function() {
//Launch
function launchIntoFullscreen(element) {
if(element.requestFullscreen) {
element.requestFullscreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
} else if(element.msRequestFullscreen) {
element.msRequestFullscreen();
}
}
//Exit
function exitFullscreen() {
if(document.exitFullscreen) {
document.exitFullscreen();
} else if(document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if(document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
if (exitFullscreen()) {
launchIntoFullscreen(document.documentElement);
}
else {
launchIntoFullscreen(document.documentElement);
}
}
})
// =========================================================================
// Best Selling Widget
// =========================================================================
.controller('bestsellingCtrl', function(bestsellingService){
// Get Best Selling widget Data
this.img = bestsellingService.img;
this.name = bestsellingService.name;
this.range = bestsellingService.range;
this.bsResult = bestsellingService.getBestselling(this.img, this.name, this.range);
})
// =========================================================================
// Todo List Widget
// =========================================================================
.controller('todoCtrl', function(todoService){
//Get Todo List Widget Data
this.todo = todoService.todo;
this.tdResult = todoService.getTodo(this.todo);
//Add new Item (closed by default)
this.addTodoStat = false;
})
// =========================================================================
// Recent Items Widget
// =========================================================================
.controller('recentitemCtrl', function(recentitemService){
//Get Recent Items Widget Data
this.id = recentitemService.id;
this.name = recentitemService.name;
this.parseInt = recentitemService.price;
this.riResult = recentitemService.getRecentitem(this.id, this.name, this.price);
})
// =========================================================================
// Recent Posts Widget
// =========================================================================
.controller('recentpostCtrl', function($scope, recentpostService, APIService, animationService){
//Get Recent Posts Widget Items
this.img = recentpostService.img;
this.user = recentpostService.user;
this.text = recentpostService.text;
this.rpResultzz = recentpostService.getRecentpost(this.img, this.user, this.text);
this.getRecentpost = function (){
APIService.async({method: "getschede"}).then(function(adata) {
if(adata.status && adata.message.length){
//assegno i dati ricevuti a data
this.rpResult = adata.message;
$scope.rpResult = adata.message;
for (var i = $scope.rpResult.length - 1; i >= 0; i--) {
$scope.rpResult[i].id = $scope.rpResult[i]._id.$id;
// format date per tabella schede lavorazione
/*
data[i].datamodifica = new Date(data[i].datamodifica.sec * 1000);
data[i].datacreazione = new Date(data[i].datacreazione.sec * 1000);
*/
}
console.log('SVHEDEEEEE', this.rpResult);
}else{
animationService.setAnimationJam("bounceInDown", "alert-red", false, "Errore in fase di carimento dei dati, si prega di aggiornare la pagina!");
}
});
};
this.getRecentpost();
})
//=================================================
// Profile
//=================================================
.controller('profileCtrl', function(growlService){
//Get Profile Information from profileService Service
//User
this.profileSummary = "Sed eu est vulputate, fringilla ligula ac, maximus arcu. Donec sed felis vel magna mattis ornare ut non turpis. Sed id arcu elit. Sed nec sagittis tortor. Mauris ante urna, ornare sit amet mollis eu, aliquet ac ligula. Nullam dolor metus, suscipit ac imperdiet nec, consectetur sed ex. Sed cursus porttitor leo.";
this.fullName = "Mallinda Hollaway";
this.gender = "female";
this.birthDay = "23/06/1988";
this.martialStatus = "Single";
this.mobileNumber = "00971123456789";
this.emailAddress = "malinda.h@gmail.com";
this.twitter = "@malinda";
this.twitterUrl = "twitter.com/malinda";
this.skype = "malinda.hollaway";
this.addressSuite = "44-46 Morningside Road";
this.addressCity = "Edinburgh";
this.addressCountry = "Scotland";
//Edit
this.editSummary = 0;
this.editInfo = 0;
this.editContact = 0;
this.submit = function(item, message) {
if(item === 'profileSummary') {
this.editSummary = 0;
}
if(item === 'profileInfo') {
this.editInfo = 0;
}
if(item === 'profileContact') {
this.editContact = 0;
}
growlService.growl(message+' has updated Successfully!', 'inverse');
}
})
//=================================================
// LOGIN
//=================================================
.controller('loginCtrl', function(){
//Status
this.login = 1;
this.register = 0;
this.forgot = 0;
})
//=================================================
// CALENDAR
//=================================================
.controller('calendarCtrl', function($modal, $scope, APIService, animationService, $state){
this.calendarioElement =""
//aggiungere chiamata
APIService.async({method: "getschedecalendario"}).then(function(adata) {
console.log(adata);
if(adata.status){
//assegno i dati ricevuti a data
if(adata.message.length){
calendarioData = adata.message;
}else{
calendarioData = [];
}
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
//Generate the Calendar
$('#calendar').fullCalendar({
header: {
right: '',
center: 'prev, title, next',
left: ''
},
eventClick: function(calEvent, jsEvent, view) {
this.setTimer(setTimeout(function(){
$state.go("jam.scheda.informazioni", {id_scheda: 1, scheda: calEvent });
},1000));
/*
if (event.url) {
return false;
}
*/
//alert('Event: ' + calEvent);
//
//alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
//alert('View: ' + view.name);
// change the border color just for fun
//$(this).css('border-color', 'red');
},
theme: true, //Do not remove this as it ruin the design
selectable: true,
selectHelper: true,
editable: true,
//Add Events
events: calendarioData,
//On Day Select
select: function(start, end, allDay) {
scope.select({
start: start,
end: end
});
}
});
}else{
animationService.setAnimationJam("bounceInDown", "alert-red", false, "Errore in fase di carimento dei dati, si prega di aggiornare la pagina!");
}
}) //Fine chiamata
//Create and add Action button with dropdown in Calendar header.
this.month = 'month';
this.actionMenu = '<ul class="actions actions-alt" id="fc-actions">' +
'<li class="dropdown" dropdown>' +
'<a href="" dropdown-toggle><i class="zmdi zmdi-more-vert"></i></a>' +
'<ul class="dropdown-menu dropdown-menu-right">' +
'<li class="active">' +
'<a data-calendar-view="month" href="">Vista Mensile</a>' +
'</li>' +
'<li>' +
'<a data-calendar-view="basicWeek" href="">Vista Settimanale</a>' +
'</li>' +
'<li>' +
'<a data-calendar-view="agendaWeek" href="">Vista Agenda Settimanale</a>' +
'</li>' +
'<li>' +
'<a data-calendar-view="basicDay" href="">Vista Giornaliera</a>' +
'</li>' +
'<li>' +
'<a data-calendar-view="agendaDay" href="">Vista Agenda Giornaliera</a>' +
'</li>' +
'</ul>' +
'</div>' +
'</li>';
//Open new event modal on selecting a day
this.onSelect = function(argStart, argEnd) {
var modalInstance = $modal.open({
templateUrl: 'addEvent.html',
controller: 'addeventCtrl',
backdrop: 'static',
keyboard: false,
resolve: {
calendarData: function() {
var x = [argStart, argEnd];
return x;
}
}
});
}
})
//Add event Controller (Modal Instance)
.controller('addeventCtrl', function($scope, $modalInstance, calendarData){
//Calendar Event Data
$scope.calendarData = {
eventStartDate: calendarData[0],
eventEndDate: calendarData[1]
};
//Tags
$scope.tags = [
'bgm-teal',
'bgm-red',
'bgm-pink',
'bgm-blue',
'bgm-lime',
'bgm-green',
'bgm-cyan',
'bgm-orange',
'bgm-purple',
'bgm-gray',
'bgm-black',
]
//Select Tag
$scope.currentTag = '';
$scope.onTagClick = function(tag, $index) {
$scope.activeState = $index;
$scope.activeTagColor = tag;
}
//Add new event
$scope.addEvent = function() {
if ($scope.calendarData.eventName) {
//Render Event
$('#calendar').fullCalendar('renderEvent',{
title: $scope.calendarData.eventName,
start: $scope.calendarData.eventStartDate,
end: $scope.calendarData.eventEndDate,
allDay: true,
className: $scope.activeTagColor
},true ); //Stick the event
$scope.activeState = -1;
$scope.calendarData.eventName = '';
$modalInstance.close();
}
}
//Dismiss
$scope.eventDismiss = function() {
$modalInstance.dismiss();
}
})
// =========================================================================
// COMMON FORMS
// =========================================================================
.controller('formCtrl', function(){
//Input Slider
this.nouisliderValue = 4;
this.nouisliderFrom = 25;
this.nouisliderTo = 80;
this.nouisliderRed = 35;
this.nouisliderBlue = 90;
this.nouisliderCyan = 20;
this.nouisliderAmber = 60;
this.nouisliderGreen = 75;
//Color Picker
this.color = '#03A9F4';
this.color2 = '#8BC34A';
this.color3 = '#F44336';
this.color4 = '#FFC107';
})
// =========================================================================
// PHOTO GALLERY
// =========================================================================
.controller('photoCtrl', function(){
//Default grid size (2)
this.photoColumn = 'col-md-2';
this.photoColumnSize = 2;
this.photoOptions = [
{ value: 2, column: 6 },
{ value: 3, column: 4 },
{ value: 4, column: 3 },
{ value: 1, column: 12 },
]
//Change grid
this.photoGrid = function(size) {
this.photoColumn = 'col-md-'+size;
this.photoColumnSize = size;
}
})
// =========================================================================
// ANIMATIONS DEMO
// =========================================================================
.controller('animCtrl', function($timeout){
//Animation List
this.attentionSeekers = [
{ animation: 'bounce', target: 'attentionSeeker' },
{ animation: 'flash', target: 'attentionSeeker' },
{ animation: 'pulse', target: 'attentionSeeker' },
{ animation: 'rubberBand', target: 'attentionSeeker' },
{ animation: 'shake', target: 'attentionSeeker' },
{ animation: 'swing', target: 'attentionSeeker' },
{ animation: 'tada', target: 'attentionSeeker' },
{ animation: 'wobble', target: 'attentionSeeker' }
]
this.flippers = [
{ animation: 'flip', target: 'flippers' },
{ animation: 'flipInX', target: 'flippers' },
{ animation: 'flipInY', target: 'flippers' },
{ animation: 'flipOutX', target: 'flippers' },
{ animation: 'flipOutY', target: 'flippers' }
]
this.lightSpeed = [
{ animation: 'lightSpeedIn', target: 'lightSpeed' },
{ animation: 'lightSpeedOut', target: 'lightSpeed' }
]
this.special = [
{ animation: 'hinge', target: 'special' },
{ animation: 'rollIn', target: 'special' },
{ animation: 'rollOut', target: 'special' }
]
this.bouncingEntrance = [
{ animation: 'bounceIn', target: 'bouncingEntrance' },
{ animation: 'bounceInDown', target: 'bouncingEntrance' },
{ animation: 'bounceInLeft', target: 'bouncingEntrance' },
{ animation: 'bounceInRight', target: 'bouncingEntrance' },
{ animation: 'bounceInUp', target: 'bouncingEntrance' }
]
this.bouncingExits = [
{ animation: 'bounceOut', target: 'bouncingExits' },
{ animation: 'bounceOutDown', target: 'bouncingExits' },
{ animation: 'bounceOutLeft', target: 'bouncingExits' },
{ animation: 'bounceOutRight', target: 'bouncingExits' },
{ animation: 'bounceOutUp', target: 'bouncingExits' }
]
this.rotatingEntrances = [
{ animation: 'rotateIn', target: 'rotatingEntrances' },
{ animation: 'rotateInDownLeft', target: 'rotatingEntrances' },
{ animation: 'rotateInDownRight', target: 'rotatingEntrances' },
{ animation: 'rotateInUpLeft', target: 'rotatingEntrances' },
{ animation: 'rotateInUpRight', target: 'rotatingEntrances' }
]
this.rotatingExits = [
{ animation: 'rotateOut', target: 'rotatingExits' },
{ animation: 'rotateOutDownLeft', target: 'rotatingExits' },
{ animation: 'rotateOutDownRight', target: 'rotatingExits' },
{ animation: 'rotateOutUpLeft', target: 'rotatingExits' },
{ animation: 'rotateOutUpRight', target: 'rotatingExits' }
]
this.fadeingEntrances = [
{ animation: 'fadeIn', target: 'fadeingEntrances' },
{ animation: 'fadeInDown', target: 'fadeingEntrances' },
{ animation: 'fadeInDownBig', target: 'fadeingEntrances' },
{ animation: 'fadeInLeft', target: 'fadeingEntrances' },
{ animation: 'fadeInLeftBig', target: 'fadeingEntrances' },
{ animation: 'fadeInRight', target: 'fadeingEntrances' },
{ animation: 'fadeInRightBig', target: 'fadeingEntrances' },
{ animation: 'fadeInUp', target: 'fadeingEntrances' },
{ animation: 'fadeInBig', target: 'fadeingEntrances' }
]
this.fadeingExits = [
{ animation: 'fadeOut', target: 'fadeingExits' },
{ animation: 'fadeOutDown', target: 'fadeingExits' },
{ animation: 'fadeOutDownBig', target: 'fadeingExits' },
{ animation: 'fadeOutLeft', target: 'fadeingExits' },
{ animation: 'fadeOutLeftBig', target: 'fadeingExits' },
{ animation: 'fadeOutRight', target: 'fadeingExits' },
{ animation: 'fadeOutRightBig', target: 'fadeingExits' },
{ animation: 'fadeOutUp', target: 'fadeingExits' },
{ animation: 'fadeOutUpBig', target: 'fadeingExits' }
]
this.zoomEntrances = [
{ animation: 'zoomIn', target: 'zoomEntrances' },
{ animation: 'zoomInDown', target: 'zoomEntrances' },
{ animation: 'zoomInLeft', target: 'zoomEntrances' },
{ animation: 'zoomInRight', target: 'zoomEntrances' },
{ animation: 'zoomInUp', target: 'zoomEntrances' }
]
this.zoomExits = [
{ animation: 'zoomOut', target: 'zoomExits' },
{ animation: 'zoomOutDown', target: 'zoomExits' },
{ animation: 'zoomOutLeft', target: 'zoomExits' },
{ animation: 'zoomOutRight', target: 'zoomExits' },
{ animation: 'zoomOutUp', target: 'zoomExits' }
]
//Animate
this.ca = '';
this.setAnimation = function(animation, target) {
if (animation === "hinge") {
animationDuration = 2100;
}
else {
animationDuration = 1200;
}
angular.element('#'+target).addClass(animation);
$timeout(function(){
angular.element('#'+target).removeClass(animation);
}, animationDuration);
}
this.setAnimationJam = function(animation, target, hidden) {
if (animation === "hinge") {
animationDuration = 2100;
}
else {
animationDuration = 1200;
}
if(!hidden){
angular.element('#'+target).removeClass("hidden");
}
angular.element('#'+target).addClass(animation);
$timeout(function(){
angular.element('#'+target).removeClass(animation);
if(hidden){
angular.element('#'+target).addClass("hidden");
}
}, animationDuration,
function(){
});
}
})