Skip to content

Commit

Permalink
add subtotal renderer and make it default renderer for lead billing
Browse files Browse the repository at this point in the history
table
  • Loading branch information
digitalfox committed Feb 27, 2025
1 parent aa0eea6 commit bfce4e9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion templates/billing/_lead_billing.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ <h4 class="py-2">{% trans "Client billing control" %}</h4>
$("#pivotable-output-{{ lead.id|unlocalize }}").pivot({{ data|safe }},
{ rows: ["{% trans 'billing mode' %}", "{% trans 'mission' %}", "{% trans 'type' %}", "{% trans 'consultant' %}"],
cols: ["{% trans 'month' %}"],
renderer: $.pivotUtilities.renderers.Table,
dataClass: $.pivotUtilities.SubtotalPivotData,
renderer: $.pivotUtilities.subtotal_renderers["Table With Subtotal"],
sorters: {"type": $.pivotUtilities.sortAs(['{% trans "Done work" %}', '{% trans "Service bill" %}', '{% trans "Expense" %}', '{% trans "Expense bill" %}', ])},
aggregator: $.pivotUtilities.aggregators.Sum(["{% trans 'amount' %}"]) },
lang);
Expand Down
3 changes: 2 additions & 1 deletion templates/core/_pivotable_body.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
var lang = {% if LANGUAGE_CODE == "fr-fr" %}'fr'{% else %}'en'{% endif %};

function drawPivot(data, rows, cols, rendererName, aggregatorName, vals, options) {
var renderers = $.extend($.pivotUtilities.renderers, $.pivotUtilities.plotly_renderers, $.pivotUtilities.export_renderers);
var renderers = $.extend($.pivotUtilities.renderers, $.pivotUtilities.plotly_renderers, $.pivotUtilities.export_renderers, $.pivotUtilities.subtotal_renderers);
if (typeof options == "undefined") { var options = {}; }
$("#{{ output|default_if_none:'pivotable-output' }}").pivotUI(
data,
{
dataClass: $.pivotUtilities.SubtotalPivotData,
rows: rows,
cols: cols,
renderers: renderers,
Expand Down
2 changes: 2 additions & 0 deletions templates/core/_pivotable_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<script src="https://cdn.plot.ly/plotly-basic-latest.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/export_renderers.min.js" integrity="sha512-p5LbrvUKLNYfB4NnF9AUhdzcr2VaLfWxZ65rU8/P1VM06XvwEGNfU9gaXPiJGQh1NCHzzbhpcjIRLiFE8GSnCA==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/plotly_renderers.min.js" integrity="sha512-nGY6wbyP3gWxAjsZwsjWahe9nKLCTTyTLn1dpwuNHb9CKLjogHAMVIbbr4wNYL0dKOsWTCrlpx9RDY+bB1MFrQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/subtotal/1.10.0/subtotal.min.js" integrity="sha512-lnO0AIR27qSKXIaFjrDgvJ6G8SMvn21BNvZ4Gottzb3iT3z8bw/5eVMIeh3EtEcY+mtnK2NFiHOX8D8jAkb7Tg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/pivot.min.css" integrity="sha512-BDStKWno6Ga+5cOFT9BUnl9erQFzfj+Qmr5MDnuGqTQ/QYDO1LPdonnF6V6lBO6JI13wg29/XmPsufxmCJ8TvQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/subtotal/1.10.0/subtotal.min.css" integrity="sha512-ODJVGFpLF+Tf1FnZHiZqCxZdJzagXG9nl7HaRd7gE3t/kfI1DF5+TSQ6pQ+5HfAVcoYWS93LTT9qtmXzvUiFjw==" crossorigin="anonymous" referrerpolicy="no-referrer" />

0 comments on commit bfce4e9

Please sign in to comment.