mirror of https://github.com/interlegis/sapl.git
				
				
			
				 20 changed files with 1082 additions and 376 deletions
			
			
		| @ -1,8 +1,124 @@ | |||||
|  | from crispy_forms.helper import FormHelper | ||||
|  | from crispy_forms.layout import Layout, Fieldset, ButtonHolder, Submit, Field,\ | ||||
|  |     Div, Column, Row, Hidden, Button | ||||
| from django import forms | from django import forms | ||||
|  | from django.core.urlresolvers import reverse | ||||
|  | from django.forms.models import ModelForm | ||||
| from django.utils.translation import ugettext_lazy as _ | from django.utils.translation import ugettext_lazy as _ | ||||
| 
 | 
 | ||||
|  | from compilacao.models import Nota, TipoNota, Dispositivo | ||||
|  | import sapl | ||||
|  | 
 | ||||
| 
 | 
 | ||||
| class UpLoadImportFileForm(forms.Form): | class UpLoadImportFileForm(forms.Form): | ||||
|     import_file = forms.FileField( |     import_file = forms.FileField( | ||||
|         required=True, |         required=True, | ||||
|         label=_('Arquivo formato ODF para Importanção')) |         label=_('Arquivo formato ODF para Importanção')) | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | def get_tipos_nota(): | ||||
|  |     return [(t.id, t.sigla + ' - ' + t.nome) for t in TipoNota.objects.all()] | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | class NotaForm(ModelForm): | ||||
|  |     NPRIV = 1 | ||||
|  |     NSTRL = 2 | ||||
|  |     NINST = 3 | ||||
|  |     NPUBL = 4 | ||||
|  | 
 | ||||
|  |     PUBLICIDADE_CHOICES = ( | ||||
|  |         # Only the owner of the note has visibility. | ||||
|  |         (NPRIV, _('Nota Privada')), | ||||
|  |         # All of the same group have visibility. | ||||
|  |         (NSTRL, _('Nota Setorial')), | ||||
|  |         # All authenticated users have visibility. | ||||
|  |         (NINST, _('Nota Institucional')), | ||||
|  |         # All users have visibility. | ||||
|  |         (NPUBL, _('Nota Pública')), | ||||
|  |     ) | ||||
|  | 
 | ||||
|  |     titulo = forms.CharField(label=' ', required=False) | ||||
|  |     texto = forms.CharField(label='', widget=forms.Textarea) | ||||
|  |     url_externa = forms.URLField(label='', required=False) | ||||
|  | 
 | ||||
|  |     publicidade = forms.ChoiceField( | ||||
|  |         required=True, | ||||
|  |         label='Publicidade', | ||||
|  |         choices=PUBLICIDADE_CHOICES, | ||||
|  |         widget=forms.Select(attrs={'class': 'selector'})) | ||||
|  | 
 | ||||
|  |     tipo = forms.ModelChoiceField( | ||||
|  |         required=False, | ||||
|  |         label='Tipo da Nota', | ||||
|  |         queryset=TipoNota.objects.all(), | ||||
|  |         empty_label=None) | ||||
|  | 
 | ||||
|  |     publicacao = forms.DateField(label=u'Publicação', | ||||
|  |                                  input_formats=['%d/%m/%Y'], | ||||
|  |                                  required=True, | ||||
|  |                                  widget=forms.DateInput( | ||||
|  |                                      format='%d/%m/%Y')) | ||||
|  |     efetividade = forms.DateField(label=u'Efetividade', | ||||
|  |                                   input_formats=['%d/%m/%Y'], | ||||
|  |                                   required=True, | ||||
|  |                                   widget=forms.DateInput( | ||||
|  |                                       format='%d/%m/%Y')) | ||||
|  |     dispositivo = forms.ModelChoiceField(queryset=Dispositivo.objects.all(), | ||||
|  |                                          widget=forms.HiddenInput()) | ||||
|  |     pk = forms.IntegerField(widget=forms.HiddenInput(), | ||||
|  |                             required=False) | ||||
|  | 
 | ||||
|  |     class Meta: | ||||
|  |         model = Nota | ||||
|  |         fields = ['titulo', | ||||
|  |                   'texto', | ||||
|  |                   'url_externa', | ||||
|  |                   'publicidade', | ||||
|  |                   'publicacao', | ||||
|  |                   'efetividade', | ||||
|  |                   'tipo', | ||||
|  |                   'dispositivo', | ||||
|  |                   'pk' | ||||
|  |                   ] | ||||
|  | 
 | ||||
|  |     def __init__(self, *args, **kwargs): | ||||
|  | 
 | ||||
|  |         row1 = sapl.layout.to_row([ | ||||
|  |             ('tipo', 4), | ||||
|  |         ]) | ||||
|  |         row1.append( | ||||
|  |             Column( | ||||
|  |                 Field( | ||||
|  |                     'titulo', | ||||
|  |                     placeholder=_('Título da Nota (opcional)') | ||||
|  |                 ), | ||||
|  |                 css_class='columns large-8')) | ||||
|  | 
 | ||||
|  |         row3 = sapl.layout.to_row([ | ||||
|  |             ('publicidade', 3), | ||||
|  |             ('publicacao', 3), | ||||
|  |             ('efetividade', 3), | ||||
|  |             (Button('submit', 'Salvar', | ||||
|  |                     css_class='button primary'), 3) | ||||
|  |         ]) | ||||
|  | 
 | ||||
|  |         self.helper = FormHelper() | ||||
|  |         self.helper.layout = Layout( | ||||
|  |             row1, | ||||
|  |             Field('texto', placeholder=_('Adicionar Nota')), | ||||
|  |             Field('url_externa', placeholder=_('URL Externa (opcional)')), | ||||
|  |             row3 | ||||
|  |         ) | ||||
|  | 
 | ||||
|  |         kwargs.pop('norma_id') | ||||
|  |         dispositivo_id = kwargs.pop('dispositivo_id') | ||||
|  |         if 'pk' in kwargs: | ||||
|  |             pk = kwargs.pop('pk') | ||||
|  |         else: | ||||
|  |             pk = '' | ||||
|  | 
 | ||||
|  |         super(NotaForm, self).__init__(*args, **kwargs) | ||||
|  | 
 | ||||
|  |         self.fields['dispositivo'].initial = dispositivo_id | ||||
|  |         if pk: | ||||
|  |             self.fields['pk'].initial = pk | ||||
|  | |||||
| @ -0,0 +1,24 @@ | |||||
|  | # -*- coding: utf-8 -*- | ||||
|  | from __future__ import unicode_literals | ||||
|  | 
 | ||||
|  | from django.db import migrations, models | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | class Migration(migrations.Migration): | ||||
|  | 
 | ||||
|  |     dependencies = [ | ||||
|  |         ('compilacao', '0024_auto_20151120_1814'), | ||||
|  |     ] | ||||
|  | 
 | ||||
|  |     operations = [ | ||||
|  |         migrations.RenameField( | ||||
|  |             model_name='nota', | ||||
|  |             old_name='efetifidade', | ||||
|  |             new_name='efetividade', | ||||
|  |         ), | ||||
|  |         migrations.AlterField( | ||||
|  |             model_name='nota', | ||||
|  |             name='dispositivo', | ||||
|  |             field=models.ForeignKey(to='compilacao.Dispositivo', related_name='notas', verbose_name='Dispositivo da Nota'), | ||||
|  |         ), | ||||
|  |     ] | ||||
| @ -0,0 +1,28 @@ | |||||
|  | # -*- coding: utf-8 -*- | ||||
|  | from __future__ import unicode_literals | ||||
|  | 
 | ||||
|  | from django.db import migrations, models | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | class Migration(migrations.Migration): | ||||
|  | 
 | ||||
|  |     dependencies = [ | ||||
|  |         ('compilacao', '0025_auto_20151122_1744'), | ||||
|  |     ] | ||||
|  | 
 | ||||
|  |     operations = [ | ||||
|  |         migrations.AlterModelOptions( | ||||
|  |             name='nota', | ||||
|  |             options={'verbose_name': 'Nota', 'ordering': ['publicacao'], 'verbose_name_plural': 'Notas'}, | ||||
|  |         ), | ||||
|  |         migrations.AddField( | ||||
|  |             model_name='nota', | ||||
|  |             name='titulo', | ||||
|  |             field=models.CharField(verbose_name='Título', max_length=100, default=''), | ||||
|  |         ), | ||||
|  |         migrations.AlterField( | ||||
|  |             model_name='nota', | ||||
|  |             name='texto', | ||||
|  |             field=models.TextField(verbose_name='Texto'), | ||||
|  |         ), | ||||
|  |     ] | ||||
| After Width: | Height: | Size: 682 B | 
| After Width: | Height: | Size: 502 B | 
| @ -0,0 +1,254 @@ | |||||
|  | 
 | ||||
|  | var editortype = "textarea"; | ||||
|  | var gets = 0; | ||||
|  | var onSubmitEditForm = function(event) { | ||||
|  | 
 | ||||
|  | 	var texto = ''; | ||||
|  | 	var editorTiny = tinymce.get('editdi_texto'); | ||||
|  | 
 | ||||
|  | 	if (editorTiny != null) | ||||
|  | 		texto = editorTiny.getContent(); | ||||
|  | 	else | ||||
|  | 		texto = $('#editdi_texto').val(); | ||||
|  | 
 | ||||
|  | 	var formData = { | ||||
|  | 		'csrfmiddlewaretoken' : $('input[name=csrfmiddlewaretoken]').val(), | ||||
|  | 		'texto'               : texto | ||||
|  | 	}; | ||||
|  | 
 | ||||
|  | 	var url = $('.csform form').attr( "action_ajax" ); | ||||
|  | 	$("#message_block").css("display", "block"); | ||||
|  | 
 | ||||
|  | 	$.post(url, formData) | ||||
|  | 	.done(function(data) { | ||||
|  | 
 | ||||
|  | 		if (typeof data == "string") { | ||||
|  | 			$('.dpt-selected').html(data); | ||||
|  | 			clearEditSelected(); | ||||
|  | 			reloadFunctionClicks(); | ||||
|  | 			return; | ||||
|  | 		} | ||||
|  | 
 | ||||
|  | 		clearEditSelected(); | ||||
|  | 
 | ||||
|  | 		if (data.pk != null) | ||||
|  | 			refreshScreenFocusPk(data); | ||||
|  | 		else { | ||||
|  | 			alert('Erro na inserção!'); | ||||
|  | 			flag_refresh_all = false; | ||||
|  | 		} | ||||
|  | 
 | ||||
|  | 	}).always(function() { | ||||
|  | 		$("#message_block").css("display", "none"); | ||||
|  | 	}); | ||||
|  | 	if (event != null) | ||||
|  | 		event.preventDefault(); | ||||
|  | } | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | var clickEditDispositivo = function(event) { | ||||
|  | 	var _pk = event.currentTarget.getAttribute('pk'); | ||||
|  | 	if ($('#dpt'+_pk).hasClass("dpt-selected")) { | ||||
|  | 		clearEditSelected(); | ||||
|  | 		return; | ||||
|  | 	} | ||||
|  | 	clearEditSelected(); | ||||
|  | 	clickUpdateDispositivo(event); | ||||
|  | } | ||||
|  | 
 | ||||
|  | var clickUpdateDispositivo = function(event, __pk_refresh, __pk_edit, __action, flag_actions_vibible, flag_refresh_all) { | ||||
|  | 
 | ||||
|  | 	var pk_refresh = __pk_refresh; | ||||
|  | 	var pk_edit = __pk_edit; | ||||
|  | 	var _action = __action; | ||||
|  | 	var _variacao = ''; | ||||
|  | 	var _tipo_pk = ''; | ||||
|  | 	var _perfil_pk = ''; | ||||
|  | 
 | ||||
|  | 	if (event != null) { | ||||
|  | 		pk_refresh = event.currentTarget.getAttribute('pk'); | ||||
|  | 		_action = $(this).attr('action'); | ||||
|  | 		_variacao = $(this).attr('variacao'); | ||||
|  | 		_tipo_pk = $(this).attr('tipo_pk'); | ||||
|  | 		_perfil_pk = $(this).attr('perfil_pk'); | ||||
|  | 	} | ||||
|  | 
 | ||||
|  | 	if (pk_edit == null) | ||||
|  | 		pk_edit = pk_refresh; | ||||
|  | 
 | ||||
|  | 	var url = ''; | ||||
|  | 	if (_action == '') | ||||
|  | 		return; | ||||
|  | 	else if ( _action == null) { | ||||
|  | 		url = pk_refresh+'/refresh?edit='+pk_edit; | ||||
|  | 	} | ||||
|  | 	else if (_action.startsWith('refresh')) { | ||||
|  | 		var str = _action.split(':'); | ||||
|  | 		if (str.length > 1) { | ||||
|  | 			if(_action.endsWith('perfil')) { | ||||
|  | 				url = '&perfil_pk='+_perfil_pk; | ||||
|  | 				$("#message_block").css("display", "block"); | ||||
|  | 			} | ||||
|  | 			else { | ||||
|  | 				editortype = str[1]; | ||||
|  | 				SetCookie("editortype", editortype, 30) | ||||
|  | 			} | ||||
|  | 		} | ||||
|  | 		url = pk_refresh+'/refresh?edit='+pk_edit+url; | ||||
|  | 
 | ||||
|  | 	} | ||||
|  | 	else if (_action.startsWith('add_')) { | ||||
|  | 
 | ||||
|  | 		url = pk_refresh+'/actions?action='+_action; | ||||
|  | 		url += '&tipo_pk='+_tipo_pk; | ||||
|  | 		url += '&variacao='+_variacao; | ||||
|  | 
 | ||||
|  | 		$("#message_block").css("display", "block"); | ||||
|  | 
 | ||||
|  | 	} | ||||
|  | 	else if (_action.startsWith('delete_')) { | ||||
|  | 		var r = confirm("Confirma Exclusão deste dispositivo?"); | ||||
|  | 		if (r == true) { | ||||
|  | 		    x = "You pressed OK!"; | ||||
|  | 		} else { | ||||
|  | 		    return | ||||
|  | 		} | ||||
|  | 		url = pk_refresh+'/actions?action='+_action; | ||||
|  | 		$("#message_block").css("display", "block"); | ||||
|  | 	} | ||||
|  | 
 | ||||
|  | 	$.get(url).done(function( data ) { | ||||
|  | 		if ( _action == null || _action.startsWith('refresh')) { | ||||
|  | 
 | ||||
|  | 			if (flag_refresh_all) { | ||||
|  |                 if (flag_actions_vibible) | ||||
|  |                     clearEditSelected(); | ||||
|  | 
 | ||||
|  | 				$( '#dpt' + pk_refresh ).html( data); | ||||
|  | 			} | ||||
|  | 			else { | ||||
|  | 				//console.log(pk_refresh + ' - '+pk_edit)
 | ||||
|  | 				if (flag_actions_vibible == null || flag_actions_vibible) | ||||
|  |                 	clearEditSelected(); | ||||
|  | 
 | ||||
|  | 				$( '#dpt' + pk_refresh ).prepend( data ); | ||||
|  | 			} | ||||
|  | 
 | ||||
|  | 			reloadFunctionClicks(); | ||||
|  | 
 | ||||
|  | 			var _editortype = editortype; | ||||
|  | 			if ( $('.edt-'+_editortype).length == 0) { | ||||
|  | 				_editortype = 'construct'; | ||||
|  | 			} | ||||
|  | 
 | ||||
|  | 			if ( _editortype == 'tinymce' ) { | ||||
|  | 				initTinymce(); | ||||
|  | 			} | ||||
|  | 			else if (_editortype == 'textarea') { | ||||
|  | 				$('.csform form').submit(onSubmitEditForm); | ||||
|  | 			} | ||||
|  | 			else if (_editortype == 'construct') { | ||||
|  | 				$('.csform .btn-salvar').parent().addClass("displaynone"); | ||||
|  | 				$('.csform .btn-salvar, .csform .fields').addClass("displaynone"); | ||||
|  | 				$('#dpt'+pk_refresh).css('min-height', $('.actions_right').height()*2); | ||||
|  | 				$('.actions_inserts').removeClass('menu_flutuante'); | ||||
|  | 			} | ||||
|  | 			else if (_editortype == 'detail') { | ||||
|  | 				$('.csform .btn-salvar').parent().removeClass("displaynone"); | ||||
|  | 				$('.csform .btn-salvar,  .csform .fields').removeClass("displaynone"); | ||||
|  | 				$('#dpt'+pk_refresh).css('min-height', $('.actions_right').height()*2); | ||||
|  | 				$('.actions_inserts').addClass('menu_flutuante'); | ||||
|  | 			} | ||||
|  | 
 | ||||
|  | 			$(".edt-"+_editortype).addClass('selected'); | ||||
|  | 			//$(".container").addClass('class_color_container');
 | ||||
|  | 
 | ||||
|  | 			if (flag_actions_vibible == null || flag_actions_vibible) { | ||||
|  | 				$('#dpt'+pk_edit).addClass('dpt-selected'); | ||||
|  | 				$('html, body').animate({ | ||||
|  | 					scrollTop: $('#dpt' + pk_edit ).offset().top - window.innerHeight / 10 | ||||
|  | 				}, 300); | ||||
|  | 			} | ||||
|  | 		} | ||||
|  | 
 | ||||
|  | 		else if (_action == 'add_next' || _action == 'add_in') { | ||||
|  | 			clearEditSelected(); | ||||
|  | 			if (data.pk != null) { | ||||
|  | 
 | ||||
|  | 				if (data.alert != null) | ||||
|  | 					alert(data.alert) | ||||
|  | 
 | ||||
|  | 				refreshScreenFocusPk(data); | ||||
|  | 			} | ||||
|  | 			else { | ||||
|  | 				alert('Erro na inserção!'); | ||||
|  | 			} | ||||
|  | 		} | ||||
|  | 		else if (_action.startsWith('delete_')) { | ||||
|  | 			$("#message_block").css("display", "block"); | ||||
|  | 			clearEditSelected(); | ||||
|  | 			if (data.pk != null) { | ||||
|  | 				refreshScreenFocusPk(data); | ||||
|  | 			} | ||||
|  | 			else { | ||||
|  | 				alert('Erro exclusão!'); | ||||
|  | 			} | ||||
|  | 		} | ||||
|  | 		else { | ||||
|  | 			clearEditSelected(); | ||||
|  | 			reloadFunctionClicks(); | ||||
|  | 		} | ||||
|  | 	}).always(function() { | ||||
|  | 		$("#message_block").css("display", "none"); | ||||
|  | 	}); | ||||
|  | } | ||||
|  | 
 | ||||
