diff --git a/Js/fonctions.js b/Js/fonctions.js index 762e634..e56b841 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -2416,3 +2416,61 @@ function prorater_prime_beneficiaire() }); } + + +$.prototype.enable = function () { + $.each(this, function (index, el) { + $(el).removeAttr('disabled'); + }); +} + +$.prototype.disable = function () { + $.each(this, function (index, el) { + $(el).attr('disabled', 'disabled'); + }); +} + +$.prototype.unreadable = function () { + $.each(this, function (index, el) { + $(el).attr('READONLY', 'READONLY'); + }); +} + +$.prototype.readable = function () { + $.each(this, function (index, el) { + $(el).removeAttr('READONLY'); + }); +} + +Date.estAnneeBissextile = function (annee) { + return (((annee % 4 === 0) && (annee % 100 !== 0)) || (annee % 400 === 0)); +}; + +Date.getDaysInMonth = function (annee, month) { + return [31, (Date.estAnneeBissextile(annee) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; +}; + +Date.prototype.estAnneeBissextile = function () { + return Date.estAnneeBissextile(this.getFullYear()); +}; + +Date.prototype.getDaysInMonth = function () { + return Date.getDaysInMonth(this.getFullYear(), this.getMonth()); +}; + +Date.prototype.addMonths = function (value) { + var n = this.getDate(); + this.setDate(1); + this.setMonth(this.getMonth() + value); + this.setDate(Math.min(n, this.getDaysInMonth())); + this.setDate(this.getDate()-1); + return this; +}; + +$( ".datepicker" ).datepicker({ + inline: true, + changeMonth: true, + changeYear: true, + yearRange: "c-60:c+20" + +}); \ No newline at end of file