Skip to content
Code-Schnipsel Gruppen Projekte
Bestätigt Commit b314e1d6 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

feat: new process window and process window button

Übergeordneter c29b851a
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!140Update 'next-4.x' with latest changes from 'main',!112Next 3.x
Pipeline-Nr. 8751 bestanden
<?php
/**
* This file contains package_quiqqer_erp_ajax_process_getProcess
*/
use QUI\ERP\Process;
use QUI\ERP\Processes;
QUI::$Ajax->registerFunction(
'package_quiqqer_erp_ajax_process_getProcess',
function ($globalProcessId, $hash) {
if (!empty($hash) && empty($globalProcessId)) {
$Entity = (new Processes())->getEntity($hash);
$globalProcessId = $Entity->getGlobalProcessId();
}
$Process = new Process($globalProcessId);
return [
'globalProcessId' => $Process->getUUID(),
'history' => $Process->getCompleteHistory()->toArray()
];
},
['globalProcessId', 'hash'],
['Permission::checkAdminUser']
);
.quiqqer-erp-process-window-header {
background: #f7f7f7;
display: inline-block;
padding: 20px;
width: 100%;
}
.quiqqer-erp-process-window {
display: flex;
flex-direction: column;
}
.quiqqer-erp-process-window-comments {
overflow: auto;
flex-shrink: 0;
flex-grow: 1;
height: 200px;
}
\ No newline at end of file
/**
* @module package/quiqqer/erp/bin/backend/controls/process/ProcessWindow
* @author www.pcsg.de (Henning Leutz)
*/
define('package/quiqqer/erp/bin/backend/controls/process/ProcessWindow', [
'qui/QUI',
'qui/controls/windows/Popup',
'Locale',
'Ajax',
'css!package/quiqqer/erp/bin/backend/controls/process/ProcessWindow.css'
], function(QUI, QUIPopup, QUILocale, QUIAjax) {
'use strict';
const lg = 'quiqqer/erp';
return new Class({
Extends: QUIPopup,
Type: 'package/quiqqer/erp/bin/backend/controls/process/ProcessWindow',
Binds: [
'$onCreate',
'$onOpen'
],
options: {
globalProcessId: false,
hash: false,
buttons: false
},
initialize: function(options) {
this.setAttributes({
icon: 'fa fa-timeline',
title: '',
maxHeight: 900,
maxWidth: 750,
});
this.parent(options);
this.$Comments = null;
this.addEvents({
onCreate: this.$onCreate,
onOpen: this.$onOpen
});
},
$onCreate: function() {
if (!this.getAttribute('globalProcessId') && !this.getAttribute('hash')) {
this.close();
return;
}
this.Loader.show();
this.refresh();
this.getContent().setStyle('padding', 0);
this.getContent().addClass('quiqqer-erp-process-window');
new Element('div', {
'class': 'quiqqer-erp-process-window-header',
html: '<div class="quiqqer-erp-process-window-header-filter">' +
' <input type="text" name="filter" placeholder="Filter (Nachricht, Type, ID) ...">' +
' </div>'
}).inject(this.getContent());
require(['package/quiqqer/erp/bin/backend/controls/Comments'], (Comments) => {
const CommentContainer = new Element('div', {
'class': 'quiqqer-erp-process-window-comments',
styles: {
padding: 20
}
}).inject(this.getContent());
const Filter = this.getContent().getElement('[name="filter"]');
this.$Comments = new Comments().inject(CommentContainer);
Filter.addEvent('keyup', () => {
this.$Comments.filter(Filter.value);
});
this.$onOpen();
});
},
$onOpen: function() {
if (!this.getAttribute('globalProcessId') && !this.getAttribute('hash')) {
this.close();
return;
}
if (!this.$Comments) {
return;
}
this.Loader.show();
QUIAjax.get('package_quiqqer_erp_ajax_process_getProcess', (result) => {
this.setAttributes({
icon: 'fa fa-timeline',
title: QUILocale.get(lg, 'panel.globalProcess.title', {
globalProcessId: result.globalProcessId
})
});
this.refresh();
this.$Comments.clear();
this.$Comments.unserialize(result.history);
this.Loader.hide();
}, {
'package': 'quiqqer/erp',
globalProcessId: this.getAttribute('globalProcessId'),
hash: this.getAttribute('hash'),
});
}
});
});
/**
* Button which opens the window for the process
*/
define('package/quiqqer/erp/bin/backend/controls/process/ProcessWindowButton', [
'qui/QUI',
'qui/controls/buttons/Button',
'package/quiqqer/erp/bin/backend/controls/process/ProcessWindow',
'Locale'
], function(QUI, QUIButton, ProcessWindow, QUILocale) {
'use strict';
const lg = 'quiqqer/erp';
return new Class({
Extends: QUIButton,
Type: 'package/quiqqer/erp/bin/backend/controls/process/ProcessWindowButton',
options: {
globalProcessId: false,
hash: false
},
initialize: function(options) {
this.setAttributes({
styles: {
'border-left-width': 1,
'border-right-width': 1,
'float': 'right',
width: 40
}
});
this.parent(options);
this.setAttributes({
icon: 'fa fa-timeline',
alt: QUILocale.get(lg, 'process.button.alt'),
title: QUILocale.get(lg, 'process.button.title')
});
this.addEvents({
click: () => {
new ProcessWindow({
globalProcessId: this.getAttribute('globalProcessId'),
hash: this.getAttribute('hash')
}).open();
}
});
}
});
});
......@@ -60,6 +60,11 @@ protected function table(): string
return QUI::getDBTableName('process');
}
public function getUUID(): string
{
return $this->processId;
}
/**
* Return all entities which are connected to this process
*
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren