In my Application Everything Work Fine add/edit but my main Problem is IF i am on a 'agendaWeek' of Fullcalendar and try to submit or cancel the form then it is going to Month View Updated Code:
JAVASCRIPT:
<script>
var globalEvent = null;
$(document).ready(function() {
var count=0;
var liveDate=new Date();
var dat = new Date();
var d = dat.getDate();
var m = dat.getMonth();
var y = dat.getFullYear();
var calendar = $('#calendar').fullCalendar({
selectable: true,
selectHelper: true,
select: function(startDate, endDate, allDay, jsEvent, view) {
var startDate1=$.fullCalendar.formatDate(startDate, "yyyy-MM-dd HH:mm:ss");
var endDate1=$.fullCalendar.formatDate(endDate, "yyyy-MM-dd HH:mm:ss");
document.getElementById('mode').innerHTML = "ADD :"+"<img src='<?php echo base_url();?>/assets/images/close.png' style='float:right; height:35px; width:35px; margin-top:-7px;' id='closeimg' name='closeimg'>";
document.getElementById('starting').innerHTML = startDate1;
document.getElementById('ending').innerHTML = endDate1;
$("#ginger").show();
$("#closeimg").click(function(){
$("#ginger").hide();
});
$("#eventName").focus();
$("#submit").click(function(){
var title=$("#eventName").val();
calendar.fullCalendar('renderEvent',{
title: title,
start: startDate1,
end: endDate1,
allDay: false},
true // make the event "stick"
);
var dataString={};
dataString['eventName']=title;
dataString['startTime']=startDate1;
dataString['endTime']=endDate1;
$.ajax({
type : 'POST',
dataType : 'json',
url : '<?php echo base_url(); ?>data/insert',
data: dataString,
success: function(data) {
alert("data insert SuccessFully1");// I get this alert
var currentView = calendar.fullCalendar('getView');
calendar.fullCalendar('refetchEvents');
calendar.fullCalendar('changeView', currentView.name)
calendar.fullCalendar('unselect');
calendar.fullCalendar('refetchEvents');
$("#ginger").hide();
if(data.success){
alert("Data insert suceessfully 2");// i can't get this alert
}
}
});
});
},
});
});
</script>
CSS:
body {
font-size: 14px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 70%;
margin: 0 auto;
}
#popup{
padding-left: 0%; padding-top:17%; display: block; top: 0; left: 37%; z-index:1007; opacity: 1; transform: scale(1);
height: auto;
overflow: auto;
position: absolute;
width:auto;
}
#data{
background-color: #ffffff;
color:#585858;
width:400px;
display:block;
z-index: 100;
padding:0px;
font-family: arial;
font-weight: bold;
border-radius: 7px 7px 0px 0px;
border:1px solid #C5C5C5;
}
#popup textarea{
width:200px;
height:60px;
border-radius: 5px;
vertical-align: top;
}
#detail{
/* display: none;*/
position:fixed;
top:0;
left:0;
z-index:1;
width:100%;
height:100%;
background-color:#000;
filter:alpha(opacity=50);
opacity:.5;
}
.mode{
width:99%;
background-color: #8DB3CC;
background-image:url("<?php echo base_url();?>assets/kendou/styles/textures/highlight.png");
background-position: 0 center;
background-repeat: repeat-x;
height:30px;
padding: 5px 0px 0px 5px;
font-size: 15px;
font-weight:normal;
border-bottom:1px solid #C5C5C5;
border-radius: 7px 7px 0px 0px;
}
.dropdown{
border-style: solid;
border-width: 1px;
padding: 2px 22px 2px 2px;
display: block;
cursor: default;
position: relative;
text-align: right;
line-height:1px;
border-radius: 2px 2px 2px 2px;
color: #2E2E2E;
border-color: #C5C5C5;
}
HTML :
<div class="wrapper">
<div id='calendar'></div>
<div style="display:none;" id="ginger">
<div id="detail"> </div>
<form name="addData" id="addData" action="" method="post">
<div id="popup">
<div id="data">
<div id="mode" value="" class="mode">
<!--<img src="<?php echo base_url();?>/assets/images/close.png" style="float:right;"/>-->
<img src="<?php echo base_url();?>/assets/images/logo.png">
</div><br>
<div style="padding:10px;">
<label for="timing">Timing: <span id="starting"></span> to <span id="ending"></span></label><br><br>
<label for="eventName">Description : </label>
<textarea name="eventName" id="eventName"type="text" value=""></textarea><br><br>
<label for="AgentName"><b>Agent Name*</b></label>
<input name="AgentName" id="AgentName"/>
<label for="UserName">UserName : </label>
<select name="UserName" id="UserName" value=""></select><br><br>
<input type="button"class="k-button" name="submit" id="submit" value="submit">//Changes here
<input type="reset" name="reset" class="k-button" id="reset" value="Reset">//changes here
<input type="button"class="k-button" name="cancel" id="cancel" value="Cancel">//changes here
</div>
</div>
</div>
</form>
</div>
</div>