Traduction
This commit is contained in:
parent
52f60be731
commit
a8253efd2a
2 changed files with 16 additions and 3 deletions
|
@ -8,9 +8,14 @@
|
||||||
<link rel="stylesheet" href="{% static 'vendor/datetimepicker/picker.css' %}">
|
<link rel="stylesheet" href="{% static 'vendor/datetimepicker/picker.css' %}">
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
{% get_current_language as LANGUAGE_CODE %}
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
new DateTimePicker('input[name=start_date]', {});
|
new DateTimePicker('input[name=start_date]', {
|
||||||
new DateTimePicker('input[name=end_date]', {});
|
lang: '{{ LANGUAGE_CODE }}',
|
||||||
|
});
|
||||||
|
new DateTimePicker('input[name=end_date]', {
|
||||||
|
lang: '{{ LANGUAGE_CODE }}',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
10
shared/static/vendor/datetimepicker/picker.js
vendored
10
shared/static/vendor/datetimepicker/picker.js
vendored
|
@ -7,6 +7,14 @@ const _months = {
|
||||||
'fr': ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
|
'fr': ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
|
||||||
'en': ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
'en': ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
||||||
}
|
}
|
||||||
|
const _horaire = {
|
||||||
|
'fr': 'Horaire :',
|
||||||
|
'en': 'Time:',
|
||||||
|
};
|
||||||
|
const _valider = {
|
||||||
|
'fr': 'Valider',
|
||||||
|
'en': 'Validate',
|
||||||
|
};
|
||||||
|
|
||||||
const formatDT_1 = /(?<day>\d{2})\/(?<month>\d{2})\/(?<year>\d{4}) (?<hour>\d{2}):(?<minutes>\d{2})(:\d\d)?/;
|
const formatDT_1 = /(?<day>\d{2})\/(?<month>\d{2})\/(?<year>\d{4}) (?<hour>\d{2}):(?<minutes>\d{2})(:\d\d)?/;
|
||||||
const formatDT_2 = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) (?<hour>\d{2}):(?<minutes>\d{2})(:\d\d)?/;
|
const formatDT_2 = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) (?<hour>\d{2}):(?<minutes>\d{2})(:\d\d)?/;
|
||||||
|
@ -60,7 +68,7 @@ class DateTimePicker {
|
||||||
// Création du modal
|
// Création du modal
|
||||||
this.modal = document.createElement('div');
|
this.modal = document.createElement('div');
|
||||||
this.modal.classList.add('modal');
|
this.modal.classList.add('modal');
|
||||||
this.modal.innerHTML = `<div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><div class="field is-grouped has-addons is-flex-grow-1"><div class="control"><a class="button"><span class="icon"><i class="fas fa-chevron-left"></i></span></a></div><div class="control is-expanded"><a class="button is-fullwidth"></a></div><div class="control"><a class="button"><span class="icon"><i class="fas fa-chevron-right"></i></span></a></div></div></header><section class="modal-card-body"><div class="columns is-centered"><div class="column is-narrow"></div></div></section><footer class="modal-card-foot"><div class="field is-horizontal is-flex-grow-1"><div class="field-label is-normal"><label class="label">Horaire :</label></div><div class="field-body"><div class="field has-addons"><div class="control"><div class="select is-left"><select><option>00</option><option>01</option><option>02</option><option>03</option><option>04</option><option>05</option><option>06</option><option>07</option><option>08</option><option>09</option><option>10</option><option>11</option><option>12</option><option>13</option><option>14</option><option>15</option><option>16</option><option>17</option><option>18</option><option>19</option><option>20</option><option>21</option><option>22</option><option>23</option></select></div></div><div class="control"><button class="button is-static has-text-primary"><b>h</b></button></div></div><div class="field has-addons"><div class="control"><div class="select"><select><option>00</option><option>05</option><option>10</option><option>15</option><option>20</option><option>25</option><option>30</option><option>35</option><option>40</option><option>45</option><option>50</option><option>55</option></select></div></div><div class="control"><button class="button is-static has-text-primary"><b>min</b></button></div></div><div class="field is-expanded"><button class="button is-primary is-fullwidth button-close">Valider</button></div></div></div></footer></div><button class="modal-close is-large" aria-label="close"></button>`;
|
this.modal.innerHTML = `<div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><div class="field is-grouped has-addons is-flex-grow-1"><div class="control"><a class="button"><span class="icon"><i class="fas fa-chevron-left"></i></span></a></div><div class="control is-expanded"><a class="button is-fullwidth"></a></div><div class="control"><a class="button"><span class="icon"><i class="fas fa-chevron-right"></i></span></a></div></div></header><section class="modal-card-body"><div class="columns is-centered"><div class="column is-narrow"></div></div></section><footer class="modal-card-foot"><div class="field is-horizontal is-flex-grow-1"><div class="field-label is-normal"><label class="label">${_horaire[this.config.lang]}</label></div><div class="field-body"><div class="field has-addons"><div class="control"><div class="select is-left"><select><option>00</option><option>01</option><option>02</option><option>03</option><option>04</option><option>05</option><option>06</option><option>07</option><option>08</option><option>09</option><option>10</option><option>11</option><option>12</option><option>13</option><option>14</option><option>15</option><option>16</option><option>17</option><option>18</option><option>19</option><option>20</option><option>21</option><option>22</option><option>23</option></select></div></div><div class="control"><button class="button is-static has-text-primary"><b>h</b></button></div></div><div class="field has-addons"><div class="control"><div class="select"><select><option>00</option><option>05</option><option>10</option><option>15</option><option>20</option><option>25</option><option>30</option><option>35</option><option>40</option><option>45</option><option>50</option><option>55</option></select></div></div><div class="control"><button class="button is-static has-text-primary"><b>min</b></button></div></div><div class="field is-expanded"><button class="button is-primary is-fullwidth button-close">${_valider[this.config.lang]}</button></div></div></div></footer></div><button class="modal-close is-large" aria-label="close"></button>`;
|
||||||
let _controls = this.modal.querySelectorAll('header a.button');
|
let _controls = this.modal.querySelectorAll('header a.button');
|
||||||
this._leftArrow = _controls[0];
|
this._leftArrow = _controls[0];
|
||||||
this._menu = _controls[1];
|
this._menu = _controls[1];
|
||||||
|
|
Loading…
Reference in a new issue