partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 994e8b1deda00d24c3a36e29e49f251044d8ecb9
parent 3e3781d6a5753bdc4093074efe426e3d139339fd
Author: Felicitus <felicitus@felicitus.org>
Date:   Tue,  5 Jul 2011 04:03:25 +0200

Fix for issue #75

Diffstat:
Mfrontend/js/Components/MenuBar.js | 7++++++-
Dfrontend/js/Components/Statistics/CurrentStatisticsDialog.js | 93-------------------------------------------------------------------------------
Afrontend/js/Components/Statistics/CurrentStatisticsPanel.js | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 99 insertions(+), 94 deletions(-)

diff --git a/frontend/js/Components/MenuBar.js b/frontend/js/Components/MenuBar.js @@ -46,7 +46,12 @@ Ext.define('PartKeepr.MenuBar', { this.callParent(); }, showStatistics: function () { - var j = Ext.create("PartKeepr.CurrentStatisticsDialog"); + var j = Ext.create("PartKeepr.CurrentStatisticsPanel", { + closable: true + }); + + + PartKeepr.getApplication().addItem(j); j.show(); }, editStorageLocations: function () { diff --git a/frontend/js/Components/Statistics/CurrentStatisticsDialog.js b/frontend/js/Components/Statistics/CurrentStatisticsDialog.js @@ -1,92 +0,0 @@ -Ext.define('PartKeepr.CurrentStatisticsDialog', { - extend: 'Ext.window.Window', - width: 400, - height: 250, - title: i18n("Current Statistics"), - bodyStyle: { - padding: "5px" - }, - layout: 'fit', - /** - * Initializes the component and adds a template - */ - initComponent: function () { - /** - * Create the template - */ - this.tpl = new Ext.XTemplate( - '<h1>'+i18n("Current Statistics")+'</h1>', - '<table>', - '<tr>', - '<td style="width: 200px;" class="o">'+i18n("Different Parts")+':</td>', - '<td style="width: 200px;" class="o">{partCount}</td>', - '</tr>', - '<tr>', - '<td style="width: 200px;" class="e">'+i18n("Total Part Value")+':</td>', - '<td style="width: 200px;" class="e">{totalPrice}</td>', - '</tr>', - '<tr>', - '<td style="width: 200px;" class="o">'+i18n("Average Part Value")+':</td>', - '<td style="width: 200px;" class="o">{averagePrice}</td>', - '</tr>', - '<tr>', - '<td style="width: 200px;" class="e">'+i18n("Parts with price")+':</td>', - '<td style="width: 200px;" class="e">{partsWithPrice}</td>', - '</tr>', - '<tr>', - '<td style="width: 200px;" class="o">'+i18n("Parts without price")+':</td>', - '<td style="width: 200px;" class="o">{partsWithoutPrice}</td>', - '</tr>', - '<tr>', - '<td class="e">'+i18n("Categories")+':</td>', - '<td class="e">{categoryCount}</td>', - '</tr>', - '</table>', - '<h1>'+i18n("Counts per Unit")+'</h1>', - '<table>', - '<tpl for="units">', - '<tr>', - '<td style="width: 200px;" class="{[xindex % 2 === 0 ? "e" : "o"]}">{name}</td>', - '<td style="width: 200px;" class="{[xindex % 2 === 0 ? "e" : "o"]}">{stockLevel}</td>', - '</tr>', - '</tpl>', - '</table>'); - - this.tbButtons = [{ - text: i18n("Refresh"), - handler: this.loadStats, - scope: this - },{ - text: i18n("Close"), - handler: this.close, - scope: this - }]; - - this.dockedItems = [{ - xtype: 'toolbar', - dock: 'bottom', - ui: 'footer', - items: this.tbButtons - }]; - - this.view = Ext.create("Ext.panel.Panel", { - autoScroll: true - }); - - this.items = this.view; - this.callParent(); - - this.loadStats(); - }, - loadStats: function () { - var call = new PartKeepr.ServiceCall( - "Statistic", - "getCurrentStats"); - - call.setHandler(Ext.bind(this.onStatsLoaded, this)); - call.doCall(); - }, - onStatsLoaded: function (data) { - this.tpl.overwrite(this.view.getTargetEl(), data); - } -});- \ No newline at end of file diff --git a/frontend/js/Components/Statistics/CurrentStatisticsPanel.js b/frontend/js/Components/Statistics/CurrentStatisticsPanel.js @@ -0,0 +1,92 @@ +Ext.define('PartKeepr.CurrentStatisticsPanel', { + extend: 'Ext.panel.Panel', + width: 400, + height: 250, + title: i18n("Current Statistics"), + bodyStyle: { + padding: "5px" + }, + layout: 'fit', + /** + * Initializes the component and adds a template + */ + initComponent: function () { + /** + * Create the template + */ + this.tpl = new Ext.XTemplate( + '<h1>'+i18n("Current Statistics")+'</h1>', + '<table>', + '<tr>', + '<td style="width: 200px;" class="o">'+i18n("Different Parts")+':</td>', + '<td style="width: 200px;" class="o">{partCount}</td>', + '</tr>', + '<tr>', + '<td style="width: 200px;" class="e">'+i18n("Total Part Value")+':</td>', + '<td style="width: 200px;" class="e">{totalPrice}</td>', + '</tr>', + '<tr>', + '<td style="width: 200px;" class="o">'+i18n("Average Part Value")+':</td>', + '<td style="width: 200px;" class="o">{averagePrice}</td>', + '</tr>', + '<tr>', + '<td style="width: 200px;" class="e">'+i18n("Parts with price")+':</td>', + '<td style="width: 200px;" class="e">{partsWithPrice}</td>', + '</tr>', + '<tr>', + '<td style="width: 200px;" class="o">'+i18n("Parts without price")+':</td>', + '<td style="width: 200px;" class="o">{partsWithoutPrice}</td>', + '</tr>', + '<tr>', + '<td class="e">'+i18n("Categories")+':</td>', + '<td class="e">{categoryCount}</td>', + '</tr>', + '</table>', + '<h1>'+i18n("Counts per Unit")+'</h1>', + '<table>', + '<tpl for="units">', + '<tr>', + '<td style="width: 200px;" class="{[xindex % 2 === 0 ? "e" : "o"]}">{name}</td>', + '<td style="width: 200px;" class="{[xindex % 2 === 0 ? "e" : "o"]}">{stockLevel}</td>', + '</tr>', + '</tpl>', + '</table>'); + + this.tbButtons = [{ + text: i18n("Refresh"), + handler: this.loadStats, + scope: this + },{ + text: i18n("Close"), + handler: this.close, + scope: this + }]; + + this.dockedItems = [{ + xtype: 'toolbar', + dock: 'bottom', + ui: 'footer', + items: this.tbButtons + }]; + + this.view = Ext.create("Ext.panel.Panel", { + autoScroll: true + }); + + this.items = this.view; + this.callParent(); + + this.loadStats(); + }, + loadStats: function () { + var call = new PartKeepr.ServiceCall( + "Statistic", + "getCurrentStats"); + + call.setHandler(Ext.bind(this.onStatsLoaded, this)); + call.doCall(); + }, + onStatsLoaded: function (data) { + this.tpl.overwrite(this.view.getTargetEl(), data); + } +});+ \ No newline at end of file