Preorder campaign rework
This commit is contained in:
@@ -75,13 +75,13 @@ class ADBHausnummer extends mfBaseModel {
|
||||
}
|
||||
|
||||
public function getBuildingType() {
|
||||
$rimo_type = strtolower($this->rimo_type);
|
||||
$rimo_type = $this->rimo_type === NULL ? '' : strtolower($this->rimo_type);
|
||||
|
||||
if(array_key_exists($this->rimo_type, TT_ADB_GDA_TYPES)) {
|
||||
return TT_ADB_GDA_TYPES[$this->rimo_type];
|
||||
}
|
||||
|
||||
$gdaeigenschaft = strtolower($this->gdaeigenschaft);
|
||||
$gdaeigenschaft = $this->gdaeigenschaft === NULL ? '' : strtolower($this->gdaeigenschaft);
|
||||
if(array_key_exists($gdaeigenschaft, TT_ADB_GDA_TYPES)) {
|
||||
return TT_ADB_GDA_TYPES[$gdaeigenschaft];
|
||||
}
|
||||
|
||||
@@ -927,8 +927,69 @@ class PreorderModel
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function countHistoryStatus($filter = [], $status_code = null)
|
||||
{
|
||||
public static function countActivePreorder($preorderCampaignId = null) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = "1=1 ";
|
||||
if ($preorderCampaignId) {
|
||||
$where .= " AND p.preordercampaign_id = $preorderCampaignId";
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
COALESCE(SUM(CASE
|
||||
WHEN LOWER(vh.gdaeigenschaft) IN ('multi dwelling', 'mehrparteienhaus', 'gebaeude mit 2 oder mehr wohnungen', 'gebäude mit 2 oder mehr wohnungen', 'wohngebaeude fuer gemeinschaften', 'wohngebäude für gemeinschaften', 'hotels und aehnliche gebaeude', 'hotels und ähnliche gebäude', 'wohngebäude mit 2 und mehr wohnungen')
|
||||
OR LOWER(vh.rimo_type) IN ('multi dwelling', 'mehrparteienhaus', 'gebaeude mit 2 oder mehr wohnungen', 'gebäude mit 2 oder mehr wohnungen', 'wohngebaeude fuer gemeinschaften', 'wohngebäude für gemeinschaften', 'hotels und aehnliche gebaeude', 'hotels und ähnliche gebäude', 'wohngebäude mit 2 und mehr wohnungen')
|
||||
THEN COALESCE(p.connection_count, 1)
|
||||
ELSE 0
|
||||
END), 0) AS md_count,
|
||||
COALESCE(SUM(COALESCE(p.connection_count, 1)), 0) AS total_count
|
||||
|
||||
FROM
|
||||
`".FRONKDB_DBNAME."`.Preorder p
|
||||
LEFT JOIN `".ADDRESSDB_DBNAME."`.view_hausnummer vh ON p.adb_hausnummer_id = vh.hausnummer_id
|
||||
LEFT JOIN `".FRONKDB_DBNAME."`.Preorderstatus tt_preorderstatus ON p.status_id = tt_preorderstatus.id
|
||||
WHERE p.deleted = 0 AND tt_preorderstatus.code < 899";
|
||||
|
||||
$queryStart = microtime(true);
|
||||
$res = $db->query($sql . $where);
|
||||
mfLoghandler::singleton()->debug("[Query took: ".(microtime(true) - $queryStart)." seconds] " . $sql);
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return ['md_count' => $data->md_count, 'sd_count' => $data->total_count - $data->md_count, 'total_count' => $data->total_count];
|
||||
}
|
||||
return ['md_count' => 0, 'sd_count' => 0, 'total_count' => 0];
|
||||
}
|
||||
|
||||
public static function countTotalUnits($preorderCampaignId = null) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = "1=1 ";
|
||||
if ($preorderCampaignId) {
|
||||
$where .= " AND pc.id = $preorderCampaignId";
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
pc.id AS campaign_id,
|
||||
COALESCE(SUM(n.unit_count), 0) AS total_unit_count,
|
||||
COALESCE(SUM(n.unit_count_sd), 0) AS total_unit_count_sd,
|
||||
COALESCE(SUM(n.unit_count_md), 0) AS total_unit_count_md
|
||||
FROM Preordercampaign pc
|
||||
LEFT JOIN `".FRONKDB_DBNAME."`.PreordercampaignSalescluster pcs ON pc.id = pcs.preordercampaign_id
|
||||
LEFT JOIN `".ADDRESSDB_DBNAME."`.Netzgebiet n ON pcs.salescluster_id = n.id
|
||||
WHERE $where
|
||||
GROUP BY pc.id";
|
||||
|
||||
$queryStart = microtime(true);
|
||||
$res = $db->query($sql);
|
||||
mfLoghandler::singleton()->debug("[Query took: ".(microtime(true) - $queryStart)." seconds] " . $sql);
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return ['total_unit_count' => $data->total_unit_count, 'total_unit_count_sd' => $data->total_unit_count_sd, 'total_unit_count_md' => $data->total_unit_count_md];
|
||||
}
|
||||
return ['total_unit_count' => 0, 'total_unit_count_sd' => 0, 'total_unit_count_md' => 0];
|
||||
}
|
||||
|
||||
public static function countHistoryStatus($filter = [], $status_code = null) {
|
||||
if ($status_code === null) {
|
||||
die("Please select a status code");
|
||||
}
|
||||
|
||||
@@ -7,111 +7,65 @@ class PreordercampaignController extends mfBaseController {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me",$me);
|
||||
$this->layout()->set("me", $this->me);
|
||||
|
||||
if(!$me->is(["Admin", "netowner", "salespartner"]) && !$me->can("Preorder")) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
if (!$this->me->is(["Admin", "netowner", "salespartner"]) && !$this->me->can("Preorder")) $this->redirect("Dashboard");
|
||||
if ($this->me->is("Preorderlogistics")) $this->redirect("Preorderlogistics");
|
||||
if ($this->me->is("Preorderfront")) $this->redirect("Preorder");
|
||||
}
|
||||
|
||||
protected function indexAction() {
|
||||
if($this->me->is("Preorderlogistics")) {
|
||||
$this->redirect("Preorderlogistics");
|
||||
}
|
||||
|
||||
|
||||
$this->layout()->setTemplate("Preordercampaign/Index");
|
||||
|
||||
$this->layout->set("filter", $this->request->filter);
|
||||
$isAdmin = $this->me->is("Admin");
|
||||
|
||||
$filter = [];
|
||||
if($this->request->filter) {
|
||||
$filter = $this->getPreparedFilter($this->request->filter);
|
||||
if ($isAdmin) $my_networks = NetworkModel::getAll();
|
||||
else $filter['network_id'] = array_unique(array_merge(
|
||||
array_column($this->me->myNetworks(["netowner", "salespartner"]), 'id'),
|
||||
json_decode($this->me->getFlag("preorder_networks")->value() ?: '[]')
|
||||
));
|
||||
|
||||
|
||||
|
||||
$campaigns = array_map(function ($c) {
|
||||
return [
|
||||
'id' => $c->id,
|
||||
'network_id' => $c->network_id,
|
||||
'network_name' => $c->network->name,
|
||||
'network_owner_name' => $c->network->owner->getCompanyOrName(),
|
||||
'name' => $c->name,
|
||||
'area' => $c->area,
|
||||
'from' => $c->from,
|
||||
'to' => $c->to,
|
||||
'rimo_workoders' => $c->workorder_count,
|
||||
'active_preorder_count' => PreorderModel::countActivePreorder($c->id),
|
||||
'count_total_units' => PreorderModel::countTotalUnits($c->id),
|
||||
];
|
||||
}, PreordercampaignModel::search($filter));
|
||||
|
||||
$net_owners = array_map(function ($n) {
|
||||
return [
|
||||
'value' => $n->getCompanyOrName(),
|
||||
'text' => $n->getCompanyOrName()
|
||||
];
|
||||
}, $isAdmin ? $this->getNetworkOwners(array_column($my_networks, 'id')) : []);
|
||||
|
||||
Helper::renderVue($this, "Preordercampaign", "Vorbestellkampagnen",
|
||||
[
|
||||
"NETWORK_OWNER_OPTIONS" => $net_owners,
|
||||
"SHOW_MISC_BUTTONS" => in_array($this->me->address_id, [1, 4807], true),
|
||||
"IS_ADMIN" => $isAdmin,
|
||||
"CAMPAIGNS" => $campaigns,
|
||||
"VIEW_URL" => self::getUrl("Preorder", "Index"),
|
||||
"PREORDER_DISCOUNT_IMPORT_URL" => self::getUrl("Preorderdiscount", "import"),
|
||||
"PREORDER_STATUS_UPDATE_IMPORT_URL" => self::getUrl("Preorder", "statusupdateimport"),
|
||||
"ADD_PREORDER_URL" => self::getUrl("Preorder", "add"),
|
||||
"DOWNLOAD_ADDON_SERVICES_URL" => self::getUrl("Preordercampaign", "downloadAddonServices"),
|
||||
"PREORDER_NOTIFICATION_URL" => self::getUrl("Preordernotification", "Index"),
|
||||
"ADD_URL" => self::getUrl("Preordercampaign", "add"),
|
||||
"EDIT_URL" => self::getUrl("Preordercampaign", "edit"),
|
||||
"ADMIN_URL" => self::getUrl("Preordercampaign", "admin"),
|
||||
]);
|
||||
}
|
||||
|
||||
// pagination defaults
|
||||
$pagination = [];
|
||||
$pagination['start'] = 0;
|
||||
$pagination['count'] = 20;
|
||||
$pagination['maxItems'] = 0;
|
||||
|
||||
if(is_numeric($this->request->s)) {
|
||||
$pagination['start'] = intval($this->request->s);
|
||||
}
|
||||
|
||||
$my_networks = [];
|
||||
//var_dump($filter);exit;
|
||||
if($this->me->is("Admin")) {
|
||||
if(!is_array($filter['network_id']) && $filter['network_id']) {
|
||||
$my_networks[] = new Network($filter['network_id']);
|
||||
} else {
|
||||
$my_networks = NetworkModel::getAll();
|
||||
}
|
||||
$this->layout()->set("mynetworks", NetworkModel::getAll());
|
||||
|
||||
$netowners = $this->getNetworkOwners($my_network_ids);
|
||||
$this->layout()->set("netowners", $netowners);
|
||||
|
||||
} else {
|
||||
$use_filter_network = false;
|
||||
$my_networks = $this->me->myNetworks(["netowner", "salespartner"]);
|
||||
|
||||
// check users allowed networks
|
||||
$user_network_ids = $this->me->getFlag("preorder_networks")->value();
|
||||
if($user_network_ids) {
|
||||
$user_network_ids = json_decode($user_network_ids);
|
||||
}
|
||||
|
||||
if(is_array($user_network_ids) && count($user_network_ids)) {
|
||||
|
||||
if(!$my_networks) {
|
||||
foreach($user_network_ids as $mnid) {
|
||||
$my_networks[] = new Network($mnid);
|
||||
}
|
||||
} else {
|
||||
//var_dump($user_network_ids, $my_networks);exit;
|
||||
$new_my_networks = [];
|
||||
foreach($my_networks as $network) {
|
||||
if(in_array($network->id, $user_network_ids)) {
|
||||
$new_my_networks[$network->id] = $network;
|
||||
}
|
||||
}
|
||||
$my_networks = $new_my_networks;
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($my_networks);exit;
|
||||
foreach($my_networks as $mn) {
|
||||
if($mn->id == $filter['network_id']) {
|
||||
$use_filter_network = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->layout()->set("mynetworks", $my_networks);
|
||||
|
||||
if($use_filter_network) {
|
||||
$my_networks = [];
|
||||
$my_networks[] = new Network($filter['network_id']);
|
||||
}
|
||||
|
||||
$my_network_ids = [];
|
||||
foreach($my_networks as $network) {
|
||||
$my_network_ids[] = $network->id;
|
||||
}
|
||||
$filter['network_id'] = $my_network_ids;
|
||||
}
|
||||
|
||||
|
||||
$pagination['maxItems'] = PreordercampaignModel::count($filter);
|
||||
$campaigns = PreordercampaignModel::search($filter, $pagination);
|
||||
|
||||
$this->layout()->set("pagination", $pagination);
|
||||
$this->layout()->set("campaigns", $campaigns);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function getPreparedFilter($filter) {
|
||||
$new_filter = [];
|
||||
|
||||
@@ -153,7 +107,7 @@ class PreordercampaignController extends mfBaseController {
|
||||
ORDER BY Address.company, Address.lastname, Address.firstname
|
||||
";
|
||||
$res = $this->db()->query($sql);
|
||||
if($this->db()->num_rows($reso)) {
|
||||
if($this->db()->num_rows($res)) {
|
||||
while($data = $this->db()->fetch_object($res)) {
|
||||
$owners[] = new Address($data->id);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php /** @noinspection ALL */
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AddPreorderDbImprovements extends AbstractMigration {
|
||||
public function up(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("PreordercampaignSalescluster")->addIndex(["preordercampaign_id","salescluster_id"])->save();
|
||||
$this->table("RimoWorkorder")->addIndex(["adb_wohneinheit_id"])->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("PreordercampaignSalescluster")->removeIndex(["preordercampaign_id","salescluster_id"])->save();
|
||||
$this->table("RimoWorkorder")->removeIndex(["adb_wohneinheit_id"])->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
<?php
|
||||
|
||||
class FronkDB {
|
||||
|
||||
public $link;
|
||||
private $result;
|
||||
private $lastError;
|
||||
private $log;
|
||||
|
||||
public $insert_id;
|
||||
|
||||
private static $instances = [];
|
||||
|
||||
//private static $instance;
|
||||
public $host;
|
||||
public $user;
|
||||
public $pass;
|
||||
public $db;
|
||||
|
||||
public function __construct($host = false, $user = false, $pass = false, $db = false) {
|
||||
$this->host = $host;
|
||||
|
||||
36
public/js/pages/Preordercampaign/Preordercampaign.css
Normal file
36
public/js/pages/Preordercampaign/Preordercampaign.css
Normal file
@@ -0,0 +1,36 @@
|
||||
.campaign-grid {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 0.75rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.campaign-icon,
|
||||
.campaign-icon > i{
|
||||
font-size: 24px !important;
|
||||
padding: 0.25rem;
|
||||
}
|
||||
|
||||
.campaign-icon:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.progress-grid {
|
||||
display: grid;
|
||||
grid-template-columns: auto repeat(3, max-content);
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.progress-row > *:nth-child(n+2) {
|
||||
text-align: right;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.preorder-campaign-table-actions > a > i {
|
||||
font-size: 17px !important;
|
||||
}
|
||||
|
||||
.preorder-campaign-table-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
103
public/js/pages/Preordercampaign/Preordercampaign.js
Normal file
103
public/js/pages/Preordercampaign/Preordercampaign.js
Normal file
@@ -0,0 +1,103 @@
|
||||
Vue.component('Preordercampaign', {
|
||||
template: `
|
||||
<tt-card>
|
||||
<tt-table :data="window['TT_CONFIG']['CAMPAIGNS']" :config="PreordercampaignTableConfig">
|
||||
<template v-slot:top-buttons>
|
||||
<button v-if="window['TT_CONFIG']['IS_ADMIN'] === '1'" type="button" class="btn btn-primary" @click="window.location = window['TT_CONFIG']['ADD_URL']">
|
||||
<i class="fas fa-plus"></i> Vorbestellung hinzufügen
|
||||
</button>
|
||||
<a v-if="window['TT_CONFIG']['SHOW_MISC_BUTTONS'] === '1'" class="btn btn-purple" :href="window['TT_CONFIG']['PREORDER_DISCOUNT_IMPORT_URL']">
|
||||
<i class="fas fa-tags fa-fw"></i> Gutscheincodes importieren</a>
|
||||
<a v-if="window['TT_CONFIG']['SHOW_MISC_BUTTONS'] === '1'" class="btn btn-purple ml-1" :href="window['TT_CONFIG']['PREORDER_STATUS_UPDATE_IMPORT_URL']">
|
||||
<i class="fas fa-retweet fa-fw"></i> Statusupdates importieren</a>
|
||||
</template>
|
||||
|
||||
<template v-slot:status="{ row: campaign }">
|
||||
<span class="fa-stack" title="Vorbestellkampagne aktiv" v-if="campaign.from <= Date.now()/1000 && campaign.to >= Date.now()/1000">
|
||||
<i class="fas fa-alarm-clock fa-stack-1x text-success" style="z-index:20"></i>
|
||||
<i class="fas fa-circle-check" style="color:Tomato;font-size:.7em"></i>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template v-slot:add="{ row: campaign }">
|
||||
<a class="btn btn-sm btn-outline-primary" :href="window['TT_CONFIG']['ADD_PREORDER_URL'] + '?preordercampaign_id=' + campaign.id">
|
||||
<i class="fas fa-plus" title="Vorbestellung hinzufügen"></i></a>
|
||||
</template>
|
||||
|
||||
<template v-slot:progress="{ row: campaign }">
|
||||
<div class="campaign-grid">
|
||||
<a :href="window['TT_CONFIG']['VIEW_URL'] + '?filter[preordercampaign_id]=' + campaign.id" class="campaign-icon">
|
||||
<i class="fas fa-list-alt" title="Bestellungen anzeigen"></i></a>
|
||||
<div class="progress-grid">
|
||||
<template v-if="campaign.count_total_units.total_unit_count_sd > 0">
|
||||
<span>EFH:</span><span>{{ campaign.active_preorder_count.sd_count }} /</span>
|
||||
<span>{{ campaign.count_total_units.total_unit_count_sd }}</span>
|
||||
<span>({{ ((campaign.active_preorder_count.sd_count / campaign.count_total_units.total_unit_count_sd) * 100 || 0).toFixed(2) }} %)</span>
|
||||
</template>
|
||||
<template v-if="campaign.count_total_units.total_unit_count_md > 0">
|
||||
<span>MPH:</span><span>{{ campaign.active_preorder_count.md_count }} /</span>
|
||||
<span>{{ campaign.count_total_units.total_unit_count_md }}</span>
|
||||
<span>({{ ((campaign.active_preorder_count.md_count / campaign.count_total_units.total_unit_count_md) * 100 || 0).toFixed(2) }} %)</span>
|
||||
</template>
|
||||
<template v-if="campaign.count_total_units.total_unit_count > 0">
|
||||
<span>Gesamt:</span><span>{{ campaign.active_preorder_count.total_count }} /</span>
|
||||
<span>{{ campaign.count_total_units.total_unit_count * 2 }}</span>
|
||||
<span>({{ ((campaign.active_preorder_count.total_count / (campaign.count_total_units.total_unit_count * 2)) * 100 || 0).toFixed(1) }} %)</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:from="{ row: campaign }">{{ formatDate(campaign.from) }}</template>
|
||||
<template v-slot:to="{ row: campaign }">{{ formatDate(campaign.to) }}</template>
|
||||
<template v-slot:rimo_workoders="{ row: campaign }">{{ campaign.rimo_workoders }} / {{ campaign.active_preorder_count.total_count }}</template>
|
||||
|
||||
<template v-slot:actions="{ row: campaign }">
|
||||
<div class="preorder-campaign-table-actions">
|
||||
<a :href="window['TT_CONFIG']['PREORDER_NOTIFICATION_URL'] + '?filter[preordercampaign_id]=' + campaign.id" title="Email Aussendungen"><i class="far fa-envelope"></i></a>
|
||||
<template v-if="window['TT_CONFIG']['IS_ADMIN'] === '1'">
|
||||
<a class="ml-2" :href="window['TT_CONFIG']['EDIT_URL'] + '?id=' + campaign.id"><i class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a class="ml-2" :href="window['TT_CONFIG']['ADMIN_URL'] + '?id=' + campaign.id"><i class="far fa-a" title="Adminfunktionen"></i></a>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</tt-table>
|
||||
</tt-card>
|
||||
|
||||
`,
|
||||
|
||||
data() {
|
||||
return {
|
||||
window: window,
|
||||
PreordercampaignTableConfig: {
|
||||
key: 'PreordercampaignTable',
|
||||
tableHeader: 'Vorbestellkampagnen',
|
||||
defaultPageSize: 25,
|
||||
headers: [
|
||||
{text: 'Status', key: 'status', class: 'text-center',sortable: false,filter:false, priority: 20},
|
||||
{text: '', key: 'add', class: 'text-center',filter:false, sortable: false, priority: 18},
|
||||
{text: 'Netzgebiet', key: 'network_name', priority: 19},
|
||||
{text: 'Name', key: 'name', priority: 14},
|
||||
{text: 'Fortschritt', key: 'progress', priority: 17,filter:false,sortable: false},
|
||||
{text: 'Workorders', key: 'rimo_workoders', class: 'text-center', priority: 16,filter:false},
|
||||
{text: 'Von', key: 'from', class: 'text-center', priority: 13,filter:false,sortable: false},
|
||||
{text: 'Bis', key: 'to', class: 'text-center', priority: 12,filter:false,sortable: false},
|
||||
{text: 'Aktionen', key: 'actions', class: 'text-center', sortable: false, priority: 21,filter:false}
|
||||
],
|
||||
customRowClass: (row) => {
|
||||
if (row.from <= Date.now()/1000 && row.to >= Date.now()/1000) {
|
||||
return 'active';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (window.TT_CONFIG.IS_ADMIN === "1") {
|
||||
this.PreordercampaignTableConfig.headers.splice(3, 0, {text: 'Netzbesitzer', key: 'network_owner_name', priority: 4, filter: 'select', filterOptions: window['TT_CONFIG']['NETWORK_OWNER_OPTIONS']});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate: date => window.moment(date * 1000).format('DD.MM.YYYY'),
|
||||
}
|
||||
});
|
||||
@@ -83,7 +83,7 @@
|
||||
}
|
||||
|
||||
.tt-table.table-sm > tbody > tr > td * {
|
||||
font-size: 13px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.tt-table.table-sm > tbody > tr {
|
||||
|
||||
@@ -66,8 +66,9 @@ Vue.component('tt-table-crud', {
|
||||
<tt-select v-show="crudModalColumnVisibility[column.key]" v-else-if="column.type === 'select'" v-model="crudModalData[column.key]" :label="column.text" :options="column.items" sm row/>
|
||||
<tt-autocomplete v-show="crudModalColumnVisibility[column.key]" v-else-if="column.type === 'autocomplete'" v-model="crudModalData[column.key]" :label="column.text" :api-url="column.apiUrl" :items="column.items" sm row :return-text="column.returnText" />
|
||||
<tt-date-picker v-show="crudModalColumnVisibility[column.key]" v-else-if="column.type === 'datepicker'" v-model="crudModalData[column.key]" :label="column.text" sm row :date-range="false" :ref="column.key.toLowerCase() + '-modal-input'"/>
|
||||
<tt-icon-select v-show="crudModalColumnVisibility[column.key]" v-else-if="column.type === 'icon-select'" v-model="crudModalData[column.key]" :label="column.text" sm row/>
|
||||
<tt-icon-select v-show="crudModalColumnVisibility[column.key]" v-else-if="column.type === 'icon-select'" v-model="crudModalData[column.key]" :options="column.items" :label="column.text" sm row/>
|
||||
<tt-checkbox v-show="crudModalColumnVisibility[column.key]" v-else-if="column.type === 'checkbox'" v-model="crudModalData[column.key]" :label="column.text" sm row/>
|
||||
<tt-positions-manager v-show="crudModalColumnVisibility[column.key]" v-else-if="column.type === 'positions-manager'" v-model="crudModalData[column.key]" :config="column.config" sm row/>
|
||||
</slot>
|
||||
<!-- @formatter:on -->
|
||||
</template>
|
||||
|
||||
@@ -825,16 +825,16 @@ Vue.component('tt-table', {
|
||||
}
|
||||
})
|
||||
|
||||
Vue.config.errorHandler = function (err, vm, info) {
|
||||
// still log errors to the console
|
||||
console.error(info, err, vm);
|
||||
|
||||
if (typeof vm.config.key === 'string') {
|
||||
// check if document.querySelector table.tt-table exists aswell if it has atleast 3 <tr> elements
|
||||
const table = document.querySelector('table.tt-table');
|
||||
if (!table || !table.querySelectorAll('tr').length > 2) {
|
||||
// localStorage.removeItem(`tt-table-${vm.config.key}`);
|
||||
// window.location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Vue.config.errorHandler = function (err, vm, info) {
|
||||
// // still log errors to the console
|
||||
// console.error(info, err, vm);
|
||||
//
|
||||
// if (typeof vm.config.key === 'string') {
|
||||
// // check if document.querySelector table.tt-table exists aswell if it has atleast 3 <tr> elements
|
||||
// const table = document.querySelector('table.tt-table');
|
||||
// if (!table || !table.querySelectorAll('tr').length > 2) {
|
||||
// // localStorage.removeItem(`tt-table-${vm.config.key}`);
|
||||
// // window.location.reload();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user