{% extends "formwizard/profesor/wizard_base.html" %}
{% load cuestionario_wizard %}

{% block formwizard%}
				<fieldset> <legend> <h1 style="padding-left:3%;">Editar Actividad</h1> </legend> 
               <form id="ActividadForm" method="post" action="{%url editar_actividad_wizard informacion.asignatura step0%}" class="form-horizontal ">
                  {% csrf_token %}
				{% for field in form%}
					<div class="control-group">
						<label class="control-label" for="input01" style="margin-right:10%;"><p><strong>{{ field.label}}</strong></p></label>
						{% if  field.errors %}
	                        <div class="alert alert-error" style="margin-top:0.4em;width:10em;">
	                            <a class="close" data-dismiss="alert">×</a>
	                            <strong>ERROR</strong>{{ field.errors }}
	                        </div>
                        {%endif%}
						<div class="controls">						
							<p>{{field}}</p>
						</div>
					</div>

				{% endfor %}
				</fieldset>
				
				<fieldset>
					<legend> <h1 style="padding-left:3%;">Preguntas</h1> </legend>
						{% ver_preguntas_actividad step0 %}
		        <div id="add_pregunta" class="pull-right" style="margin-right:4%;">
						<a data-toggle="modal" href="{% url crear_pregunta_actividad_wizard informacion.asignatura step0  %}" class="btn btn-primary btn-large"><i class="icon-plus"></i> Añadir</a>


		        </div><!--/span-->
		         </fieldset>



                  <div id="form-edit">
				  <div class="form-actions">
				  	<div class="pull-right">
                     <button type="submit" class="btn btn-primary btn-large btn-success">Siguiente</button>
                     <a href="{%url tareas_indice informacion.asignatura %}" class="btn btn-primary btn-large btn-danger">Volver</a>
				  	</div>
                  </div>
              	</div>
			  	</form>


{% endblock %}

{% block extra_js%}

<script src="{{MEDIA_URL}}js/bootstrap/bootstrap-datepicker.js"></script>
<script src="{{MEDIA_URL}}js/bootstrap/bootstrap-timepicker.js"></script>

<script type="text/javascript"> 
 	$(document).ready(function () { 
    		$(".datepicker").datepicker({format: 'dd/mm/yyyy'});

            $('.timepicker').timepicker({
                defaultTime: 'current',
                minuteStep: 15,
                disableFocus: true,
                showMeridian: false,
                template: 'dropdown'
            });

        });


	  $("#title-1").removeClass("current-step");
	  $("#title-0").addClass("current-step")

	  $('#title-0 a').attr('href', '{% url editar_actividad_wizard informacion.asignatura step0 %}');
	  $('#title-1 a').attr('href', '{% url crear_cuestionario_wizard informacion.asignatura step0 %}');
	  $('#title-0 span').replaceWith('<span>Modifica la tarea</span>');

	  $("span[id*=pregunta-]").each(function(i) {
		 var valor = $(this).text();
		 var url = "{%url editar_actividad_wizard informacion.asignatura step0 %}pregunta/" + valor;

		 var url_view = url + '/view';
	 	 $('a[name=view-pregunta-'+valor+']').attr('href', url_view);

		 var url_editar = url + '/edit';
	 	 $('a[name=edit-pregunta-'+valor+']').attr('href', url_editar);
	 	 
	 	 var url_borrar =url + '/del'
	 	 $('a[name=del-pregunta-'+valor+']').attr('href', url_borrar);

		});



</script>
{% endblock %}