Commit 82e9b3c3 authored by Kgneo's avatar Kgneo
Browse files

Merged branch terla into terla

parents dc979195 9113aa1c
......@@ -439,6 +439,10 @@ class CommunecterController extends Controller
"save" => array("href" => "/ph/co2/order/save"),
"get" => array("href" => "/ph/co2/order/get"),
),
"orderitem"=> array(
"save" => array("href" => "/ph/co2/orderitem/save"),
"get" => array("href" => "/ph/co2/orderitem/get"),
),
"action"=> array(
"addaction" => array("href" => "/ph/co2/action/addaction"),
),
......
<?php
/**
* CommentController.php
*
* @author: Sylvain Barbot
* Date: 2/7/15
* Time: 12:25 AM
*/
class OrderitemController extends CommunecterController {
protected function beforeAction($action) {
parent::initPage();
return parent::beforeAction($action);
}
public function actions()
{
return array(
//'index' => 'citizenToolKit.controllers.comment.IndexAction',
'save' => 'citizenToolKit.controllers.orderitem.SaveAction',
'get' => 'citizenToolKit.controllers.orderitem.GetAction',
/*'abuseprocess' => 'citizenToolKit.controllers.comment.AbuseProcessAction',
'moderate' => 'citizenToolKit.controllers.comment.ModerateAction',
'countcommentsfrom' => 'citizenToolKit.controllers.comment.CountCommentsAction',
'delete' => 'citizenToolKit.controllers.comment.DeleteAction',
'updatefield' => 'citizenToolKit.controllers.comment.UpdateFieldAction',*/
);
}
public function actionTestPod() {
$params = array();
$this->render( "testpod" , $params );
}
}
\ No newline at end of file
......@@ -104,6 +104,8 @@
var subViewElement, subViewContent, subViewIndex;
var tabOrganiser = [];
var openingHours=element.openingHours;
var monthLoad=[];
var allBookings=[];
jQuery(document).ready(function() {
showCalendar();
......@@ -114,8 +116,32 @@
$(".fc-button").on("click", function(e){
setCategoryColor(tabOrganiser);
});
//if(!inArray(month,monthLoad)){
//alert("getAjaxMonth");
//monthLoad.push(month);
//data={"id":itemId,"type":itemType,"start":start,"end":end}
$.ajax({
type: "POST",
url: baseUrl+"/"+moduleId+"/orderitem/get",
data:{"id":itemId,"type":itemType,"start": new Date()},
success: function(data){
if(data.result) {
if(Object.keys(data.items).length > 0){
$.each(data.items,function(e,v){
$.each(v.reservations,function(i,resa){
allBookings.push(resa);
});
});
}
console.log(data.items);
}
else
toastr.error(data.msg);
},
dataType: "json"
});
//}
});
//creates fullCalendar
function buildCalObj(eventObj) {
//entries for the calendar
......@@ -167,6 +193,7 @@ function showCalendar() {
//mylog.info("addTasks2Calendar",events);//,taskCalendar);
hiddenDays=[];
calendar = [];
//$.ajax({});
$.each(openingHours, function(e,v){
if(v!=""){
if(typeof v.hours !="undefined"){
......@@ -243,8 +270,16 @@ function showCalendar() {
}
},
//defaultView: 'month',
viewRender: function(view, element) {
console.log(view.start,view.end, view.intervalStart, view.intervalEnd);
/*month=view.start.format('MM');
start=view.start.format('YYYY-MM-DD');
end=view.end.format('YYYY-MM-DD');
alert($('#calendar').fullCalendar('getDate'));*/
},
eventRender: function(event, element) {
console.log("ensuite");
if(event.start < Date.now()) { return false; }
element.find(".fc-event-title").remove();
element.find(".fc-event-time").remove();
......@@ -253,18 +288,26 @@ function showCalendar() {
hoursRender=moment(event.start).format("HH:mm") + ' - '
+ moment(event.end).format("HH:mm") + '<br/>';
}
var new_description =
//+ event.quantity + '<br/>'
hoursRender
+ 'Disponible: <span class="inc-capacity">' + event.capacity + '</span><br/>'
+'<a href="javascript:;" class="letter-orange remove-session hide"><i class="fa fa-minus"></i></a>'
+'<span class="eventCountItem margin-left-5 margin-right-5">'
+'<i class="fa fa-shopping-cart"></i>'
+'<span class="inc-session hide topbar-badge badge animated bounceIn badge-transparent badge-success">1</span>'
+'</span>'
//+'<span class="inc-session"> '+event.quantity+' </span>'
+'<a href="javascript:;" class="letter-orange add-session"><i class="fa fa-plus"></i></a>';
element.find(".fc-content").html(new_description);
currentCartFilter=getDayFilter(event);
// setTimeout(function(){
event.capacity=event.capacity-currentCartFilter.quantity-currentCartFilter.myQuantity;
event.quantity=currentCartFilter.myQuantity;
classQuantity="";
if(event.quantity==0)
classQuantity="hide";
var new_description =
//+ event.quantity + '<br/>'
hoursRender
+ 'Disponible: <span class="inc-capacity">' + event.capacity + '</span><br/>'
+'<a href="javascript:;" class="letter-orange remove-session hide"><i class="fa fa-minus"></i></a>'
+'<span class="eventCountItem margin-left-5 margin-right-5">'
+'<i class="fa fa-shopping-cart"></i>'
+'<span class="inc-session '+classQuantity+' topbar-badge badge animated bounceIn badge-transparent badge-success">'+event.quantity+'</span>'
+'</span>'
+'<a href="javascript:;" class="letter-orange add-session"><i class="fa fa-plus"></i></a>';
element.find(".fc-content").html(new_description);
element.find(".remove-session").on('click', function (e) {
bookDate=event.start.format('YYYY-MM-DD');
event.capacity++;
......@@ -321,6 +364,7 @@ function showCalendar() {
addToShoppingCart(itemId, itemType, subType, ranges);
calendar.push(event);
});
//},2000);
}/*,
eventClick : function(calEvent, jsEvent, view) {
//show event in subview
......@@ -341,11 +385,58 @@ function showCalendar() {
//dateToShow = calEvent.start;
}*/
});
$('#my-button').click(function() {
});
$('#my-prev-button').click(function() {
var d = $('#calendar').fullCalendar('getDate');
alert("The current date of the calendar is " + d);
$('#calendar').fullCalendar('prev');
});
setCategoryColor();
//dateToShow = new Date();
};
function getDayFilter(event){
currentCartFilter={"quantity":0,"myQuantity":0};
// GET QUANTITY OF CURRENT CART
if(typeof shoppingCart["services"] != "undefined"
&& typeof shoppingCart["services"][subType] != "undefined"
&& typeof shoppingCart["services"][subType][itemId] != "undefined"
&& typeof shoppingCart[type][subType][id]["reservations"][event.start.format('YYYY-MM-DD')] != "undefined"){
if(event.allDay==true){
currentCartFilter.myQuantity=currentCartFilter.myQuantity+shoppingCart[type][subType][id]["reservations"][event.start.format('YYYY-MM-DD')]["countQuantity"];
}else{
if(typeof shoppingCart[type][subType][id]["reservations"][event.start.format('YYYY-MM-DD')]["hours"] != "undefined"){
$.each(shoppingCart[type][subType][id]["reservations"][event.start.format('YYYY-MM-DD')]["hours"],function(e,v){
if(v.start==event.startTime && v.end==event.endTime)
currentCartFilter.myQuantity=currentCartFilter.myQuantity+v.countQuantity;
});
}
}
}
// GET QUANTITY ALREADY BOOKED
//console.log("allBook",allBookings);
if(allBookings.length){
$.each(allBookings,function(e,v){
date=new Date( parseInt(v.date.sec)*1000 );
//console.log(date+"////"+moment(date).format('YYYY-MM-DD')+"///"+event.start.format('YYYY-MM-DD'));
if(moment(date).format('YYYY-MM-DD')==event.start.format('YYYY-MM-DD')){
if(event.allDay){
currentCartFilter.quantity=currentCartFilter.quantity+v.countQuantity;
}else{
if(typeof v.hours != "undefined"){
$.each(v.hours,function(i, hours){
if(hours.start==event.startTime && hours.end==event.endTime)
currentCartFilter.quantity=currentCartFilter.quantity+hours.countQuantity;
});
}
}
}
});
}
return currentCartFilter;
}
function setCategoryColor(tab){
$(".fc-content").css("color", "white");
$(".fc-content").addClass("text-center");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment