Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.02 KB | None | 0 0
  1. <html>
  2. <head>
  3. <meta charset='utf-8' />
  4. <!-- FullCalendar CSS Files !-->
  5. <link rel='stylesheet' href='/css/fullcalendar.min.css' />
  6. <link rel='stylesheet' href='/css/fullcalendar.print.css' media='print' />
  7.  
  8. <!-- jQuery UI CSS Files !-->
  9. <link rel='stylesheet' href='/css/jquery-ui.css' />
  10.  
  11. <!-- DateTimePicker CSS Files !-->
  12. <link rel="stylesheet" type="text/css" href="/css/datetimepicker.css"/>
  13.  
  14. <!-- jQuery JS Files !-->
  15. <script src='/js/jquery-1.10.2.js'></script>
  16.  
  17. <!-- jQuery UI JS Files !-->
  18. <script src='/js/jquery-ui.js'></script>
  19.  
  20. <!-- Moment JS Files !-->
  21. <script src='/js/moment.js'></script>
  22.  
  23. <!-- FullCalendar JS File !-->
  24. <script src='/js/fullcalendar.min.js'></script>
  25.  
  26. <!-- Helper JS File !-->
  27. <script type="text/javascript" src="/js/helpers.js"></script>
  28.  
  29. <!-- DateTimePicker JS Files !-->
  30. <script type="text/javascript" src="/js/datetimepicker.js"></script>
  31.  
  32. <script>
  33. $(document).ready(function() {
  34.  
  35. // page is now ready, initialize the calendar...
  36.  
  37. $('#calendar').fullCalendar({
  38. header: {
  39. left: 'prev,next today',
  40. center: 'title',
  41. right: 'month,basicWeek,basicDay'
  42. },
  43. slotMinutes: 15,
  44. firstHour: 8,
  45. lastHour: 18,
  46. editable: true,
  47. droppable: true,
  48. timezone: "America/Chicago",
  49. aspectRatio: 2.3,
  50. events: "/calendar/events",
  51.  
  52. dayRender: function(date, cell){
  53. if (moment().diff(date,'days') > 0){
  54. cell.css("background-color","silver");
  55. }
  56. },
  57.  
  58. eventDrop: function(event, date, revertFunc) {
  59. var id = event.id;
  60. var title = event.title;
  61. var start = event.start.format();
  62. var end = (event.end == null) ? start : event.end.format();
  63.  
  64. if (moment().diff(start, 'days') > 0) {
  65. revertFunc();
  66. QMSG('You cannot create a Calendar Event in the past', 'orange', 1000);
  67. } else {
  68. var HTML = "<div>";
  69. HTML += "<p>Please confirm you want to move this Calendar Event.</p>";
  70. HTML += "</div>";
  71. DialogHelper.create(HTML, [{value:'Confirm',color:'blue'},{value:'Cancel',color:'blue'}],function(v){
  72. if(v == 'Confirm'){
  73. $.ajax({
  74. url: "/calendar/update_event",
  75. data: 'type=resetdate&title=' + title + '&start=' + start + '&end=' + end + '&eventid=' + id,
  76. type: 'POST',
  77. dataType: 'json',
  78. success: function (response) {
  79. if (response.status != 'success')
  80. revertFunc();
  81. },
  82. error: function (e) {
  83. revertFunc();
  84. alert('Error processing your request: ' + e.responseText);
  85. }
  86. });
  87. } else if (v == 'Cancel'){
  88. revertFunc();
  89. }
  90. });
  91. }
  92. },
  93.  
  94. eventClick: function(event, delta, revertFunc) {
  95.  
  96. var event_date = moment(event.start).format('YYYY-DD-MM HH:mm A');
  97.  
  98. event.backgroundColor = '#FFF5EE';
  99.  
  100. var HTML = "<div>";
  101. HTML += "<table>";
  102. HTML += "<thead>";
  103. HTML += "<tr>";
  104. HTML += "<td colspan='2' style='padding-bottom:20px;'>Update Calendar Event</td>";
  105. HTML += "</tr>";
  106. HTML += "</thead>";
  107. HTML += "<tbody>";
  108. HTML += "<tr>";
  109. HTML += "<td>When:</td>";
  110. HTML += "<td><input type='text' id='cal_event_time' value='"+event_date+"' style='margin-top: 0!important;' /><img src='/assets/glyphicons/png/glyphicons-46-calendar.png' title='Select Date'></td>";
  111. HTML += "</tr>";
  112. HTML += "<tr>";
  113. HTML += "<td>What:</td>";
  114. HTML += "<td><input type='text' id='cal_event_title' value='"+event.title+"' style='margin-top: 0!important;' /></td>";
  115. HTML += "</tr>";
  116. HTML += "</tfoot>";
  117. HTML += "</table>";
  118.  
  119. DialogHelper.create(HTML,[{value:'Create event',color:'blue'},{value:'Cancel',color:'blue'}],function(v){
  120. if(v == 'Create event'){
  121. var updatedcal = {
  122. id:event.id,
  123. delete:false,
  124. title:$("#cal_title").val(),
  125. date_time:$("#cal_event_time").val(),
  126. did_attend:$("#cal_attended").val()
  127. };
  128. $.ajax({
  129. url: "/calendar/update_event",
  130. data: {cal:updatedcal},
  131. type: 'POST',
  132. dataType: 'json',
  133. success: function (response) {
  134. if (response.status != 'success')
  135. alert('There was a problem updating this event');
  136. revertFunc();
  137. },
  138. error: function (e) {
  139. alert('There was a problem updating this event');
  140. console.log(e);
  141. revertFunc();
  142. }
  143.  
  144. });
  145. }
  146. },function(){
  147. $('#cal_event_time').datetimepicker({
  148. format: 'Y-m-d g:i A',
  149. formatTime: ' g:i A'
  150. });
  151. $('#cal_event_time').blur(function(){
  152. var el = this;
  153. if($(this).val()!=''){
  154. $.post('/quote/actions_panel_cal_event_check',{datetime:$(this).val()},function(msg){
  155. if(msg!=null){
  156. $(this).addClass('badtime');
  157. QMSG(msg, 'orange', 1000);
  158. }else{
  159. $(this).removeClass('badtime');
  160. }
  161. });
  162. }
  163. });
  164. });
  165.  
  166. },
  167.  
  168. dayClick: function(date, event, delta) {
  169.  
  170. if (moment().diff(date, 'days') > 0) {
  171. QMSG('You cannot create a Calendar Event in the past', 'orange', 1000);
  172. } else {
  173. var HTML = "<div>";
  174. HTML += "<table>";
  175. HTML += "<thead>";
  176. HTML += "<tr>";
  177. HTML += "<td colspan='2' style='padding-bottom:20px;'>Create Calendar Event</td>";
  178. HTML += "</tr>";
  179. HTML += "</thead>";
  180. HTML += "<tbody>";
  181. HTML += "<td>When:</td>";
  182. HTML += "<td><input type='text' id='cal_event_time' value='"+date.format()+"' style='margin-top: 0!important;' /></td>";
  183. HTML += "</tr>";
  184. HTML += "<tr>";
  185. HTML += "<td>What:</td>";
  186. HTML += "<td><input type='text' id='cal_event_title' style='margin-top: 0!important;' /></td>";
  187. HTML += "</tr>";
  188. HTML += "<tr>";
  189. HTML += "</tfoot>";
  190. HTML += "</table>";
  191.  
  192. DialogHelper.create(HTML,[{value:'Create event',color:'blue'},{value:'Cancel',color:'blue'}],function(v){
  193. if(v == 'Create event'){
  194. var updatedcal = {
  195. id:event.id,
  196. delete:false,
  197. title:$("#cal_title").val(),
  198. date_time:$("#cal_event_time").val(),
  199. did_attend:$("#cal_attended").val()
  200. };
  201. $.ajax({
  202. url: "/calendar/update_event",
  203. data: {cal:updatedcal},
  204. type: 'POST',
  205. dataType: 'json',
  206. success: function (response) {
  207. if (response.status != 'success')
  208. alert('There was a problem updating this event');
  209. revertFunc();
  210. },
  211. error: function (e) {
  212. alert('There was a problem updating this event');
  213. console.log(e);
  214. revertFunc();
  215. }
  216.  
  217. });
  218. }
  219. },function(){
  220. $('#cal_event_time').datetimepicker({format: 'Y-m-d g:i A',formatTime: ' g:i A'});
  221. $('#cal_event_time').blur(function(){
  222. var el = this;
  223. if($(this).val()!=''){
  224. $.post('/quote/actions_panel_cal_event_check',{datetime:$(this).val()},function(msg){
  225. if(msg!=null){
  226. $(this).addClass('badtime');
  227. QMSG(msg, 'orange', 1000);
  228. }else{
  229. $(this).removeClass('badtime');
  230. }
  231. });
  232. }
  233. });
  234. });
  235. }
  236. }
  237. });
  238.  
  239. });
  240. </script>
  241. <style>
  242. body {
  243. margin: 40px 10px;
  244. padding: 0;
  245. font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
  246. font-size: 14px;
  247. }
  248. #calendar {
  249. margin: 0 auto;
  250. }
  251. .xdsoft_datetimepicker {
  252. z-index: 99999999983 !important;
  253. }
  254. .accepttherequestbox {
  255. position: relative;
  256. background: #88b7d5;
  257. border: 4px solid #c2e1f5;
  258. }
  259. .accepttherequestbox popup_mediapp pop_1 ui-draggable {
  260. position: relative;
  261. background: #FFFFFF;
  262. }
  263. .accepttherequestbox popup_mediapp pop_1 ui-draggable:after {
  264. top: 100%;
  265. left: 50%;
  266. border: solid transparent;
  267. content: " ";
  268. height: 0;
  269. width: 0;
  270. position: absolute;
  271. pointer-events: none;
  272. border-color: rgba(255, 255, 255, 0);
  273. border-top-color: #FFFFFF;
  274. border-width: 10px;
  275. margin-left: -10px;
  276. }
  277.  
  278. #message {
  279. background: #f9edbe;
  280. border: 1px solid #f0c36d;
  281. color: #222;
  282. font-size: 11px;
  283. font-weight: bold;
  284. padding: 9px 15px;
  285. z-index: 9999;
  286. position: relative;
  287. bottom: 598px;
  288. width: 170px;
  289. margin: auto;
  290. }
  291. </style>
  292. </head>
  293. <body>
  294. <div id="calendar"></div>
  295.  
  296. <div id="message" style="display: none;"><p>Your event was updated. <a href="#">Undo</a></p></div>
  297.  
  298. </body>
  299. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement