brotherton-erpnext/portal/templates/includes/transactions.html

60 lines
1.5 KiB
HTML
Raw Normal View History

2013-09-10 08:16:15 +00:00
{% extends base_template %}
{% block content -%}
<div class="col-md-12">
<ul class="breadcrumb">
<li><a href="index">Home</a></li>
<li class="active"><i class="{{ icon }} icon-fixed-width"></i> {{ title }}</li>
</ul>
2013-09-11 13:28:20 +00:00
<p id="msgprint-alert" class="alert alert-danger"
style="display: none;">&nbsp;</p>
<div class="list-group transaction-list">
<div class="progress progress-striped active">
<div class="progress-bar progress-bar-info" style="width: 100%;"></div>
</div>
</div>
<div class="text-center">
<button class="btn btn-default btn-show-more hide">More</button>
</div>
</div>
{%- endblock %}
{% block javascript -%}
2013-09-10 08:16:15 +00:00
<script>
$(document).ready(function() {
window.start = 0;
window.$list = $(".transaction-list");
window.$show_more = $(".btn-show-more").on("click", function() { get_transactions(this); })
get_transactions();
});
var get_transactions = function(btn) {
wn.call({
method: "{{ method }}",
args: { start: start },
btn: btn,
callback: function(r) {
$list.find(".progress").remove();
$show_more.toggleClass("hide", !(r.message && r.message.length===20));
if(!(r.message && r.message.length)) {
console.log("empty");
if(!$list.html().trim()) {
$list.html("<div class='alert alert-warning'>\
{{ empty_list_message }}</div>");
}
return;
}
start += r.message.length;
$.each(r.message, function(i, doc) {
render(doc);
});
}
})
};
2013-09-10 08:16:15 +00:00
</script>
2013-09-10 08:16:15 +00:00
<!-- // var render = function(doc) { }; -->
{% endblock %}