1 var template_valuationcalendar = function( static )
7 this.construct = function()
9 $('#frmModal').modal('hide');
10 $('#modalFormContent').html('Loading...');
12 //console.log('App.userData',App.userData);
14 if(undefined != App.userData)
16 var userId = App.userData.id
19 "url" : 'workspace/get-calendar-events',
20 "data" : {'userId' : userId}
22 $.proxy(function(response) {
24 //console.log('response',response);
26 var calendarEvents = [];
28 $.each( response, function( responseKey, responseValue ) {
30 $.each( responseValue, function( responseK, responseV ) {
32 var startDate = responseV.start.replace("SAST", "T");
33 var endDate = responseV.end.replace("SAST", "T");
37 'title' : responseV.title,
40 //'url' : '/#/appointmentedit',
41 'id' : responseV.appointmentId,
42 'appointmentCompleted' : responseV.appointmentCompleted,
43 'appointmentCancelled' : responseV.appointmentCancelled
49 this.createCalendar(calendarEvents);
52 $.proxy(function(response) {
53 console.log('App.Notification.remove Error', response);
62 this.createCalendar = $.proxy(function(calendarEvents) {
65 var strDate = d.getFullYear() + "/" + (d.getMonth()+1) + "/" + d.getDate();
67 //console.log('calendarEvents',calendarEvents);
69 $('#calendar').fullCalendar({
73 left: 'prev,next today',
75 right: 'agendaWeek,agendaDay'
78 defaultView: 'agendaWeek',
80 eventLimit: false, // allow "more" link when too many events
81 events: calendarEvents,
86 eventRender: function(event, element) {
87 if (event.appointmentCancelled == true) {
88 element.css('background-color', '#d42e30');
90 if (event.appointmentCompleted == true) {
91 element.css('background-color', '#333');
94 eventClick: $.proxy(function(event) {
96 console.log('event',event);
98 console.log('calendarEvents.id',event.id);
100 _w.appointmentId = event.id;
102 App.Template.register(
103 'appointmentedit', "page", 'appointmentedit', 'modalFormContent', {},
104 $.proxy( this.renderPage, this )
109 $('.fc-center').hide();
112 this.renderPage = function( id, pageName )
114 _t[pageName].publish();
115 $('#frmModal').modal({
120 this.destruct = function()