You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 line
3.9KB

  1. $(document).ready(function() {
  2. chat_calendar() ;
  3. chat_datepicker() ;
  4. chat_vrac() ;
  5. chat_email_masse() ;
  6. $('button[data-toggle=popover]').popover() ;
  7. }) ;
  8. function chat_email_masse() {
  9. $('#ids-users .label').click(function() {
  10. if($(this).hasClass('label-default')) {
  11. $(this).removeClass('label\-default') ;
  12. $(this).addClass('label-danger') ;
  13. }
  14. else if($(this).hasClass('label-danger'))
  15. $(this).removeClass('label-danger').addClass('label-default') ;
  16. }) ;
  17. $('#email-masse-form button[type=submit]').click(function() {
  18. $(this).attr('disabled','disabled').html('Envoyer ...') ;
  19. chat_email_masse_send() ;
  20. return false ;
  21. }) ;
  22. }
  23. function chat_email_masse_send() {
  24. var user = $('#ids-users .label-default:first') ;
  25. if(user.size()) {
  26. $('input[name=id_user]').val(user.data('id')) ;
  27. $.post('index.php?r=user/mail',$('#email-masse-form').serialize(), function(retour) {
  28. user.removeClass('label-default').addClass('label-success') ;
  29. setTimeout("chat_email_masse_send()",30000) ;
  30. }) ;
  31. }
  32. else {
  33. alert('Fini !') ;
  34. }
  35. }
  36. function chat_vrac() {
  37. $('.edit-vrac').click(function() {
  38. if($('.vrac').css('display') == 'none')
  39. $('.vrac').show() ;
  40. else
  41. $('.vrac').hide() ;
  42. }) ;
  43. }
  44. function chat_datepicker() {
  45. $('.datepicker').datepicker({dateFormat:'dd/mm/yy'}) ;
  46. }
  47. function chat_calendar() {
  48. if($('#page-commande').size()) {
  49. var events = new Array ;
  50. $('ul#jours-production li').each(function() {
  51. var date = $(this).html() ;
  52. events.push({
  53. title: 'Production',
  54. start: date,
  55. allDay: true
  56. }) ;
  57. }) ;
  58. jQuery('#calendar').fullCalendar({
  59. header: {
  60. left:"prev,next",
  61. center: "title",
  62. //right:"month,agendaWeek,agendaDay"
  63. right:""
  64. },
  65. lang:"fr-fr",
  66. loading:function loading(bool) {
  67. if (bool) $('#loading').show();
  68. else $('#loading').hide();
  69. },
  70. dayClick: function(date, jsEvent, view) {
  71. var url = $(location).attr('href') ;
  72. var tab_url = url.split('?') ;
  73. $(location).attr('href',tab_url[0]+'?r=commande/index&date='+date.format());
  74. },
  75. eventRender: function (event, element) {
  76. var dataToFind = moment(event.start).format('YYYY-MM-DD');
  77. $("td[data-date='"+dataToFind+"']").addClass('dayWithEvent');
  78. },
  79. //eventBackgroundColor: '#000000',
  80. events: events,
  81. id:"calendar"
  82. });
  83. if($('#current-date').val())
  84. $('td[data-date='+$('#current-date').val()+']').addClass('current-date') ;
  85. }
  86. }
  87. /* French initialisation for the jQuery UI date picker plugin. */
  88. /* Written by Keith Wood (kbwood{at}iinet.com.au),
  89. Stéphane Nahmani (sholby@sholby.net),
  90. Stéphane Raimbault <stephane.raimbault@gmail.com> */
  91. (function( factory ) {
  92. if ( typeof define === "function" && define.amd ) {
  93. // AMD. Register as an anonymous module.
  94. define([ "../jquery.ui.datepicker" ], factory );
  95. } else {
  96. // Browser globals
  97. factory( jQuery.datepicker );
  98. }
  99. }(function( datepicker ) {
  100. datepicker.regional['fr'] = {
  101. closeText: 'Fermer',
  102. prevText: 'Précédent',
  103. nextText: 'Suivant',
  104. currentText: 'Aujourd\'hui',
  105. monthNames: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin',
  106. 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
  107. monthNamesShort: ['janv.', 'févr.', 'mars', 'avril', 'mai', 'juin',
  108. 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
  109. dayNames: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
  110. dayNamesShort: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
  111. dayNamesMin: ['D','L','M','M','J','V','S'],
  112. weekHeader: 'Sem.',
  113. dateFormat: 'dd/mm/yy',
  114. firstDay: 1,
  115. isRTL: false,
  116. showMonthAfterYear: false,
  117. yearSuffix: ''};
  118. datepicker.setDefaults(datepicker.regional['fr']);
  119. return datepicker.regional['fr'];
  120. }));