|  | function refreshScreenFocusPk(data) { | ||||
|  | 
 | ||||
|  | 	for (var pai = 0; pai < data.pai.length; pai++) | ||||
|  | 		if (data.pai[pai] != -1) { | ||||
|  | 			clickUpdateDispositivo(null, data.pai[pai], data.pk, 'refresh', pai == 0, true); | ||||
|  | 		} | ||||
|  | 		else { | ||||
|  | 			href = location.href.split('#')[0] | ||||
|  | 			location.href = href+'#'+data.pk | ||||
|  | 			location.reload(true) | ||||
|  | 		} | ||||
|  | } | ||||
|  | 
 | ||||
|  | function clearEditSelected() { | ||||
|  | 	$(".container").removeClass('class_color_container'); | ||||
|  | 	tinymce.remove(); | ||||
|  | 	$('.dpt-selected').removeClass('dpt-selected'); | ||||
|  | 	$('.dpt').css('min-height', ''); | ||||
|  | 	$('.csform').remove(); | ||||
|  | } | ||||
|  | 
 | ||||
|  | function reloadFunctionClicks() { | ||||
|  | 	$('.dpt .de, .btn-action, .btn-edit').off(); | ||||
|  | 
 | ||||
|  | 	$('.dpt .de, .btn-edit').on('click', clickEditDispositivo); | ||||
|  | 
 | ||||
|  | 	$('.btn-action').on('click', clickUpdateDispositivo); | ||||
|  | 
 | ||||
|  | 	$('#editdi_texto').focus(); | ||||
|  | } | ||||
|  | 
 | ||||
