{% extends "django_msp_sms\base.html" %}
{% block title %}SMS Masivo{% endblock %}

<!-- CSS Code -->
{% block style_css %}{% endblock %}

<!-- JavaScript Code -->
{% block js_code %}
	{{ block.super }} 
	<script src="{{STATIC_URL}}js/countdown.min.js"></script>
	<script src="{{STATIC_URL}}js/countdown.task.js"></script>
	<script src="{{STATIC_URL}}js/django_msp_sms/saldos/tarea_preferencias.js"></script>
{% endblock %}

{% block breadcrumb %}{{ block.super }} 
  <li class='active'> Saldos a Todos los Clientes automatico</li>{% endblock %}
{% block content %}
<div >
	<br style="clear:both;">
	{% if msg %}
		<div class="alert alert-success fade in">
		    <button type="button" class="close" data-dismiss="alert">×</button>
		    {{ msg }}
		</div>
	{% endif %}
	{%if errors %}
		<div class="alert alert-warning fade in">
		<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
		<strong>:/ Aplicación de Tareas automáticas requerida</strong>

		{% for error in errors %}
		  <br>
		  {% autoescape off %} {{ error }} {% endautoescape %}
		{% endfor %}
		</div>
	{% else %}
		<form method="post" class="form-horizontal" action="" enctype='multipart/form-data'>{% csrf_token %}
		<div id="id_modal_seguro" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
		  <div class="modal-dialog">
		    <div class="modal-content">
		      <div class="modal-header">
		          <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Cerrar</span></button>
		          <h4 class="modal-title" id="mySmallModalLabel">Seguro que deseas guardar la tarea</h4>
		        </div>
		        <div class="modal-body">
		          <div class="alert alert-success fade in">
		            <span class="info_guardar_preview">
		            	
		            </span>
		          </div>
		          <div class="row">
		            {{ form.sysdba_password }} 
		          </div>
		        </div>
		        <div class="modal-footer">
		          <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
		          <input type="submit" class="btn btn-default" onclick="this.disabled=true,this.form.submit(), this.value='Procesando petición...';" value="Si, Estoy seguro" />
		        </div>
		    </div>
		  </div>
		</div>
		{{ form.errors }}
		<div class="alert alert-info" role="alert" id="id_siguiente_ejecucion_alert">
			{{ form.next_execution }}
			<span id="id_siguiente_ejecucion_text"></span>
		</div>		
		<div class="page-header">
			<h3><b>Envío de Saldos a Todos los Clientes por periodos</b> 
			<a href="#" class="btn btn-default" id="id_btnshow_modal">Guardar</a>  
			</h3>
		</div>
		<!-- Tab panes -->
		<div class="tab-content">
			<div class="tab-pane active" id="home" style="margin: 0 1em;">
				<div class="row">
					<div class="col-md-4 col-xs-10 col-sm-10">
			          <div class="input-group">
						<span class="input-group-addon">Inicio</span>
						{{ form.period_start_datetime }}
						<span class="input-group-addon">Fin</span>
						{{ form.period_end_datetime }}
					  </div>
			        </div>
			        <div class="col-md-4 col-xs-10 col-sm-10">
			          <div class="input-group">
						<span class="input-group-addon">Cada</span>
						{{ form.period_quantity }}
						<span class="input-group-addon">Fin</span>
						{{ form.period_unit }}
					  </div>
			        </div>
				</div>
				
		  	</div>
		</div>
		</form>
	{% endif %}

</div>
{% endblock %}