From c4b7dc267eb81e0e6accd22de0939df14efcf1e9 Mon Sep 17 00:00:00 2001 From: "alextselegidis@gmail.com" Date: Fri, 5 Jul 2013 16:20:33 +0000 Subject: [PATCH] Display working plan on provider's calendar. --- src/assets/css/backend.css | 4 + src/assets/images/break.jpg | Bin 0 -> 147127 bytes src/assets/images/unavailable.jpg | Bin 0 -> 104487 bytes src/assets/js/backend_calendar.js | 190 ++++++++++++++++++++++++------ src/configuration.php | 4 +- 5 files changed, 161 insertions(+), 37 deletions(-) create mode 100644 src/assets/images/break.jpg create mode 100644 src/assets/images/unavailable.jpg diff --git a/src/assets/css/backend.css b/src/assets/css/backend.css index fb31aebb..b75b658e 100644 --- a/src/assets/css/backend.css +++ b/src/assets/css/backend.css @@ -47,6 +47,10 @@ root { #calendar-page #calendar-filter select { margin-top: 5px; } #calendar-page #calendar-actions { display: inline-block; float: right; margin-top: 4px; } #calendar-page #calendar { margin: 12px; } +#calendar-page #calendar .fc-unavailable { background-image: url('../images/unavailable.jpg'); + font-size: 24px; border: none; border-radius: 0; font-weight: bold; color: #333; + text-shadow: 0px 1px 0px #FFF;} +#calendar-page #calendar .fc-break { background-image: url('../images/break.jpg'); } /* BACKEND CUSTOMERS PAGE -------------------------------------------------------------------- */ diff --git a/src/assets/images/break.jpg b/src/assets/images/break.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ed74051a956219cee2f1632b3f5524f58accddb8 GIT binary patch literal 147127 zcmeI*3s@6Zq6hGkgjWzyP^?yKV+8S0Bq0VQN|8qpP>=?ERQJ0zBm+eAA_*^hSFN?W zx^1n9cI~!XUsP>%uXcU)wP@{X-Tiu35YXycYjwBUZL6)eDqYMyXC?_?ZEg47-LQNA z;Uk&HnVB=^HIwt3nYd57&-Jd;)|g5O$d`{s5NvR>@no@nQKN#`&P%U(eui6_oMUH3~g zw{yQlj;{M97WvjOU+i0VL?2;wB!_;oed9mfC*7ZsFn(Vi$;>BW_va*nA0x&^ES&o^ zSwg}>LPDe=VNz*WWUtU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-sCyqzp5X z-1et026Q&OQP}iudio?I3Cv!fSa@0g;YLX6)`(4xO^#BI6AMl(bS|$qo*47y>bdU( zdiV{oX`#HYs1}+N)iKYXYM}{WI`dUm%la)_X8)EurW&TyS?@U9f?0NYq6kdRhDK*TX7r9DXJRQof+9sPK7U$-j0xTlLf7EmS`p z@$YfelVy04eeQaPk@Nac{q*@?>4B9%ibhg1%!98x)?a`vQhCy~k_ zl|w3rR1T>eQaSrkIj|i_p}2k;);JLn?<<4yhbcIeSvM6G-Kd z$|03QDu+}Kshs_&9M}#al|w3rR1T>eQaPk@cA|3d%_00CD1HzWKYNQ`8fLW+{$Dx# zzjAi@zj8H5<&erDl|w3rR1T?}{iqz+4k498Du+}KsT@){q;htma`4R|q;g2*kjf#I zLn_zS8in6rwbM6P>yXMJl|w3rR1T>eQaSrkIj|i_p{GAeBQ4 zReQaPk@_M>uOJA_mYsT@){q;g2*kjmMK%E32> zaIGA!mBY1ixK<9=%HdkMOCLUKr?qmmNac{qA(cZahg1%!oc*XA*bX6;Ln?<<4yhbc zIizxSqH^%fA*6Ch<&erDl|w3rRL*`>t{$lzQaPk@Nac{qA(gWql>^%$q;g2*kjf#I zLn?<<&Q4SgzBzeQaPk@_M>uOJA_mYsT@){ zq;g2*kjmMK%E32>kjf#ILn?<<4yhbcIr~w$lSt)|$|03QDu+}Kshs_&9M}#al|w3r zR1T>eQaPk@cA|3d%^{?6Nac{qA(cZahg8mfRPF>)Iizw(<&erDl|w3LKPm^dLrCS2 z$|03QDu+}Kshpjt9DH*KsT@){q;g2*kjf#IvmceKK`Mt-4yhbcIizw( workDateEnd) { + var unavailablePeriod = { + 'title': 'Unavailable', + 'start': workDateEnd, + 'end': calendarDateEnd, + 'allDay': false, + 'color': '#AAA', + 'editable': false, + 'className': 'fc-unavailable' + }; + $('#calendar').fullCalendar('renderEvent', unavailablePeriod, true); + } + + // Add unavailable periods for breaks. + var breakStart, breakEnd; + $.each(workingPlan[selDayName].breaks, function(index, currBreak) { + breakStart = Date.parseExact(calendarDateStart.toString('dd/MM/yyyy') + + ' ' + currBreak.start, 'dd/MM/yyyy HH:mm'); + breakEnd = Date.parseExact(calendarDateStart.toString('dd/MM/yyyy') + + ' ' + currBreak.end, 'dd/MM/yyyy HH:mm'); + var unavailablePeriod = { + 'title': 'Break', + 'start': breakStart, + 'end': breakEnd, + 'allDay': false, + 'color': '#AAA', + 'editable': false, + 'className': 'fc-unavailable fc-break' + }; + $('#calendar').fullCalendar('renderEvent', unavailablePeriod, true); + }); + + // @task Add custom unavailable periods. + + + break; + + case 'agendaWeek': + var currDateStart = GeneralFunctions.clone($('#calendar').fullCalendar('getView').start); + var currDateEnd = GeneralFunctions.clone(currDateStart).addDays(1); + + $.each(workingPlan, function(index, workingDay) { + var start, end; + + // Add unavailable period before work starts. + start = Date.parseExact(currDateStart.toString('dd/MM/yyyy') + + ' ' + workingDay.start, 'dd/MM/yyyy HH:mm'); + if (currDateStart < start) { + unavailablePeriod = { + 'title': 'Unavailable', + 'start': GeneralFunctions.clone(currDateStart), + 'end': GeneralFunctions.clone(start), + 'allDay': false, + 'color': '#AAA', + 'editable': false, + 'className': 'fc-unavailable' + }; + $('#calendar').fullCalendar('renderEvent', unavailablePeriod, + true); + } + + // Add unavailable period after work ends. + end = Date.parseExact(currDateStart.toString('dd/MM/yyyy') + + ' ' + workingDay.end, 'dd/MM/yyyy HH:mm'); + if (currDateEnd > end) { + unavailablePeriod = { + 'title': 'Unavailable', + 'start': GeneralFunctions.clone(end), + 'end': GeneralFunctions.clone(currDateEnd), + 'allDay': false, + 'color': '#AAA', + 'editable': false, + 'className': 'fc-unavailable fc-brake' + }; + $('#calendar').fullCalendar('renderEvent', unavailablePeriod, true); + } + + // Add unavailable periods during day breaks. + var breakStart, breakEnd; + $.each(workingDay.breaks, function(index, currBreak) { + breakStart = Date.parseExact(currDateStart.toString('dd/MM/yyyy') + + ' ' + currBreak.start, 'dd/MM/yyyy HH:mm'); + breakEnd = Date.parseExact(currDateStart.toString('dd/MM/yyyy') + + ' ' + currBreak.end, 'dd/MM/yyyy HH:mm'); + var unavailablePeriod = { + 'title': 'Break', + 'start': breakStart, + 'end': breakEnd, + 'allDay': false, + 'color': '#AAA', + 'editable': false, + 'className': 'fc-unavailable fc-break' + }; + $('#calendar').fullCalendar('renderEvent', unavailablePeriod, true); + }); + + + // @task Add custom unavailable periods. + + + currDateStart.addDays(1); + currDateEnd.addDays(1); + }); + break; + } + } + }); + } }, 'json'); }, @@ -722,6 +841,10 @@ var BackendCalendar = { calendarEventClick: function(event, jsEvent, view) { $('.popover').remove(); // Close all open popovers. + if ($(jsEvent.target).hasClass('fc-unavailable')) { + return; // do not show popover on unavailable events + } + // Display a popover with the event details. var html = '