|  | $(document).ready(function() { | ||||
|  | 
 | ||||
|  | 	editortype = ReadCookie("editortype") | ||||
|  | 
 | ||||
|  | 	if (editortype == null || editortype == "") { | ||||
|  | 		editortype = "textarea" | ||||
|  | 		SetCookie("editortype", editortype, 30) | ||||
|  | 	} | ||||
|  | 
 | ||||
|  | 	reloadFunctionClicks(); | ||||
|  | 	$("#message_block").css("display", "none"); | ||||
|  | 
 | ||||
|  | 	href = location.href.split('#') | ||||
|  | 	if (href.length == 2) { | ||||
|  | 		clickUpdateDispositivo(null, href[1], href[1], 'refresh', true); | ||||
|  | 	} | ||||
|  | 
 | ||||
|  | }); | ||||
| @ -0,0 +1,91 @@ | |||||
|  | 
 | ||||
|  | function onEventsDneExec(pk) { | ||||
|  | 
 | ||||
|  | 	$('html, body').animate({ | ||||
|  | 		scrollTop: $('#dne' + pk ).offset().top - window.innerHeight / 5 | ||||
|  | 	}, 300); | ||||
|  | 
 | ||||
|  | 	$('.dateinput').fdatepicker({ | ||||
|  |         // TODO localize
 | ||||
|  |         format: 'dd/mm/yyyy', | ||||
|  |         language: 'pt', | ||||
|  |         endDate: '31/12/2100', | ||||
|  |         todayBtn: true | ||||
|  |     }); | ||||
|  | 
 | ||||
|  | 	$('#dne'+pk+" select[name='tipo']").change(function(event) { | ||||
|  | 		var url = ''; | ||||
|  | 		url = 'compilacao/'+pk+'/nota/create?action=modelo_nota&id_tipo='+this.value; | ||||
|  | 		$.get(url).done(function( data ) { | ||||
|  | 			$('#dne'+pk+" textarea[name='texto']").val(data); | ||||
|  | 		}); | ||||
|  | 	}); | ||||
|  | 
 | ||||
|  | 	$('#dne'+pk+" .button").click(onSubmitEditForm); | ||||
|  | } | ||||
|  | 
 | ||||
