%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/projetos/suporte.iigd.com.br.old/js/
Upload File :
Create Path :
Current File : /var/www/projetos/suporte.iigd.com.br.old/js/reservations.min.js

/**
 * ---------------------------------------------------------------------
 *
 * GLPI - Gestionnaire Libre de Parc Informatique
 *
 * http://glpi-project.org
 *
 * @copyright 2015-2022 Teclib' and contributors.
 * @copyright 2003-2014 by the INDEPNET Development Team.
 * @licence   https://www.gnu.org/licenses/gpl-3.0.html
 *
 * ---------------------------------------------------------------------
 *
 * LICENSE
 *
 * This file is part of GLPI.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 * ---------------------------------------------------------------------
 */
var Reservations=function(){this.is_all=true;this.id=0;this.rand="";this.dom_id="";this.calendar=null;this.license_key=null;this.currentv=null;this.defaultDate=null;var e=this;e.init=function(t){e.id=t.id||0;e.is_all=t.is_all||true;e.rand=t.rand||true;e.is_tab=t.is_tab||false;e.license_key=t.license_key||"";e.dom_id="reservations_planning_"+e.rand;e.currentv=t.currentv||"dayGridMonth";e.defaultDate=t.defaultDate||new Date;e.defaultPDate=new Date(e.defaultDate)};e.displayPlanning=function(){e.calendar=new FullCalendar.Calendar(document.getElementById(e.dom_id),{schedulerLicenseKey:e.license_key,timeZone:"UTC",nowIndicator:true,theme:true,editable:true,defaultDate:e.defaultDate,minTime:CFG_GLPI.planning_begin,maxTime:CFG_GLPI.planning_end,weekNumbers:true,defaultView:localStorage.getItem("fcDefaultViewReservation")!==null?localStorage.getItem("fcDefaultViewReservation"):e.currentv,height:function(){var t=$(window).height()-272;if($("#debugajax").length>0){t-=$("#debugajax").height()}if(e.is_tab){t=$(".glpi_tabs ").height()-150}var a=300;if(t<a){t=a}return t},resourceAreaWidth:"15%",plugins:["dayGrid","interaction","list","timeGrid","resourceTimeline"],header:{left:"prev,next,today",center:"title",right:"dayGridMonth, timeGridWeek, timeGridDay, listFull, resourceWeek"},views:{listFull:{type:"list",titleFormat:function(){return""},visibleRange:function(t){var a=t.getFullYear();var i=1;if(e.id>0){i=10}return{start:new Date(t.getTime()).setFullYear(a-i),end:new Date(t.getTime()).setFullYear(a+i)}}},resourceWeek:{type:"resourceTimeline",buttonText:__("Timeline Week"),duration:{weeks:1},groupByDateAndResource:true,slotLabelFormat:[{week:"short"},{weekday:"short",day:"numeric",month:"numeric",omitCommas:true},function(e){return e.date.hour}]}},events:{url:CFG_GLPI.root_doc+"/ajax/reservations.php",type:"GET",extraParams:{action:"get_events",reservationitems_id:e.id},success:function(){},failure:function(e){console.error("there was an error while fetching events!",e)}},resources:{url:CFG_GLPI.root_doc+"/ajax/reservations.php",method:"GET",extraParams:{action:"get_resources"}},eventRender:function(t){var a=t.event;var i=a.extendedProps;var n=$(t.el);var r=t.view;if("icon"in i&&!e.is_tab){var l="";if("icon_alt"in i){l=i.icon_alt}n.find(".fc-title, .fc-list-item-title").append("&nbsp;<i class='"+i.icon+"' title='"+l+"'></i>")}var o={target:"mouse",adjust:{mouse:false},viewport:$(window)};if(r.type.indexOf("list")>=0){o.target=n.find("a")}n.qtip({position:o,content:i.comment,style:{classes:"qtip-shadow qtip-bootstrap"},show:{solo:true,delay:100},hide:{fixed:true,delay:100}})},dayRender:function(t){if(e.dateAreSameDay(t.date,e.defaultPDate)){$(t.el).addClass("defaultDate")}},viewSkeletonRender:function(e){var t=e.view;localStorage.setItem("fcDefaultViewReservation",t.type)},eventResize:function(t){e.editEvent(t)},eventDrop:function(t){e.editEvent(t)},selectable:true,select:function(t){glpi_ajax_dialog({title:__("Add reservation"),url:CFG_GLPI.root_doc+"/ajax/reservations.php",params:{action:"add_reservation_fromselect",id:e.id,start:t.start.toISOString(),end:t.end.toISOString()},dialogclass:"modal-lg"});e.calendar.unselect()},eventClick:function(e){var t=e.event;var a=t.extendedProps.ajaxurl;var i=t.extendedProps._editable;e.jsEvent.preventDefault();if(!i||!a){return}glpi_ajax_dialog({title:__("Edit reservation"),url:a+"&ajax=true",dialogclass:"modal-lg"})}});e.calendar.render();var t=Object.keys(FullCalendarLocales);if(t.length===1){e.calendar.setOption("locale",t[0])}};e.editEvent=function(e){var t=e.event;var a=e.revert;var i=t.start;var n=t.end;$.ajax({url:CFG_GLPI.root_doc+"/ajax/reservations.php",type:"POST",data:{action:"update_event",start:i.toISOString(),end:n.toISOString(),id:t.id},success:function(e){if(!e){a()}},error:function(){a()}})};e.dateAreSameDay=function(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}};

Zerion Mini Shell 1.0