Compare commits
No commits in common. "499829054966d6fe81a1ca31cb5385c5706f246f" and "a49f192125f732e9b29f8f5cf338fbb3d5d64fbc" have entirely different histories.
4998290549
...
a49f192125
@ -1,806 +0,0 @@
|
||||
// HumanizeDuration.js - https://git.io/j0HgmQ
|
||||
|
||||
;(function () {
|
||||
// This has to be defined separately because of a bug: we want to alias
|
||||
// `gr` and `el` for backwards-compatiblity. In a breaking change, we can
|
||||
// remove `gr` entirely.
|
||||
// See https://github.com/EvanHahn/HumanizeDuration.js/issues/143 for more.
|
||||
var greek = {
|
||||
y: function (c) { return c === 1 ? 'χρόνος' : 'χρόνια' },
|
||||
mo: function (c) { return c === 1 ? 'μήνας' : 'μήνες' },
|
||||
w: function (c) { return c === 1 ? 'εβδομάδα' : 'εβδομάδες' },
|
||||
d: function (c) { return c === 1 ? 'μέρα' : 'μέρες' },
|
||||
h: function (c) { return c === 1 ? 'ώρα' : 'ώρες' },
|
||||
m: function (c) { return c === 1 ? 'λεπτό' : 'λεπτά' },
|
||||
s: function (c) { return c === 1 ? 'δευτερόλεπτο' : 'δευτερόλεπτα' },
|
||||
ms: function (c) { return c === 1 ? 'χιλιοστό του δευτερολέπτου' : 'χιλιοστά του δευτερολέπτου' },
|
||||
decimal: ','
|
||||
}
|
||||
|
||||
var languages = {
|
||||
ar: {
|
||||
y: function (c) { return c === 1 ? 'سنة' : 'سنوات' },
|
||||
mo: function (c) { return c === 1 ? 'شهر' : 'أشهر' },
|
||||
w: function (c) { return c === 1 ? 'أسبوع' : 'أسابيع' },
|
||||
d: function (c) { return c === 1 ? 'يوم' : 'أيام' },
|
||||
h: function (c) { return c === 1 ? 'ساعة' : 'ساعات' },
|
||||
m: function (c) {
|
||||
return ['دقيقة', 'دقائق'][getArabicForm(c)]
|
||||
},
|
||||
s: function (c) { return c === 1 ? 'ثانية' : 'ثواني' },
|
||||
ms: function (c) { return c === 1 ? 'جزء من الثانية' : 'أجزاء من الثانية' },
|
||||
decimal: ','
|
||||
},
|
||||
bg: {
|
||||
y: function (c) { return ['години', 'година', 'години'][getSlavicForm(c)] },
|
||||
mo: function (c) { return ['месеца', 'месец', 'месеца'][getSlavicForm(c)] },
|
||||
w: function (c) { return ['седмици', 'седмица', 'седмици'][getSlavicForm(c)] },
|
||||
d: function (c) { return ['дни', 'ден', 'дни'][getSlavicForm(c)] },
|
||||
h: function (c) { return ['часа', 'час', 'часа'][getSlavicForm(c)] },
|
||||
m: function (c) { return ['минути', 'минута', 'минути'][getSlavicForm(c)] },
|
||||
s: function (c) { return ['секунди', 'секунда', 'секунди'][getSlavicForm(c)] },
|
||||
ms: function (c) { return ['милисекунди', 'милисекунда', 'милисекунди'][getSlavicForm(c)] },
|
||||
decimal: ','
|
||||
},
|
||||
ca: {
|
||||
y: function (c) { return 'any' + (c === 1 ? '' : 's') },
|
||||
mo: function (c) { return 'mes' + (c === 1 ? '' : 'os') },
|
||||
w: function (c) { return 'setman' + (c === 1 ? 'a' : 'es') },
|
||||
d: function (c) { return 'di' + (c === 1 ? 'a' : 'es') },
|
||||
h: function (c) { return 'hor' + (c === 1 ? 'a' : 'es') },
|
||||
m: function (c) { return 'minut' + (c === 1 ? '' : 's') },
|
||||
s: function (c) { return 'segon' + (c === 1 ? '' : 's') },
|
||||
ms: function (c) { return 'milisegon' + (c === 1 ? '' : 's') },
|
||||
decimal: ','
|
||||
},
|
||||
cs: {
|
||||
y: function (c) { return ['rok', 'roku', 'roky', 'let'][getCzechOrSlovakForm(c)] },
|
||||
mo: function (c) { return ['měsíc', 'měsíce', 'měsíce', 'měsíců'][getCzechOrSlovakForm(c)] },
|
||||
w: function (c) { return ['týden', 'týdne', 'týdny', 'týdnů'][getCzechOrSlovakForm(c)] },
|
||||
d: function (c) { return ['den', 'dne', 'dny', 'dní'][getCzechOrSlovakForm(c)] },
|
||||
h: function (c) { return ['hodina', 'hodiny', 'hodiny', 'hodin'][getCzechOrSlovakForm(c)] },
|
||||
m: function (c) { return ['minuta', 'minuty', 'minuty', 'minut'][getCzechOrSlovakForm(c)] },
|
||||
s: function (c) { return ['sekunda', 'sekundy', 'sekundy', 'sekund'][getCzechOrSlovakForm(c)] },
|
||||
ms: function (c) { return ['milisekunda', 'milisekundy', 'milisekundy', 'milisekund'][getCzechOrSlovakForm(c)] },
|
||||
decimal: ','
|
||||
},
|
||||
da: {
|
||||
y: 'år',
|
||||
mo: function (c) { return 'måned' + (c === 1 ? '' : 'er') },
|
||||
w: function (c) { return 'uge' + (c === 1 ? '' : 'r') },
|
||||
d: function (c) { return 'dag' + (c === 1 ? '' : 'e') },
|
||||
h: function (c) { return 'time' + (c === 1 ? '' : 'r') },
|
||||
m: function (c) { return 'minut' + (c === 1 ? '' : 'ter') },
|
||||
s: function (c) { return 'sekund' + (c === 1 ? '' : 'er') },
|
||||
ms: function (c) { return 'millisekund' + (c === 1 ? '' : 'er') },
|
||||
decimal: ','
|
||||
},
|
||||
de: {
|
||||
y: function (c) { return 'Jahr' + (c === 1 ? '' : 'e') },
|
||||
mo: function (c) { return 'Monat' + (c === 1 ? '' : 'e') },
|
||||
w: function (c) { return 'Woche' + (c === 1 ? '' : 'n') },
|
||||
d: function (c) { return 'Tag' + (c === 1 ? '' : 'e') },
|
||||
h: function (c) { return 'Stunde' + (c === 1 ? '' : 'n') },
|
||||
m: function (c) { return 'Minute' + (c === 1 ? '' : 'n') },
|
||||
s: function (c) { return 'Sekunde' + (c === 1 ? '' : 'n') },
|
||||
ms: function (c) { return 'Millisekunde' + (c === 1 ? '' : 'n') },
|
||||
decimal: ','
|
||||
},
|
||||
el: greek,
|
||||
en: {
|
||||
y: function (c) { return 'year' + (c === 1 ? '' : 's') },
|
||||
mo: function (c) { return 'month' + (c === 1 ? '' : 's') },
|
||||
w: function (c) { return 'week' + (c === 1 ? '' : 's') },
|
||||
d: function (c) { return 'day' + (c === 1 ? '' : 's') },
|
||||
h: function (c) { return 'hour' + (c === 1 ? '' : 's') },
|
||||
m: function (c) { return 'minute' + (c === 1 ? '' : 's') },
|
||||
s: function (c) { return 'second' + (c === 1 ? '' : 's') },
|
||||
ms: function (c) { return 'millisecond' + (c === 1 ? '' : 's') },
|
||||
decimal: '.'
|
||||
},
|
||||
es: {
|
||||
y: function (c) { return 'año' + (c === 1 ? '' : 's') },
|
||||
mo: function (c) { return 'mes' + (c === 1 ? '' : 'es') },
|
||||
w: function (c) { return 'semana' + (c === 1 ? '' : 's') },
|
||||
d: function (c) { return 'día' + (c === 1 ? '' : 's') },
|
||||
h: function (c) { return 'hora' + (c === 1 ? '' : 's') },
|
||||
m: function (c) { return 'minuto' + (c === 1 ? '' : 's') },
|
||||
s: function (c) { return 'segundo' + (c === 1 ? '' : 's') },
|
||||
ms: function (c) { return 'milisegundo' + (c === 1 ? '' : 's') },
|
||||
decimal: ','
|
||||
},
|
||||
et: {
|
||||
y: function (c) { return 'aasta' + (c === 1 ? '' : 't') },
|
||||
mo: function (c) { return 'kuu' + (c === 1 ? '' : 'd') },
|
||||
w: function (c) { return 'nädal' + (c === 1 ? '' : 'at') },
|
||||
d: function (c) { return 'päev' + (c === 1 ? '' : 'a') },
|
||||
h: function (c) { return 'tund' + (c === 1 ? '' : 'i') },
|
||||
m: function (c) { return 'minut' + (c === 1 ? '' : 'it') },
|
||||
s: function (c) { return 'sekund' + (c === 1 ? '' : 'it') },
|
||||
ms: function (c) { return 'millisekund' + (c === 1 ? '' : 'it') },
|
||||
decimal: ','
|
||||
},
|
||||
fa: {
|
||||
y: 'سال',
|
||||
mo: 'ماه',
|
||||
w: 'هفته',
|
||||
d: 'روز',
|
||||
h: 'ساعت',
|
||||
m: 'دقیقه',
|
||||
s: 'ثانیه',
|
||||
ms: 'میلی ثانیه',
|
||||
decimal: '.'
|
||||
},
|
||||
fi: {
|
||||
y: function (c) { return c === 1 ? 'vuosi' : 'vuotta' },
|
||||
mo: function (c) { return c === 1 ? 'kuukausi' : 'kuukautta' },
|
||||
w: function (c) { return 'viikko' + (c === 1 ? '' : 'a') },
|
||||
d: function (c) { return 'päivä' + (c === 1 ? '' : 'ä') },
|
||||
h: function (c) { return 'tunti' + (c === 1 ? '' : 'a') },
|
||||
m: function (c) { return 'minuutti' + (c === 1 ? '' : 'a') },
|
||||
s: function (c) { return 'sekunti' + (c === 1 ? '' : 'a') },
|
||||
ms: function (c) { return 'millisekunti' + (c === 1 ? '' : 'a') },
|
||||
decimal: ','
|
||||
},
|
||||
fo: {
|
||||
y: 'ár',
|
||||
mo: function (c) { return c === 1 ? 'mánaður' : 'mánaðir' },
|
||||
w: function (c) { return c === 1 ? 'vika' : 'vikur' },
|
||||
d: function (c) { return c === 1 ? 'dagur' : 'dagar' },
|
||||
h: function (c) { return c === 1 ? 'tími' : 'tímar' },
|
||||
m: function (c) { return c === 1 ? 'minuttur' : 'minuttir' },
|
||||
s: 'sekund',
|
||||
ms: 'millisekund',
|
||||
decimal: ','
|
||||
},
|
||||
fr: {
|
||||
y: function (c) { return 'an' + (c >= 2 ? 's' : '') },
|
||||
mo: 'mois',
|
||||
w: function (c) { return 'semaine' + (c >= 2 ? 's' : '') },
|
||||
d: function (c) { return 'jour' + (c >= 2 ? 's' : '') },
|
||||
h: function (c) { return 'heure' + (c >= 2 ? 's' : '') },
|
||||
m: function (c) { return 'minute' + (c >= 2 ? 's' : '') },
|
||||
s: function (c) { return 'seconde' + (c >= 2 ? 's' : '') },
|
||||
ms: function (c) { return 'milliseconde' + (c >= 2 ? 's' : '') },
|
||||
decimal: ','
|
||||
},
|
||||
gr: greek,
|
||||
he: {
|
||||
y: function (c) { return c === 1 ? 'שנה' : 'שנים' },
|
||||
mo: function (c) { return c === 1 ? 'חודש' : 'חודשים' },
|
||||
w: function (c) { return c === 1 ? 'שבוע' : 'שבועות' },
|
||||
d: function (c) { return c === 1 ? 'יום' : 'ימים' },
|
||||
h: function (c) { return c === 1 ? 'שעה' : 'שעות' },
|
||||
m: function (c) { return c === 1 ? 'דקה' : 'דקות' },
|
||||
s: function (c) { return c === 1 ? 'שניה' : 'שניות' },
|
||||
ms: function (c) { return c === 1 ? 'מילישנייה' : 'מילישניות' },
|
||||
decimal: '.'
|
||||
},
|
||||
hr: {
|
||||
y: function (c) {
|
||||
if (c % 10 === 2 || c % 10 === 3 || c % 10 === 4) {
|
||||
return 'godine'
|
||||
}
|
||||
return 'godina'
|
||||
},
|
||||
mo: function (c) {
|
||||
if (c === 1) {
|
||||
return 'mjesec'
|
||||
} else if (c === 2 || c === 3 || c === 4) {
|
||||
return 'mjeseca'
|
||||
}
|
||||
return 'mjeseci'
|
||||
},
|
||||
w: function (c) {
|
||||
if (c % 10 === 1 && c !== 11) {
|
||||
return 'tjedan'
|
||||
}
|
||||
return 'tjedna'
|
||||
},
|
||||
d: function (c) { return c === 1 ? 'dan' : 'dana' },
|
||||
h: function (c) {
|
||||
if (c === 1) {
|
||||
return 'sat'
|
||||
} else if (c === 2 || c === 3 || c === 4) {
|
||||
return 'sata'
|
||||
}
|
||||
return 'sati'
|
||||
},
|
||||
m: function (c) {
|
||||
var mod10 = c % 10
|
||||
if ((mod10 === 2 || mod10 === 3 || mod10 === 4) && (c < 10 || c > 14)) {
|
||||
return 'minute'
|
||||
}
|
||||
return 'minuta'
|
||||
},
|
||||
s: function (c) {
|
||||
if ((c === 10 || c === 11 || c === 12 || c === 13 || c === 14 || c === 16 || c === 17 || c === 18 || c === 19) || (c % 10 === 5)) {
|
||||
return 'sekundi'
|
||||
} else if (c % 10 === 1) {
|
||||
return 'sekunda'
|
||||
} else if (c % 10 === 2 || c % 10 === 3 || c % 10 === 4) {
|
||||
return 'sekunde'
|
||||
}
|
||||
return 'sekundi'
|
||||
},
|
||||
ms: function (c) {
|
||||
if (c === 1) {
|
||||
return 'milisekunda'
|
||||
} else if (c % 10 === 2 || c % 10 === 3 || c % 10 === 4) {
|
||||
return 'milisekunde'
|
||||
}
|
||||
return 'milisekundi'
|
||||
},
|
||||
decimal: ','
|
||||
},
|
||||
hu: {
|
||||
y: 'év',
|
||||
mo: 'hónap',
|
||||
w: 'hét',
|
||||
d: 'nap',
|
||||
h: 'óra',
|
||||
m: 'perc',
|
||||
s: 'másodperc',
|
||||
ms: 'ezredmásodperc',
|
||||
decimal: ','
|
||||
},
|
||||
id: {
|
||||
y: 'tahun',
|
||||
mo: 'bulan',
|
||||
w: 'minggu',
|
||||
d: 'hari',
|
||||
h: 'jam',
|
||||
m: 'menit',
|
||||
s: 'detik',
|
||||
ms: 'milidetik',
|
||||
decimal: '.'
|
||||
},
|
||||
is: {
|
||||
y: 'ár',
|
||||
mo: function (c) { return 'mánuð' + (c === 1 ? 'ur' : 'ir') },
|
||||
w: function (c) { return 'vik' + (c === 1 ? 'a' : 'ur') },
|
||||
d: function (c) { return 'dag' + (c === 1 ? 'ur' : 'ar') },
|
||||
h: function (c) { return 'klukkutím' + (c === 1 ? 'i' : 'ar') },
|
||||
m: function (c) { return 'mínút' + (c === 1 ? 'a' : 'ur') },
|
||||
s: function (c) { return 'sekúnd' + (c === 1 ? 'a' : 'ur') },
|
||||
ms: function (c) { return 'millisekúnd' + (c === 1 ? 'a' : 'ur') },
|
||||
decimal: '.'
|
||||
},
|
||||
it: {
|
||||
y: function (c) { return 'ann' + (c === 1 ? 'o' : 'i') },
|
||||
mo: function (c) { return 'mes' + (c === 1 ? 'e' : 'i') },
|
||||
w: function (c) { return 'settiman' + (c === 1 ? 'a' : 'e') },
|
||||
d: function (c) { return 'giorn' + (c === 1 ? 'o' : 'i') },
|
||||
h: function (c) { return 'or' + (c === 1 ? 'a' : 'e') },
|
||||
m: function (c) { return 'minut' + (c === 1 ? 'o' : 'i') },
|
||||
s: function (c) { return 'second' + (c === 1 ? 'o' : 'i') },
|
||||
ms: function (c) { return 'millisecond' + (c === 1 ? 'o' : 'i') },
|
||||
decimal: ','
|
||||
},
|
||||
ja: {
|
||||
y: '年',
|
||||
mo: '月',
|
||||
w: '週',
|
||||
d: '日',
|
||||
h: '時間',
|
||||
m: '分',
|
||||
s: '秒',
|
||||
ms: 'ミリ秒',
|
||||
decimal: '.'
|
||||
},
|
||||
ko: {
|
||||
y: '년',
|
||||
mo: '개월',
|
||||
w: '주일',
|
||||
d: '일',
|
||||
h: '시간',
|
||||
m: '분',
|
||||
s: '초',
|
||||
ms: '밀리 초',
|
||||
decimal: '.'
|
||||
},
|
||||
lo: {
|
||||
y: 'ປີ',
|
||||
mo: 'ເດືອນ',
|
||||
w: 'ອາທິດ',
|
||||
d: 'ມື້',
|
||||
h: 'ຊົ່ວໂມງ',
|
||||
m: 'ນາທີ',
|
||||
s: 'ວິນາທີ',
|
||||
ms: 'ມິນລິວິນາທີ',
|
||||
decimal: ','
|
||||
},
|
||||
lt: {
|
||||
y: function (c) { return ((c % 10 === 0) || (c % 100 >= 10 && c % 100 <= 20)) ? 'metų' : 'metai' },
|
||||
mo: function (c) { return ['mėnuo', 'mėnesiai', 'mėnesių'][getLithuanianForm(c)] },
|
||||
w: function (c) { return ['savaitė', 'savaitės', 'savaičių'][getLithuanianForm(c)] },
|
||||
d: function (c) { return ['diena', 'dienos', 'dienų'][getLithuanianForm(c)] },
|
||||
h: function (c) { return ['valanda', 'valandos', 'valandų'][getLithuanianForm(c)] },
|
||||
m: function (c) { return ['minutė', 'minutės', 'minučių'][getLithuanianForm(c)] },
|
||||
s: function (c) { return ['sekundė', 'sekundės', 'sekundžių'][getLithuanianForm(c)] },
|
||||
ms: function (c) { return ['milisekundė', 'milisekundės', 'milisekundžių'][getLithuanianForm(c)] },
|
||||
decimal: ','
|
||||
},
|
||||
lv: {
|
||||
y: function (c) { return ['gads', 'gadi'][getLatvianForm(c)] },
|
||||
mo: function (c) { return ['mēnesis', 'mēneši'][getLatvianForm(c)] },
|
||||
w: function (c) { return ['nedēļa', 'nedēļas'][getLatvianForm(c)] },
|
||||
d: function (c) { return ['diena', 'dienas'][getLatvianForm(c)] },
|
||||
h: function (c) { return ['stunda', 'stundas'][getLatvianForm(c)] },
|
||||
m: function (c) { return ['minūte', 'minūtes'][getLatvianForm(c)] },
|
||||
s: function (c) { return ['sekunde', 'sekundes'][getLatvianForm(c)] },
|
||||
ms: function (c) { return ['milisekunde', 'milisekundes'][getLatvianForm(c)] },
|
||||
decimal: ','
|
||||
},
|
||||
ms: {
|
||||
y: 'tahun',
|
||||
mo: 'bulan',
|
||||
w: 'minggu',
|
||||
d: 'hari',
|
||||
h: 'jam',
|
||||
m: 'minit',
|
||||
s: 'saat',
|
||||
ms: 'milisaat',
|
||||
decimal: '.'
|
||||
},
|
||||
nl: {
|
||||
y: 'jaar',
|
||||
mo: function (c) { return c === 1 ? 'maand' : 'maanden' },
|
||||
w: function (c) { return c === 1 ? 'week' : 'weken' },
|
||||
d: function (c) { return c === 1 ? 'dag' : 'dagen' },
|
||||
h: 'uur',
|
||||
m: function (c) { return c === 1 ? 'minuut' : 'minuten' },
|
||||
s: function (c) { return c === 1 ? 'seconde' : 'seconden' },
|
||||
ms: function (c) { return c === 1 ? 'milliseconde' : 'milliseconden' },
|
||||
decimal: ','
|
||||
},
|
||||
no: {
|
||||
y: 'år',
|
||||
mo: function (c) { return 'måned' + (c === 1 ? '' : 'er') },
|
||||
w: function (c) { return 'uke' + (c === 1 ? '' : 'r') },
|
||||
d: function (c) { return 'dag' + (c === 1 ? '' : 'er') },
|
||||
h: function (c) { return 'time' + (c === 1 ? '' : 'r') },
|
||||
m: function (c) { return 'minutt' + (c === 1 ? '' : 'er') },
|
||||
s: function (c) { return 'sekund' + (c === 1 ? '' : 'er') },
|
||||
ms: function (c) { return 'millisekund' + (c === 1 ? '' : 'er') },
|
||||
decimal: ','
|
||||
},
|
||||
pl: {
|
||||
y: function (c) { return ['rok', 'roku', 'lata', 'lat'][getPolishForm(c)] },
|
||||
mo: function (c) { return ['miesiąc', 'miesiąca', 'miesiące', 'miesięcy'][getPolishForm(c)] },
|
||||
w: function (c) { return ['tydzień', 'tygodnia', 'tygodnie', 'tygodni'][getPolishForm(c)] },
|
||||
d: function (c) { return ['dzień', 'dnia', 'dni', 'dni'][getPolishForm(c)] },
|
||||
h: function (c) { return ['godzina', 'godziny', 'godziny', 'godzin'][getPolishForm(c)] },
|
||||
m: function (c) { return ['minuta', 'minuty', 'minuty', 'minut'][getPolishForm(c)] },
|
||||
s: function (c) { return ['sekunda', 'sekundy', 'sekundy', 'sekund'][getPolishForm(c)] },
|
||||
ms: function (c) { return ['milisekunda', 'milisekundy', 'milisekundy', 'milisekund'][getPolishForm(c)] },
|
||||
decimal: ','
|
||||
},
|
||||
pt: {
|
||||
y: function (c) { return 'ano' + (c === 1 ? '' : 's') },
|
||||
mo: function (c) { return c === 1 ? 'mês' : 'meses' },
|
||||
w: function (c) { return 'semana' + (c === 1 ? '' : 's') },
|
||||
d: function (c) { return 'dia' + (c === 1 ? '' : 's') },
|
||||
h: function (c) { return 'hora' + (c === 1 ? '' : 's') },
|
||||
m: function (c) { return 'minuto' + (c === 1 ? '' : 's') },
|
||||
s: function (c) { return 'segundo' + (c === 1 ? '' : 's') },
|
||||
ms: function (c) { return 'milissegundo' + (c === 1 ? '' : 's') },
|
||||
decimal: ','
|
||||
},
|
||||
ro: {
|
||||
y: function (c) { return c === 1 ? 'an' : 'ani' },
|
||||
mo: function (c) { return c === 1 ? 'lună' : 'luni' },
|
||||
w: function (c) { return c === 1 ? 'săptămână' : 'săptămâni' },
|
||||
d: function (c) { return c === 1 ? 'zi' : 'zile' },
|
||||
h: function (c) { return c === 1 ? 'oră' : 'ore' },
|
||||
m: function (c) { return c === 1 ? 'minut' : 'minute' },
|
||||
s: function (c) { return c === 1 ? 'secundă' : 'secunde' },
|
||||
ms: function (c) { return c === 1 ? 'milisecundă' : 'milisecunde' },
|
||||
decimal: ','
|
||||
},
|
||||
ru: {
|
||||
y: function (c) { return ['лет', 'год', 'года'][getSlavicForm(c)] },
|
||||
mo: function (c) { return ['месяцев', 'месяц', 'месяца'][getSlavicForm(c)] },
|
||||
w: function (c) { return ['недель', 'неделя', 'недели'][getSlavicForm(c)] },
|
||||
d: function (c) { return ['дней', 'день', 'дня'][getSlavicForm(c)] },
|
||||
h: function (c) { return ['часов', 'час', 'часа'][getSlavicForm(c)] },
|
||||
m: function (c) { return ['минут', 'минута', 'минуты'][getSlavicForm(c)] },
|
||||
s: function (c) { return ['секунд', 'секунда', 'секунды'][getSlavicForm(c)] },
|
||||
ms: function (c) { return ['миллисекунд', 'миллисекунда', 'миллисекунды'][getSlavicForm(c)] },
|
||||
decimal: ','
|
||||
},
|
||||
uk: {
|
||||
y: function (c) { return ['років', 'рік', 'роки'][getSlavicForm(c)] },
|
||||
mo: function (c) { return ['місяців', 'місяць', 'місяці'][getSlavicForm(c)] },
|
||||
w: function (c) { return ['тижнів', 'тиждень', 'тижні'][getSlavicForm(c)] },
|
||||
d: function (c) { return ['днів', 'день', 'дні'][getSlavicForm(c)] },
|
||||
h: function (c) { return ['годин', 'година', 'години'][getSlavicForm(c)] },
|
||||
m: function (c) { return ['хвилин', 'хвилина', 'хвилини'][getSlavicForm(c)] },
|
||||
s: function (c) { return ['секунд', 'секунда', 'секунди'][getSlavicForm(c)] },
|
||||
ms: function (c) { return ['мілісекунд', 'мілісекунда', 'мілісекунди'][getSlavicForm(c)] },
|
||||
decimal: ','
|
||||
},
|
||||
ur: {
|
||||
y: 'سال',
|
||||
mo: function (c) { return c === 1 ? 'مہینہ' : 'مہینے' },
|
||||
w: function (c) { return c === 1 ? 'ہفتہ' : 'ہفتے' },
|
||||
d: 'دن',
|
||||
h: function (c) { return c === 1 ? 'گھنٹہ' : 'گھنٹے' },
|
||||
m: 'منٹ',
|
||||
s: 'سیکنڈ',
|
||||
ms: 'ملی سیکنڈ',
|
||||
decimal: '.'
|
||||
},
|
||||
sk: {
|
||||
y: function (c) { return ['rok', 'roky', 'roky', 'rokov'][getCzechOrSlovakForm(c)] },
|
||||
mo: function (c) { return ['mesiac', 'mesiace', 'mesiace', 'mesiacov'][getCzechOrSlovakForm(c)] },
|
||||
w: function (c) { return ['týždeň', 'týždne', 'týždne', 'týždňov'][getCzechOrSlovakForm(c)] },
|
||||
d: function (c) { return ['deň', 'dni', 'dni', 'dní'][getCzechOrSlovakForm(c)] },
|
||||
h: function (c) { return ['hodina', 'hodiny', 'hodiny', 'hodín'][getCzechOrSlovakForm(c)] },
|
||||
m: function (c) { return ['minúta', 'minúty', 'minúty', 'minút'][getCzechOrSlovakForm(c)] },
|
||||
s: function (c) { return ['sekunda', 'sekundy', 'sekundy', 'sekúnd'][getCzechOrSlovakForm(c)] },
|
||||
ms: function (c) { return ['milisekunda', 'milisekundy', 'milisekundy', 'milisekúnd'][getCzechOrSlovakForm(c)] },
|
||||
decimal: ','
|
||||
},
|
||||
sv: {
|
||||
y: 'år',
|
||||
mo: function (c) { return 'månad' + (c === 1 ? '' : 'er') },
|
||||
w: function (c) { return 'veck' + (c === 1 ? 'a' : 'or') },
|
||||
d: function (c) { return 'dag' + (c === 1 ? '' : 'ar') },
|
||||
h: function (c) { return 'timm' + (c === 1 ? 'e' : 'ar') },
|
||||
m: function (c) { return 'minut' + (c === 1 ? '' : 'er') },
|
||||
s: function (c) { return 'sekund' + (c === 1 ? '' : 'er') },
|
||||
ms: function (c) { return 'millisekund' + (c === 1 ? '' : 'er') },
|
||||
decimal: ','
|
||||
},
|
||||
sw: {
|
||||
y: function (c) { return c === 1 ? 'mwaka' : 'miaka' },
|
||||
mo: function (c) { return c === 1 ? 'mwezi' : 'miezi' },
|
||||
w: 'wiki',
|
||||
d: function (c) { return c === 1 ? 'siku' : 'masiku' },
|
||||
h: function (c) { return c === 1 ? 'saa' : 'masaa' },
|
||||
m: 'dakika',
|
||||
s: 'sekunde',
|
||||
ms: 'milisekunde',
|
||||
decimal: '.'
|
||||
},
|
||||
tr: {
|
||||
y: 'yıl',
|
||||
mo: 'ay',
|
||||
w: 'hafta',
|
||||
d: 'gün',
|
||||
h: 'saat',
|
||||
m: 'dakika',
|
||||
s: 'saniye',
|
||||
ms: 'milisaniye',
|
||||
decimal: ','
|
||||
},
|
||||
th: {
|
||||
y: 'ปี',
|
||||
mo: 'เดือน',
|
||||
w: 'อาทิตย์',
|
||||
d: 'วัน',
|
||||
h: 'ชั่วโมง',
|
||||
m: 'นาที',
|
||||
s: 'วินาที',
|
||||
ms: 'มิลลิวินาที',
|
||||
decimal: '.'
|
||||
},
|
||||
vi: {
|
||||
y: 'năm',
|
||||
mo: 'tháng',
|
||||
w: 'tuần',
|
||||
d: 'ngày',
|
||||
h: 'giờ',
|
||||
m: 'phút',
|
||||
s: 'giây',
|
||||
ms: 'mili giây',
|
||||
decimal: ','
|
||||
},
|
||||
zh_CN: {
|
||||
y: '年',
|
||||
mo: '个月',
|
||||
w: '周',
|
||||
d: '天',
|
||||
h: '小时',
|
||||
m: '分钟',
|
||||
s: '秒',
|
||||
ms: '毫秒',
|
||||
decimal: '.'
|
||||
},
|
||||
zh_TW: {
|
||||
y: '年',
|
||||
mo: '個月',
|
||||
w: '周',
|
||||
d: '天',
|
||||
h: '小時',
|
||||
m: '分鐘',
|
||||
s: '秒',
|
||||
ms: '毫秒',
|
||||
decimal: '.'
|
||||
}
|
||||
}
|
||||
|
||||
// You can create a humanizer, which returns a function with default
|
||||
// parameters.
|
||||
function humanizer (passedOptions) {
|
||||
var result = function humanizer (ms, humanizerOptions) {
|
||||
var options = extend({}, result, humanizerOptions || {})
|
||||
return doHumanization(ms, options)
|
||||
}
|
||||
|
||||
return extend(result, {
|
||||
language: 'en',
|
||||
delimiter: ', ',
|
||||
spacer: ' ',
|
||||
conjunction: '',
|
||||
serialComma: true,
|
||||
units: ['y', 'mo', 'w', 'd', 'h', 'm', 's'],
|
||||
languages: {},
|
||||
round: false,
|
||||
unitMeasures: {
|
||||
y: 31557600000,
|
||||
mo: 2629800000,
|
||||
w: 604800000,
|
||||
d: 86400000,
|
||||
h: 3600000,
|
||||
m: 60000,
|
||||
s: 1000,
|
||||
ms: 1
|
||||
}
|
||||
}, passedOptions)
|
||||
}
|
||||
|
||||
// The main function is just a wrapper around a default humanizer.
|
||||
var humanizeDuration = humanizer({})
|
||||
|
||||
// Build dictionary from options
|
||||
function getDictionary (options) {
|
||||
var languagesFromOptions = [options.language]
|
||||
|
||||
if (has(options, 'fallbacks')) {
|
||||
if (isArray(options.fallbacks) && options.fallbacks.length) {
|
||||
languagesFromOptions = languagesFromOptions.concat(options.fallbacks)
|
||||
} else {
|
||||
throw new Error('fallbacks must be an array with at least one element')
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < languagesFromOptions.length; i++) {
|
||||
var languageToTry = languagesFromOptions[i]
|
||||
if (has(options.languages, languageToTry)) {
|
||||
return options.languages[languageToTry]
|
||||
} else if (has(languages, languageToTry)) {
|
||||
return languages[languageToTry]
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error('No language found.')
|
||||
}
|
||||
|
||||
// doHumanization does the bulk of the work.
|
||||
function doHumanization (ms, options) {
|
||||
var i, len, piece
|
||||
|
||||
// Make sure we have a positive number.
|
||||
// Has the nice sideffect of turning Number objects into primitives.
|
||||
ms = Math.abs(ms)
|
||||
|
||||
var dictionary = getDictionary(options)
|
||||
var pieces = []
|
||||
|
||||
// Start at the top and keep removing units, bit by bit.
|
||||
var unitName, unitMS, unitCount
|
||||
for (i = 0, len = options.units.length; i < len; i++) {
|
||||
unitName = options.units[i]
|
||||
unitMS = options.unitMeasures[unitName]
|
||||
|
||||
// What's the number of full units we can fit?
|
||||
if (i + 1 === len) {
|
||||
if (has(options, 'maxDecimalPoints')) {
|
||||
// We need to use this expValue to avoid rounding functionality of toFixed call
|
||||
var expValue = Math.pow(10, options.maxDecimalPoints)
|
||||
var unitCountFloat = (ms / unitMS)
|
||||
unitCount = parseFloat((Math.floor(expValue * unitCountFloat) / expValue).toFixed(options.maxDecimalPoints))
|
||||
} else {
|
||||
unitCount = ms / unitMS
|
||||
}
|
||||
} else {
|
||||
unitCount = Math.floor(ms / unitMS)
|
||||
}
|
||||
|
||||
// Add the string.
|
||||
pieces.push({
|
||||
unitCount: unitCount,
|
||||
unitName: unitName
|
||||
})
|
||||
|
||||
// Remove what we just figured out.
|
||||
ms -= unitCount * unitMS
|
||||
}
|
||||
|
||||
var firstOccupiedUnitIndex = 0
|
||||
for (i = 0; i < pieces.length; i++) {
|
||||
if (pieces[i].unitCount) {
|
||||
firstOccupiedUnitIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (options.round) {
|
||||
var ratioToLargerUnit, previousPiece
|
||||
for (i = pieces.length - 1; i >= 0; i--) {
|
||||
piece = pieces[i]
|
||||
piece.unitCount = Math.round(piece.unitCount)
|
||||
|
||||
if (i === 0) { break }
|
||||
|
||||
previousPiece = pieces[i - 1]
|
||||
|
||||
ratioToLargerUnit = options.unitMeasures[previousPiece.unitName] / options.unitMeasures[piece.unitName]
|
||||
if ((piece.unitCount % ratioToLargerUnit) === 0 || (options.largest && ((options.largest - 1) < (i - firstOccupiedUnitIndex)))) {
|
||||
previousPiece.unitCount += piece.unitCount / ratioToLargerUnit
|
||||
piece.unitCount = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result = []
|
||||
for (i = 0, pieces.length; i < len; i++) {
|
||||
piece = pieces[i]
|
||||
if (piece.unitCount) {
|
||||
result.push(render(piece.unitCount, piece.unitName, dictionary, options))
|
||||
}
|
||||
|
||||
if (result.length === options.largest) { break }
|
||||
}
|
||||
|
||||
if (result.length) {
|
||||
if (!options.conjunction || result.length === 1) {
|
||||
return result.join(options.delimiter)
|
||||
} else if (result.length === 2) {
|
||||
return result.join(options.conjunction)
|
||||
} else if (result.length > 2) {
|
||||
return result.slice(0, -1).join(options.delimiter) + (options.serialComma ? ',' : '') + options.conjunction + result.slice(-1)
|
||||
}
|
||||
} else {
|
||||
return render(0, options.units[options.units.length - 1], dictionary, options)
|
||||
}
|
||||
}
|
||||
|
||||
function render (count, type, dictionary, options) {
|
||||
var decimal
|
||||
if (has(options, 'decimal')) {
|
||||
decimal = options.decimal
|
||||
} else if (has(dictionary, 'decimal')) {
|
||||
decimal = dictionary.decimal
|
||||
} else {
|
||||
decimal = '.'
|
||||
}
|
||||
|
||||
var countStr = count.toString().replace('.', decimal)
|
||||
|
||||
var dictionaryValue = dictionary[type]
|
||||
var word
|
||||
if (typeof dictionaryValue === 'function') {
|
||||
word = dictionaryValue(count)
|
||||
} else {
|
||||
word = dictionaryValue
|
||||
}
|
||||
|
||||
return countStr + options.spacer + word
|
||||
}
|
||||
|
||||
function extend (destination) {
|
||||
var source
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
source = arguments[i]
|
||||
for (var prop in source) {
|
||||
if (has(source, prop)) {
|
||||
destination[prop] = source[prop]
|
||||
}
|
||||
}
|
||||
}
|
||||
return destination
|
||||
}
|
||||
|
||||
// Internal helper function for Polish language.
|
||||
function getPolishForm (c) {
|
||||
if (c === 1) {
|
||||
return 0
|
||||
} else if (Math.floor(c) !== c) {
|
||||
return 1
|
||||
} else if (c % 10 >= 2 && c % 10 <= 4 && !(c % 100 > 10 && c % 100 < 20)) {
|
||||
return 2
|
||||
} else {
|
||||
return 3
|
||||
}
|
||||
}
|
||||
|
||||
// Internal helper function for Russian and Ukranian languages.
|
||||
function getSlavicForm (c) {
|
||||
if (Math.floor(c) !== c) {
|
||||
return 2
|
||||
} else if ((c % 100 >= 5 && c % 100 <= 20) || (c % 10 >= 5 && c % 10 <= 9) || c % 10 === 0) {
|
||||
return 0
|
||||
} else if (c % 10 === 1) {
|
||||
return 1
|
||||
} else if (c > 1) {
|
||||
return 2
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
// Internal helper function for Slovak language.
|
||||
function getCzechOrSlovakForm (c) {
|
||||
if (c === 1) {
|
||||
return 0
|
||||
} else if (Math.floor(c) !== c) {
|
||||
return 1
|
||||
} else if (c % 10 >= 2 && c % 10 <= 4 && c % 100 < 10) {
|
||||
return 2
|
||||
} else {
|
||||
return 3
|
||||
}
|
||||
}
|
||||
|
||||
// Internal helper function for Lithuanian language.
|
||||
function getLithuanianForm (c) {
|
||||
if (c === 1 || (c % 10 === 1 && c % 100 > 20)) {
|
||||
return 0
|
||||
} else if (Math.floor(c) !== c || (c % 10 >= 2 && c % 100 > 20) || (c % 10 >= 2 && c % 100 < 10)) {
|
||||
return 1
|
||||
} else {
|
||||
return 2
|
||||
}
|
||||
}
|
||||
|
||||
// Internal helper function for Latvian language.
|
||||
function getLatvianForm (c) {
|
||||
if (c === 1 || (c % 10 === 1 && c % 100 !== 11)) {
|
||||
return 0
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
// Internal helper function for Arabic language.
|
||||
function getArabicForm (c) {
|
||||
if (c <= 2) { return 0 }
|
||||
if (c > 2 && c < 11) { return 1 }
|
||||
return 0
|
||||
}
|
||||
|
||||
// We need to make sure we support browsers that don't have
|
||||
// `Array.isArray`, so we define a fallback here.
|
||||
var isArray = Array.isArray || function (arg) {
|
||||
return Object.prototype.toString.call(arg) === '[object Array]'
|
||||
}
|
||||
|
||||
function has (obj, key) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key)
|
||||
}
|
||||
|
||||
humanizeDuration.getSupportedLanguages = function getSupportedLanguages () {
|
||||
var result = []
|
||||
for (var language in languages) {
|
||||
if (has(languages, language) && language !== 'gr') {
|
||||
result.push(language)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
humanizeDuration.humanizer = humanizer
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return humanizeDuration
|
||||
})
|
||||
} else if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = humanizeDuration
|
||||
} else {
|
||||
this.humanizeDuration = humanizeDuration
|
||||
}
|
||||
})(); // eslint-disable-line semi
|
@ -47,7 +47,6 @@
|
||||
|
||||
<link href="{% static 'RUG_template/css/base.css' %}" rel="stylesheet"/>
|
||||
<script type="text/javascript" src="{% static 'RUG_template/javascript/moment-with-locales.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'RUG_template/javascript/humanize-duration.js' %}"></script>
|
||||
|
||||
</head>
|
||||
<body itemtype="http://schema.org/WebPage" itemscope="itemscope" id="top" class="page--topicpage"><!--googleoff: all-->
|
||||
|
@ -14,8 +14,8 @@ class Employee(MetaDataModel):
|
||||
|
||||
Attributes
|
||||
----------
|
||||
user : :class:`~django.contrib.auth.models.User`
|
||||
The Django User model that is the employee.
|
||||
user : User
|
||||
The Django user in the system where this employee data belongs to.
|
||||
hospital : Hospital
|
||||
The hospital where this employee is working. You can only choose **one** hospital per employee.
|
||||
polyclinic : Polyclinic
|
||||
@ -37,4 +37,4 @@ class Employee(MetaDataModel):
|
||||
|
||||
def __str__(self):
|
||||
"""str: Returns a readable name for the employee. Format is [employee_full_name] ([city])."""
|
||||
return '{} ({})'.format(self.user.get_full_name(), self.hospital)
|
||||
return '{} ({})'.format(self.user.get_full_name(), self.hospital)
|
@ -347,7 +347,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="behandeling">
|
||||
<td><input type="text" class="form-control" id="behandeling_0" name="behandeling_0" maxlength="20" required></td>
|
||||
<td><input type="text" class="form-control" id="behandeling_0" name="behandeling_0" required></td>
|
||||
<td>
|
||||
<select class="form-control" id="behandeling_duration_0" name="behandeling_duration_0" required>
|
||||
<option value="5">5</option>
|
||||
@ -568,18 +568,10 @@
|
||||
function calculateBehandelingen() {
|
||||
let total = 0, percentage = 0;
|
||||
let error = false;
|
||||
let show_message = false;
|
||||
|
||||
jQuery('tr.behandeling').each(function(counter,row){
|
||||
row = jQuery(row);
|
||||
if (row.find('select[name^="behandeling_method_"]').val() == 'live') {
|
||||
if (!show_message) {
|
||||
show_message = ( row.find('input[name^="behandeling_"]').val() !== ''
|
||||
&& row.find('select[name^="behandeling_specialisme_"]').val() !== ''
|
||||
&& row.find('input[name^="behandeling_100p_"]').val() !== ''
|
||||
&& row.find('input[name^="behandeling_30p_"]').val() !== '' )
|
||||
}
|
||||
|
||||
total += (row.find('input[name*="_100p_"]').val() != '' ? row.find('input[name*="_100p_"]').val() * 1 : 0);
|
||||
percentage += (row.find('input[name*="_30p_"]').val() != '' ? row.find('input[name*="_30p_"]').val() * 1 : 0);
|
||||
}
|
||||
@ -602,12 +594,7 @@
|
||||
calc_message = 'Dit klopt precies';
|
||||
class_message = 'alert-success';
|
||||
}
|
||||
|
||||
jQuery('div.behandeling_calc_remarks').removeClass('alert-danger alert-warning alert-success').html('');
|
||||
if (show_message) {
|
||||
jQuery('div.behandeling_calc_remarks').addClass(class_message).text(calc_message);
|
||||
}
|
||||
|
||||
jQuery('div.behandeling_calc_remarks').removeClass('alert-danger alert-warning alert-success').addClass(class_message).text(calc_message);
|
||||
|
||||
validate_behandeling_hours();
|
||||
|
||||
@ -694,13 +681,12 @@
|
||||
let specialisme = element.find('input[name^="specialisatie_"]').val();
|
||||
|
||||
behandelingen[specialisme] = {
|
||||
name : element.find('input[name^="specialisatie_"]').val(),
|
||||
artsen : element.find('input[name^="specialisatie_aantal_artsen_"]').val() * 1,
|
||||
max_time : 0,
|
||||
used_time : 0
|
||||
name : element.find('input[name^="specialisatie_"]').val(),
|
||||
artsen : element.find('input[name^="specialisatie_aantal_artsen_"]').val() * 1,
|
||||
max_time : 0,
|
||||
used_time : 0
|
||||
};
|
||||
|
||||
// Hole working day, first time row
|
||||
let time_start_value = element.find('select[name^="werkdag_start_afdeling_"]').val() * 1;
|
||||
let time_end_value = element.find('select[name^="werkdag_end_afdeling_"]').val() * 1;
|
||||
|
||||
@ -718,10 +704,11 @@
|
||||
time_end.setSeconds(0);
|
||||
time_end.setMilliseconds(0);
|
||||
|
||||
//console.log(time_start,time_end);
|
||||
|
||||
behandelingen[specialisme]['max_time'] = ((time_end - time_start) / (1000 * 60));
|
||||
}
|
||||
|
||||
// Morning break. Second row
|
||||
time_start_value = element.find('select[name^="ochtend_pauze_start_afdeling_"]').val() * 1;
|
||||
time_end_value = element.find('select[name^="ochtend_pauze_end_afdeling_"]').val() * 1;
|
||||
|
||||
@ -739,6 +726,8 @@
|
||||
time_end.setSeconds(0);
|
||||
time_end.setMilliseconds(0);
|
||||
|
||||
//console.log(time_start,time_end);
|
||||
|
||||
behandelingen[specialisme]['max_time'] -= ((time_end - time_start) / (1000 * 60));
|
||||
}
|
||||
|
||||
@ -807,19 +796,13 @@
|
||||
message.html('')
|
||||
|
||||
jQuery.each(behandelingen,function(specialisme,obj){
|
||||
if ('' == specialisme) {
|
||||
return;
|
||||
}
|
||||
if ((obj.artsen * obj.max_time) - obj.used_time < 0) {
|
||||
error = true;
|
||||
duration_to_much = (obj.used_time - (obj.artsen * obj.max_time)) * 60 * 1000;
|
||||
duration_to_much = humanizeDuration(duration_to_much, {language: moment.locale(), delimiter: ' {% trans "and" %} ', units: ['h','m']});
|
||||
message.append(jQuery('<div>').addClass('alert-danger').html('<strong>' + specialisme + ' </strong>: Te veel behandelingen voor het aantal artsen en werktijd. ' + duration_to_much + ' te veel.'));
|
||||
message.append(jQuery('<div>').addClass('alert-danger').html('<strong>' + specialisme + ' </strong>: Te veel behandelingen voor het aantal arsten en werktijd. ' + moment.duration(obj.used_time - (obj.artsen * obj.max_time),'minutes').humanize() + ' teveel.'));
|
||||
} else if ((obj.artsen * obj.max_time) - obj.used_time == 0) {
|
||||
message.append(jQuery('<div>').addClass('alert-success').html('<strong>' + specialisme + ' </strong>: Perfect! Alle tijd is ingedeeld.'));
|
||||
} else {
|
||||
// do not show this message here, as it is hard to predict the maximum available time
|
||||
// message.append(jQuery('<div>').addClass('alert-warning').html('<strong>' + specialisme + ' </strong>: Uw heeft nog ' + moment.duration((obj.artsen * obj.max_time) - obj.used_time,'minutes').humanize() + ' tijd over voor meer afspraken.'));
|
||||
message.append(jQuery('<div>').addClass('alert-warning').html('<strong>' + specialisme + ' </strong>: Uw heeft nog ' + moment.duration((obj.artsen * obj.max_time) - obj.used_time,'minutes').humanize() + ' tijd over voor meer afspraken.'));
|
||||
}
|
||||
});
|
||||
|
||||
@ -868,35 +851,18 @@
|
||||
});
|
||||
|
||||
morning_break_end.find('option').each(function(index,element){
|
||||
if ('' !== element.value && element.value >= 0) {
|
||||
if ('' !== element.value && element.value > 0) {
|
||||
// Only allow options that are between the day start and day end.
|
||||
// Or when morning_break_start is selected and valid, add period time for end time selections
|
||||
// When start time is selected, the option 'no break' is not valid (value 0)
|
||||
let time = ('' != morning_break_start.val() ? morning_break_start.val() : day_start.val());
|
||||
let disable = false;
|
||||
|
||||
// Selected no-break at morning starting time and select no-break here
|
||||
if (time == 0 && element.value == 0) {
|
||||
disable = false;
|
||||
} else if (time == 0) {
|
||||
disable = element.value != 0;
|
||||
} else if (element.value == 0) {
|
||||
disable = '' != morning_break_start.val();
|
||||
} else {
|
||||
disable = (time && element.value <= time) || (day_end.val() && element.value > day_end.val());
|
||||
}
|
||||
|
||||
if(element.selected && disable) {
|
||||
let disable = (time && element.value <= time) || (day_end.val() && element.value > day_end.val());
|
||||
if (element.selected && disable) {
|
||||
morning_break_end.val('');
|
||||
}
|
||||
element.disabled = disable;
|
||||
}
|
||||
});
|
||||
|
||||
if (morning_break_start.val() == '0') {
|
||||
morning_break_end.val('0');
|
||||
}
|
||||
|
||||
lunch_start.find('option').each(function(index,element){
|
||||
if ('' !== element.value && element.value > 0) {
|
||||
// Only allow options that are between the day start and day end.
|
||||
@ -911,23 +877,11 @@
|
||||
});
|
||||
|
||||
lunch_end.find('option').each(function(index,element){
|
||||
if ('' !== element.value && element.value >= 0) {
|
||||
if ('' !== element.value && element.value > 0) {
|
||||
// Only allow options that are between the day start and day end.
|
||||
// Or when lunch_start is selected and valid, add period time for end time selections
|
||||
// When start time is selected, the option 'no break' is not valid (value 0)
|
||||
let time = ('' != lunch_start.val() ? lunch_start.val() : day_start.val()) * 1;
|
||||
let disable = false;
|
||||
|
||||
if (time == 0 && element.value == 0) {
|
||||
disable = false;
|
||||
} else if (time == 0) {
|
||||
disable = element.value != 0;
|
||||
} else if (element.value == 0) {
|
||||
disable = '' != lunch_start.val();
|
||||
} else {
|
||||
disable = (time && element.value <= time) || (day_end.val() && element.value > day_end.val());
|
||||
}
|
||||
|
||||
let disable = (time && element.value <= time) || (day_end.val() && element.value > day_end.val());
|
||||
if (element.selected && disable) {
|
||||
lunch_end.val('');
|
||||
}
|
||||
@ -935,10 +889,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
if (lunch_start.val() == '0') {
|
||||
lunch_end.val('0');
|
||||
}
|
||||
|
||||
|
||||
afternoon_break_start.find('option').each(function(index,element){
|
||||
if ('' !== element.value && element.value > 0) {
|
||||
@ -954,23 +904,11 @@
|
||||
});
|
||||
|
||||
afternoon_break_end.find('option').each(function(index,element){
|
||||
if ('' !== element.value && element.value >= 0) {
|
||||
if ('' !== element.value && element.value > 0) {
|
||||
// Only allow options that are between the day start and day end.
|
||||
// Or when morning_break_start is selected and valid, add period time for end time selections
|
||||
// When start time is selected, the option 'no break' is not valid (value 0)
|
||||
let time = ('' != afternoon_break_start.val() ? afternoon_break_start.val() : day_start.val());
|
||||
let disable = false;
|
||||
|
||||
if (time == 0 && element.value == 0) {
|
||||
disable = false;
|
||||
} else if (time == 0) {
|
||||
disable = element.value != 0;
|
||||
} else if (element.value == 0) {
|
||||
disable = '' != afternoon_break_start.val();
|
||||
} else {
|
||||
disable = (time && element.value <= time) || (day_end.val() && element.value > day_end.val());
|
||||
}
|
||||
|
||||
let disable = (time && element.value <= time) || (day_end.val() && element.value > day_end.val());
|
||||
if (element.selected && disable) {
|
||||
afternoon_break_end.val('');
|
||||
}
|
||||
@ -978,10 +916,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
if (afternoon_break_start.val() == '0') {
|
||||
afternoon_break_end.val('0');
|
||||
}
|
||||
|
||||
if (showerror) {
|
||||
html.find('small.text-danger').toggle(day_start.val() == '' || day_start.val() == null ||
|
||||
day_end.val() == '' || day_end.val() == null ||
|
||||
|
@ -124,7 +124,7 @@ LOGOUT_REDIRECT_URL = '/'
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/3.0/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'nl'
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
LANGUAGES = [
|
||||
('nl', _('Dutch')),
|
||||
|
Loading…
Reference in New Issue
Block a user