namibia
df0489e1eeeeab5a9bd44e1d84fce49924fe1bac
namibia / public / templates / page / valuationcalendar.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
var template_valuationcalendar = function( static ) { this.static = static; this.elements = { }; this.construct = function() { $('#frmModal').modal('hide'); $('#modalFormContent').html('Loading...'); //console.log('App.userData',App.userData); if(undefined != App.userData) { var userId = App.userData.id App.Ajax.JSON({ "url" : 'workspace/get-calendar-events', "data" : {'userId' : userId} }, $.proxy(function(response) { //console.log('response',response); var calendarEvents = []; $.each( response, function( responseKey, responseValue ) { $.each( responseValue, function( responseK, responseV ) { var startDate = responseV.start.replace("SAST", "T"); var endDate = responseV.end.replace("SAST", "T"); calendarEvents.push( { 'title' : responseV.title, 'start' : startDate, 'end' : endDate, //'url' : '/#/appointmentedit', 'id' : responseV.appointmentId, 'appointmentCompleted' : responseV.appointmentCompleted, 'appointmentCancelled' : responseV.appointmentCancelled } ); }); }); this.createCalendar(calendarEvents); },this), $.proxy(function(response) { console.log('App.Notification.remove Error', response); },this) ); } }; this.createCalendar = $.proxy(function(calendarEvents) { var d = new Date(); var strDate = d.getFullYear() + "/" + (d.getMonth()+1) + "/" + d.getDate(); //console.log('calendarEvents',calendarEvents); $('#calendar').fullCalendar({ defaultDate: strDate, editable: false, header: { left: 'prev,next today', center: 'title', right: 'agendaWeek,agendaDay' }, height: 999999999, defaultView: 'agendaWeek', allDaySlot:false, eventLimit: false, // allow "more" link when too many events events: calendarEvents, disableResizing:true, minTime: "07:00:00", maxTime: "21:00:00", weekends: false, eventRender: function(event, element) { if (event.appointmentCancelled == true) { element.css('background-color', '#d42e30'); } if (event.appointmentCompleted == true) { element.css('background-color', '#333'); } }, eventClick: $.proxy(function(event) { console.log('event',event); console.log('calendarEvents.id',event.id); _w.appointmentId = event.id; App.Template.register( 'appointmentedit', "page", 'appointmentedit', 'modalFormContent', {}, $.proxy( this.renderPage, this ) ); }, this) }); $('.fc-center').hide(); },this); this.renderPage = function( id, pageName ) { _t[pageName].publish(); $('#frmModal').modal({ show: true }); }; this.destruct = function() { }; }; |
Commits for namibiapublic/templates/page/valuationcalendar.js
Revision | Author | Commited | Message |
---|---|---|---|
df0489 ... | Mark | Fri 14 Oct, 2016 10:01:00 +0000 | initial commit |