partkeepr

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

commit bca1bcc1bbb3631f411ea595a6f1eb2e3de418f8
parent 329c564f8031b9101f39a2e5ffa3641dd09d4233
Author: Felicia Hummel <felicia@partkeepr.com>
Date:   Fri,  2 Jun 2017 22:33:44 +0200

- Fixed non-working project removals
- Added confirmation when stock is removed
- Added error when unassigned meta-parts are in place

Diffstat:
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReport.js | 4++--
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js | 46++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReport.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReport.js @@ -56,11 +56,11 @@ Ext.define('PartKeepr.ProjectReportView', { */ onCreateReportClick: function () { - this.reportedProjects = this.reportList.getProjectsToReport(); + this.reportResult.setProjectsToReport(this.reportList.getProjectsToReport()); this.projectReportStore.load({ params: { - projects: Ext.encode(this.reportedProjects) + projects: Ext.encode(this.reportList.getProjectsToReport()) } }); }, diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js @@ -229,6 +229,13 @@ Ext.define("PartKeepr.Components.Project.ProjectReportResultGrid", { */ onStockRemovalClick: function () { + if (this.hasMetaParts()) + { + Ext.Msg.alert(i18n("Unassigned Meta-Parts"), + i18n("You have unassigned meta-parts. In order to remove parts from stock, you need to assign the meta-parts first.")); + return; + } + Ext.Msg.confirm(i18n("Remove parts from stock"), i18n("Do you really want to remove the parts in the project report from the stock?"), this.removeStocks, this); @@ -305,7 +312,21 @@ Ext.define("PartKeepr.Components.Project.ProjectReportResultGrid", { } PartKeepr.PartBundle.Entity.Part.callPostCollectionAction("massRemoveStock", - {"removals": Ext.encode(removals), "projects": Ext.encode(this.reportedProjects)}); + { + "removals": Ext.encode(removals), + "projects": Ext.encode(this.getProjectsToReport()) + }, + function (options, success, response) + { + if (success) + { + Ext.Msg.alert( + i18n("Stock Removal Complete"), + i18n("Removed stock and created a new project run.") + ); + } + } + ); } }, onEdit: function (editor, context) @@ -429,6 +450,20 @@ Ext.define("PartKeepr.Components.Project.ProjectReportResultGrid", { return cheapestDistributor; }, + hasMetaParts: function () + { + var i, record; + for (i = 0; i < this.getStore().getCount(); i++) + { + record = this.getStore().getAt(i); + if (record.get("metaPart")) + { + return true; + } + } + + return false; + }, displayWaitWindow: function (text, description, value) { this.waitMessage = Ext.MessageBox.show({ @@ -440,6 +475,13 @@ Ext.define("PartKeepr.Components.Project.ProjectReportResultGrid", { }); this.waitMessage.updateProgress(value); - + }, + setProjectsToReport: function (projects) + { + this.reportedProjects = projects; + }, + getProjectsToReport: function () + { + return this.reportedProjects; } });