notification_ok=0; mobile_admin=0; StatusBar_overlaysWebView=false; window.onerror = function (msg, url, noLigne, noColonne, erreur) { if(mobile_admin){ var chaine = msg.toLowerCase(); var souschaine = "script error"; if (chaine.indexOf(souschaine) > -1){ alert('Script Error : voir la Console du Navigateur pour les Détails'); } else { var message = [ 'Message : ' + msg, 'URL : ' + url, 'Ligne : ' + noLigne, 'Colonne : ' + noColonne, 'Objet Error : ' + JSON.stringify(erreur) ].join(' - '); alert(message); } } return false; }; var app = { initialize: function () { document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); }, onDeviceReady: function () { isCordovaApp=1; window.open=cordova.InAppBrowser.open; permissions = cordova.plugins.permissions; device_platform = device.platform; device_uuid = device.uuid.toLowerCase(); device_serial = device.serial; device_cordova = device.cordova; device_manufacturer = device.manufacturer; device_model = device.model; device_version = device.version; device_isVirtual = (device.isVirtual?1:0); window.setInterval(function(){StatusBar.overlaysWebView(false);},500); StatusBar.overlaysWebView(false); $("[data-elementor-type=header]>section").css("padding-top","30px"); /* console = (function(oldCons){ return { log: function(text){ oldCons.log(text); window.plugins.toast.showLongBottom(text, null, null); }, info: function (text) { oldCons.info(text); window.plugins.toast.showLongBottom('Info : '+text, null, null); }, warn: function (text) { oldCons.warn(text); window.plugins.toast.showLongBottom('Attention : '+text, null, null); }, error: function (text) { oldCons.error(text); window.plugins.toast.showLongBottom('Erreur : '+text, null, null); } }; }(window.console)); */ window.alert = function (txt,title) { if(typeof title==="undefined"){ title="Ma Tatie"; } navigator.notification.alert(txt, null, title, "Ok"); } $(document).on('click', 'a[target]', function (e) { var url = $(this).attr('href'); var target = $(this).attr('target'); //navigator.app.loadUrl(url, { openExternal: true }); cordova.InAppBrowser.open(url,target, 'location=yes'); e.preventDefault(); }); document.addEventListener("backbutton", this.onBackKeyDown.bind(this), false); document.addEventListener("offline", this.onOffline.bind(this), false); document.addEventListener("online", this.onOnline.bind(this), false); if(notification_ok==1){ $(".div_notifications").attr("hidden",true); if(typeof cordova.plugins.firebase!=="undefined"){ cordova.plugins.firebase.messaging.getToken().then(function(token){ if(device_firebase!=token){ device_firebase = token; } }); cordova.plugins.firebase.messaging.onTokenRefresh(function(token){ if(device_firebase!=token){ device_firebase = token; } }); } } ready = 1; }, onOffline: function (e) { /* online = 0; $(".offline").removeAttr("hidden"); */ }, onOnline: function (e) { /* var networkState = navigator.connection.type; if (networkState !== Connection.NONE) { online = 1; $(".offline").attr("hidden", "true"); } */ }, onBackKeyDown: function (e) { // e.preventDefault(); }, }; app.initialize(); // Function to convert JSON data to HTML table function convert(jsonData,container) { // Create the table element let table = $("
"); th.text(item); // Set the column name as the text of the header cell tr.append(th); // Append the header cell to the header row }); thead.append(tr); // Append the header row to the header table.append(tr) // Append the header to the table // Loop through the JSON data and create table rows $.each(jsonData, function(i, item){ let tr = $(" |
---|
");
td.text(elem); // Set the value as the text of the table cell
tr.append(td); // Append the table cell to the table row
});
table.append(tr); // Append the table row to the table
});
container.append(table) // Append the table to the container element
}
Date.prototype.addHours = function(h) {
this.setTime(this.getTime() + (h*60*60*1000));
return this;
};
function isJsonString(str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
$(document).ready(function(){
if($(".tab_disponibilite").length>0){
if(typeof _dispos!="undefined" && _dispos!="" && _dispos!="[]"){
$(".tab_disponibilite>div").html("");
convert(_dispos,$(".tab_disponibilite>div"));
}
}
if($(".tab_alaiseavec").length>0){
_a_laise_avec=$(".tab_alaiseavec>div").html();
if(_a_laise_avec!=""){
_a_laise_avec=_a_laise_avec.replaceAll("\n","");
_a_laise_avec=_a_laise_avec.replaceAll("\t","");
_a_laise_avec=_a_laise_avec.replaceAll('“','"');
_a_laise_avec=_a_laise_avec.replaceAll('”','"');
if(isJsonString(_a_laise_avec)){
_a_laise_avec=JSON.parse(_a_laise_avec);
_a_laise_avec=_a_laise_avec.join(", ");
$(".tab_alaiseavec>div").html(_a_laise_avec);
}
}
}
if($("body:not(.single-profils.author,._author) .fluent_form_26").length>0){
$('.fluent_form_26 [name^="jour_garde"]').addClass("text-center");
$('.fluent_form_26 [name="enfant[]"]').each(function(elt){
if($(this).val()=="" || $(this).val()=="[meta ID]"){
var loop=$(this);
loop=loop.closest(".e-loop-item");
loop=loop.attr("class").split(/\s+/);
loop=loop.filter((classe) => classe.startsWith('post-'));
if(loop.length>0){
$(this).val(loop[0].replace("post-", ""));
}
}
});
var jour_garde_max=0;
fluent_form_26_nb_jours=0;
interval_calcul=setInterval(function(){
var jour_garde=$('.fluent_form_26 td[data-label="Jours de la garde"] input[name^="jour_garde"]');
if(jour_garde.length!=fluent_form_26_nb_jours){
jour_garde.each(function(jour){
if(typeof $(this)[0]._flatpickr=="undefined"){
$('td[data-label="Nombre d\'heures"] [name^="jour_garde"]',$( this ).closest("tr")).attr("min",1).attr("value",1);
$('td[data-label="Nombre d\'heures"] [name^="jour_garde"]',$( this ).closest("tr")).val(1);
$( this ).flatpickr({
"locale": {
"firstDayOfWeek": 1
},
"minDate" : "today",
dateFormat: "d/m/Y",
"disable":[
function(date_) {
var retour=true;
if(typeof _jours_off!="undefined"){
retour=_jours_off.includes(date_.getDay());
}
return retour;
}
],
onChange: function(selectedDates, dateStr, instance){
var select_creneau_horaire=$('td[data-label="Créneau horaire"] select[name^="jour_garde"]',$( instance.element ).closest("tr"));
select_creneau_horaire.children('option').removeAttr("disabled").removeAttr("selected");
if(dateStr!=""){
dateStr=instance.parseDate(dateStr, instance.config.dateFormat);
var creneaux=_dispos;
for (let i = 0; i < creneaux.length; i++) {
creneaux[i].jour==jours[dateStr.getDay()];
}
creneaux=_dispos.filter(item => item.jour.toLowerCase()==jours[dateStr.getDay()]);
creneaux=creneaux.map(item => item.heure).filter((value, index, self) => self.indexOf(value) === index);
select_creneau_horaire.children('option').each(function(){
if(!creneaux.includes($(this).attr("value"))){
$(this).attr("disabled",true);
}
});
var tmp=select_creneau_horaire.find(':selected');
if(select_creneau_horaire[0].selectedIndex<0 || tmp.prop('disabled')){
select_creneau_horaire.children('option:enabled').eq(0).prop('selected',true);
}
select_creneau_horaire.change();
}
},
onReady: function(dateObj, dateStr, instance) {
dateStr=new Date();
if(typeof _jours_on!="undefined"){
var next_dow=_jours_on.findIndex(function(dow) {
return dow >= dateStr.getDay();
});
if(next_dow<0){
next_dow=0;
next_dow=_jours_on.findIndex(function(dow) {
return dow >= next_dow;
});
}
dateStr.setDate(dateStr.getDate() + (_jours_on[next_dow]+(7-dateStr.getDay())) % 7);
instance.setDate(dateStr,true);
}
},
});
}
});
if(fluent_form_26_nb_jours>jour_garde.length){
jour_garde.change();
}
fluent_form_26_nb_jours=jour_garde.length;
}
//calcul();
},500);
/*function calcul(){
var total=0;
if($('.fluent_form_12').length>0){
total=0;
$(".fluent_form_12 .bouton_prix_garde").addClass("disabled").attr("disabled",true);
var debut=$('.fluent_form_12 input[name=debut]').val();
if(debut!==""){
var jour_debut=debut.split(" ")[0].split("/");
var heure_debut=debut.split(" ")[1].split(":");
debut=new Date(parseInt(jour_debut[2]),parseInt(jour_debut[1]-1),parseInt(jour_debut[0]),parseInt(heure_debut[0]),parseInt(heure_debut[1]));
var duree=$('.fluent_form_12 input[name=duree]').val();
var fin=new Date(debut.getTime());
fin.addHours(duree);
var bebe=Number($(".fluent_form_12 input[name=bebe]").val());
var enfant=Number($(".fluent_form_12 input[name=enfant]").val());
var total_enfants=(bebe+enfant);
var tmp=new Date(debut.getTime());
for(var i=0;i |