Files
thetool/Layout/default/PreorderProduct/include/netoperator-prices-usage.php
2025-03-17 12:22:03 +01:00

315 lines
23 KiB
PHP

<?php
/**
* @var Address $netowner
* @var Address $netoperator
* @var PreorderProduct $product
* @var Array $campaigns
* @var string $today_date
*/
?>
<div class="row" id="netop-<?=$netoperator->id?>-<?=$product->id?>">
<?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-7">
<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>Preise Netzdurchdringung</h4>
<h5>Heute gültige Preise</h5>
Gültig von: <?=($current_price->start_date) ? (new DateTime($current_price->start_date))->format("d.m.Y") : ""?><br />
Gültig bis: <?=($current_price->end_date) ? (new DateTime($current_price->end_date))->format("d.m.Y") : ""?>
<table class="table table-sm table-striped table-hover">
<tr>
<th>Gruppe</th>
<th>INET</th>
<th>INET+TV</th>
<th>CATV</th>
<th>Passive</th>
</tr>
<tr>
<td>0 - 15%</td>
<td><?=$current_price->price_inet?></td>
<td><?=$current_price->price_inet_tv?></td>
<td><?=$current_price->price_catv?></td>
<td><?=$current_price->price_passive?></td>
</tr>
<?php foreach($current_price->marketsharediscounts as $bracket => $discount): ?>
<tr>
<td><?=$bracket?>% - <?=($bracket+5)?>%</td>
<td><?=$discount->price_inet?></td>
<td><?=$discount->price_inet_tv?></td>
<td><?=$discount->price_catv?></td>
<td><?=$discount->price_passive?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
<div class="col-5">
<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 title="Erstellt <?=date("d.m.Y", $line->create)?>"><?=$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="row">
<div class="col">
<div class="form-group">
<label>FIBU Artikelnummer</label>
<input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][article_number]" value="<?=$product->getDefaultArticlenumber()?>" />
</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" id="price-inet-<?=$netoperator->id?>-<?=$product->id?>" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_inet]" value="" onchange="priceToMarketshare(<?=$netoperator->id?>, <?=$product->id?>, 'inet')" />
</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" id="price-inet_tv-<?=$netoperator->id?>-<?=$product->id?>" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_inet_tv]" value="" onchange="priceToMarketshare(<?=$netoperator->id?>, <?=$product->id?>, 'inet_tv')" />
</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" id="price-catv-<?=$netoperator->id?>-<?=$product->id?>" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_catv]" value="" onchange="priceToMarketshare(<?=$netoperator->id?>, <?=$product->id?>, 'catv')" />
</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" id="price-passive-<?=$netoperator->id?>-<?=$product->id?>" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_passive]" value="" onchange="priceToMarketshare(<?=$netoperator->id?>, <?=$product->id?>, 'passive')" />
</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 class="mt-3">Netzdurchdringung</h4>
<div class="row">
<div class="col">
<p>Rabattierte Preise für das Erreichen on Netzdurchdringungszielen</p>
<p>0 - 15% ist der Standardpreis </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" id="marketshare-0-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][0][inet]" onchange="marketshareToPrice(<?=$netoperator->id?>, <?=$product->id?>, 'inet')" /></th>
<th><input type="text" class="form-control" id="marketshare-0-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][0][inet_tv]" onchange="marketshareToPrice(<?=$netoperator->id?>, <?=$product->id?>, 'inet_tv')" /></th>
<th><input type="text" class="form-control" id="marketshare-0-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][0][catv]" onchange="marketshareToPrice(<?=$netoperator->id?>, <?=$product->id?>, 'catv')" /></th>
<th><input type="text" class="form-control" id="marketshare-0-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][0][passive]" onchange="marketshareToPrice(<?=$netoperator->id?>, <?=$product->id?>, 'passive')" /></th>
</tr><tr>
<th>15,01% - 20%</th>
<th><input type="text" class="form-control" id="marketshare-15-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][15][inet]" /></th>
<th><input type="text" class="form-control" id="marketshare-15-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][15][inet_tv]" /></th>
<th><input type="text" class="form-control" id="marketshare-15-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][15][catv]" /></th>
<th><input type="text" class="form-control" id="marketshare-15-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][15][passive]" /></th>
</tr><tr>
<th>20,01% - 25%</th>
<th><input type="text" class="form-control" id="marketshare-20-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][20][inet]" /></th>
<th><input type="text" class="form-control" id="marketshare-20-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][20][inet_tv]" /></th>
<th><input type="text" class="form-control" id="marketshare-20-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][20][catv]" /></th>
<th><input type="text" class="form-control" id="marketshare-20-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][20][passive]" /></th>
</tr><tr>
<th>25,01% - 30%</th>
<th><input type="text" class="form-control" id="marketshare-25-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][25][inet]" /></th>
<th><input type="text" class="form-control" id="marketshare-25-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][25][inet_tv]" /></th>
<th><input type="text" class="form-control" id="marketshare-25-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][25][catv]" /></th>
<th><input type="text" class="form-control" id="marketshare-25-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][25][passive]" /></th>
</tr><tr>
<th>30,01% - 35%</th>
<th><input type="text" class="form-control" id="marketshare-30-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][30][inet]" /></th>
<th><input type="text" class="form-control" id="marketshare-30-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][30][inet_tv]" /></th>
<th><input type="text" class="form-control" id="marketshare-30-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][30][catv]" /></th>
<th><input type="text" class="form-control" id="marketshare-30-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][30][passive]" /></th>
</tr><tr>
<th>35,01% - 40%</th>
<th><input type="text" class="form-control" id="marketshare-35-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][35][inet]" /></th>
<th><input type="text" class="form-control" id="marketshare-35-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][35][inet_tv]" /></th>
<th><input type="text" class="form-control" id="marketshare-35-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][35][catv]" /></th>
<th><input type="text" class="form-control" id="marketshare-35-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][35][passive]" /></th>
</tr><tr>
<th>40,01% - 45%</th>
<th><input type="text" class="form-control" id="marketshare-40-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][40][inet]" /></th>
<th><input type="text" class="form-control" id="marketshare-40-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][40][inet_tv]" /></th>
<th><input type="text" class="form-control" id="marketshare-40-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][40][catv]" /></th>
<th><input type="text" class="form-control" id="marketshare-40-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][40][passive]" /></th>
</tr>
</table>
</div>
</div>
</div>
<input type="submit" class="btn btn-primary mt-2" value="Speichern" />
</div>
</div>
</form>
</div>
</div>