99 lines
5.8 KiB
HTML
99 lines
5.8 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<div id="page" class=" sidebar_right">
|
|
<div class="container">
|
|
<div id="frame2">
|
|
<div id="content">
|
|
<div class="row">
|
|
<div class="col-md-12 col-lg-12">
|
|
<h1>{% if prestation_id %}Modification{% else %}Nouvelle{% endif %} prestation</h1>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xs-12 col-sm-12 col-md-10 col-lg-8 col-md-offset-1 col-lg-offset-2">
|
|
<div class="well well-small text-right">
|
|
<form action="{% if prestation_id %}{% url 'prestation_update' prestation_id %}{% else %}{% url 'prestation_create' %}{% endif %}" method="post" class="form-horizontal" id="formulaire" name="formulaire">
|
|
{% csrf_token %}
|
|
|
|
<div class="form-group row ">
|
|
<label for="id_contract" class="col-sm-4 col-md-4 col-lg-3 col-xl-2 control-label">{{ form.contract.label }}</label>
|
|
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6 {% if form.contract.errors %}has-danger{% endif %}">
|
|
{{ form.contract }}
|
|
{% if form.contract.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.contract.errors %}{{error}}{% endfor %}</span>{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="form-group row ">
|
|
<label for="id_date" class="col-sm-4 col-md-4 col-lg-3 col-xl-2 control-label">{{ form.date.label }}</label>
|
|
<div class="col-sm-3 col-md-3 col-lg-3 col-xl-3 {% if form.date.errors %}has-danger{% endif %}">
|
|
{{ form.date }}
|
|
{% if form.date.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.date.errors %}{{error}}{% endfor %}</span>{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="form-group row ">
|
|
<label for="id_label" class="col-sm-4 col-md-4 col-lg-3 col-xl-2 control-label">{{ form.label.label }}</label>
|
|
<div class="col-sm-6 col-md-6 col-lg-8 col-xl-8 {% if form.label.errors %}has-danger{% endif %}">
|
|
{{ form.label }}
|
|
{% if form.label.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.label.errors %}{{error}}{% endfor %}</span>{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="form-group row ">
|
|
<label for="id_unit" class="col-sm-4 col-md-4 col-lg-3 col-xl-2 control-label">{{ form.unit.label }}</label>
|
|
<div class="col-sm-3 col-md-3 col-lg-2 col-xl-2 {% if form.unit.errors %}has-danger{% endif %}">
|
|
{{ form.unit }}
|
|
{% if form.unit.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.unit.errors %}{{error}}{% endfor %}</span>{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="form-group row ">
|
|
<label for="id_unit_price" class="col-sm-4 col-md-4 col-lg-3 col-xl-2 control-label">{{ form.unit_price.label }}</label>
|
|
<div class="col-sm-3 col-md-3 col-lg-2 col-xl-2 {% if form.unit_price.errors %}has-danger{% endif %}">
|
|
{{ form.unit_price }}
|
|
{% if form.unit_price.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.unit_price.errors %}{{error}}{% endfor %}</span>{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="form-group text-center">
|
|
<input type="submit" value="{% if prestation_id %}Modifier{% else %}Sauvegarder{% endif %}" class="btn btn-primary" />
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript" >
|
|
$(function(){
|
|
$('#id_contract_related').autocomplete({
|
|
source: function(request, response){
|
|
$.ajax({
|
|
url: '/billing/contract/lookup/?pattern=' + $('#id_contract_related').val(),
|
|
dataType: "json",
|
|
success: function(data){
|
|
if(data.length != 0){
|
|
response($.map(data, function(item){
|
|
return {
|
|
label: item.Name,
|
|
value: item.Name,
|
|
contractid: item.ID
|
|
}
|
|
}))
|
|
} else {
|
|
response([{ label: 'No result found.', value: '' }]);
|
|
};
|
|
},
|
|
|
|
error: function(exception){
|
|
console.log(exception);
|
|
}
|
|
});
|
|
},
|
|
minLength: 3,
|
|
select: function(event, ui){
|
|
$($(this).data('ref')).val(ui.item.contractid);
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %} |