Files
thetool/Layout/default/PreorderProduct/Index.php
2025-03-17 12:22:03 +01:00

198 lines
9.5 KiB
PHP

<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<!-- 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"><a href="<?=self::getUrl("Preordercampaign")?>">Vorbestellkampagnen</a></li>
<li class="breadcrumb-item active">Bepreisung</li>
</ol>
</div>
<h4 class="page-title">Kampagnenmanagement Preise</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body mb-3 bg-light">
<div class="row">
<div class="col-12">
<h4 class="header-title">Kampagnenmanagement Preise</h4>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-4">
<form class="form-inline" type="get" action="<?=self::getUrl("PreorderProduct")?>">
<div class="form-group mx-sm-3 mb-2">
<label for="view_date">Ansichtsdatum:</label>
<input type="text" class="form-control datepicker-sys ml-2" name="view_date" placeholder="Datum..." value="<?=$today_date?>" />
</div>
<button type="submit" class="btn btn-primary mb-2">Anzeigen</button>
</form>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<ul class="nav nav-tabs mb-0" id="netop-tabs" role="tablist">
<?php $i = 0; foreach($netoperators as $netoperator): ?>
<li class="nav-item" role="presentation">
<!--a class="nav-link active" id="netop-<?=$netoperator->id?>-tab" data-toggle="tab" data-target="#netop-<?=$netoperator->id?>"><?=$netoperator->getCompanyOrName()?> (<?=$netoperator->id?>)</a-->
<a href="#netop-<?=$netoperator->id?>" class="nav-link <?=($i === 0) ? "active" : ""?>" id="netop-<?=$netoperator->id?>-tab" data-toggle="pill" data-target="#netop-<?=$netoperator->id?>" type="button" role="tab" aria-controls="netop-<?=$netoperator->id?>" aria-selected="<?=($i === 0) ? "true" : "false"?>">
<?=$netoperator->getCompanyOrName()?>
</a>
</li>
<?php $i++; endforeach; ?>
</ul>
<div class="tab-content mt-0 pt-0" id="netop-tabs-content">
<?php $i = 0; foreach($netoperators as $netoperator): ?>
<div class="tab-pane fade <?=($i === 0) ? "show active" : ""?>" id="netop-<?=$netoperator->id?>" role="tabpanel">
<div class="card">
<div class="card-body mb-3">
<h4>Produkte für Netzbetreiber <?=$netoperator->getCompanyOrName()?></h4>
<?php foreach($products as $product): ?>
<?php $product->setNetoperatorId($netoperator->id) ?>
<?php $product->setTodayDate($today_date); ?>
<?php //$prices = (array_key_exists($netoperator->id, $product->prices)) ? $product->prices[$netoperator->id] : false; ?>
<div class="card mt-4">
<div class="card-header" >
<h4 class="pointer"
data-toggle="collapse" data-target="#price-detail-<?=$netoperator->id?>-<?=$product->id?>"
id="price-detail-<?=$netoperator->id?>-<?=$product->id?>-collapse" data-collapse-indicator="fa-chevron" onclick="toggleCollapseIndicator(this)"
>
<i class="fas fa-fw fa-chevron-right collapse-indicator"></i> <span class="text-pink"><?=$product->name?></span>
</h4>
</div>
<div class="card-body mb-3 collapse" id="price-detail-<?=$netoperator->id?>-<?=$product->id?>">
<?php if($product->type == "operator_setup"): ?>
<?php include(__DIR__."/include/prices-setup.php"); ?>
<?php elseif($product->type == "enduser_setup"): ?>
<?php include(__DIR__."/include/prices-setup.php"); ?>
<?php elseif($product->type == "operator_usage"): ?>
<?php include(__DIR__."/include/netoperator-prices-usage.php"); ?>
<?php endif; ?>
</div>
</div>
<?php $i++; endforeach; ?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$('.datepicker').datepicker({
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
$('.datepicker-sys').datepicker({
language: 'de',
format: "yyyy-mm-dd",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
$(".select2").select2({
allowClear: true,
placeholder: "",
closeOnSelect: true
});
$(".select2-nc").select2({
allowClear: true,
placeholder: "",
closeOnSelect: false
});
function toggleCollapseIndicator(elem) {
if(typeof elem === 'object') {
var selector = "#" + $(elem).attr("id");
} else {
var selector = elem;
}
var itype = $(elem).data("collapse-indicator");
//console.log("selector: " + selector);
if($(selector + " i.collapse-indicator").hasClass(itype + "-right")) {
$(selector + " i.collapse-indicator").removeClass(itype + "-right").addClass(itype + "-down");
} else {
$(selector + " i.collapse-indicator").removeClass(itype + "-down").addClass(itype + "-right");
}
}
function priceToMarketshare(netop_id, product_id, type) {
console.log(netop_id, product_id, type);
let price = $("#price-" + type + "-" + netop_id + "-" + product_id).val();
console.log(price);
if(!price.length) return;
$("#marketshare-0-" + netop_id + "-" + product_id + "-" + type).val(price);
}
function marketshareToPrice(netop_id, product_id, type) {
console.log(netop_id, product_id, type);
let price = $("#marketshare-0-" + netop_id + "-" + product_id + "-" + type).val();
console.log(price);
if(!price.length) return;
$("#price-" + type + "-" + netop_id + "-" + product_id).val(price);
}
$(document).ready(() => {
var hash = window.location.hash.substring(1);
var match = hash.match(/product-(\d+)(?:-(\d)+)?/);
console.log(match);
if(match && typeof match[1] !== 'undefined') {
var netop = match[1];
console.log('$("#netop-' + netop + '-tab").tab("show");');
$("#netop-" + netop + "-tab").tab('show');
if(typeof match[2] !== 'undefined') {
let prod_id = match[2];
$("#price-detail-" + netop + "-" + prod_id).collapse('toggle');
toggleCollapseIndicator("#price-detail-" + netop + "-" + prod_id + "-collapse");
}
}
});
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>