Bugzilla – Attachment 97088 Details for
Bug 23355
Add a 'cashup' process to accounts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23355: Use rowGroup plugin
Bug-23355-Use-rowGroup-plugin.patch (text/plain), 11.62 KB, created by
Martin Renvoize (ashimema)
on 2020-01-09 13:55:53 UTC
(
hide
)
Description:
Bug 23355: Use rowGroup plugin
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-01-09 13:55:53 UTC
Size:
11.62 KB
patch
obsolete
>From 6d5134d7f83f20db406c311d8df87a3f311115a9 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 9 Jan 2020 13:53:28 +0000 >Subject: [PATCH] Bug 23355: Use rowGroup plugin > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../rowGroup/dataTables.rowGroup.min.js | 25 +++++++++++ > .../stylesheets/rowGroup.dataTables.min.css | 1 + > .../intranet-tmpl/prog/en/modules/pos/pay.tt | 1 - > .../prog/en/modules/pos/register.tt | 41 ++++++++++++------- > 4 files changed, 53 insertions(+), 15 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js > create mode 100644 koha-tmpl/intranet-tmpl/lib/jquery/plugins/rowGroup/stylesheets/rowGroup.dataTables.min.css > >diff --git a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js >new file mode 100644 >index 0000000000..ca1f5922c7 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js >@@ -0,0 +1,25 @@ >+/*! >+ Copyright 2017-2018 SpryMedia Ltd. >+ >+ This source file is free software, available under the following license: >+ MIT license - http://datatables.net/license/mit >+ >+ This source file is distributed in the hope that it will be useful, but >+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY >+ or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. >+ >+ For details please refer to: http://www.datatables.net >+ RowGroup 1.1.0 >+ ©2017-2018 SpryMedia Ltd - datatables.net/license >+*/ >+var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,d,c){a instanceof String&&(a=String(a));for(var e=a.length,f=0;f<e;f++){var h=a[f];if(d.call(c,h,f,a))return{i:f,v:h}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,d,c){a!=Array.prototype&&a!=Object.prototype&&(a[d]=c.value)}; >+$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,d,c,e){if(d){c=$jscomp.global;a=a.split(".");for(e=0;e<a.length-1;e++){var f=a[e];f in c||(c[f]={});c=c[f]}a=a[a.length-1];e=c[a];d=d(e);d!=e&&null!=d&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:d})}}; >+$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3"); >+(function(a){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(d){return a(d,window,document)}):"object"===typeof exports?module.exports=function(d,c){d||(d=window);c&&c.fn.dataTable||(c=require("datatables.net")(d,c).$);return a(c,d,d.document)}:a(jQuery,window,document)})(function(a,d,c,e){var f=a.fn.dataTable,h=function(b,g){if(!f.versionCheck||!f.versionCheck("1.10.8"))throw"RowGroup requires DataTables 1.10.8 or newer";this.c=a.extend(!0,{},f.defaults.rowGroup, >+h.defaults,g);this.s={dt:new f.Api(b)};this.dom={};b=this.s.dt.settings()[0];if(g=b.rowGroup)return g;b.rowGroup=this;this._constructor()};a.extend(h.prototype,{dataSrc:function(b){if(b===e)return this.c.dataSrc;var g=this.s.dt;this.c.dataSrc=b;a(g.table().node()).triggerHandler("rowgroup-datasrc.dt",[g,b]);return this},disable:function(){this.c.enable=!1;return this},enable:function(b){if(!1===b)return this.disable();this.c.enable=!0;return this},_constructor:function(){var b=this,a=this.s.dt;a.on("draw.dtrg", >+function(){b.c.enable&&b._draw()});a.on("column-visibility.dt.dtrg responsive-resize.dt.dtrg",function(){b._adjustColspan()});a.on("destroy",function(){a.off(".dtrg")});a.on("responsive-resize.dt",function(){b._adjustColspan()})},_adjustColspan:function(){a("tr."+this.c.className,this.s.dt.table().body()).find("td").attr("colspan",this._colspan())},_colspan:function(){return this.s.dt.columns().visible().reduce(function(b,a){return b+a},0)},_draw:function(){var b=this._group(0,this.s.dt.rows({page:"current"}).indexes()); >+this._groupDisplay(0,b)},_group:function(b,g){for(var c=a.isArray(this.c.dataSrc)?this.c.dataSrc:[this.c.dataSrc],d=f.ext.oApi._fnGetObjectDataFn(c[b]),h=this.s.dt,l,n,m=[],k=0,p=g.length;k<p;k++){var q=g[k];l=h.row(q).data();l=d(l);if(null===l||l===e)l=that.c.emptyDataGroup;if(n===e||l!==n)m.push({dataPoint:l,rows:[]}),n=l;m[m.length-1].rows.push(q)}if(c[b+1]!==e)for(k=0,p=m.length;k<p;k++)m[k].children=this._group(b+1,m[k].rows);return m},_groupDisplay:function(b,a){for(var c=this.s.dt,g,d=0,f= >+a.length;d<f;d++){var e=a[d],h=e.dataPoint,k=e.rows;this.c.startRender&&(g=this.c.startRender.call(this,c.rows(k),h,b),(g=this._rowWrap(g,this.c.startClassName,b))&&g.insertBefore(c.row(k[0]).node()));this.c.endRender&&(g=this.c.endRender.call(this,c.rows(k),h,b),(g=this._rowWrap(g,this.c.endClassName,b))&&g.insertAfter(c.row(k[k.length-1]).node()));e.children&&this._groupDisplay(b+1,e.children)}},_rowWrap:function(b,g,c){if(null===b||""===b)b=this.c.emptyDataGroup;return b===e?null:("object"===typeof b&& >+b.nodeName&&"tr"===b.nodeName.toLowerCase()?a(b):b instanceof a&&b.length&&"tr"===b[0].nodeName.toLowerCase()?b:a("<tr/>").append(a("<td/>").attr("colspan",this._colspan()).append(b))).addClass(this.c.className).addClass(g).addClass("dtrg-level-"+c)}});h.defaults={className:"dtrg-group",dataSrc:0,emptyDataGroup:"No group",enable:!0,endClassName:"dtrg-end",endRender:null,startClassName:"dtrg-start",startRender:function(a,c){return c}};h.version="1.1.0";a.fn.dataTable.RowGroup=h;a.fn.DataTable.RowGroup= >+h;f.Api.register("rowGroup()",function(){return this});f.Api.register("rowGroup().disable()",function(){return this.iterator("table",function(a){a.rowGroup&&a.rowGroup.enable(!1)})});f.Api.register("rowGroup().enable()",function(a){return this.iterator("table",function(b){b.rowGroup&&b.rowGroup.enable(a===e?!0:a)})});f.Api.register("rowGroup().dataSrc()",function(a){return a===e?this.context[0].rowGroup.dataSrc():this.iterator("table",function(b){b.rowGroup&&b.rowGroup.dataSrc(a)})});a(c).on("preInit.dt.dtrg", >+function(b,c,d){"dt"===b.namespace&&(b=c.oInit.rowGroup,d=f.defaults.rowGroup,b||d)&&(d=a.extend({},d,b),!1!==b&&new h(c,d))});return h}); >diff --git a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/rowGroup/stylesheets/rowGroup.dataTables.min.css b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/rowGroup/stylesheets/rowGroup.dataTables.min.css >new file mode 100644 >index 0000000000..ed986cc66c >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/rowGroup/stylesheets/rowGroup.dataTables.min.css >@@ -0,0 +1 @@ >+table.dataTable tr.dtrg-group td{background-color:#e0e0e0}table.dataTable tr.dtrg-group.dtrg-level-0 td{font-weight:bold}table.dataTable tr.dtrg-group.dtrg-level-1 td,table.dataTable tr.dtrg-group.dtrg-level-2 td{background-color:#f0f0f0;padding-top:0.25em;padding-bottom:0.25em;padding-left:2em;font-size:0.9em}table.dataTable tr.dtrg-group.dtrg-level-2 td{background-color:#f3f3f3} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt >index 44c313dfa6..7e8acc2069 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt >@@ -178,7 +178,6 @@ > [% END %] > > [% MACRO jsinclude BLOCK %] >- [% Asset.js("js/admin-menu.js") | $raw %] > [% INCLUDE 'format_price.inc' %] > [% INCLUDE 'datatables.inc' %] > [% Asset.js("lib/jquery/plugins/jquery.jeditable.mini.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >index 59b3994069..d7535be961 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >@@ -9,6 +9,7 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Cashup</title> > [% INCLUDE 'doc-head-close.inc' %] >+[% Asset.css("lib/jquery/plugins/rowGroup/stylesheets/rowGroup.dataTables.min.css") | $raw %] > </head> > > <body id="register" class="pos"> >@@ -53,6 +54,9 @@ > <th> > Receipt ID > </th> >+ <th> >+ Transaction >+ </th> > <th> > Description of charges > </th> >@@ -69,22 +73,10 @@ > <tbody> > [% FOREACH accountline IN accountlines %] > [% IF accountline.is_credit %] >- <tr class="credit"> >- <td>[% accountline.accountlines_id %]</td> >- <td> >- [%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %]) >- </td> >- <td></td> >- <td> >- [% accountline.amount * -1 | $Price %] >- </td> >- <td> >- <button class="printReceipt" data-accountline="[%- accountline.accountlines_id | html -%]"><i class="fa fa-print"></i> Print receipt</button> >- </td> >- </tr> > [% FOREACH credit IN accountline.credit_offsets %] > <tr> > <td>[% accountline.accountlines_id %]</td> >+ <td>{ "type": "credit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" }</td> > <td>[%- PROCESS account_type_description account=credit.debit -%]</td> > <td>[% credit.debit.amount | $Price %]</td> > <td></td> >@@ -96,7 +88,7 @@ > </tbody> > <tfoot> > <tr> >- <td colspan="3">Total income: </td> >+ <td colspan="4">Total income: </td> > <td>[% accountlines.total * -1 | $Price %]</td> > <td></td> > </tr> >@@ -113,7 +105,28 @@ > </div><!-- /.row --> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %] > <script> >+ var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, { >+ orderFixed: [ 0, 'asc'], >+ columnDefs: [ { >+ targets: [ 0, 1 ], >+ visible: false >+ }], >+ rowGroup: { >+ dataSrc: 0, >+ startRender: function ( rows, group ) { >+ var details = JSON.parse(rows.data().pluck(1).pop()); >+ return $('<tr class="'+details.type+'"/>') >+ .append( '<td colspan="2">'+group+' '+details.description+'</td>' ) >+ .append( '<td>'+details.amount+'</td>' ) >+ .append( '<td><button class="printReceipt" data-accountline="'+group+'"><i class="fa fa-print"></i> Print receipt</button></td>'); >+ }, >+ endRender: null, >+ } >+ })); >+ > $(".printReceipt").click(function() { > var accountlines_id = $(this).data('accountline'); > var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=' + accountlines_id, '_blank'); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23355
:
92941
|
92942
|
92943
|
92944
|
92945
|
92946
|
92947
|
92948
|
92949
|
92950
|
92951
|
92952
|
92953
|
97031
|
97032
|
97033
|
97034
|
97035
|
97036
|
97037
|
97038
|
97039
|
97040
|
97041
|
97043
|
97044
|
97045
|
97046
|
97047
|
97048
|
97049
|
97050
|
97051
|
97052
|
97053
|
97054
|
97077
|
97078
|
97079
|
97080
|
97081
|
97082
|
97083
|
97084
|
97085
|
97086
|
97087
|
97088
|
97089
|
97706
|
97707
|
97708
|
97709
|
97710
|
97711
|
97712
|
97713
|
97714
|
97715
|
97716
|
97784
|
97785
|
97786
|
97787
|
97788
|
97789
|
97790
|
97791
|
97792
|
97793
|
97794
|
97816
|
97817
|
97818
|
97819
|
97820
|
97821
|
97822
|
97823
|
98026
|
98027
|
98028
|
98835
|
98836
|
98837
|
98838
|
98839
|
98840
|
98841
|
98842
|
100009
|
100010
|
100011
|
100012
|
100013
|
100014
|
100015
|
100016
|
100017
|
100018
|
100019
|
100020
|
100021
|
100030
|
100090
|
101685