|  | var onSubmitEditForm = function(event) { | ||||
|  | 
 | ||||
|  | 	var id_dispositivo = $('#id_dispositivo').val(); | ||||
|  | 	var id_nota = $('#id_pk').val(); | ||||
|  | 	var url = 'compilacao/'+id_dispositivo+'/nota/' | ||||
|  | 
 | ||||
|  | 	if (id_nota == '') | ||||
|  | 		url += 'create'; | ||||
|  | 	else | ||||
|  | 		url += id_nota+'/edit'; | ||||
|  | 
 | ||||
|  | 	$.post( url, $('#dne'+id_dispositivo+" form").serialize(), function(data) { | ||||
|  | 
 | ||||
|  | 			if (typeof data == "string") { | ||||
|  | 				if (data.indexOf('<form') >= 0) { | ||||
|  | 					$('#dne'+id_dispositivo+' .dne-form').html(data); | ||||
|  | 					onEventsDneExec(id_dispositivo); | ||||
|  | 				} | ||||
|  | 				else { | ||||
|  | 					$('#dne'+id_dispositivo+' .dne-form').closest('.dpt').html(data) | ||||
|  | 					onReadyNotas(); | ||||
|  | 				} | ||||
|  | 			} | ||||
|  | 		} | ||||
|  | 	); | ||||
|  | } | ||||
|  | function getFormNota(_this, _btn) { | ||||
|  | 
 | ||||
|  | 	var id_dispositivo = $('.dne-exec .dne-form').closest('.dne').attr('pk'); | ||||
|  | 	if (id_dispositivo != null) { | ||||
|  | 		$('#dne'+id_dispositivo).removeClass('dne-exec'); | ||||
|  | 		$('#dne'+id_dispositivo+' .dne-form').html(''); | ||||
|  | 	} | ||||
|  | 
 | ||||
|  | 	var url = ''; | ||||
|  | 	if (_btn == 'btn-create') { | ||||
|  | 		id_dispositivo = $(_this).attr('pk'); | ||||
|  | 		url = 'compilacao/'+id_dispositivo+'/nota/create'; | ||||
|  | 		} | ||||
|  | 	else { | ||||
|  | 		var id_nota = $(_this).attr('pk'); | ||||
|  | 		id_dispositivo = $(_this).closest('.dn').attr('pk'); | ||||
|  | 		url = 'compilacao/'+id_dispositivo+'/nota/'+id_nota+'/edit' | ||||
|  | 	} | ||||
|  | 	$('#dne'+id_dispositivo).addClass('dne-exec'); | ||||
|  | 	$('#dne'+id_dispositivo).addClass('dne-exec'); | ||||
|  | 
 | ||||
|  | 	$.get(url).done(function( data ) { | ||||
|  | 		$('#dne'+id_dispositivo+' .dne-form').html(data); | ||||
|  | 		onEventsDneExec(id_dispositivo); | ||||
|  | 	}); | ||||
|  | } | ||||
|  | function onReadyNotas() { | ||||
|  | 		$('.dne .btn-create').off(); | ||||
|  | 		$('.dne .btn-edit').off(); | ||||
|  | 		$('.dne .btn-create').click(function(){ | ||||
|  | 			getFormNota(this, 'btn-create') | ||||
|  | 		}); | ||||
|  | 		$('.dn .btn-edit').click(function(){ | ||||
|  | 			getFormNota(this, 'btn-edit') | ||||
|  | 		}); | ||||
|  | } | ||||
|  | $(document).ready(function() { | ||||
|  | 	onReadyNotas() | ||||
|  | }); | ||||
| @ -0,0 +1,40 @@ | |||||
|  | $( window ).scroll(function() { | ||||
|  |     if (window.pageYOffset <= 180) | ||||
|  |         $( "section.vigencias" ).removeClass("fixed"); | ||||
|  |     else if (!$( "section.vigencias" ).hasClass("fixed")) | ||||
|  |         $( "section.vigencias" ).addClass("fixed"); | ||||
|  | }); | ||||
|  | 
 | ||||
|  | $(window).load(function() { | ||||
|  |     setTimeout(function() { | ||||
|  | 	    height = $( "section.vigencias" ).height(); | ||||
|  |         $('html, body').animate({ | ||||
|  |         scrollTop:  window.pageYOffset - height - 55 | ||||
|  |         }, 300); | ||||
|  |     }, 100); | ||||
|  | }); | ||||
|  | 
 | ||||
|  | function textoMultiVigente(item) { | ||||
|  | 	$(".cp .tipo-vigencias a").removeClass("selected") | ||||
|  | 	$(item).addClass("selected") | ||||
|  | 	$(".desativado").removeClass("displaynone"); | ||||
|  | 	$(".link_alterador").removeClass("displaynone"); | ||||
|  | } | ||||
|  | 
 | ||||
|  | function textoVigente(item, link) { | ||||
|  | 	$(".cp .tipo-vigencias a").removeClass("selected") | ||||
|  | 	$(item).addClass("selected") | ||||
|  | 	$(".desativado").addClass("displaynone"); | ||||
|  | 	$(".link_alterador").removeClass("displaynone"); | ||||
|  | 	if (!link) | ||||
|  | 		$(".link_alterador").addClass("displaynone"); | ||||
|  | } | ||||
|  | 
 | ||||
|  | $(document).ready(function() { | ||||
|  | 	$("#btn_font_menos").click(function() { | ||||
|  | 	    $(".dpt").css("font-size", "-=1"); | ||||
|  | 	}); | ||||
|  | 	$("#btn_font_mais").click(function() { | ||||
|  | 	    $(".dpt").css("font-size", "+=1"); | ||||
|  | 	}); | ||||
|  | }); | ||||
| @ -0,0 +1,3 @@ | |||||
|  | {% load crispy_forms_tags %}  | ||||
|  | {% crispy form form.helper%}     | ||||
|  | 
 | ||||
					Loading…
					
					
				
		Reference in new issue