Initial xentral_oss_20.3.c9ffacf
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Resubmission\DataTable;
|
||||
|
||||
use Aura\SqlQuery\Exception as AuraSqlQueryException;
|
||||
use Xentral\Components\Database\SqlQuery\SelectQuery;
|
||||
use Xentral\Widgets\DataTable\Column\Column;
|
||||
use Xentral\Widgets\DataTable\Column\ColumnCollection;
|
||||
use Xentral\Widgets\DataTable\Column\ColumnFormatter;
|
||||
use Xentral\Widgets\DataTable\Feature\FeatureCollection;
|
||||
use Xentral\Widgets\DataTable\Feature\TableControlFeature;
|
||||
use Xentral\Widgets\DataTable\Options\DataTableOptions;
|
||||
use Xentral\Widgets\DataTable\Type\AbstractDataTableType;
|
||||
|
||||
final class ResubmissionTaskTemplateDataTable extends AbstractDataTableType
|
||||
{
|
||||
/**
|
||||
* @param SelectQuery $query
|
||||
*
|
||||
* @throws AuraSqlQueryException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureQuery(SelectQuery $query)
|
||||
{
|
||||
$query
|
||||
->cols([
|
||||
'wav.id',
|
||||
'wav.title',
|
||||
'a.name',
|
||||
'wav.submission_date_days',
|
||||
'wsr.name' => 'required_from_stage',
|
||||
'wsa.name' => 'add_task_at_stage',
|
||||
'wav.state'
|
||||
])
|
||||
->from('wiedervorlage_aufgabe_vorlage AS wav')
|
||||
->leftJoin('wiedervorlage_stages AS wsr', 'wsr.id = wav.required_from_stage_id')
|
||||
->leftJoin('wiedervorlage_stages AS wsa', 'wsa.id = wav.add_task_at_stage_id')
|
||||
->leftJoin('adresse AS a', 'a.id = wav.employee_address_id');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ColumnCollection $columns
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureColumns(ColumnCollection $columns)
|
||||
{
|
||||
$menu = Column::fixed('menu', 'Menü', 'center', '1%');
|
||||
$menu->setFormatter(static function ($value, $row) {
|
||||
$html =
|
||||
'<table class="datatable-menu" align="center" border="0" cellpadding="0" cellspacing="0"><tr>' .
|
||||
'<td><a href="#" class="resubmissiontasktemplate-edit-button" data-tasktemplate-config-id="{ID}" ' .
|
||||
'title="Vorlage bearbeiten">' .
|
||||
'<img src="themes/new/images/edit.svg" alt="Vorlage bearbeiten" border="0" align="center">' .
|
||||
'</a></td>' .
|
||||
'<td><a href="#" class="resubmissiontasktemplate-delete-button" data-tasktemplate-config-id="{ID}" ' .
|
||||
'title="Vorlage löschen">' .
|
||||
'<img src="themes/new/images/delete.svg" alt="Vorlage löschen" border="0" align="center">' .
|
||||
'</a></td>' .
|
||||
'</tr></table>';
|
||||
|
||||
$html = str_replace('{ID}', $row['id'], $html);
|
||||
|
||||
return $html;
|
||||
});
|
||||
|
||||
$requiredFromStage = Column::searchable('required_from_stage', 'Pflichtfeld ab');
|
||||
$requiredFromStage->setFormatter(ColumnFormatter::ifEmpty('- Nie -'));
|
||||
|
||||
$columns->add(Column::searchable('title', 'Bezeichnung'));
|
||||
$columns->add(Column::searchable('name', 'Bearbeiter'));
|
||||
$columns->add(Column::searchable('submission_date_days', 'Intervall'));
|
||||
$columns->add($requiredFromStage);
|
||||
$columns->add(Column::searchable('add_task_at_stage', 'Hinzufügen ab'));
|
||||
|
||||
$state = Column::searchable('state', 'Status');
|
||||
$state->setFormatter(function ($value, $row) {
|
||||
if ($row['state'] == 'open') {
|
||||
return 'Offen';
|
||||
}elseif ($row['state'] == 'processing') {
|
||||
return 'In Bearbeitung';
|
||||
}elseif ($row['state'] == 'completed') {
|
||||
return 'Abgeschlossen';
|
||||
}
|
||||
|
||||
return (string)$row['state'];
|
||||
});
|
||||
$columns->add($state);
|
||||
$columns->add($menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DataTableOptions $options
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureOptions(DataTableOptions $options)
|
||||
{
|
||||
$options->setDefaultSorting(['required_from_stage' => 'ASC', 'add_task_at_stage' => 'ASC']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FeatureCollection $features
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureFeatures(FeatureCollection $features)
|
||||
{
|
||||
parent::configureFeatures($features);
|
||||
|
||||
/** @var TableControlFeature $control */
|
||||
$control = $features->get(TableControlFeature::class);
|
||||
$control->hideButtons();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Resubmission\DataTable;
|
||||
|
||||
use Aura\SqlQuery\Exception as AuraSqlQueryException;
|
||||
use Xentral\Components\Database\SqlQuery\SelectQuery;
|
||||
use Xentral\Widgets\DataTable\Column\Column;
|
||||
use Xentral\Widgets\DataTable\Column\ColumnCollection;
|
||||
use Xentral\Widgets\DataTable\Feature\FeatureCollection;
|
||||
use Xentral\Widgets\DataTable\Feature\TableControlFeature;
|
||||
use Xentral\Widgets\DataTable\Filter\CustomFilter;
|
||||
use Xentral\Widgets\DataTable\Filter\FilterCollection;
|
||||
use Xentral\Widgets\DataTable\Options\DataTableOptions;
|
||||
use Xentral\Widgets\DataTable\Request\DataTableRequest;
|
||||
use Xentral\Widgets\DataTable\Type\AbstractDataTableType;
|
||||
|
||||
final class ResubmissionTasksDataTable extends AbstractDataTableType
|
||||
{
|
||||
/**
|
||||
* @param SelectQuery $query
|
||||
*
|
||||
* @throws AuraSqlQueryException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureQuery(SelectQuery $query)
|
||||
{
|
||||
$query
|
||||
->cols([
|
||||
'a.id',
|
||||
'a.aufgabe' => 'title',
|
||||
'adr.name' => 'employee_name',
|
||||
'adr.mitarbeiternummer' => 'employee_number',
|
||||
'a.abgabe_bis' => 'completion_date',
|
||||
'a.startdatum' => 'start_date',
|
||||
'a.startzeit' => 'start_time',
|
||||
'a.prio' => 'priority',
|
||||
'a.status' => 'state',
|
||||
])
|
||||
->from('aufgabe AS a')
|
||||
->innerJoin('wiedervorlage_aufgabe AS wa', 'wa.task_id = a.id')
|
||||
->leftJoin('adresse AS adr', 'a.adresse = adr.id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ColumnCollection $columns
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureColumns(ColumnCollection $columns)
|
||||
{
|
||||
$priority = Column::searchable('priority', 'Priorität', Column::ALIGN_CENTER);
|
||||
$priority->setFormatter(static function ($value) {
|
||||
$prio = (int)$value;
|
||||
if ($prio === 1) {
|
||||
return 'hoch';
|
||||
}
|
||||
if ($prio === -1) {
|
||||
return 'niedrig';
|
||||
}
|
||||
|
||||
return 'mittel';
|
||||
});
|
||||
|
||||
$employee = Column::searchable('employee', 'Mitarbeiter');
|
||||
$employee->setFormatter(function ($value, $row) {
|
||||
if (!empty($row['employee_number'])) {
|
||||
return sprintf('%s %s', $row['employee_number'], $row['employee_name']);
|
||||
}
|
||||
|
||||
return (string)$row['employee_name'];
|
||||
});
|
||||
|
||||
$menu = Column::fixed('menu', 'Menü', 'center', '1%');
|
||||
$menu->setFormatter(function ($value, $row) {
|
||||
$stateText = $row['state'] === 'abgeschlossen' ? 'completed' : 'open';
|
||||
$stateIcon = $row['state'] === 'abgeschlossen' ? 'check_circle_filled.svg' : 'check_circle_outlined.svg';
|
||||
$html =
|
||||
'<table class="datatable-menu" align="center" border="0" cellpadding="0" cellspacing="0"><tr>' .
|
||||
'<td><a href="#" class="resubmissiontask-state-button" data-task-id="{ID}" ' .
|
||||
'data-task-state="{STATE_TEXT}" title="Status ändern">' .
|
||||
'<img src="themes/new/images/{STATE_ICON}" alt="Status ändern" border="0" align="center">' .
|
||||
'</a></td>' .
|
||||
'<td><a href="#" class="resubmissiontask-edit-button" data-task-id="{ID}" title="Aufgabe bearbeiten">' .
|
||||
'<img src="themes/new/images/edit.svg" alt="Aufgabe bearbeiten" border="0" align="center">' .
|
||||
'</a></td>' .
|
||||
'<td><a href="#" class="resubmissiontask-delete-button" data-task-id="{ID}" title="Aufgabe löschen">' .
|
||||
'<img src="themes/new/images/delete.svg" alt="Aufgabe löschen" border="0" align="center">' .
|
||||
'</a></td>' .
|
||||
'</tr></table>';
|
||||
|
||||
$html = str_replace('{ID}', $row['id'], $html);
|
||||
$html = str_replace('{STATE_TEXT}', $stateText, $html);
|
||||
$html = str_replace('{STATE_ICON}', $stateIcon, $html);
|
||||
|
||||
return $html;
|
||||
});
|
||||
|
||||
$columns->add(Column::searchable('title', 'Aufgabe'));
|
||||
$columns->add($employee);
|
||||
$columns->add(Column::searchable('completion_date', 'Abgabe bis'));
|
||||
$columns->add($priority);
|
||||
$columns->add($menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DataTableOptions $options
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureOptions(DataTableOptions $options)
|
||||
{
|
||||
$options->setDefaultSorting(['completion_date' => 'ASC', 'title' => 'ASC']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FeatureCollection $features
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureFeatures(FeatureCollection $features)
|
||||
{
|
||||
parent::configureFeatures($features);
|
||||
|
||||
/** @var TableControlFeature $control */
|
||||
$control = $features->get(TableControlFeature::class);
|
||||
$control->disablePaging();
|
||||
$control->disableSearching();
|
||||
$control->hideLengthChange();
|
||||
$control->hideButtons();
|
||||
$control->hideInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FilterCollection $filters
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureFilters(FilterCollection $filters)
|
||||
{
|
||||
$closure = static function (SelectQuery $query, DataTableRequest $request) {
|
||||
$resubmissionId = (int)$request->getOriginalRequest()->getParam('id');
|
||||
if ($resubmissionId > 0) {
|
||||
$query->where('wa.resubmission_id = ?', $resubmissionId);
|
||||
}
|
||||
};
|
||||
$filters->add(new CustomFilter($closure));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Resubmission\DataTable;
|
||||
|
||||
use Aura\SqlQuery\Exception as AuraSqlQueryException;
|
||||
use Xentral\Components\Database\SqlQuery\SelectQuery;
|
||||
use Xentral\Widgets\DataTable\Column\Column;
|
||||
use Xentral\Widgets\DataTable\Column\ColumnCollection;
|
||||
use Xentral\Widgets\DataTable\Column\ColumnFormatter;
|
||||
use Xentral\Widgets\DataTable\Feature\FeatureCollection;
|
||||
use Xentral\Widgets\DataTable\Feature\TableControlFeature;
|
||||
use Xentral\Widgets\DataTable\Options\DataTableOptions;
|
||||
use Xentral\Widgets\DataTable\Type\AbstractDataTableType;
|
||||
|
||||
final class ResubmissionTextFieldDataTable extends AbstractDataTableType
|
||||
{
|
||||
/**
|
||||
* @param SelectQuery $query
|
||||
*
|
||||
* @throws AuraSqlQueryException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureQuery(SelectQuery $query)
|
||||
{
|
||||
$query
|
||||
->cols([
|
||||
'wfk.id',
|
||||
'wfk.title',
|
||||
'wsa.name' => 'available_from_stage',
|
||||
'wsr.name' => 'required_from_stage',
|
||||
'wfk.show_in_pipeline',
|
||||
'wfk.show_in_tables',
|
||||
])
|
||||
->from('wiedervorlage_freifeld_konfiguration AS wfk')
|
||||
->leftJoin('wiedervorlage_stages AS wsa', 'wsa.id = wfk.available_from_stage_id')
|
||||
->leftJoin('wiedervorlage_stages AS wsr', 'wsr.id = wfk.required_from_stage_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ColumnCollection $columns
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureColumns(ColumnCollection $columns)
|
||||
{
|
||||
$menu = Column::fixed('menu', 'Menü', 'center', '1%');
|
||||
$menu->setFormatter(static function ($value, $row) {
|
||||
$html =
|
||||
'<table class="datatable-menu" align="center" border="0" cellpadding="0" cellspacing="0"><tr>' .
|
||||
'<td><a href="#" class="resubmissiontextfield-edit-button" data-textfield-config-id="{ID}" ' .
|
||||
'title="Freifeld bearbeiten">' .
|
||||
'<img src="themes/new/images/edit.svg" alt="Freifeld bearbeiten" border="0" align="center">' .
|
||||
'</a></td>' .
|
||||
'<td><a href="#" class="resubmissiontextfield-delete-button" data-textfield-config-id="{ID}" ' .
|
||||
'title="Freifeld löschen">' .
|
||||
'<img src="themes/new/images/delete.svg" alt="Freifeld löschen" border="0" align="center">' .
|
||||
'</a></td>' .
|
||||
'</tr></table>';
|
||||
|
||||
$html = str_replace('{ID}', $row['id'], $html);
|
||||
|
||||
return $html;
|
||||
});
|
||||
|
||||
$availableFromStage = Column::searchable('available_from_stage', 'Verfügbar ab Stage');
|
||||
$availableFromStage->setFormatter(ColumnFormatter::ifEmpty('- Immer -'));
|
||||
|
||||
$requiredFromStage = Column::searchable('required_from_stage', 'Pflichtfeld ab Stage');
|
||||
$requiredFromStage->setFormatter(ColumnFormatter::ifEmpty('- Nie -'));
|
||||
|
||||
$showInPipeline = Column::sortable('show_in_pipeline', 'Anzeigen in Pipeline');
|
||||
$showInPipeline->setFormatter(static function ($value) {
|
||||
return (int)$value === 1 ? 'Ja' : 'Nein';
|
||||
});
|
||||
|
||||
$showInTables = Column::sortable('show_in_tables', 'Anzeigen in Tabellen');
|
||||
$showInTables->setFormatter(static function ($value) {
|
||||
return (int)$value === 1 ? 'Ja' : 'Nein';
|
||||
});
|
||||
|
||||
$columns->add(Column::searchable('title', 'Bezeichnung'));
|
||||
$columns->add($availableFromStage);
|
||||
$columns->add($requiredFromStage);
|
||||
$columns->add($showInPipeline);
|
||||
$columns->add($showInTables);
|
||||
$columns->add($menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DataTableOptions $options
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureOptions(DataTableOptions $options)
|
||||
{
|
||||
$options->setDefaultSorting(['available_from_stage' => 'ASC', 'required_from_stage' => 'ASC']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FeatureCollection $features
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function configureFeatures(FeatureCollection $features)
|
||||
{
|
||||
parent::configureFeatures($features);
|
||||
|
||||
/** @var TableControlFeature $control */
|
||||
$control = $features->get(TableControlFeature::class);
|
||||
$control->hideButtons();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user