mirror of
https://github.com/pcvolkmer/onkostar-plugin-dnpm.git
synced 2025-07-02 17:22:54 +00:00
Issue #37: Checkbox zum Einschluss inaktiver Studien in die Suche
This commit is contained in:
@ -12,8 +12,8 @@ const availableStore = new Ext.data.ArrayStore({
|
|||||||
|
|
||||||
let pluginRequestsDisabled = false;
|
let pluginRequestsDisabled = false;
|
||||||
|
|
||||||
const findButtonFieldFormInformation = function(context) {
|
const findButtonFieldFormInformation = function (context) {
|
||||||
const findElemId = function(elem) {
|
const findElemId = function (elem) {
|
||||||
if (elem.tagName === 'BODY') {
|
if (elem.tagName === 'BODY') {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@ -25,7 +25,7 @@ const findButtonFieldFormInformation = function(context) {
|
|||||||
return findElemId(elem.parentElement);
|
return findElemId(elem.parentElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
const formInfo = function(formItem, blockIndex = undefined) {
|
const formInfo = function (formItem, blockIndex = undefined) {
|
||||||
if (formItem.xtype === 'buttonField') {
|
if (formItem.xtype === 'buttonField') {
|
||||||
return formInfo(formItem.ownerCt, formItem.blockIndex);
|
return formInfo(formItem.ownerCt, formItem.blockIndex);
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ const findButtonFieldFormInformation = function(context) {
|
|||||||
if (context.genericEditForm && document.activeElement.tagName === 'BUTTON') {
|
if (context.genericEditForm && document.activeElement.tagName === 'BUTTON') {
|
||||||
let elemId = findElemId(document.activeElement);
|
let elemId = findElemId(document.activeElement);
|
||||||
if (elemId) {
|
if (elemId) {
|
||||||
let formItem = context.genericEditForm.down('#'+elemId);
|
let formItem = context.genericEditForm.down('#' + elemId);
|
||||||
if (formItem) {
|
if (formItem) {
|
||||||
return formInfo(formItem);
|
return formInfo(formItem);
|
||||||
}
|
}
|
||||||
@ -66,12 +66,12 @@ const findButtonFieldFormInformation = function(context) {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const request = function (query) {
|
const request = function (query, includeInactive) {
|
||||||
if (pluginRequestsDisabled) return;
|
if (pluginRequestsDisabled) return;
|
||||||
executePluginMethod(
|
executePluginMethod(
|
||||||
'EinzelempfehlungAnalyzer',
|
'EinzelempfehlungAnalyzer',
|
||||||
'getStudien',
|
'getStudien',
|
||||||
{q: query},
|
includeInactive ? {q: query, inactive: true} : {q: query},
|
||||||
function (response) {
|
function (response) {
|
||||||
if (response.status.code < 0) {
|
if (response.status.code < 0) {
|
||||||
onFailure();
|
onFailure();
|
||||||
@ -87,7 +87,7 @@ const itemMapping = function (item) {
|
|||||||
return [item.kategorieName, item.version, item.code, item.type, item.studiennummer, item.shortDesc, item.description];
|
return [item.kategorieName, item.version, item.code, item.type, item.studiennummer, item.shortDesc, item.description];
|
||||||
}
|
}
|
||||||
|
|
||||||
const onFailure = function() {
|
const onFailure = function () {
|
||||||
pluginRequestsDisabled = true;
|
pluginRequestsDisabled = true;
|
||||||
Ext.MessageBox.show({
|
Ext.MessageBox.show({
|
||||||
title: 'Hinweis',
|
title: 'Hinweis',
|
||||||
@ -96,7 +96,7 @@ const onFailure = function() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSuccess = function(d) {
|
const onSuccess = function (d) {
|
||||||
available = d;
|
available = d;
|
||||||
const extData = available.map(itemMapping);
|
const extData = available.map(itemMapping);
|
||||||
availableStore.loadData(extData);
|
availableStore.loadData(extData);
|
||||||
@ -110,6 +110,7 @@ const save = (selectedItemIndex) => {
|
|||||||
const showDialog = function (blockIndex) {
|
const showDialog = function (blockIndex) {
|
||||||
let selectedItemIndex = -1;
|
let selectedItemIndex = -1;
|
||||||
let queryString = '';
|
let queryString = '';
|
||||||
|
let includeInactive = false;
|
||||||
|
|
||||||
const gridColumns = [
|
const gridColumns = [
|
||||||
{header: 'Kategorie', width: 80, sortable: false, dataIndex: 'kategorieName'},
|
{header: 'Kategorie', width: 80, sortable: false, dataIndex: 'kategorieName'},
|
||||||
@ -128,7 +129,20 @@ const showDialog = function (blockIndex) {
|
|||||||
listeners: {
|
listeners: {
|
||||||
change: (f) => {
|
change: (f) => {
|
||||||
queryString = f.value;
|
queryString = f.value;
|
||||||
request(f.value);
|
request(queryString, includeInactive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const inactiveSelection = new Ext.form.field.Checkbox({
|
||||||
|
name: 'inactive',
|
||||||
|
fieldLabel: 'Inaktive Studien einschließen',
|
||||||
|
labelWidth: 240,
|
||||||
|
padding: 8,
|
||||||
|
listeners: {
|
||||||
|
handler: (_, checked) => {
|
||||||
|
includeInactive = checked;
|
||||||
|
request(queryString, includeInactive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -161,7 +175,7 @@ const showDialog = function (blockIndex) {
|
|||||||
type: 'vbox',
|
type: 'vbox',
|
||||||
align: 'stretch'
|
align: 'stretch'
|
||||||
},
|
},
|
||||||
items: [query, availableGrid]
|
items: [query, inactiveSelection, availableGrid]
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.create('Ext.window.Window', {
|
Ext.create('Ext.window.Window', {
|
||||||
|
Reference in New Issue
Block a user