{% extends 'registration/base_custom.html' %} {% block title %}Admin - Documenti{% endblock %} {% block nav %} {% endblock %} {% block content %}
{% csrf_token %}
{% endblock %} {%block script%} $(document).ready(function(){ $('.collapsible').collapsible(); $('.tooltipped').tooltip(); $('.modal').modal(); $('.datepicker').datepicker(options); {% if error %} M.toast({html: '{{ error_text}}', classes: 'orange'}) {% endif %} }); $('.chips').chips(); $('#chips_type').chips({ placeholder: 'Tipo', secondaryPlaceholder: '+Altro tipo', autocompleteOptions: { data: { {% for t in types %} '{{t.name}}': null, {% endfor %} }, limit: Infinity, minLength: 0 }, data: [ {% for d in chips_type %} {tag: '{{d}}'}, {% endfor %} ] }); $('#chips_owner').chips({ placeholder: 'Utente', secondaryPlaceholder: '+Altro utente', autocompleteOptions: { data: { {% for user in users %} '{{user.username}} ({{user.first_name}} {{user.last_name}})': null, {% endfor %} }, limit: Infinity, minLength: 0 }, data: [ {% for d in chips_owner %} {tag: '{{d}}'}, {% endfor %} ] }); $('#chips_groups').chips({ placeholder: 'Gruppo', secondaryPlaceholder: '+Altro gruppo', autocompleteOptions: { data: { {% for g in groups %} '{{g}}': null, {% endfor %} }, limit: Infinity, minLength: 0 }, data: [ {% for g in chips_groups %} {tag: '{{g}}'}, {% endfor %} ] }); function send(id) { var form = document.getElementById('selection') var action = document.getElementById('action') var owner = document.getElementById('owner') var type = document.getElementById('type') var groups = document.getElementById('groups') var chips_owner = M.Chips.getInstance(document.getElementById('chips_owner')); var chips_type = M.Chips.getInstance(document.getElementById('chips_type')); var chips_groups = M.Chips.getInstance(document.getElementById('chips_groups')); var type_array = [] var owner_array = [] var groups_array = [] for (i=0; i < chips_owner.chipsData.length; i++) { owner_array.push(chips_owner.chipsData[i].tag) } for (i=0; i < chips_type.chipsData.length; i++) { type_array.push(chips_type.chipsData[i].tag) } for (i=0; i < chips_groups.chipsData.length; i++) { groups_array.push(chips_groups.chipsData[i].tag) } action.setAttribute('value', id); owner.setAttribute('value', owner_array.join("^|")) type.setAttribute('value', type_array.join("^|")) groups.setAttribute('value', groups_array.join("^|")) form.submit() } $('#select-all').click(function(event) { if(this.checked) { // Iterate each checkbox $('.allselect').each(function() { this.checked = true; }); } else { $('.allselect').each(function() { this.checked = false; }); } }); var options = { showClearBtn: true, container: document.getElementById('main'), yearRange:100, format:'dd mmmm yyyy', i18n: { months: [ 'gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre' ], monthsShort: [ 'gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic' ], weekdays: [ 'domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato' ], weekdaysShort: [ 'dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab' ], weekdaysAbbrev: [ 'D', 'L', 'M', 'M', 'G', 'V', 'S' ], today: 'Oggi', clear: 'Cancella', close: 'Chiudi', cancel: 'Annulla', firstDay: 1, format: 'dddd d mmmm yyyy', formatSubmit: 'yyyy/mm/dd', labelMonthNext: 'Mese successivo', labelMonthPrev: 'Mese precedente', labelMonthSelect: 'Seleziona un mese', labelYearSelect: 'Seleziona un anno' } } {% endblock %}