Active/inactive client functionality added
This commit is contained in:
@@ -22,10 +22,9 @@
|
||||
{% render_field form.Activo class+="form-checkbox" type="checkbox" %}
|
||||
<label class="form-check-label" for="{{form.Activo.label}}">Activo</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
{% render_field form.fecha_baja.label %}
|
||||
{% render_field form.fecha_baja placeholder=form.fecha_baja.label class+="form-control" type="date" %}
|
||||
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
@@ -33,6 +32,14 @@
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
window.addEventListener("load", (event)=>{
|
||||
if(!id_Activo.checked){
|
||||
id_fecha_baja.setAttribute('required','')
|
||||
}else{
|
||||
id_fecha_baja.removeAttribute('requied')
|
||||
}
|
||||
})
|
||||
|
||||
id_fecha_baja.addEventListener('click',(event)=>{
|
||||
|
||||
if(id_Activo.checked){
|
||||
@@ -41,6 +48,16 @@
|
||||
return
|
||||
}
|
||||
})
|
||||
id_Activo.addEventListener('click', (event)=>{
|
||||
|
||||
if(id_Activo.checked){
|
||||
id_fecha_baja.value=''
|
||||
id_fecha_baja.removeAttribute('required')
|
||||
|
||||
}else{
|
||||
id_fecha_baja.setAttribute('required','')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
{% endblock scripts %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user