Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 0a828a5a

Přidáno uživatelem Martin Sebela před asi 4 roky(ů)

Re #8076 - finishing new datepicker

Zobrazit rozdíly:

website/templates/heatmap.html.twig
34 34
                  'type' : 'text',
35 35
                  'id' : 'date',
36 36
                  'attr' : {
37
                    'class' : 'form-control',                 
37
                    'class' : 'form-control',
38 38
                    'onChange' : 'checkDataSetsAvailability("' ~ path('available') ~ '")'
39 39
                  }
40 40
                })
......
47 47
                form_widget(form.time, {
48 48
                  'id' : 'time',
49 49
                  'attr' : {
50
                    'class' : "custom-select"
50
                    'class' : 'custom-select'
51 51
                  }
52 52
                })
53 53
              }}             
......
59 59
                form_widget(form.type, {
60 60
                  'id' : 'type',
61 61
                  'attr' : {
62
                    'class' : "custom-select"                 
62
                    'class' : 'custom-select'
63 63
                  }
64 64
                })
65 65
              }}  
......
157 157
    <script src="{{ asset('js/leaflet-heat.js') }}"></script>
158 158
    <script src="{{ asset('js/zcu-heatmap.js') }}"></script>
159 159
    <script>
160
        initDatepicker("{{ path('dates') }}");
160 161
        initMap();
161 162
        checkDataSetsAvailability("{{ path('available') }}")
162 163
        {% if submitted %}
163 164
          loadCurrentTimeHeatmap("{{ path('opendata') }}", "{{ path('positions') }}");
164 165
        {% endif %}
165
      
166
        var datesetDates = '23-04-2019,24-04-2019,25-04-2019,24-05-2020,27-05-2020'.split(',');
167

  
168
        function formatDate(date) {
169
          var day = String(date.getDate());
170
          var month = String(date.getMonth() + 1);
171

  
172
          if (day.length === 1) {
173
            day = '0' + day;
174
          }
175

  
176
          if (month.length === 1) {
177
            month = '0' + month;
178
          }
179

  
180
          return day + '-' + month + '-' + date.getFullYear();
181
        }
182

  
183
        $(function () {
184
          $('#date').datepicker({
185
            format: 'yyyy-mm-dd',
186
            language: 'cs',
187
            beforeShowDay: function(date) {
188
              if (datesetDates.indexOf(formatDate(date)) < 0) {
189
                return {enabled: false, tooltip: 'Žádná data'}
190
              }
191
              else {
192
                return {enabled: true}
193
              }
194
            },
195
            autoclose: true
196
          })
197
        });
198 166
  </script>
199 167

  
200 168
{% endblock %}

Také k dispozici: Unified diff