<form id="frm-anuncioafiliado-{{ hash_vista }}" >
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Formulario de Anuncios de Afiliados</h3>
<div class="box-tools pull-right">
{% if AnuncioAfiliado %}
{{ boton("guardar","guardarCambiosAfiliadosAnuncio")}}
{% else %}
{{ boton("guardar","guardarNuevoAfiliadosAnuncio")}}
{% endif %}
{{ boton("cancelar","", "cancelarFormularioBenefiocAfiliado()")}}
{{ boton("resetear", "", "anuncioNombre.focus();")}}
</div>
<!-- /.box-tools -->
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-12" id="">
<div class="form-group">
<div class="form-group">
<label for="anuncioCATEGORIA">Categoria:</label>
<select class="form-control select2" id="anuncioCATEGORIA" name="anuncioCATEGORIA" style="width: 100%;">
<option>NINGUNA</option>
{% if CategoriasAnuncios %}
{% for categoria in CategoriasAnuncios %}
<option value="{{categoria.categoriaID}}" >{{categoria.categoriaTITULO}}</option>
{% endfor %}
{% endif %}
</select>
</div>
</div>
</div>
<div class="col-md-12" id="">
<div class="form-group">
<label for="anuncioTITULO">Titulo del Anuncio</label>
<input type="text" class="form-control uppercase" name="anuncioTITULO" id="anuncioTITULO" required
value="{{ AnuncioAfiliado.anuncioTITULO }}" placeholder="Titulo del Anuncios" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-6" >
<div class="form-group">
<label for="anuncioDESCRIPCION">Contenido de la Anuncio</label>
<textarea rows="10" cols="80" class="wysiwyg form-control " placeholder="Descripción del anuncio"
name="anuncioDESCRIPCION" id="anuncioDESCRIPCION-{{ hash_vista }}"
>{{ AnuncioAfiliado.anuncioDESCRIPCION }}</textarea>
</div>
<div class="form-group">
<label for="anuncioLINK">Link de Anuncio Externa</label>
<input type="url" class="form-control" name="anuncioLINK" id="anuncioLINK"
value="{{ AnuncioAfiliado.anuncioLINK }}" placeholder="Link de Anuncio" >
</div>
<div class="form-group">
<label>Estado:</label>
</div>
<div class="form-group">
<label class="col-sm-6">
<input type="radio" name="anuncioEstado" id="anuncioActivado" class="flat-red" required
{% if AnuncioAfiliado.anuncioESTADO == 'ACTIVO'%}checked{% endif %} value="ACTIVO" />
ACTIVADO
</label>
<label class="col-sm-6">
<input type="radio" name="anuncioEstado" id="anuncioSuspendido" class="flat-red" required
{% if AnuncioAfiliado.anuncioESTADO == 'SUSPENDIDO' %}checked{% endif %} value="SUSPENDIDO" />
SUSPENDIDO
</label>
</div>
</div>
<div class="col-md-6" >
<div class="thumbnail">
<img src="{% if AnuncioAfiliado.anuncioIMGMAX %}{{ AnuncioAfiliado.anuncioIMGMAX }}{% else %}http://via.placeholder.com/300x420/FEDCBA/000000/?text=Anuncios+300x420{% endif %}" alt="Imagen Promocional Completa" class="img-thumbnail" style="width:100%" />
<div class="caption">
<label for="anuncioMax">Imagen Completa</label>
<input accept="image/*" class="file anuncioFile" data-show-upload="false" data-show-caption="true"
type="file" id="anuncioMax" name='anuncioMax' {% if not AnuncioAfiliado %}required{% endif %} />
</div>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" name="anuncioID" value="{{AnuncioAfiliado.anuncioID}}" />
</form>
<script>
$(document).ready(function () {
$("#frm-anuncioafiliado-{{hash_vista}}").submit(function(){
ejecutarOperacionArchivo(
"afiliados","AfiliadosAnuncios","guardarDatosAnuncio",
crearFormData("frm-anuncioafiliado-{{ hash_vista }}"),
function(anuncio){
cerrarTabContenedor("frm-anuncioafiliado-{{hash_vista}}");
cargarVista('afiliados','afiliadosAnuncios','mostrarFormularioEditar', 'anuncioID='+anuncio.anuncioID );
cargarTablaAnuncios();
}
);
});
$("#anuncioDESCRIPCION-{{ hash_vista }}").wysihtml5();
$(".anuncioFile").fileinput({
previewFileType: "image",
maxFileSize: 512,
// slugCallback: function (filename) {
// return filename.replace('(', '_').replace(']', '_');
// }
});
$('#anuncioESTADO').iCheck({
checkboxClass: 'icheckbox_flat-green',
radioClass : 'iradio_flat-green'
});
$('.select2').select2()
});
function cancelarFormularioBenefiocAfiliado (){
cerrarTabContenedor("frm-anuncioafiliado-{{ hash_vista }}");
}
</script>