307 lines
20 KiB
PHP
307 lines
20 KiB
PHP
<?php
|
|
/**
|
|
* @var Address $netowner
|
|
* @var Address $netoperator
|
|
* @var PreorderProduct $product
|
|
* @var Array $campaigns
|
|
* @var string $today_date
|
|
*/
|
|
?>
|
|
|
|
<div class="row">
|
|
<div class="col-6">
|
|
<form method="post" action="<?=self::getUrl("PreorderProduct", "save")?>">
|
|
|
|
<div class="form-group">
|
|
<button type="button" class="btn btn-outline-success" onclick='$("#pricehistory-<?=$netoperator->id?>-<?=$product->id?>").toggle()'><i class="fas fa-fw fa-list"></i> Preishistory anzeigen</button>
|
|
</div>
|
|
|
|
<div class="row hidden" id="pricehistory-<?=$netoperator->id?>-<?=$product->id?>">
|
|
<table class="table table-sm table-striped table-hover">
|
|
<tr>
|
|
<th>INET</th>
|
|
<th>INET+TV</th>
|
|
<th>CATV</th>
|
|
<th>Passive</th>
|
|
<th>Gültig von</th>
|
|
<th>Gültig bis</th>
|
|
<th>Kampagnen</th>
|
|
<th>Beschreibung</th>
|
|
<th>Erstellt von</th>
|
|
</tr>
|
|
<?php foreach(PreorderProductPrice::search(["netowner_id" => $netowner->id, "preorderproduct_id" => $product->id, "netoperator_id" => $netoperator->id]) as $line): ?>
|
|
<tr>
|
|
<td class="text-monospace">€ <?=number_format($line->price_inet, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($line->price_inet_tv, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($line->price_catv, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($line->price_passive, 2, ",", ".")?></td>
|
|
<td class="text-monospace"><?=($line->start_date) ? (new DateTime($line->start_date))->format("d.m.Y") : "-"?></td>
|
|
<td class="text-monospace"><?=($line->end_date) ? (new DateTime($line->end_date))->format("d.m.Y") : "-"?></td>
|
|
<td><?=(is_array($line->campaigns) && count($line->campaigns)) ? count($line->campaigns) : ""?></td>
|
|
<td><?=$line->description?></td>
|
|
<td><?=$line->creator->name?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h4 class="pointer text-info" data-toggle="collapse" data-target="#new-price-<?=$netoperator->id?>-<?=$product->id?>"
|
|
id="new-price-<?=$netoperator->id?>-<?=$product->id?>-collapse" data-collapse-indicator="fa-circle-chevron"
|
|
onclick="toggleCollapseIndicator(this)">
|
|
<i class="fas fa-fw fa-circle-chevron-right collapse-indicator"></i> Neuen Preis eingeben
|
|
</h4>
|
|
</div>
|
|
<div class="card-body collapse" id="new-price-<?=$netoperator->id?>-<?=$product->id?>">
|
|
<div class="row">
|
|
<div class="col">
|
|
<div class="form-group">
|
|
<label>Beschreibung</label>
|
|
<input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][description]" value="" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Preis Internet</label>
|
|
<div class="input-group mb-3">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text">€</span>
|
|
</div>
|
|
<input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_inet]" value="" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Preis Internet + TV</label>
|
|
<div class="input-group mb-3">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text">€</span>
|
|
</div>
|
|
<input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_inet_tv]" value="" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Preis Cable-TV</label>
|
|
<div class="input-group mb-3">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text">€</span>
|
|
</div>
|
|
<input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_catv]" value="" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Preis Passive Leitung</label>
|
|
<div class="input-group mb-3">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text">€</span>
|
|
</div>
|
|
<input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_passive]" value="" />
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="form-group">
|
|
<label>Gültigkeit</label>
|
|
<div class="row">
|
|
<div class="col-6">
|
|
<div class="input-group mb-3">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text">Preis gültig von</span>
|
|
</div>
|
|
<input type="text" class="form-control datepicker" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][start_date]" value="" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-6">
|
|
<div class="input-group mb-3">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text">Preis gültig bis</span>
|
|
</div>
|
|
<input type="text" class="form-control datepicker" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][end_date]" value="" />
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<small>
|
|
Ohne <strong>Gültig-Bis-Datum</strong> gilt der neue Preis für immer, bis ein neuer Preis eingetragen wird.<br />
|
|
Mit <strong>Gültig-Bis-Datum</strong> gilt der neue Preis bis einschließlich dem <strong>Gültig-Bis-Datum</strong>, danach gilt der vorige Preis wieder.
|
|
</small>
|
|
|
|
<div class="row mt-3">
|
|
<div class="col">
|
|
<div class="form-group">
|
|
<label>Nur gültig in folgenden Kampagnen</label>
|
|
<select class="select2-nc form-control select2-multiple" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][campaigns][]" multiple="multiple" data-placeholder="Kampagnen ...">
|
|
<?php foreach ($campaigns as $campaign): ?>
|
|
<option value="<?= $campaign->id ?>" <?= (is_array($product->campaigns) && array_key_exists($campaign->id, $product->campaigns)) ? "selected='selected'" : "" ?>><?= $campaign->name ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<small>
|
|
Wenn keine Kampagne ausgewählt wird, gilt der Preis für alle Kampagnen.
|
|
</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<h4>Netzdurchdringung</h4>
|
|
<div class="row">
|
|
<div class="col">
|
|
<p>Rabattierte Preise für das Erreichen on Netzdurchdringungszielen</p>
|
|
<p>0 - 15% ist der Standardpreis. Falls keine Netzdurchdringung </p>
|
|
<table class="table table-sm table-bordered table-striped table-hover">
|
|
<tr>
|
|
<th>Ziel</th>
|
|
<th>INET</th>
|
|
<th>INET+TV</th>
|
|
<th>CATV</th>
|
|
<th>Passive</th>
|
|
</tr><tr>
|
|
<th>0 - 15%</th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][0-15][inet]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][0-15][inet_tv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][0-15][catv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][0-15][passive]" /></th>
|
|
</tr><tr>
|
|
<th>15,01% - 20%</th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][15-20][inet]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][15-20][inet_tv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][15-20][catv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][15-20][passive]" /></th>
|
|
</tr><tr>
|
|
<th>20,01% - 25%</th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][20-25][inet]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][20-25][inet_tv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][20-25][catv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][20-25][passive]" /></th>
|
|
</tr><tr>
|
|
<th>25,01% - 30%</th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][25-30][inet]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][25-30][inet_tv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][25-30][catv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][25-30][passive]" /></th>
|
|
</tr><tr>
|
|
<th>30,01% - 35%</th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][30-35][inet]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][30-35][inet_tv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][30-35][catv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][30-35][passive]" /></th>
|
|
</tr><tr>
|
|
<th>35,01% - 40%</th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][35-40][inet]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][35-40][inet_tv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][35-40][catv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][35-40][passive]" /></th>
|
|
</tr><tr>
|
|
<th>40,01% - 45%</th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][40-45][inet]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][40-45][inet_tv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][40-45][catv]" /></th>
|
|
<th><input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][40-45][passive]" /></th>
|
|
</tr>
|
|
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<input type="submit" class="btn btn-primary mt-2" value="Speichern" />
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
$current_price = $product->getCurrentPrice($today_date, true);
|
|
$current_regular_price = $product->getCurrentRegularPrice($today_date, true);
|
|
$first_price = $product->getFirstPrice($today_date);
|
|
?>
|
|
<div class="col-6">
|
|
<div class="row">
|
|
<div class="col">
|
|
<h4>Aktuelle Preise für <?=$product->getTodayDate()?></h4>
|
|
<table class="table">
|
|
<tr>
|
|
<th></th>
|
|
<th>INET</th>
|
|
<th>INET+TV</th>
|
|
<th>CATV</th>
|
|
<th>Passive</th>
|
|
<th></th>
|
|
</tr>
|
|
<tr>
|
|
<th>Heute gültiger Preis</th>
|
|
<td class="text-monospace">€ <?=number_format($current_price->price_inet, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($current_price->price_inet_tv, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($current_price->price_catv, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($current_price->price_passive, 2, ",", ".")?></td>
|
|
<td>
|
|
<?=$current_price->description?>
|
|
<?php if($current_price->end_date): ?>
|
|
bis <?=(new DateTime($current_price->end_date))->format("d.m.Y")?>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr><tr>
|
|
<th>Derzeit regulärer Preis</th>
|
|
<td class="text-monospace">€ <?=number_format($current_regular_price->price_inet, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($current_regular_price->price_inet_tv, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($current_regular_price->price_catv, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($current_regular_price->price_passive, 2, ",", ".")?></td>
|
|
<td><?=$current_regular_price->description?></td>
|
|
</tr><tr>
|
|
<td>Initialpreis</td>
|
|
<td class="text-monospace">€ <?=number_format($first_price->price_inet, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($first_price->price_inet_tv, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($first_price->price_catv, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($first_price->price_passive, 2, ",", ".")?></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col">
|
|
<h4>Preis Pro Kampagne</h4>
|
|
<table class="table table-sm table-striped table-hover">
|
|
<tr>
|
|
<th>Kampagne</th>
|
|
<th>INET</th>
|
|
<th>INET+TV</th>
|
|
<th>CATV</th>
|
|
<th>Passive</th>
|
|
<th>Gültig von</th>
|
|
<th>Gültig bis</th>
|
|
<th>Beschreibung</th>
|
|
<th></th>
|
|
</tr>
|
|
<?php foreach($campaigns as $campaign): ?>
|
|
<?php $cprice = $product->getCampaignPrice($campaign->id, $today_date); ?>
|
|
<tr>
|
|
<td><?=$campaign->name?></td>
|
|
<td class="text-monospace">€ <?=number_format($cprice->price_inet, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($cprice->price_inet_tv, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($cprice->price_catv, 2, ",", ".")?></td>
|
|
<td class="text-monospace">€ <?=number_format($cprice->price_passive, 2, ",", ".")?></td>
|
|
<td class="text-monospace"><?=($cprice->start_date) ? (new DateTime($cprice->start_date))->format("d.m.Y") : "-"?></td>
|
|
<td class="text-monospace"><?=($cprice->end_date) ? (new DateTime($cprice->end_date))->format("d.m.Y") : "-"?></td>
|
|
<td><?=$cprice->description?></td>
|
|
<td><?=$product->getTodayDate()?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|