Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <meta charset='utf-8' />
- <!-- FullCalendar CSS Files !-->
- <link rel='stylesheet' href='/css/fullcalendar.min.css' />
- <link rel='stylesheet' href='/css/fullcalendar.print.css' media='print' />
- <!-- jQuery UI CSS Files !-->
- <link rel='stylesheet' href='/css/jquery-ui.css' />
- <!-- DateTimePicker CSS Files !-->
- <link rel="stylesheet" type="text/css" href="/css/datetimepicker.css"/>
- <!-- jQuery JS Files !-->
- <script src='/js/jquery-1.10.2.js'></script>
- <!-- jQuery UI JS Files !-->
- <script src='/js/jquery-ui.js'></script>
- <!-- Moment JS Files !-->
- <script src='/js/moment.js'></script>
- <!-- FullCalendar JS File !-->
- <script src='/js/fullcalendar.min.js'></script>
- <!-- Helper JS File !-->
- <script type="text/javascript" src="/js/helpers.js"></script>
- <!-- DateTimePicker JS Files !-->
- <script type="text/javascript" src="/js/datetimepicker.js"></script>
- <script>
- $(document).ready(function() {
- // page is now ready, initialize the calendar...
- $('#calendar').fullCalendar({
- header: {
- left: 'prev,next today',
- center: 'title',
- right: 'month,basicWeek,basicDay'
- },
- slotMinutes: 15,
- firstHour: 8,
- lastHour: 18,
- editable: true,
- droppable: true,
- timezone: "America/Chicago",
- aspectRatio: 2.3,
- events: "/calendar/events",
- dayRender: function(date, cell){
- if (moment().diff(date,'days') > 0){
- cell.css("background-color","silver");
- }
- },
- eventDrop: function(event, date, revertFunc) {
- var id = event.id;
- var title = event.title;
- var start = event.start.format();
- var end = (event.end == null) ? start : event.end.format();
- if (moment().diff(start, 'days') > 0) {
- revertFunc();
- QMSG('You cannot create a Calendar Event in the past', 'orange', 1000);
- } else {
- var HTML = "<div>";
- HTML += "<p>Please confirm you want to move this Calendar Event.</p>";
- HTML += "</div>";
- DialogHelper.create(HTML, [{value:'Confirm',color:'blue'},{value:'Cancel',color:'blue'}],function(v){
- if(v == 'Confirm'){
- $.ajax({
- url: "/calendar/update_event",
- data: 'type=resetdate&title=' + title + '&start=' + start + '&end=' + end + '&eventid=' + id,
- type: 'POST',
- dataType: 'json',
- success: function (response) {
- if (response.status != 'success')
- revertFunc();
- },
- error: function (e) {
- revertFunc();
- alert('Error processing your request: ' + e.responseText);
- }
- });
- } else if (v == 'Cancel'){
- revertFunc();
- }
- });
- }
- },
- eventClick: function(event, delta, revertFunc) {
- var event_date = moment(event.start).format('YYYY-DD-MM HH:mm A');
- event.backgroundColor = '#FFF5EE';
- var HTML = "<div>";
- HTML += "<table>";
- HTML += "<thead>";
- HTML += "<tr>";
- HTML += "<td colspan='2' style='padding-bottom:20px;'>Update Calendar Event</td>";
- HTML += "</tr>";
- HTML += "</thead>";
- HTML += "<tbody>";
- HTML += "<tr>";
- HTML += "<td>When:</td>";
- 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>";
- HTML += "</tr>";
- HTML += "<tr>";
- HTML += "<td>What:</td>";
- HTML += "<td><input type='text' id='cal_event_title' value='"+event.title+"' style='margin-top: 0!important;' /></td>";
- HTML += "</tr>";
- HTML += "</tfoot>";
- HTML += "</table>";
- DialogHelper.create(HTML,[{value:'Create event',color:'blue'},{value:'Cancel',color:'blue'}],function(v){
- if(v == 'Create event'){
- var updatedcal = {
- id:event.id,
- delete:false,
- title:$("#cal_title").val(),
- date_time:$("#cal_event_time").val(),
- did_attend:$("#cal_attended").val()
- };
- $.ajax({
- url: "/calendar/update_event",
- data: {cal:updatedcal},
- type: 'POST',
- dataType: 'json',
- success: function (response) {
- if (response.status != 'success')
- alert('There was a problem updating this event');
- revertFunc();
- },
- error: function (e) {
- alert('There was a problem updating this event');
- console.log(e);
- revertFunc();
- }
- });
- }
- },function(){
- $('#cal_event_time').datetimepicker({
- format: 'Y-m-d g:i A',
- formatTime: ' g:i A'
- });
- $('#cal_event_time').blur(function(){
- var el = this;
- if($(this).val()!=''){
- $.post('/quote/actions_panel_cal_event_check',{datetime:$(this).val()},function(msg){
- if(msg!=null){
- $(this).addClass('badtime');
- QMSG(msg, 'orange', 1000);
- }else{
- $(this).removeClass('badtime');
- }
- });
- }
- });
- });
- },
- dayClick: function(date, event, delta) {
- if (moment().diff(date, 'days') > 0) {
- QMSG('You cannot create a Calendar Event in the past', 'orange', 1000);
- } else {
- var HTML = "<div>";
- HTML += "<table>";
- HTML += "<thead>";
- HTML += "<tr>";
- HTML += "<td colspan='2' style='padding-bottom:20px;'>Create Calendar Event</td>";
- HTML += "</tr>";
- HTML += "</thead>";
- HTML += "<tbody>";
- HTML += "<td>When:</td>";
- HTML += "<td><input type='text' id='cal_event_time' value='"+date.format()+"' style='margin-top: 0!important;' /></td>";
- HTML += "</tr>";
- HTML += "<tr>";
- HTML += "<td>What:</td>";
- HTML += "<td><input type='text' id='cal_event_title' style='margin-top: 0!important;' /></td>";
- HTML += "</tr>";
- HTML += "<tr>";
- HTML += "</tfoot>";
- HTML += "</table>";
- DialogHelper.create(HTML,[{value:'Create event',color:'blue'},{value:'Cancel',color:'blue'}],function(v){
- if(v == 'Create event'){
- var updatedcal = {
- id:event.id,
- delete:false,
- title:$("#cal_title").val(),
- date_time:$("#cal_event_time").val(),
- did_attend:$("#cal_attended").val()
- };
- $.ajax({
- url: "/calendar/update_event",
- data: {cal:updatedcal},
- type: 'POST',
- dataType: 'json',
- success: function (response) {
- if (response.status != 'success')
- alert('There was a problem updating this event');
- revertFunc();
- },
- error: function (e) {
- alert('There was a problem updating this event');
- console.log(e);
- revertFunc();
- }
- });
- }
- },function(){
- $('#cal_event_time').datetimepicker({format: 'Y-m-d g:i A',formatTime: ' g:i A'});
- $('#cal_event_time').blur(function(){
- var el = this;
- if($(this).val()!=''){
- $.post('/quote/actions_panel_cal_event_check',{datetime:$(this).val()},function(msg){
- if(msg!=null){
- $(this).addClass('badtime');
- QMSG(msg, 'orange', 1000);
- }else{
- $(this).removeClass('badtime');
- }
- });
- }
- });
- });
- }
- }
- });
- });
- </script>
- <style>
- body {
- margin: 40px 10px;
- padding: 0;
- font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
- font-size: 14px;
- }
- #calendar {
- margin: 0 auto;
- }
- .xdsoft_datetimepicker {
- z-index: 99999999983 !important;
- }
- .accepttherequestbox {
- position: relative;
- background: #88b7d5;
- border: 4px solid #c2e1f5;
- }
- .accepttherequestbox popup_mediapp pop_1 ui-draggable {
- position: relative;
- background: #FFFFFF;
- }
- .accepttherequestbox popup_mediapp pop_1 ui-draggable:after {
- top: 100%;
- left: 50%;
- border: solid transparent;
- content: " ";
- height: 0;
- width: 0;
- position: absolute;
- pointer-events: none;
- border-color: rgba(255, 255, 255, 0);
- border-top-color: #FFFFFF;
- border-width: 10px;
- margin-left: -10px;
- }
- #message {
- background: #f9edbe;
- border: 1px solid #f0c36d;
- color: #222;
- font-size: 11px;
- font-weight: bold;
- padding: 9px 15px;
- z-index: 9999;
- position: relative;
- bottom: 598px;
- width: 170px;
- margin: auto;
- }
- </style>
- </head>
- <body>
- <div id="calendar"></div>
- <div id="message" style="display: none;"><p>Your event was updated. <a href="#">Undo</a></p></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement