Commit 9b2ec8e1 authored by Clément Damiens's avatar Clément Damiens
Browse files

finish service form

parent a980304c
......@@ -2813,7 +2813,16 @@ var uploadObj = {
}
}
};
var openingHoursResult=[
{"dayOfWeek":"Su","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
{"dayOfWeek":"Mo","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
{"dayOfWeek":"Tu","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
{"dayOfWeek":"We","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
{"dayOfWeek":"Th","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
{"dayOfWeek":"Fr","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
{"dayOfWeek":"Sa","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
];
var dyFObj = {
elementObj : null,
elementData : null,
......@@ -2901,8 +2910,20 @@ var dyFObj = {
if( typeof formData.tags != "undefined" && formData.tags != "" )
formData.tags = formData.tags.split(",");
if( typeof formData.openingHours != "undefined"){
if(typeof formData.hour != "undefined")
delete formData.hour;
if(typeof formData.minute != "undefined")
delete formData.minute;
formData.openingHours=openingHoursResult;
$.each(formData.openingHours, function(e,v){
if(v.allDays && typeof v.hours != "undefined")
delete openingHoursResult[e]["hours"];
if(typeof v.disabled != "undefined")
formData.openingHours.splice(e,1);
});
}
// Add collections and genres of notragora in tags
if( typeof formData.collections != "undefined" && formData.collections != "" ){
collectionsTagsSave=formData.collections.split(",");
......@@ -3604,6 +3625,13 @@ var dyFInputs = {
};
return inputObj;
},
quantity :function(label, placeholder, rules, custom) {
var inputObj = dyFInputs.inputText(tradDynForm.quantity, tradDynForm.quantity+" ...") ;
inputObj.init = function(){
$('input#quantity').filter_input({regex:'[0-9]'});
};
return inputObj;
},
text :function (label,placeholder,rules) {
var inputObj = {
......@@ -4232,15 +4260,16 @@ var dyFInputs = {
label : "Availabity of your service",
checked : ( notEmpty(checked) ? checked : "" ),
init : function(){
var openingHoursResult=[
{"dayOfWeek":"Su","allDay":true},
{"dayOfWeek":"Mo","allDay":true},
{"dayOfWeek":"Tu","allDay":true},
{"dayOfWeek":"We","allDay":true},
{"dayOfWeek":"Th","allDay":true},
{"dayOfWeek":"Fr","allDay":true},
{"dayOfWeek":"Sa","allDay":true},
];
//openingHoursResult=openingHours.init;
openingHoursResult=[
{"dayOfWeek":"Su","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
{"dayOfWeek":"Mo","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
{"dayOfWeek":"Tu","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
{"dayOfWeek":"We","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
{"dayOfWeek":"Th","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
{"dayOfWeek":"Fr","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
{"dayOfWeek":"Sa","allDay":true, "hours":[{"opens":"06:00","closes":"19:00"}]},
];
//jQuery.datetimepicker.setLocale('fr');
//$('.changeTime').datetimepicker({format:"HH:MM"});
$(".btn-select-day").click(function(){
......@@ -4248,19 +4277,15 @@ var dyFInputs = {
if($(this).hasClass("active")){
$(this).removeClass("active");
$.each(openingHoursResult, function(e,v){
if(v.dayOfWeek==key){
if(v.dayOfWeek==key)
openingHoursResult[e].disabled=true;
console.log("opening",openingHoursResult);
}
});
$("#contentDays"+key).fadeOut();
}else{
$(this).addClass("active");
$.each(openingHoursResult, function(e,v){
if(v.dayOfWeek==key){
if(v.dayOfWeek==key)
delete openingHoursResult[e].disabled;
console.log("opening",openingHoursResult);
}
});
$("#contentDays"+key).fadeIn();
}
......@@ -4271,38 +4296,17 @@ var dyFInputs = {
if($(this).is(':checked')){
$("#hoursRange"+keyRange).fadeOut("slow");
$.each(openingHoursResult, function(e,v){
if(v.dayOfWeek==keyRange){
if(v.dayOfWeek==keyRange)
openingHoursResult[e].allDay=true;
console.log("opening",openingHoursResult);
}
});
}else{
$("#hoursRange"+keyRange).fadeIn("slow");
$.each(openingHoursResult, function(e,v){
if(v.dayOfWeek==keyRange){
if(v.dayOfWeek==keyRange)
openingHoursResult[e].allDay=false;
console.log("opening",openingHoursResult);
}
});
}
});
/*$("#ajaxFormModal #allWeek").off().on("switchChange.bootstrapSwitch",function (e, data) {
mylog.log("allDay dateLimit",$("#ajaxFormModal #allWeek").val());
});*/
/*initbootstrapSwitch("#ajaxFormModal .allDaysWeek", function($this){
keyRange=$this.data("key");
if($("#ajaxFormModal .allDaysWeek").is(':checked')){
$("#hoursRange"+keyRange).fadeIn("slow");
}else{
$("#hoursRange"+keyRange).fadeOut("slow");
}
});*/
//$("#ajaxFormModal .allDaysWeek").off().on("switchChange.bootstrapSwitch",function (e, data) {
//mylog.log("allDay dateLimit",$("#ajaxFormModal .allDaysWeek").val());
//});
},
options: {"allWeek" : true},
"switch" : {
......
......@@ -29,7 +29,7 @@ dynForm = {
},*/
},
beforeBuild : function(){
dyFObj.setMongoId('products',function(){
dyFObj.setMongoId('services',function(){
uploadObj.gotoUrl = (contextData != null && contextData.type && contextData.id ) ? "#page.type."+contextData.type+".id."+contextData.id+".view.directory.dir.classified" : location.hash;
});
},
......@@ -62,15 +62,16 @@ dynForm = {
inputType : "custom",
html:"",
},
type : dyFInputs.inputSelect(tradDynForm["servicesTypes"],null,servicesList, { required : true }),
type : dyFInputs.inputSelect(tradDynForm.servicesTypes,null,servicesList, { required : true }),
name : dyFInputs.name( "service" ) ,
price : dyFInputs.price(),
//devise : dyFInputs.inputSelect("Devise", "Iniquez la monnaie utilisée pour votre annonce", ["€", "$"]),
name : dyFInputs.name( "service" ) ,
quantity : dyFInputs.quantity(),
openingHours : dyFInputs.openingHours(true),
description : dyFInputs.textarea("Description", "..."),
image : dyFInputs.image(),
medias : dyFInputs.videos,
contactInfo : dyFInputs.inputText(tradDynForm["contactinfo"], tradDynForm["telemail"]+" ..."),
contactInfo : dyFInputs.inputText(tradDynForm.contactinfo, tradDynForm["telemail"]+" ..."),
location : dyFInputs.location,
tags : dyFInputs.tags(),
parentId : dyFInputs.inputHidden(),
......
......@@ -356,6 +356,8 @@ var tradDynForm = {
"textproposal":"<?php echo Yii::t("form","Your proposal") ?>",
"eventTypes":"<?php echo Yii::t("form","Event type") ?>",
"organizationType":"<?php echo Yii::t("form","Organization type") ?>",
"servicesTypes":"<?php echo Yii::t("form","Service type") ?>",
"quantity":"<?php echo Yii::t("form","Quantity available") ?>",
"nameofyour":"<?php echo Yii::t("form","Name of your") ?>",
"titleofyour":"<?php echo Yii::t("form","Title of your") ?>",
"tags":"<?php echo Yii::t("form","Tags") ?>",
......
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