Added some permissions for warehouse
This commit is contained in:
@@ -149,11 +149,11 @@
|
||||
</a>
|
||||
<ul class="submenu">
|
||||
<li class="has-sub-submenu font-weight-bold"><a>XINON</a></li>
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseArticle")?>"><i class="far fa-fw fa-box text-info"></i> Artikel</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin") || $me->can("WarehouseUser")): ?><li><a href="<?=self::getUrl("WarehouseArticle")?>"><i class="far fa-fw fa-box text-info"></i> Artikel</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseItem")?>"><i class="far fa-fw fa-boxes text-info"></i> Lagerbestand</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseOrderRecommendation")?>"><i class="far fa-fw fa-box-full text-info"></i> Bestellvorschläge</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseOrder")?>"><i class="far fa-fw fa-shopping-bag text-info"></i> Bestellungen</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseShippingNote")?>"><i class="far fa-fw fa-shipping-fast text-info"></i> Lieferscheine</a></li><?php endif; ?>
|
||||
<?php if($me->can("WarehouseAdmin") || $me->can("WarehouseUser")): ?><li><a href="<?=self::getUrl("WarehouseShippingNote")?>"><i class="far fa-fw fa-shipping-fast text-info"></i> Lieferscheine</a></li><?php endif; ?>
|
||||
|
||||
<?php if($me->can("WarehouseAdmin")): ?><li><a href="<?=self::getUrl("WarehouseDistributor")?>"><i class="far fa-fw fa-cogs text-info"></i> Administration</a></li><?php endif; ?>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
class WarehouseArticleController extends TTCrud {
|
||||
protected string $headerTitle = 'Artikel';
|
||||
protected string $createText = 'Artikel erstellen';
|
||||
protected $createText = 'Artikel erstellen';
|
||||
|
||||
// @formatter:off
|
||||
protected array $columns = [
|
||||
@@ -32,11 +32,26 @@ class WarehouseArticleController extends TTCrud {
|
||||
];
|
||||
// @formatter:on
|
||||
|
||||
protected array $additionalJSVariables = ['WAREHOUSE_ADMIN' => true];
|
||||
|
||||
protected array $infoMessages = ['create' => 'Artikel wurde erstellt',
|
||||
'update' => 'Artikel wurde aktualisiert',
|
||||
'delete' => 'Artikel wurde gelöscht',
|
||||
'noChanges' => 'Keine Änderungen',];
|
||||
|
||||
protected function prepareCrudConfig() {
|
||||
if (!$this->user->can('WarehouseAdmin')) {
|
||||
// find column with key actions, cheapestPurchasePrice, warningAmount, criticalAmount and set table to false
|
||||
foreach ($this->columns as $key => $column) {
|
||||
if (in_array($column['key'], ['actions', 'cheapestPurchasePrice', 'warningAmount', 'criticalAmount'])) {
|
||||
$this->columns[$key]['table'] = false;
|
||||
}
|
||||
}
|
||||
$this->createText = false;
|
||||
$this->additionalJSVariables['WAREHOUSE_ADMIN'] = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function beforeUpdate($postData): bool {
|
||||
(new WarehouseHistoryController)->create($postData, $this->mod);
|
||||
return true;
|
||||
|
||||
@@ -11,9 +11,9 @@ final class WarehouseModify2 extends AbstractMigration {
|
||||
$WarehouseShippingNote->addColumn("deliveryAddressEMail", "string", ["null" => false, "limit" => 255]);
|
||||
$WarehouseShippingNote->addColumn("note", "string", ["null" => false, "limit" => 255]);
|
||||
$WarehouseShippingNote->addColumn("hoursEntries", "string", ["null" => false, "limit" => 255]);
|
||||
$WarehouseShippingNote->addColumn("signature", "string", ["null" => true, "limit" => 255]);
|
||||
$WarehouseShippingNote->addColumn("signatureName", "string", ["null" => true, "limit" => 255]);
|
||||
$WarehouseShippingNote->addColumn("signatureDate", "string", ["null" => true, "limit" => 255]);
|
||||
$WarehouseShippingNote->addColumn("signature", "text", ["null" => true]);
|
||||
$WarehouseShippingNote->addColumn("signatureName", "text", ["null" => true]);
|
||||
$WarehouseShippingNote->addColumn("signatureDate", "text", ["null" => true]);
|
||||
$WarehouseShippingNote->save();
|
||||
|
||||
//WarehouseArticle Table
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @property string|null $historyController
|
||||
* @property array $columns
|
||||
* @property array $additionalActions
|
||||
* @property array $additionalJSVariables
|
||||
* @property array $infoMessages
|
||||
* @property bool $onlyView
|
||||
*/
|
||||
@@ -66,12 +67,18 @@ class TTCrud extends mfBaseController {
|
||||
$pageName = "DefaultCrudView";
|
||||
}
|
||||
|
||||
Helper::renderVue($this, $pageName, $this->headerTitle, ["CRUD_CONFIG" => $this->getCrudConfig(),
|
||||
$JS_VARIABLES = ["CRUD_CONFIG" => $this->getCrudConfig(),
|
||||
"CREATE_URL" => $this::getUrl($this->mod . "/create"),
|
||||
"TABLE_URL" => $this::getUrl($this->mod . "/get"),
|
||||
"UPDATE_URL" => $this::getUrl($this->mod . "/update"),
|
||||
"DELETE_URL" => $this::getUrl($this->mod . "/delete"),
|
||||
"USER_ID" => $this->user->id]);
|
||||
"USER_ID" => $this->user->id];
|
||||
|
||||
if ($this->additionalJSVariables && is_array($this->additionalJSVariables)) {
|
||||
$JS_VARIABLES = array_merge($JS_VARIABLES, $this->additionalJSVariables);
|
||||
}
|
||||
|
||||
Helper::renderVue($this, $pageName, $this->headerTitle, $JS_VARIABLES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -261,7 +261,8 @@ Vue.component('warehouse-article', {
|
||||
|
||||
<template v-slot:cheapestsellprice="{ row }">
|
||||
<template v-for="price in JSON.parse(row.cheapestSellPrice)">
|
||||
<span v-if="price">{{price.title}}: {{(price.price)}} €</span><br>
|
||||
<span v-if="price && window.TT_CONFIG['WAREHOUSE_ADMIN'] === true">{{price.title}}: {{(price.price)}} €<br></span>
|
||||
<span v-if="price && price.title === 'Verkauf'">{{(price.price)}} €</span>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user