319 lines
14 KiB
PHP
319 lines
14 KiB
PHP
<?php
|
|
$pagination_baseurl = $this->getUrl($Mod,"Index");
|
|
$pagination_baseurl_params = ["filter" => $filter];
|
|
$pagination_entity_name = "Vorbestellkampagnen";
|
|
?>
|
|
|
|
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
|
|
|
|
<style>
|
|
.preorder-campaign-import {
|
|
display: flex;
|
|
gap: 8px;
|
|
justify-content: flex-start;
|
|
}
|
|
|
|
.preorder-campaign-header, .preorder-campaign-header-buttons {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.preorder-campaign-header-buttons {
|
|
max-width: 500px;
|
|
}
|
|
|
|
@media (max-width: 576px) {
|
|
.preorder-campaign-import, .preorder-campaign-header {
|
|
display: grid;
|
|
grid-template-columns: 1fr;
|
|
grid-gap: 8px;
|
|
}
|
|
|
|
.preorder-campaign-table-wrapper {
|
|
overflow-x: auto;
|
|
}
|
|
|
|
.preorder-campaign-header h4 {
|
|
text-align: center;
|
|
}
|
|
|
|
.preorder-campaign-header-buttons {
|
|
display:grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
grid-gap: 8px;
|
|
}
|
|
|
|
.preorder-campaign-table-actions {
|
|
display: grid;
|
|
grid-gap: 4px;
|
|
grid-template-columns: auto auto auto;
|
|
}
|
|
|
|
.preorder-campaign-table-actions a {
|
|
text-align: center;
|
|
font-size: 24px;
|
|
}
|
|
|
|
.preorder-campaign-table-actions a[title="Vorbestellkampagne Löschen"] {
|
|
grid-column: 3;
|
|
}
|
|
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
$(document).ready(function () {
|
|
if (window.matchMedia('(min-width: 576px)').matches) {
|
|
return;
|
|
}
|
|
|
|
// in ul.pagination
|
|
// if .page-item.disabled.text-secondary exists
|
|
// only keep the first 2 .page-item, the last 2 .page-item and the .page-item.disabled.text-secondary and the one before and the one after that
|
|
|
|
const pagination = $("ul.pagination");
|
|
const disabled = pagination.find(".page-item.disabled.points");
|
|
|
|
if (disabled.length) {
|
|
const first = pagination.find(".page-item").first();
|
|
const firstNext = first.next();
|
|
const last = pagination.find(".page-item").last();
|
|
const lastNext = last.prev();
|
|
const prev = disabled.prev();
|
|
const next = disabled.next();
|
|
const notToDelete = [first, firstNext, last, lastNext, prev, next, disabled];
|
|
|
|
// loop through pagination.find(".page-item") and remove all but the first, last, prev, next, firstNext, lastNext
|
|
|
|
pagination.find(".page-item").each(function (index, item) {
|
|
// if (!notToDelete.includes($(item))) {
|
|
// $(item).remove();
|
|
// } fix this becaues of we need [0] of notToDelete to compare
|
|
let check = false;
|
|
notToDelete.forEach(function (n) {
|
|
if (n[0] === item) {
|
|
check = true;
|
|
}
|
|
});
|
|
|
|
if (!check) {
|
|
$(item).remove();
|
|
}
|
|
|
|
});
|
|
|
|
|
|
}
|
|
});
|
|
</script>
|
|
|
|
|
|
<!-- start page title -->
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="page-title-box">
|
|
<div class="page-title-right">
|
|
<ol class="breadcrumb m-0">
|
|
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a></li>
|
|
<li class="breadcrumb-item active">Vorbestellung</li>
|
|
</ol>
|
|
</div>
|
|
<h4 class="page-title">Vorbestellkampagnen</h4>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- end page title -->
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
|
|
<div class="card">
|
|
<div class="card-body mb-3">
|
|
<h4 class="header-title mb-3">Filter</h4>
|
|
|
|
<form method="get" action="<?=self::getUrl("Preordercampaign")?>">
|
|
<div class="row">
|
|
|
|
<div class="col-sm-12 col-md-2">
|
|
<label class="form-label" for="filter_network_id">Netzgebiet</label>
|
|
<select name="filter[network_id]" id="filter_network_id" class="form-control">
|
|
<option></option>
|
|
<?php foreach($mynetworks as $fnet): ?>
|
|
<option value="<?=$fnet->id?>" <?=($filter['network_id'] == $fnet->id) ? "selected='selected'" : ""?>><?=$fnet->name?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<?php if($me->is("Admin")): ?>
|
|
<div class="col-sm-12 col-md-2">
|
|
<label class="form-label" for="filter_netowner">Netzbesitzer</label>
|
|
<select name="filter[netowner]" id="filter_netowner" class="form-control">
|
|
<option></option>
|
|
<?php foreach($netowners as $owner): ?>
|
|
<option value="<?=$owner->id?>" <?=($filter['netowner'] == $owner->id) ? "selected='selected'" : ""?>><?=$owner->getCompanyOrName()?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="col-sm-12 col-md-1">
|
|
<label class="form-label" for="filter_name">Name</label>
|
|
<input type="text" class="form-control" name="filter[name]" id="filter_name" value="<?=$filter['name'] ?? ""?>" />
|
|
</div>
|
|
|
|
<div class="col-sm-12 col-md-1">
|
|
<label class="form-label" for="filter_area">Gebiet</label>
|
|
<input type="text" class="form-control" name="filter[area]" id="filter_area" value="<?=$filter['area'] ?? ""?>" />
|
|
</div>
|
|
|
|
</div>
|
|
<div class="row mt-2">
|
|
<div class="col preorder-campaign-header-buttons" style="max-width: 350px">
|
|
<button type="submit" class="btn btn-primary">Filter anwenden</button>
|
|
<a class="btn btn-secondary" href="<?=self::getUrl("Preordercampaign")?>">Filter zurücksetzen</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<?php if($me->address_id == 1 || $me->address_id == 4807): // xinon, rml ?>
|
|
<div class="card">
|
|
<div class="card-body preorder-campaign-import">
|
|
<a class="btn btn-purple" href="<?=self::getUrl("PreorderDiscount", "import")?>"><i class="fas fa-tags fa-fw"></i> Gutscheincodes importieren</a>
|
|
<a class="btn btn-purple ml-1" href="<?=self::getUrl("Preorder", "statusupdateimport")?>"><i class="fas fa-retweet fa-fw"></i> Statusupdates importieren</a>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="card">
|
|
<div class="card-body mb-3">
|
|
<div class="preorder-campaign-header">
|
|
<h4 class="header-title">Liste aller Vorbestellkampagnen</h4>
|
|
<?php if ($me->is("Admin")): ?>
|
|
<a class="btn btn-primary mb-2" href="<?= self::getUrl("Preordercampaign", "add") ?>"><i class="fas fa-plus"></i> Neue
|
|
Vorbestellkampagne anlegen</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col">
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
|
|
</div>
|
|
</div>
|
|
<div class="preorder-campaign-table-wrapper">
|
|
|
|
<table class="table table-striped table-hover">
|
|
<tr>
|
|
<th></th>
|
|
<th></th>
|
|
<th>Netzgebiete</th>
|
|
<th>Name</th>
|
|
<th>Vorbestellungen</th>
|
|
<td>Workorders</td>
|
|
<th>Start</th>
|
|
<th>Ende</th>
|
|
<th></th>
|
|
</tr>
|
|
<?php foreach($campaigns as $camp): ?>
|
|
<tr <?=(date('U') >= $camp->from && date('U') <= $camp->to) ? "class='active'" : ""?>>
|
|
<td class="text-right">
|
|
<?php if(date('U') >= $camp->from && date('U') <= $camp->to): ?>
|
|
<span class="fa-stack" title="Vorbestellkampagne aktiv">
|
|
<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; vertical-align: top; font-size: 0.7em; padding-right:4px; padding-top:4px; z-index: 10;"></i>
|
|
</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td class="text-right">
|
|
<a class="btn btn-sm btn-outline-primary" href="<?=self::getUrl("Preorder", "add", ["preordercampaign_id" => $camp->id])?>"><i class="fas fa-plus" title="Vorbestellung hinzufügen"></i></a>
|
|
</td>
|
|
<td><?=$camp->network->name?></td>
|
|
<td><?=$camp->name?></td>
|
|
<td>
|
|
<div class="row">
|
|
<div class="col-1 text-right" style="font-size: 1.5em" title="Bestellungen anzeigen">
|
|
<a href="<?=self::getUrl("Preorder", "Index", ["filter" => ["preordercampaign_id" => $camp->id]])?>"><i class="fas fa-list-alt"></i></a>
|
|
</div>
|
|
<div class="col">
|
|
<table class="table-sm table-borderless">
|
|
<tr class="bg-transparent" style="line-height: .6em;">
|
|
<?php if($camp->total_homes_sd): // automatic value from AdressDB ?>
|
|
<td class="text-right">EFH:</td>
|
|
<td class="text-right"><?=$camp->active_preorder_count_sd?> /</td>
|
|
<td class="text-right"><?=$camp->total_homes_sd?></td>
|
|
<td>(<?=(round(($camp->active_preorder_count_sd / $camp->total_homes_sd) * 100, 2))?> %)</td>
|
|
<?php endif; ?>
|
|
</tr>
|
|
<tr class="bg-transparent" style="line-height: .6em;">
|
|
<?php if($camp->total_homes_md): // automatic value from AdressdB ?>
|
|
<td class="text-right">MPH:</td>
|
|
<td class="text-right"><?=$camp->active_preorder_count_md?> /</td>
|
|
<td class="text-right"><?=$camp->total_homes_md?></td>
|
|
<td>(<?=(round(($camp->active_preorder_count_md / $camp->total_homes_md) * 100, 2))?> %)</td>
|
|
<?php endif; ?>
|
|
</tr>
|
|
<tr class="bg-transparent" style="line-height: .6em;">
|
|
<td class="text-right">Gesamt:</td>
|
|
<td class="text-right"><?=$camp->active_preorder_count?> /</td>
|
|
<td class="text-right">
|
|
<?php if($camp->homes_total): // manual value ?>
|
|
<?=$camp->homes_total?>
|
|
<?php elseif($camp->total_homes): // automatic value from AdressDB ?>
|
|
<?=$camp->total_homes?>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td>
|
|
<?php if($camp->homes_total): // manual value ?>
|
|
(<?=(round(($camp->active_preorder_count / $camp->homes_total) * 100, 2))?> %)
|
|
<?php elseif($camp->total_homes): // automatic value from AdressDB ?>
|
|
(<?=(round(($camp->active_preorder_count / $camp->total_homes) * 100, 2))?> %)
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<?php if($camp->workorder_count): ?>
|
|
<?=$camp->workorder_count?>
|
|
<?php else: ?>
|
|
0
|
|
<?php endif; ?>
|
|
/ <?=$camp->active_preorder_count?>
|
|
</td>
|
|
<td><?=date('d.m.Y',$camp->from)?></td>
|
|
<td><?=date('d.m.Y',$camp->to)?></td>
|
|
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
|
<div class="preorder-campaign-table-actions">
|
|
<a href="<?=self::getUrl("Preordercampaign", "downloadAddonServices", ["preordercampaign_id" => $camp->id])?>" title="Bestellte Zusatzdienste exportieren"><i class="far fa-sunset"></i></a>
|
|
<a href="<?=self::getUrl("Preordernotification", "Index", ["filter" => ["preordercampaign_id" => $camp->id]])?>" title="Email Aussendungen"><i class="far fa-envelope"></i></a>
|
|
<?php if($me->is("Admin")): ?>
|
|
<a href="<?=self::getUrl("Preordercampaign", "edit", ["id" => $camp->id])?>"><i class="far fa-edit" title="Vorbestellkampagne Bearbeiten"></i></a>
|
|
<a href="<?=self::getUrl("Preordercampaign", "admin", ["id" => $camp->id])?>"><i class="far fa-a" title="Adminfunktionen"></i></a>
|
|
<a href="<?=self::getUrl("Preordercampaign", "delete", ["id" => $camp->id])?>" class="text-danger" onclick="if(!confirm('Vorbestellkampagne wirklich löschen?')) return false;" title="Vorbestellkampagne Löschen"><i class="fas fa-trash"></i></a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
</div>
|
|
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
|
|