commit 19ff84ee8c3cdd7bb1f77b9b82193c53824d5e7d
parent 8999d5a576ef91ef8efa8d37312f2ad37d4a9810
Author: Felicia Hummel <felicitus@felicitus.org>
Date: Thu, 18 Aug 2016 16:20:17 +0200
Merge pull request #719 from partkeepr/PartKeepr-645
PartKeepr-645 PartKeepr: Option to display and filter part id. Fixes …
Diffstat:
4 files changed, 93 insertions(+), 4 deletions(-)
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/Editor/PartEditor.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/Editor/PartEditor.js
@@ -182,12 +182,29 @@ Ext.define('PartKeepr.PartEditor', {
flex: 1
}, {
xtype: 'displayfield',
+ qtip: i18n("The first number is the ID in decimal, the second number is the ID in base36"),
fieldLabel: i18n("Internal ID"),
+ listeners: {
+ render: function (c)
+ {
+ Ext.QuickTips.register({
+ target: c.getEl(),
+ text: c.qtip
+ });
+ }
+ },
name: '@id',
+ fieldStyle: {
+ color: "blue",
+ "text-decoration": "underline",
+ },
renderer: function (value)
{
var values = value.split("/");
- return values[values.length - 1];
+ var idstr = values[values.length - 1];
+ var idint = parseInt(idstr);
+
+ return idstr + " (#" + idint.toString(36) + ")";
}
}
]
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartDisplay.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartDisplay.js
@@ -42,7 +42,7 @@ Ext.define('PartKeepr.PartDisplay', {
type: 'boolean'
},
internalPartNumber: {
- displayName: i18n("Internal Part Number")
+ displayName: i18n("Internal Part Number"),
},
projectNames: {
displayName: i18n("Used in Projects")
@@ -52,7 +52,9 @@ Ext.define('PartKeepr.PartDisplay', {
renderer: function (value)
{
var values = value.split("/");
- return values[values.length - 1];
+ var idstr = values[values.length - 1];
+ var idint = parseInt(idstr);
+ return idstr + " (#"+idint.toString(36)+")";
}
}
},
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartFilterPanel.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartFilterPanel.js
@@ -57,6 +57,7 @@ Ext.define('PartKeepr.PartFilterPanel', {
statusFilter: null,
conditionFilter: null,
internalPartNumberFilter: null,
+ internalIdFilter: null,
commentFilter: null,
filterControls: [],
@@ -84,7 +85,8 @@ Ext.define('PartKeepr.PartFilterPanel', {
this.partsWithoutPrice,
this.createDateFilter,
this.partsWithoutStockRemovals,
- this.needsReview
+ this.needsReview,
+ this.internalIdFilter
]
};
@@ -225,6 +227,7 @@ Ext.define('PartKeepr.PartFilterPanel', {
this.conditionFilter.setValue("");
this.internalPartNumberFilter.setValue("");
this.commentFilter.setValue("");
+ this.internalIdFilter.setValue("");
this.onApply();
},
@@ -1013,6 +1016,62 @@ Ext.define('PartKeepr.PartFilterPanel', {
this.filterControls.push(this.internalPartNumberFilter);
+ this.internalIdFilter = Ext.create("Ext.form.field.Text", {
+ fieldLabel: i18n("Internal ID"),
+ anchor: '100%',
+ qtip: i18n(
+ "The first number is the ID in decimal, the second number is the ID in base36. To search in base36 format you need to prefix the search string with #, example: #15y"),
+ plugins: [
+ Ext.create("PartKeepr.Util.FilterPlugin", {
+ getFilterFn: function ()
+ {
+ var idstr = this.internalIdFilter.getValue();
+ var idint;
+
+ if (idstr.substring(0, 1) == "#") {
+ idstr = idstr.substring(1);
+ idint = parseInt(idstr, 36);
+ } else {
+ idint = parseInt(idstr, 10);
+ }
+ return {
+ property: 'id',
+ operator: "=",
+ value: idint
+ };
+ },
+ listeners: {
+ scope: this,
+ disable: function ()
+ {
+ this.internalIdFilter.setValue("");
+ }
+ },
+ scope: this
+ })
+ ],
+ listeners: {
+ render: function (c)
+ {
+ Ext.QuickTips.register({
+ target: c.getEl(),
+ text: c.qtip
+ });
+ },
+ change: function (cmp)
+ {
+ if (cmp.getValue() !== "") {
+ cmp.enableFilter();
+ } else {
+ cmp.disableFilter();
+ }
+ },
+ scope: this
+ }
+ });
+
+ this.filterControls.push(this.internalIdFilter);
+
this.commentFilter = Ext.create("Ext.form.field.Text", {
fieldLabel: i18n("Comment"),
anchor: '100%',
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js
@@ -299,6 +299,17 @@ Ext.define('PartKeepr.PartsGrid', {
header: i18n("Create Date"),
dataIndex: 'createDate',
hidden: true
+ }, {
+ header: i18n("Internal ID"),
+ dataIndex: '@id',
+ renderer: function (value) {
+ var values = value.split("/");
+ var idstr = values[values.length - 1];
+ var idint = parseInt(idstr);
+
+ return idstr + " (#"+idint.toString(36)+")";
+
+ }
}
];