|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
Copyright distrib (2018) |
|
|
|
|
|
|
|
|
|
|
|
contact@opendistrib.net |
|
|
|
|
|
|
|
|
|
|
|
Ce logiciel est un programme informatique servant à aider les producteurs |
|
|
|
|
|
à distribuer leur production en circuits courts. |
|
|
|
|
|
|
|
|
|
|
|
Ce logiciel est régi par la licence CeCILL soumise au droit français et |
|
|
|
|
|
respectant les principes de diffusion des logiciels libres. Vous pouvez |
|
|
|
|
|
utiliser, modifier et/ou redistribuer ce programme sous les conditions |
|
|
|
|
|
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA |
|
|
|
|
|
sur le site "http://www.cecill.info". |
|
|
|
|
|
|
|
|
|
|
|
En contrepartie de l'accessibilité au code source et des droits de copie, |
|
|
|
|
|
de modification et de redistribution accordés par cette licence, il n'est |
|
|
|
|
|
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, |
|
|
|
|
|
seule une responsabilité restreinte pèse sur l'auteur du programme, le |
|
|
|
|
|
titulaire des droits patrimoniaux et les concédants successifs. |
|
|
|
|
|
|
|
|
|
|
|
A cet égard l'attention de l'utilisateur est attirée sur les risques |
|
|
|
|
|
associés au chargement, à l'utilisation, à la modification et/ou au |
|
|
|
|
|
développement et à la reproduction du logiciel par l'utilisateur étant |
|
|
|
|
|
donné sa spécificité de logiciel libre, qui peut le rendre complexe à |
|
|
|
|
|
manipuler et qui le réserve donc à des développeurs et des professionnels |
|
|
|
|
|
avertis possédant des connaissances informatiques approfondies. Les |
|
|
|
|
|
utilisateurs sont donc invités à charger et tester l'adéquation du |
|
|
|
|
|
logiciel à leurs besoins dans des conditions permettant d'assurer la |
|
|
|
|
|
sécurité de leurs systèmes et ou de leurs données et, plus généralement, |
|
|
|
|
|
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. |
|
|
|
|
|
|
|
|
|
|
|
Le fait que vous puissiez accéder à cet en-tête signifie que vous avez |
|
|
|
|
|
pris connaissance de la licence CeCILL, et que vous en avez accepté les |
|
|
|
|
|
termes. |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function() { |
|
|
|
|
|
//chat_calendar() ; |
|
|
|
|
|
chat_datepicker() ; |
|
|
|
|
|
chat_vrac() ; |
|
|
|
|
|
chat_email_masse() ; |
|
|
|
|
|
$('button[data-toggle=popover]').popover() ; |
|
|
|
|
|
chat_ordre_produits() ; |
|
|
|
|
|
chat_index_commandes_liste_produits() ; |
|
|
|
|
|
chat_index_commandes_points_vente() ; |
|
|
|
|
|
chat_index_commandes_points_vente_livraison() ; |
|
|
|
|
|
chat_btn_plus_moins() ; |
|
|
|
|
|
chat_commandeauto() ; |
|
|
|
|
|
chat_points_vente_acces() ; |
|
|
|
|
|
chat_tooltip() ; |
|
|
|
|
|
chat_points_vente_jours_livraison() ; |
|
|
|
|
|
chat_index_commandes_maj_points_vente() ; |
|
|
|
|
|
// admin |
|
|
|
|
|
chat_select_etablissement() ; |
|
|
|
|
|
chat_products() ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
var UrlManager = { |
|
|
|
|
|
getBaseUrl: function() { |
|
|
|
|
|
return $('meta[name=baseurl]').attr('content')+'/' ; |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
getBaseUrlAbsolute: function() { |
|
|
|
|
|
return $('meta[name=baseurl-absolute]').attr('content')+'/' ; |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function chat_products() { |
|
|
|
|
|
if($('.product-create').size() || $('.product-update').size()) { |
|
|
|
|
|
chat_products_event_unit(false) ; |
|
|
|
|
|
$('#product-unit').change(function() { |
|
|
|
|
|
chat_products_event_unit(true) ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_products_event_unit(change) { |
|
|
|
|
|
var unit = $('#product-unit').val() ; |
|
|
|
|
|
if(unit == 'piece') { |
|
|
|
|
|
$('.field-product-step').hide() ; |
|
|
|
|
|
$('.field-product-weight').show() ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$('.field-product-step').show() ; |
|
|
|
|
|
$('.field-product-weight').hide() ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var label_price = $('.field-product-price .control-label') ; |
|
|
|
|
|
var label_step = $('.field-product-step .control-label') ; |
|
|
|
|
|
var label_quantity_max = $('.field-product-quantity_max .control-label') ; |
|
|
|
|
|
|
|
|
|
|
|
if(unit == 'piece') { |
|
|
|
|
|
label_price.html('Prix (la pièce)') ; |
|
|
|
|
|
label_quantity_max.html('Quantité max par défaut (pièces)') ; |
|
|
|
|
|
} |
|
|
|
|
|
else if(unit == 'g' || unit == 'kg') { |
|
|
|
|
|
label_price.html('Prix (au kg)') ; |
|
|
|
|
|
label_quantity_max.html('Quantité max par défaut (kg)') ; |
|
|
|
|
|
label_step.html('Pas ('+unit+')') ; |
|
|
|
|
|
} |
|
|
|
|
|
else if(unit == 'mL' || unit == 'L') { |
|
|
|
|
|
label_price.html('Prix (au litre)') ; |
|
|
|
|
|
label_quantity_max.html('Quantité max par défaut (litres)') ; |
|
|
|
|
|
label_step.html('Pas ('+unit+')') ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(change) { |
|
|
|
|
|
if(unit == 'piece') { |
|
|
|
|
|
$('#product-step').val(1) ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$('#product-step').val('') ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_tooltip() { |
|
|
|
|
|
$('[data-toggle="tooltip"]').tooltip({container:'body'}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_nl2br(str, is_xhtml) { |
|
|
|
|
|
var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br />' : '<br>'; |
|
|
|
|
|
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_index_commandes_points_vente_livraison() { |
|
|
|
|
|
|
|
|
|
|
|
$('#pointsaledistribution-points_sale_distribution input[type=checkbox]').change(function() { |
|
|
|
|
|
|
|
|
|
|
|
var nb = $('#pointsaledistribution-points_sale_distribution input[type=checkbox]:checked').size() ; |
|
|
|
|
|
|
|
|
|
|
|
if(nb == 0) { |
|
|
|
|
|
$(this).prop('checked',true) ; |
|
|
|
|
|
chat_alert('danger','Vous devez avoir au moins un point de vente activé') ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
var val = $(this).val() ; |
|
|
|
|
|
var arr_val = val.split('-') ; |
|
|
|
|
|
|
|
|
|
|
|
var livraison = 0 ; |
|
|
|
|
|
if($(this).prop('checked')) |
|
|
|
|
|
livraison = 1 ; |
|
|
|
|
|
|
|
|
|
|
|
$.get(UrlManager.getBaseUrl()+'order/ajax-point-sale-delivery',{ |
|
|
|
|
|
idDistribution: arr_val[0], |
|
|
|
|
|
idPointSale: arr_val[1], |
|
|
|
|
|
boolDelivery: livraison |
|
|
|
|
|
}, function(data) { |
|
|
|
|
|
chat_alert('success','Point de vente modifié') ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
chat_index_commandes_maj_points_vente() ; |
|
|
|
|
|
} |
|
|
|
|
|
}) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function chat_index_commandes_maj_points_vente() { |
|
|
|
|
|
|
|
|
|
|
|
if($('#productions-point-vente').size()) { |
|
|
|
|
|
var nb = $('#pointsaledistribution-points_sale_distribution input[type=checkbox]:checked').size() ; |
|
|
|
|
|
if(nb == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
$('#panel-commandes #tabs-points-vente, #panel-commandes #commandes-points-vente').hide() ; |
|
|
|
|
|
$('#panel-commandes .alert-danger').show(); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$('#panel-commandes #tabs-points-vente, #panel-commandes #commandes-points-vente').show() ; |
|
|
|
|
|
$('#panel-commandes .alert-danger').hide(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var id_production = $('#id-production').val() ; |
|
|
|
|
|
if(id_production) { |
|
|
|
|
|
$('#tabs-points-vente li').each(function() { |
|
|
|
|
|
|
|
|
|
|
|
var id_point_vente = $(this).find('a').attr('id').replace('btn-point-vente-','') ; |
|
|
|
|
|
var nb_commandes = parseInt($(this).find('.badge-success').html()) ; |
|
|
|
|
|
var checked = $('#pointsaledistribution-points_sale_distribution input[value='+id_production+'-'+id_point_vente+']').prop('checked') ; |
|
|
|
|
|
|
|
|
|
|
|
if(checked || nb_commandes > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
$(this).show() ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$(this).hide() ; |
|
|
|
|
|
} |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
$('#tabs-points-vente li:visible:first a').click() ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_points_vente_jours_livraison() { |
|
|
|
|
|
$('#pointvente-point_fabrication').change(function() { |
|
|
|
|
|
chat_points_vente_jours_livraison_event() ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
chat_points_vente_jours_livraison_event(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_points_vente_jours_livraison_event() { |
|
|
|
|
|
if($('#pointvente-point_fabrication').prop('checked')) { |
|
|
|
|
|
$('#jours-livraison').hide() ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$('#jours-livraison').fadeIn() ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_points_vente_acces() { |
|
|
|
|
|
// affichage du bloc acces restreint |
|
|
|
|
|
$('#pointsale-restricted_access').change(function() { |
|
|
|
|
|
chat_points_vente_acces_event() ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
chat_points_vente_acces_event() ; |
|
|
|
|
|
|
|
|
|
|
|
// affichage du champs commentaire |
|
|
|
|
|
$('#pointsale-users input[type=checkbox]').change(function() { |
|
|
|
|
|
chat_points_vente_commentaire_event() ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
chat_points_vente_commentaire_event() ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_points_vente_commentaire_event() { |
|
|
|
|
|
$('#pointsale-users input[type=checkbox]').each(function() { |
|
|
|
|
|
if($(this).prop('checked')) { |
|
|
|
|
|
$(this).parent().find('.commentaire').fadeIn() ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$(this).parent().find('.commentaire').hide() ; |
|
|
|
|
|
} |
|
|
|
|
|
}) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_points_vente_acces_event() { |
|
|
|
|
|
if($('#pointsale-restricted_access').prop('checked')) { |
|
|
|
|
|
$('#pointsale-users').fadeIn() ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$('#pointsale-users').hide() ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_select_etablissement() { |
|
|
|
|
|
$('select[name="select_producer"]').change(function() { |
|
|
|
|
|
window.location.href = UrlManager.getBaseUrlAbsolute()+'/site/change-producer?id='+$(this).val() ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_commandeauto() { |
|
|
|
|
|
|
|
|
|
|
|
// dates |
|
|
|
|
|
$('#subscriptionform-date_begin, #subscriptionform-date_end').datepicker() ; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_index_commandes_points_vente() { |
|
|
|
|
|
|
|
|
|
|
|
$('#commandes-points-vente .liste-commandes a').unbind('click').click(function() { |
|
|
|
|
|
|
|
|
|
|
|
var id_pv = $(this).data('pv-id') ; |
|
|
|
|
|
|
|
|
|
|
|
// affiche la commande |
|
|
|
|
|
var id_commande = $(this).data('id-commande') ; |
|
|
|
|
|
chat_index_commandes_affiche_commande(id_pv, id_commande) ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
$('#commandes-points-vente .bloc-point-vente').each(function() { |
|
|
|
|
|
var id_pv = $(this).data('id-pv') ; |
|
|
|
|
|
|
|
|
|
|
|
// edit |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-edit').unbind('click').click(function() { |
|
|
|
|
|
// boutons |
|
|
|
|
|
$('#point-vente-'+id_pv+' .buttons-edit-remove').hide() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .buttons-save-cancel').show() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .tr-total').hide() ; |
|
|
|
|
|
|
|
|
|
|
|
// inputs |
|
|
|
|
|
chat_index_commandes_inputs_commande(id_pv, true) ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
// remove |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-remove').unbind('click').click(function() { |
|
|
|
|
|
|
|
|
|
|
|
var id_commande = $(this).data('id-commande') ; |
|
|
|
|
|
$(this).attr('disabled', 'disabled') ; |
|
|
|
|
|
|
|
|
|
|
|
$.get(UrlManager.getBaseUrl()+'order/ajax-delete',{ |
|
|
|
|
|
date: $('#date-production').val(), |
|
|
|
|
|
idOrder: id_commande |
|
|
|
|
|
}, function(data) { |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-remove').removeAttr('disabled') ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($('#point-vente-'+id_pv+' .liste-commandes li').size()) { |
|
|
|
|
|
if($('#point-vente-'+id_pv+' .liste-commandes li:last-child a').is('.active')) { |
|
|
|
|
|
var commande_next = $('#point-vente-'+id_pv+' .liste-commandes a.active').parent().prev().find('a') ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
var commande_next = $('#point-vente-'+id_pv+' .liste-commandes a.active').parent().next().find('a') ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .liste-commandes a.active').parent().remove() ; |
|
|
|
|
|
|
|
|
|
|
|
if($('#point-vente-'+id_pv+' .liste-commandes li').size()) { |
|
|
|
|
|
chat_index_commandes_affiche_commande(id_pv, commande_next.data('id-commande')) ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$('#point-vente-'+id_pv+' .liste-commandes').hide() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .creer-commande').trigger('click') ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
chat_index_commandes_maj_recap_pv(id_pv, data.total_point_sale) ; |
|
|
|
|
|
chat_index_commandes_maj_total_commandes() ; |
|
|
|
|
|
chat_alert('success','Commande supprimée') ; |
|
|
|
|
|
}, 'json') ; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// cancel |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-cancel').unbind('click').click(function() { |
|
|
|
|
|
$('#point-vente-'+id_pv+' .buttons-edit-remove').show() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .buttons-save-cancel').hide() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-save').removeClass('is-create') ; |
|
|
|
|
|
chat_index_commandes_affiche_commande(id_pv, $(this).data('id-commande')) ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
// save |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-save').unbind('click').click(function() { |
|
|
|
|
|
|
|
|
|
|
|
var tab_produits = {} ; |
|
|
|
|
|
var cpt_produits = 0 ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .table-produits tr').each(function() { |
|
|
|
|
|
tab_produits[$(this).data('id-produit')] = $(this).find('.quantite').val() ; |
|
|
|
|
|
if($(this).find('.quantite').val()) |
|
|
|
|
|
cpt_produits ++ ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
if(cpt_produits) { |
|
|
|
|
|
// création |
|
|
|
|
|
if($(this).hasClass('is-create')) { |
|
|
|
|
|
|
|
|
|
|
|
if($('#point-vente-'+id_pv+' .user-id').val() || $('#point-vente-'+id_pv+' .username').val().length) { |
|
|
|
|
|
|
|
|
|
|
|
$(this).attr('disabled', 'disabled') ; |
|
|
|
|
|
|
|
|
|
|
|
$.get(UrlManager.getBaseUrl()+'order/ajax-create',{ |
|
|
|
|
|
date: $('#date-production').val(), |
|
|
|
|
|
idPointSale: id_pv, |
|
|
|
|
|
idUser: $('#point-vente-'+id_pv+' .user-id').val(), |
|
|
|
|
|
username: $('#point-vente-'+id_pv+' .username').val(), |
|
|
|
|
|
products: JSON.stringify(tab_produits), |
|
|
|
|
|
comment: $('#point-vente-'+id_pv+' .textarea-commentaire').val() |
|
|
|
|
|
}, function(data) { |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-save').removeAttr('disabled') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-save').removeClass('is-create') ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .liste-commandes').append(data.order) ; |
|
|
|
|
|
|
|
|
|
|
|
chat_index_commandes_points_vente() ; |
|
|
|
|
|
|
|
|
|
|
|
chat_index_commandes_maj_recap_pv(id_pv, data.total_point_sale) ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .buttons-edit-remove').show() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .buttons-save-cancel').hide() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-create').removeClass('is-create') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .user-id').val(0) ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .user-id').val('') ; |
|
|
|
|
|
|
|
|
|
|
|
chat_index_commandes_affiche_commande(id_pv, data.id_commande) ; |
|
|
|
|
|
chat_alert('success', 'Commande créée') ; |
|
|
|
|
|
}, 'json') ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
chat_alert('danger', 'Veuillez choisir ou saisir un nom d\'utilisateur') ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// modification |
|
|
|
|
|
else { |
|
|
|
|
|
var id_commande = $(this).data('id-commande') ; |
|
|
|
|
|
|
|
|
|
|
|
$(this).attr('disabled', 'disabled') ; |
|
|
|
|
|
$.get(UrlManager.getBaseUrl()+'order/ajax-update',{ |
|
|
|
|
|
idOrder: id_commande, |
|
|
|
|
|
products: JSON.stringify(tab_produits), |
|
|
|
|
|
date: $('#date-production').val(), |
|
|
|
|
|
comment: $('#point-vente-'+id_pv+' .textarea-commentaire').val() |
|
|
|
|
|
}, function(data) { |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-save').removeAttr('disabled') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+']').attr('data-commande',data.json_order); |
|
|
|
|
|
$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+'] .montant').html(data.json_order.str_amount) ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chat_index_commandes_affiche_commande(id_pv, id_commande) ; |
|
|
|
|
|
chat_index_commandes_maj_recap_pv(id_pv, data.total_point_sale) ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .buttons-edit-remove').show() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .buttons-save-cancel').hide() ; |
|
|
|
|
|
|
|
|
|
|
|
chat_alert('success','Commande modifiée') ; |
|
|
|
|
|
}, 'json') ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
chat_alert('danger', 'Veuillez saisir au moins un produit') ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
chat_index_commandes_maj_total_commandes() ; |
|
|
|
|
|
|
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
// create |
|
|
|
|
|
$('.creer-commande').unbind('click').click(function() { |
|
|
|
|
|
|
|
|
|
|
|
var id_pv = $(this).data('pv-id') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .bloc-commande').fadeIn() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .liste-commandes a.active').removeClass('active') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .tr-total').hide() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .buttons-edit-remove').hide() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .the-title').hide() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .buttons-save-cancel').show() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .choix-user').show() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .choix-user .user-id').val(0) ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .choix-user .username').val('') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .commentaire').hide() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-save').addClass('is-create'); |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-save').data('id-commande',0) ; |
|
|
|
|
|
|
|
|
|
|
|
chat_index_commandes_inputs_commande(id_pv, false) ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .title-user').show() ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#commandes-points-vente .liste-commandes').each(function() { |
|
|
|
|
|
//$(this).find('a:first').trigger('click') ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_index_commandes_maj_total_commandes() { |
|
|
|
|
|
$.get(UrlManager.getBaseUrl()+'order/ajax-total-orders',{ |
|
|
|
|
|
date: $('#date-production').val() |
|
|
|
|
|
}, function(data) { |
|
|
|
|
|
$('#bloc-totaux').html(data.html_totals) ; |
|
|
|
|
|
}, 'json') ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_index_commandes_maj_recap_pv(id_pv, total) { |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .recap-pv .recettes').html(total) ; |
|
|
|
|
|
var nb_commandes = $('#point-vente-'+id_pv+' .liste-commandes li').size() ; |
|
|
|
|
|
if(nb_commandes == 0) { |
|
|
|
|
|
$('#point-vente-'+id_pv+' .recap-pv .commandes').html('Aucune commande') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .recap-pv .recettes').hide() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .liste-commandes').addClass('no-commande') ; |
|
|
|
|
|
} |
|
|
|
|
|
else if(nb_commandes == 1) { |
|
|
|
|
|
$('#point-vente-'+id_pv+' .recap-pv .commandes').html('1 commande') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .recap-pv .recettes').show() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .liste-commandes').removeClass('no-commande') ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$('#point-vente-'+id_pv+' .recap-pv .commandes').html(nb_commandes+' commandes') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .recap-pv .recettes').show() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .liste-commandes').removeClass('no-commande') ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$('#btn-point-vente-'+id_pv+' .badge').html(nb_commandes) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_index_commandes_inputs_commande(id_pv, use_quantite) { |
|
|
|
|
|
|
|
|
|
|
|
// commentaire |
|
|
|
|
|
$('#point-vente-'+id_pv+' .commentaire').hide() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .textarea-commentaire').show() ; |
|
|
|
|
|
var id_commande = $('#point-vente-'+id_pv+' .btn-save').data('id-commande') ; |
|
|
|
|
|
if(id_commande) { |
|
|
|
|
|
var link = $('a[data-id-commande='+id_commande+']') ; |
|
|
|
|
|
if(!$.isPlainObject(link.attr('data-commande'))) { |
|
|
|
|
|
var commande = JSON.parse(link.attr('data-commande')) ; |
|
|
|
|
|
if(commande.commentaire && commande.commentaire.length) |
|
|
|
|
|
$('#point-vente-'+id_pv+' .textarea-commentaire').val(commande.commentaire) ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$('#point-vente-'+id_pv+' .textarea-commentaire').val('') ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// produits |
|
|
|
|
|
$('#point-vente-'+id_pv+' .table-produits tr').each(function() { |
|
|
|
|
|
var quantite = '' ; |
|
|
|
|
|
if(use_quantite) |
|
|
|
|
|
quantite = $(this).find('.td-commande').html() ; |
|
|
|
|
|
|
|
|
|
|
|
var id_produit = $(this).data('id-produit') ; |
|
|
|
|
|
|
|
|
|
|
|
$(this).find('.td-commande').html('<div class="input-group">'+ |
|
|
|
|
|
'<span class="input-group-btn">'+ |
|
|
|
|
|
'<button class="btn btn-default btn-moins" type="button"><span class="glyphicon glyphicon-minus"></span></button>'+ |
|
|
|
|
|
'</span>'+ |
|
|
|
|
|
'<input type="text" class="form-control quantite" value="'+quantite+'" name="produit_'+id_produit+'">'+ |
|
|
|
|
|
'<span class="input-group-btn">'+ |
|
|
|
|
|
'<button class="btn btn-default btn-plus" type="button"><span class="glyphicon glyphicon-plus"></span></button>'+ |
|
|
|
|
|
'</span>'+ |
|
|
|
|
|
'</div>') ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
// plus / moins |
|
|
|
|
|
chat_btn_plus_moins() ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_btn_plus_moins() { |
|
|
|
|
|
|
|
|
|
|
|
$('.btn-plus').each(function() { |
|
|
|
|
|
$(this).click(function() { |
|
|
|
|
|
var input = $(this).parent().parent().find('input') ; |
|
|
|
|
|
var value = input.val() ; |
|
|
|
|
|
if(value) |
|
|
|
|
|
value ++ ; |
|
|
|
|
|
else |
|
|
|
|
|
value = 1 ; |
|
|
|
|
|
input.val(value) ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('.btn-moins').each(function() { |
|
|
|
|
|
$(this).click(function() { |
|
|
|
|
|
var input = $(this).parent().parent().find('input') ; |
|
|
|
|
|
var value = input.val() ; |
|
|
|
|
|
if(value && value > 1) |
|
|
|
|
|
value -- ; |
|
|
|
|
|
else |
|
|
|
|
|
value = '' ; |
|
|
|
|
|
|
|
|
|
|
|
input.val(value) ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_index_commandes_affiche_commande(id_pv, id_commande) { |
|
|
|
|
|
|
|
|
|
|
|
var link = $("a[data-id-commande="+id_commande+"]") ; |
|
|
|
|
|
|
|
|
|
|
|
if(id_commande) { |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .bloc-commande').hide() ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .liste-commandes a').removeClass('active') ; |
|
|
|
|
|
link.addClass('active') ; |
|
|
|
|
|
|
|
|
|
|
|
var commande = link.attr('data-commande') ; |
|
|
|
|
|
if(!$.isPlainObject(link.attr('data-commande'))) { |
|
|
|
|
|
commande = JSON.parse(link.attr('data-commande')) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// maj ligne commande |
|
|
|
|
|
$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+'] .montant').removeClass('paye') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+'] .montant .glyphicon').remove() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+'] .montant').html() ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+'] .montant').html(commande.str_amount) ; |
|
|
|
|
|
if(commande.paid_amount >= commande.amount) { |
|
|
|
|
|
$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+'] .montant').addClass('paye') ; |
|
|
|
|
|
|
|
|
|
|
|
if(commande.paid_amount > commande.amount) { |
|
|
|
|
|
$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+'] .montant').append(' <span class="glyphicon glyphicon-warning-sign"></span>') ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// commentaire |
|
|
|
|
|
if(commande.comment && commande.comment.length) { |
|
|
|
|
|
if(!$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+'] .glyphicon-comment').size()) { |
|
|
|
|
|
$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+']').append(' <span class="glyphicon glyphicon-comment"></span>') ; |
|
|
|
|
|
} |
|
|
|
|
|
$('#point-vente-'+id_pv+' .commentaire').html(chat_nl2br(commande.comment)).show() ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+'] .glyphicon-comment').remove() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .commentaire').hide() ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// set id_commande |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-cancel').data('id-commande',id_commande) ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-save').data('id-commande',id_commande) ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-remove').data('id-commande',id_commande) ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .btn-create').removeClass('is-create') ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .buttons-edit-remove').show() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .buttons-save-cancel').hide() ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .choix-user').hide() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .the-title').show() ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .textarea-commentaire').hide() ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .td-commande').html('') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .td-total').html('') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' tr').removeClass('active') ; |
|
|
|
|
|
|
|
|
|
|
|
$.each(commande.products, function(i, item) { |
|
|
|
|
|
$('#point-vente-'+id_pv+' .produit-'+i+' .td-commande').html(item) ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .produit-'+i).addClass('active') ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .td-total').html('<span>'+commande.str_amount+'</span>') ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .tr-total').show() ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .title-user span.the-title').html(link.find('.user').html()+" <small>"+link.data('date')+"</small>") ; |
|
|
|
|
|
|
|
|
|
|
|
$('#point-vente-'+id_pv+' .bloc-commande').fadeIn() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .title-user').show() ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' .tr-total').show() ; |
|
|
|
|
|
|
|
|
|
|
|
// paiement |
|
|
|
|
|
$.get(UrlManager.getBaseUrl()+'order/payment-status',{ |
|
|
|
|
|
idOrder: id_commande |
|
|
|
|
|
}, function(data) { |
|
|
|
|
|
$('#point-vente-'+id_pv+' .bloc-commande .td-paiement').html(data.html_payment_status) ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+']').attr('data-commande',data.json_order) ; |
|
|
|
|
|
chat_index_commandes_boutons_paiement(id_pv, id_commande) ; |
|
|
|
|
|
},'json') ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$('#point-vente-'+id_pv+' .bloc-commande').hide() ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_index_commandes_boutons_paiement(id_pv, id_commande) { |
|
|
|
|
|
// boutons paiement/remboursement |
|
|
|
|
|
$('#point-vente-'+id_pv+' .payer, #point-vente-'+id_pv+' .rembourser').click(function() { |
|
|
|
|
|
$(this).attr('disabled','disabled') ; |
|
|
|
|
|
$.get(UrlManager.getBaseUrl()+'order/payment',{ |
|
|
|
|
|
idOrder: id_commande, |
|
|
|
|
|
type: $(this).data('type'), |
|
|
|
|
|
amount: $(this).data('montant') |
|
|
|
|
|
}, function(data) { |
|
|
|
|
|
$('#point-vente-'+id_pv+' .bloc-commande .td-paiement').html(data.html_payment_status) ; |
|
|
|
|
|
$('#point-vente-'+id_pv+' a[data-id-commande='+id_commande+']').attr('data-commande',data.json_order) ; |
|
|
|
|
|
chat_index_commandes_affiche_commande(id_pv, id_commande) ; |
|
|
|
|
|
chat_index_commandes_boutons_paiement(id_pv, id_commande) ; |
|
|
|
|
|
}, 'json') ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_index_commandes_liste_produits() { |
|
|
|
|
|
|
|
|
|
|
|
$('#produits-production .td-max input').click(function() { |
|
|
|
|
|
$(this).select() ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
$('#produits-production .td-actif input').change(function() { |
|
|
|
|
|
if($(this).prop('checked')) { |
|
|
|
|
|
$(this).parent().parent().addClass('active') ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$(this).parent().parent().removeClass('active') ; |
|
|
|
|
|
} |
|
|
|
|
|
}) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_alert(type, message) { |
|
|
|
|
|
var id = 'alert-'+$('#alerts-fixed .alert').size() + 1 ; |
|
|
|
|
|
$('#alerts-fixed').append('<div id="'+id+'" class="alert alert-'+type+'">'+message+'</div>') ; |
|
|
|
|
|
setTimeout('$("#'+id+'").fadeOut();',3000) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_ordre_produits() { |
|
|
|
|
|
|
|
|
|
|
|
var fixHelper = function(e, ui) { |
|
|
|
|
|
ui.children().each(function() { |
|
|
|
|
|
$(this).width($(this).width()); |
|
|
|
|
|
}); |
|
|
|
|
|
return ui; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$(".product-index table tbody").sortable({ |
|
|
|
|
|
items: "> tr", |
|
|
|
|
|
appendTo: "parent", |
|
|
|
|
|
cursor: "move", |
|
|
|
|
|
placeholder: "ui-state-highlight", |
|
|
|
|
|
handle: '.btn-order', |
|
|
|
|
|
//helper: "clone" |
|
|
|
|
|
helper: fixHelper, |
|
|
|
|
|
stop: function(event, ui) { |
|
|
|
|
|
var tab_ordre = {} ; |
|
|
|
|
|
var ordre = 1 ; |
|
|
|
|
|
|
|
|
|
|
|
if($('ul.pagination').size()) { |
|
|
|
|
|
var page = parseInt($('ul.pagination li.active a').html()) ; |
|
|
|
|
|
var nb_items_by_page = parseInt($('#page-size').html()) ; |
|
|
|
|
|
if(page != 1) { |
|
|
|
|
|
ordre = (page - 1) * nb_items_by_page ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$(".product-index table tbody tr").each(function() { |
|
|
|
|
|
tab_ordre[$(this).attr('data-key')] = ordre ; |
|
|
|
|
|
ordre++ ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
$.post(UrlManager.getBaseUrl()+'product/order',{ |
|
|
|
|
|
array: JSON.stringify(tab_ordre) |
|
|
|
|
|
}) ; |
|
|
|
|
|
} |
|
|
|
|
|
}).disableSelection(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_email_masse() { |
|
|
|
|
|
|
|
|
|
|
|
$('#ids-users .label').click(function() { |
|
|
|
|
|
|
|
|
|
|
|
if($(this).hasClass('label-default')) { |
|
|
|
|
|
$(this).removeClass('label\-default') ; |
|
|
|
|
|
$(this).addClass('label-danger') ; |
|
|
|
|
|
} |
|
|
|
|
|
else if($(this).hasClass('label-danger')) |
|
|
|
|
|
$(this).removeClass('label-danger').addClass('label-default') ; |
|
|
|
|
|
|
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
$('#email-masse-form button[type=submit]').click(function() { |
|
|
|
|
|
$(this).attr('disabled','disabled').html('Envoyer ...') ; |
|
|
|
|
|
chat_email_masse_send() ; |
|
|
|
|
|
return false ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_email_masse_send() { |
|
|
|
|
|
|
|
|
|
|
|
var user = $('#ids-users .label-default:first') ; |
|
|
|
|
|
|
|
|
|
|
|
if(user.size()) { |
|
|
|
|
|
|
|
|
|
|
|
$('input[name=id_user]').val(user.data('id')) ; |
|
|
|
|
|
|
|
|
|
|
|
$.post(UrlManager.getBaseUrl()+'user/mail',$('#email-masse-form').serialize(), function(retour) { |
|
|
|
|
|
user.removeClass('label-default').addClass('label-success') ; |
|
|
|
|
|
setTimeout("chat_email_masse_send()",30000) ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
alert('Fini !') ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_vrac() { |
|
|
|
|
|
$('.edit-vrac').click(function() { |
|
|
|
|
|
if($('.vrac').css('display') == 'none') |
|
|
|
|
|
$('.vrac').show() ; |
|
|
|
|
|
else |
|
|
|
|
|
$('.vrac').hide() ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_datepicker() { |
|
|
|
|
|
|
|
|
|
|
|
$('input.datepicker').datepicker({dateFormat:'dd/mm/yy'}) ; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function chat_calendar() { |
|
|
|
|
|
|
|
|
|
|
|
if($('#page-order').size()) { |
|
|
|
|
|
var events = new Array ; |
|
|
|
|
|
$('ul#jours-production li').each(function() { |
|
|
|
|
|
var date = $(this).html() ; |
|
|
|
|
|
events.push({ |
|
|
|
|
|
title: 'Production', |
|
|
|
|
|
start: date, |
|
|
|
|
|
allDay: true |
|
|
|
|
|
}) ; |
|
|
|
|
|
}) ; |
|
|
|
|
|
|
|
|
|
|
|
jQuery('#calendar').fullCalendar({ |
|
|
|
|
|
header: { |
|
|
|
|
|
left:"prev,next", |
|
|
|
|
|
center: "title", |
|
|
|
|
|
//right:"month,agendaWeek,agendaDay" |
|
|
|
|
|
right:"" |
|
|
|
|
|
}, |
|
|
|
|
|
lang:"fr-fr", |
|
|
|
|
|
loading:function loading(bool) { |
|
|
|
|
|
if (bool) $('#loading').show(); |
|
|
|
|
|
else $('#loading').hide(); |
|
|
|
|
|
}, |
|
|
|
|
|
dayClick: function(date, jsEvent, view) { |
|
|
|
|
|
var url = $(location).attr('href') ; |
|
|
|
|
|
var tab_url = url.split('?') ; |
|
|
|
|
|
$(location).attr('href',tab_url[0]+'?r=order/index&date='+date.format()); |
|
|
|
|
|
}, |
|
|
|
|
|
eventRender: function (event, element) { |
|
|
|
|
|
var dataToFind = moment(event.start).format('YYYY-MM-DD'); |
|
|
|
|
|
$("td[data-date='"+dataToFind+"']").addClass('dayWithEvent'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
//eventBackgroundColor: '#000000', |
|
|
|
|
|
events: events, |
|
|
|
|
|
id:"calendar" |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if($('#current-date').val()) |
|
|
|
|
|
$('td[data-date='+$('#current-date').val()+']').addClass('current-date') ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* French initialisation for the jQuery UI date picker plugin. */ |
|
|
|
|
|
/* Written by Keith Wood (kbwood{at}iinet.com.au), |
|
|
|
|
|
Stéphane Nahmani (sholby@sholby.net), |
|
|
|
|
|
Stéphane Raimbault <stephane.raimbault@gmail.com> */ |
|
|
|
|
|
(function( factory ) { |
|
|
|
|
|
if ( typeof define === "function" && define.amd ) { |
|
|
|
|
|
|
|
|
|
|
|
// AMD. Register as an anonymous module. |
|
|
|
|
|
define([ "../jquery.ui.datepicker" ], factory ); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
// Browser globals |
|
|
|
|
|
factory( jQuery.datepicker ); |
|
|
|
|
|
} |
|
|
|
|
|
}(function( datepicker ) { |
|
|
|
|
|
datepicker.regional['fr'] = { |
|
|
|
|
|
closeText: 'Fermer', |
|
|
|
|
|
prevText: 'Précédent', |
|
|
|
|
|
nextText: 'Suivant', |
|
|
|
|
|
currentText: 'Aujourd\'hui', |
|
|
|
|
|
monthNames: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', |
|
|
|
|
|
'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'], |
|
|
|
|
|
monthNamesShort: ['janv.', 'févr.', 'mars', 'avril', 'mai', 'juin', |
|
|
|
|
|
'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'], |
|
|
|
|
|
dayNames: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'], |
|
|
|
|
|
dayNamesShort: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'], |
|
|
|
|
|
dayNamesMin: ['D','L','M','M','J','V','S'], |
|
|
|
|
|
weekHeader: 'Sem.', |
|
|
|
|
|
dateFormat: 'dd/mm/yy', |
|
|
|
|
|
firstDay: 1, |
|
|
|
|
|
isRTL: false, |
|
|
|
|
|
showMonthAfterYear: false, |
|
|
|
|
|
yearSuffix: ''}; |
|
|
|
|
|
datepicker.setDefaults(datepicker.regional['fr']); |
|
|
|
|
|
|
|
|
|
|
|
return datepicker.regional['fr']; |
|
|
|
|
|
|
|
|
|
|
|
})); |
|
|
|