actualizacion del progress bar

parent a15927ce
...@@ -27,7 +27,7 @@ function refresh() { ...@@ -27,7 +27,7 @@ function refresh() {
$('#progress_bar' + val.purchase_id + '').attr('style', 'width:' + val.progress + '%'); $('#progress_bar' + val.purchase_id + '').attr('style', 'width:' + val.progress + '%');
document.getElementById('progess_value' + val.purchase_id).innerHTML = val.progress + ' %'; document.getElementById('progess_value' + val.purchase_id).innerHTML = val.progress + ' %';
$('#view_report' + val.purchase_id + '').removeAttr("disabled"); $('#view_report' + val.purchase_id + '').removeAttr("disabled");
$('#view_report' + val.purchase_id + '').attr("href", "{{ BASE_URL }}/reports/T15QZD_sclData/" + val.purchase_id); $('#view_report' + val.purchase_id + '').attr("href", "../reports/T15QZD_sclData/" + val.purchase_id);
$('#main_progess' + val.purchase_id + '').attr("class", "hidden"); $('#main_progess' + val.purchase_id + '').attr("class", "hidden");
$('#action_buttons' + val.purchase_id + '').removeClass("hidden"); $('#action_buttons' + val.purchase_id + '').removeClass("hidden");
} }
...@@ -37,8 +37,9 @@ function refresh() { ...@@ -37,8 +37,9 @@ function refresh() {
}; };
$(function () { $(function () {
var int;
refresh(); refresh();
var int = setInterval("refresh()", 1000); int = setInterval("refresh()", 1000);
}); });
$(function () { $(function () {
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<span class="pull-right-container"> <span class="pull-right-container">
<span class="label label-primary pull-right"></span> <span class="label label-primary pull-right"></span>
</span> </span>
</a> </a>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
class="hidden" {% endif %}> class="hidden" {% endif %}>
<a id="view_report{{ product.purchase_id }}" title="View Report" <a id="view_report{{ product.purchase_id }}" title="View Report"
{% if product.progress == 100 %} {% if product.progress == 100 %}
href="{{ BASE_URL }}/reports/T15QZD_sclData/{{ product.purchase_id }}" href="#"
{% else %} {% else %}
href="#" href="#"
disabled disabled
...@@ -265,5 +265,54 @@ ...@@ -265,5 +265,54 @@
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{% static 'reports/js/scripts.js' %}"></script> <!--script src="{% static 'reports/js/scripts.js' %}"></script-->
<script>
function openmodal(info) {
info2 = info.split(";");
$("#myModal").modal();
$("#log_info").append(info2);
}
function refresh() {
$.ajax({
dataType: "json",
url: 'Reload',
success: function (data) {
$.each(data, function (key, val) {
console.log(key + " = " + val.purchase_id + "" + val.progress)
if (val.progress != 100) {
$('#progress_bar' + val.purchase_id).attr("aria-valuenow", val.progress);
$('#progress_bar' + val.purchase_id).attr('style', 'width:' + val.progress + '%');
document.getElementById('progess_value' + val.purchase_id).innerHTML = val.progress + ' %';
$('#progress_bar' + val.purchase_id).attr("class", "progress-bar progress-bar-warning progress-bar-striped active");
$('#view_report' + val.purchase_id).attr('disabled', 'false');
$('#action_buttons' + val.purchase_id).attr("class", "hidden");
$('#main_progess' + val.purchase_id).removeClass("hidden");
$('#main_progess' + val.purchase_id).attr("class", "progress");
}
else {
$('#progress_bar' + val.purchase_id).attr("class", "progress-bar progress-bar-success progress-bar-striped");
$('#progress_bar' + val.purchase_id).attr("aria-valuenow", val.progress);
$('#progress_bar' + val.purchase_id).attr('style', 'width:' + val.progress + '%');
document.getElementById('progess_value' + val.purchase_id).innerHTML = val.progress + ' %';
$('#view_report' + val.purchase_id).removeAttr("disabled");
$('#view_report' + val.purchase_id).attr("href", "../reports/T15QZD_sclData/" + val.purchase_id);
$('#main_progess' + val.purchase_id).attr("class", "hidden");
$('#action_buttons' + val.purchase_id).removeClass("hidden");
}
});
}
});
};
$(function () {
var int;
refresh();
int = setInterval("refresh()", 1000);
});
$(function () {
$('#reportPage').show();
});
</script>
{% endblock %} {% endblock %}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment