Added Voiceplan, Admin IVT product matcher and Voicenumber update

updates number in ContractConfig
This commit is contained in:
Frank Schubert
2023-05-04 15:01:28 +02:00
parent a2b519f6f3
commit 8214acd3e9
42 changed files with 1975 additions and 207 deletions

View File

@@ -10,16 +10,15 @@
<li class="breadcrumb-item active">Admin</li> <li class="breadcrumb-item active">Admin</li>
</ol> </ol>
</div> </div>
<h4 class="page-title">Admin</h4> <h4 class="page-title">Secret Admin functions</h4>
</div> </div>
</div> </div>
</div> </div>
<!-- end page title --> <!-- end page title -->
<h4>Secret Admin functions</h4>
<div class="row"> <div class="row">
<div class="col-12 col-xl-10"> <div class="col-12 col-xl-10">
<h5>Network</h5>
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="row col-12"> <div class="row col-12">
@@ -30,5 +29,18 @@
</div> </div>
</div> </div>
<div class="row">
<div class="col-12 col-xl-10">
<h5>IVT</h5>
<div class="card">
<div class="card-body">
<div class="row col-12">
<div><a href="<?=self::getUrl("Admin", "ivtImportMatchProducts")?>">IVT Produkte zu thetool Produkte matchen</a></div>
</div>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?> <?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -0,0 +1,65 @@
<?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="javascript: void(0);"><?=MFAPPNAME_SLUG?></a></li>
<li class="breadcrumb-item active"><a href="<?=self::getUrl("Admin")?>">Admin</a></li>
<li class="breadcrumb-item active">IVT Product Match</li>
</ol>
</div>
<h4 class="page-title">IVT Product Match</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<table class="table table-sm table-striped table-hover">
<tr>
<th class="text-right">IVT Produkt</th>
<th>Preis</th>
<th>Interval</th>
<th>Typ</th>
<th style="border-left: 1px solid #000">thetool Produkt</th>
</tr>
<?php foreach($ivtproducts as $ip): ?>
<tr>
<td class="text-right"><?=$ip->name?></td>
<td><?=$ip->price?></td>
<td><?=$ip->interval?></td>
<td><?=$ip->typ?></td>
<td style="border-left: 1px solid #000">
<select class="form-control" name="product[<?=$ip->id?>]" id="product_<?=$ip->id?>">
<option></option>
</select>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
<script type="text/javascript">
var products = [
<?php foreach(ProductModel::getActive() as $product): ?>
{id: <?=$product->id?>, name: '<?=$product->name?>'},
<?php endforeach; ?>
];
var new_options = "";
products.forEach(function(product) {
new_options += '<option value=' + product.id + '>' + product.name +'</option>';
});
$("select[name^=product").append(new_options);
$("select[name^=product").select2({placeholder: ""});
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -42,12 +42,17 @@
<input type="hidden" name="f" value="<?=$f?>" /> <input type="hidden" name="f" value="<?=$f?>" />
<div class="row">
<div class="col-6">
<div class="form-group row"> <div class="form-group row">
<label class="col-lg-2 col-form-label" for="owner_id">Vertragsinhaber *</label> <label class="col-lg-2 col-form-label" for="owner_id">Vertragsinhaber *</label>
<div class="col-lg-10"> <div class="col-lg-10">
<select class="form-control basicAutoComplete" autocomplete="off" name="owner_id" id="owner_id" data-url="<?=self::getUrl('Address','api')?>?do=findAddress&autocomplete=1" placeholder="Tippen zum Suchen... (Bestandskunden)" data-noresults-text="Keine Suchergebnisse"> <select class="form-control basicAutoComplete" autocomplete="off" name="owner_id" id="owner_id" data-url="<?=self::getUrl('Address','api')?>?do=findAddress&autocomplete=1" placeholder="Tippen zum Suchen... (Bestandskunden)" data-noresults-text="Keine Suchergebnisse">
<option></option> <option></option>
</select> </select>
<!--input type="hidden" name="owner_id" value="<?=$contract->owner_id?>" />
<input type="text" name="owner_text" id="owner_text" class="form-control" value="<?=($contract && $contract->owner_id) ? $contract->owner->getCompanyOrName() : ""?>" placeholder="Vertragsinhaber suchen..." /-->
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
@@ -78,8 +83,8 @@
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row" id="termination_row">
<label class="col-lg-2 col-form-label" for="matchcode">Anschluss</label> <label class="col-lg-2 col-form-label" for="matchcode">Anschluss *</label>
<div class="col-lg-10"> <div class="col-lg-10">
<select name="products[<?=$i?>][termination_id]" id="termination_id-<?=$i?>" class="form-control select2"> <select name="products[<?=$i?>][termination_id]" id="termination_id-<?=$i?>" class="form-control select2">
<option></option> <option></option>
@@ -188,6 +193,37 @@
</div> </div>
--> -->
</div> </div>
<div class="col-6">
<!--<div id="address_results" class="hidden">
<h4>Suchergebnisse</h4>
<table class="table table-sm table-bordered table-striped table-hover bg-lightblue">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Adresse</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="#" onclick="return false;">KUNDE</a> | <a href="#" onclick="return false;">RECHNUNG</a></td>
<td>Firma Test</td>
<td>Teststraße 12<br />8010 Graz</td>
</tr>
<tr>
<td><a href="#" onclick="return false;">KUNDE</a> | <a href="#" onclick="return false;">RECHNUNG</a></td>
<td>Firma Test</td>
<td>Teststraße 12<br />8010 Graz</td>
</tr>
</tbody>
</table>
</div>-->
</div>
</div>
</div>
</div> </div>
<div class="card"> <div class="card">
@@ -246,6 +282,7 @@
</div> </div>
</div> </div>
<script type="text/javascript" src="<?=self::getResourcePath()?>assets/js/pages/contract_form.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$('#finish_date').datepicker({ $('#finish_date').datepicker({
language: 'de', language: 'de',
@@ -279,13 +316,6 @@
$('#owner_id').autoComplete(); $('#owner_id').autoComplete();
<?php endif; ?> <?php endif; ?>
$('#owner_id').keydown(function() {
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
$('#owner_id').on("autocomplete.select", function(evt, item) { $('#owner_id').on("autocomplete.select", function(evt, item) {
if(item && item.value === 0) { if(item && item.value === 0) {
$('#owner_id').autoComplete('set', null); $('#owner_id').autoComplete('set', null);
@@ -347,6 +377,9 @@
*/ */
<?php if($contract->product_id && is_object(($contract->product))): ?> <?php if($contract->product_id && is_object(($contract->product))): ?>
$('#product_id').autoComplete('set', { value: <?=$contract->product_id?>, text: '<?=($contract->product_id) ? str_replace("'", "\\'", str_replace(["\n", "\r"], " ", $contract->product->name))." [".$contract->product_id."]" : ""?>'}); $('#product_id').autoComplete('set', { value: <?=$contract->product_id?>, text: '<?=($contract->product_id) ? str_replace("'", "\\'", str_replace(["\n", "\r"], " ", $contract->product->name))." [".$contract->product_id."]" : ""?>'});
<?php if(array_key_exists("termination_required", $contract->product) && $contract->product->attributes["termination_required"] != 1): ?>
$("#termination_row").hide();
<?php endif; ?>
<?php else: ?> <?php else: ?>
$('#product_id').autoComplete(); $('#product_id').autoComplete();
<?php endif; ?> <?php endif; ?>
@@ -380,6 +413,12 @@
$("#price_nbe").val(p.price_nbe); $("#price_nbe").val(p.price_nbe);
$("#billing_delay").val(p.billing_delay); $("#billing_delay").val(p.billing_delay);
$("#billing_period").val(p.billing_period); $("#billing_period").val(p.billing_period);
console.log(p.attributes);
if("attributes" in p && p.attributes.termination_required == 1) {
$("#termination_row").show();
} else {
$("#termination_row").hide();
}
}, },
"json" "json"
); );

View File

@@ -68,7 +68,7 @@
<div class="row mt-2"> <div class="row mt-2">
<div class="col"> <div class="col">
<button type="submit" class="btn btn-primary">Filter anwenden</button> <button type="submit" class="btn btn-primary">Filter anwenden</button>
<a class="btn btn-secondary" href="<?=self::getUrl("Contract")?>">Filter zurücksetzen</a> <a class="btn btn-secondary" href="<?=self::getUrl("Contract")?>?resetFilter=1">Filter zurücksetzen</a>
</div> </div>
<!--<div class="col"> <!--<div class="col">
<button class="btn btn-info" type="button" onclick="refreshMap()"><i class="far fa-map"></i> Auf Karte anzeigen</button> <button class="btn btn-info" type="button" onclick="refreshMap()"><i class="far fa-map"></i> Auf Karte anzeigen</button>
@@ -141,7 +141,6 @@
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;"> <td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?=self::getUrl("Contract", "view", ["contract_id" => $contract->id, "s" => $s, "filter" => $filter])?>"><i class="far fa-eyes" title="Aktives Produkt anzeigen"></i></a> <a href="<?=self::getUrl("Contract", "view", ["contract_id" => $contract->id, "s" => $s, "filter" => $filter])?>"><i class="far fa-eyes" title="Aktives Produkt anzeigen"></i></a>
<a href="<?=self::getUrl("Contract", "edit", ["contract_id" => $contract->id, "s" => $s, "filter" => $filter])?>"><i class="far fa-edit" title="Aktives Produkt bearbeiten"></i></a> <a href="<?=self::getUrl("Contract", "edit", ["contract_id" => $contract->id, "s" => $s, "filter" => $filter])?>"><i class="far fa-edit" title="Aktives Produkt bearbeiten"></i></a>
<a href="<?=self::getUrl("Contract", "cancel", ["contract_id" => $contract->id, "s" => $s, "filter" => $filter])?>" class="text-danger" title="Produkt kündigen"><i class="far fa-file-slash"></i></a>
<?php if($contract->orderproduct_id): ?><a href="<?=self::getUrl("Order", "edit", ["id" => $contract->orderproduct->order_id])?>"><i class="far fa-file-signature" title="Bestellung anzeigen"></i></a><?php endif; ?> <?php if($contract->orderproduct_id): ?><a href="<?=self::getUrl("Order", "edit", ["id" => $contract->orderproduct->order_id])?>"><i class="far fa-file-signature" title="Bestellung anzeigen"></i></a><?php endif; ?>
</td> </td>
</tr> </tr>

View File

@@ -22,8 +22,8 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<a href="<?=self::getUrl("Contract","Index", ['filter' => $filter, 's' => $s])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsübersicht</a> <a href="<?=self::getUrl("Contract","Index")?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsübersicht</a>
<a href="<?=self::getUrl("Contract","edit", ['contract_id' => $contract->id, 'filter' => $filter, 's' => $s, 'f' => "view"])?>" class="btn btn-sm btn-outline-success"><i class="fas fa-edit"></i> Vertrag bearbeiten</a> <a href="<?=self::getUrl("Contract","edit", ['contract_id' => $contract->id, 'f' => "view"])?>" class="btn btn-sm btn-outline-success"><i class="fas fa-edit"></i> Vertrag bearbeiten</a>
</div> </div>
</div> </div>
@@ -201,10 +201,11 @@
</tr><tr class="bg-white"> </tr><tr class="bg-white">
<td colspan="2" class="text-center"> <td colspan="2" class="text-center">
<a href="<?=self::getUrl("Contractconfig", "edit", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-info">Konfiguration bearbeiten</button></a> <a href="<?=self::getUrl("Contractconfig", "edit", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-info">Konfiguration bearbeiten</button></a>
<a href="<?=self::getUrl("Contractaccessletter", "view", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-success">Zugangsdaten anzeigen</button></a>
<?php if($contract->finish_date && $contract->finish_date < date('U')): ?> <?php if($contract->finish_date && $contract->finish_date < date('U')): ?>
<button type="button" class="btn btn-sm btn-outline-secondary">Inhaberwechsel</button> <button type="button" class="btn btn-sm btn-outline-secondary">Inhaberwechsel</button>
<a href="<?=self::getUrl("Contract", "productchange", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-success">Produkt-/Standortwechsel</button></a> <a href="<?=self::getUrl("Contract", "productchange", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-purple">Produkt-/Standortwechsel</button></a>
<button type="button" class="btn btn-sm btn-outline-danger">Kündigen</button> <a href="<?=self::getUrl("Contract", "cancel", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-danger">Kündigen</button></a>
<?php else: ?> <?php else: ?>
<a href="<?=self::getUrl("Contract", "finishContract", ['contract_id' => $contract->id])?>" onclick="if(!confirm('Jetzt fertigstellen und in Verrechnung geben?')) return false"><button type="button" class="btn btn-sm btn-success">Fertigstellen</button></a> <a href="<?=self::getUrl("Contract", "finishContract", ['contract_id' => $contract->id])?>" onclick="if(!confirm('Jetzt fertigstellen und in Verrechnung geben?')) return false"><button type="button" class="btn btn-sm btn-success">Fertigstellen</button></a>
<?php endif; ?> <?php endif; ?>

View File

@@ -1,3 +1,6 @@
<?php
if(!isset($error_items)) $error_items = [];
?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?> <?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<!-- start page title --> <!-- start page title -->
@@ -23,7 +26,7 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<a href="<?=self::getUrl("Contract","View", ['id' => $contract->id, 'filter' => $filter, 's' => $s])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsansicht</a> <a href="<?=self::getUrl("Contract","View", ['id' => $contract->id])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsansicht</a>
</div> </div>
</div> </div>
@@ -141,7 +144,7 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<a href="<?=self::getUrl("Contract","View", ['id' => $contract->id, 'filter' => $filter, 's' => $s])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsansicht</a> <a href="<?=self::getUrl("Contract","View", ['id' => $contract->id])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsansicht</a>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,95 @@
<?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("Voiceplan")?>">Sprachtarife</a></li>
<li class="breadcrumb-item active"><?=($plan->id) ? "bearbeiten" : "Neu" ?></li>
</ol>
</div>
<h4 class="page-title">Sprachtarife</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h4 class="header-title mb-2"><?=($plan->id) ? "Sprachtarifpaket bearbeiten" : "Neues Sprachtarifpaket"?></h4>
<form class="form-horizontal" method="post" action="<?=self::getUrl("Voiceplan", "save")?>" enctype="multipart/form-data">
<div class="card">
<div class="card-body">
<input type="hidden" name="id" value="<?=$plan->id?>" />
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="name">Name *</label>
<div class="col-lg-10">
<input type="name" class="form-control" name="name" id="name" value="<?=$plan->name?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="description">Beschreibung</label>
<div class="col-lg-10">
<textarea class="form-control" name="description" id="description" /><?=htmlentities($plan->description)?></textarea>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="name">Taktung *</label>
<div class="col-lg-10">
<input type="increment" class="form-control" name="increment" id="increment" value="<?=($plan->increment_first && $plan->increment) ? $plan->increment_first."/".$plan->increment : ""?>" placeholder="60/30" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="first">Destinations kopieren von bestehendem Tarifpaket</label>
<div class="col-lg-10">
<select name="copy_from_plan_id" class="form-control">
<option value=""></option>
<?php foreach(VoiceplanModel::getAll() as $voiceplan): ?>
<option value="<?=$voiceplan->id?>"><?=$voiceplan->name?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="first">oder Destinations Importieren</label>
<div class="col-lg-10">
<input type="file" class="form-control" name="voiceplanfile" />
<small class="text-danger">ACHTUNG: Bestehende Destinations werden gelöscht!</small>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2"></label>
<div class="col-lg-10">
<button type="submit" class="btn btn-primary">Speichern</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -0,0 +1,122 @@
<?php
$pagination_baseurl = $this->getUrl($Mod,"Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Sprachtarife";
?>
<?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 active">Sprachtarife</li>
</ol>
</div>
<h4 class="page-title">Sprachtarife</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("Voiceplan")?>">
<div class="row">
<div class="col-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>
<div class="row mt-2">
<div class="col">
<button type="submit" class="btn btn-primary">Filter anwenden</button>
<a class="btn btn-secondary" href="<?=self::getUrl("Voiceplan")?>">Filter zurücksetzen</a>
</div>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-body mb-3">
<div class="row">
<div class="col-12">
<div class="float-left">
<h4 class="header-title">Sprachtarifpakete</h4>
</div>
<div class="float-right">
<a class="btn btn-primary mb-2" href="<?=self::getUrl("Voiceplan", "add")?>"><i class="fas fa-plus"></i> Neues Sprachtarifpaket anlegen</a>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<table class="table table-striped table-hover">
<tr>
<th>Name</th>
<th>Beschreibung</th>
<th>Anzahl Destinations</th>
<th>Erstellt</th>
<th></th>
</tr>
<?php foreach($voiceplans as $plan): ?>
<tr>
<td><a href="<?=self::getUrl("Voiceplan", "view", ['id' => $plan->id])?>"><?=$plan->name?></a></td>
<td><?=$plan->description?></td>
<td><?=VoiceplandestinationModel::count(['voiceplan_id' => $plan->id])?></td>
<td><?=date("d.m.Y H:i", $plan->create)?> (<?=$plan->creator->name?>)</td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?=self::getUrl("Voiceplan", "view", ["id" => $plan->id])?>"><i class="far fa-eyes" title="Anzeigen"></i></a>
<a href="<?=self::getUrl("Voiceplan", "edit", ["id" => $plan->id])?>"><i class="far fa-edit" title="Bearbeiten"></i></a>
<a href="<?=self::getUrl("Voiceplan", "delete", ["id" => $plan->id])?>" onclick="if(!confirm('Sprachtarifpaket wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function toggleBlock(id) {
$('#block-detail-' + id).toggle();
if($('#block-detail-' + id).is(":hidden")) {
$('#block-' + id).removeClass("table-info");
$('#block-' + id).removeClass("text-info");
} else {
$('#block-' + id).addClass("text-info");
$('#block-' + id).addClass("table-info");
}
}
var block;
var hash = window.location.hash.substr(1);
var match = hash.match(/block=(\d+)/);
if(match && match[1]) {
block = match[1]
toggleBlock(block);
}
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -0,0 +1,105 @@
<?php
$pagination_baseurl = $this->getUrl($Mod,"View");
$pagination_baseurl_params = ["filter" => $filter, "id" => $plan->id];
$pagination_entity_name = "Destinations";
?>
<?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("Voiceplan")?>">Sprachtarife</a></li>
<li class="breadcrumb-item active"><?=$plan->name?></li>
</ol>
</div>
<h4 class="page-title">Sprachtarife</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body mb-3">
<div class="row">
<div class="col-12">
<div class="float-left">
<h4 class="header-title">Destinations für Sprachtarifpaket <?=$plan->name?></h4>
</div>
<div class="float-right">
<a class="btn btn-primary mb-2" href="<?=self::getUrl("Voiceplandestination", "add", ["voiceplan_id" => $plan->id])?>"><i class="fas fa-plus"></i> Neue Destination anlegen</a>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<table class="table table-striped table-hover">
<tr>
<th>Destination</th>
<th>Prefix</th>
<th>Taktung</th>
<th>Einkaufspreis</th>
<th>Verkaufspreis</th>
<th>Erstellt</th>
<th>Bearbeitet</th>
<th></th>
</tr>
<?php foreach($destinations as $destination): ?>
<tr>
<td><?=$destination->destination?></td>
<td><?=$destination->prefix?></td>
<td><?=($destination->increment_first && $destination->increment) ? "$destination->increment_first"."/".$destination->increment : ""?></td>
<td><?=$destination->purchase_price?></td>
<td><?=$destination->price?></td>
<td><?=date("d.m.Y H:i", $plan->create)?> (<?=$plan->creator->name?>)</td>
<td><?=date("d.m.Y H:i", $plan->edit)?> (<?=$plan->editor->name?>)</td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?=self::getUrl("Voiceplandestination", "view", ["id" => $destination->id])?>"><i class="far fa-eyes" title="Anzeigen"></i></a>
<a href="<?=self::getUrl("Voiceplandestination", "edit", ["id" => $destination->id])?>"><i class="far fa-edit" title="Bearbeiten"></i></a>
<a href="<?=self::getUrl("Voiceplandestination", "delete", ["id" => $destination->id])?>" onclick="if(!confirm('Destination wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function toggleBlock(id) {
$('#block-detail-' + id).toggle();
if($('#block-detail-' + id).is(":hidden")) {
$('#block-' + id).removeClass("table-info");
$('#block-' + id).removeClass("text-info");
} else {
$('#block-' + id).addClass("text-info");
$('#block-' + id).addClass("table-info");
}
}
var block;
var hash = window.location.hash.substr(1);
var match = hash.match(/block=(\d+)/);
if(match && match[1]) {
block = match[1]
toggleBlock(block);
}
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -0,0 +1,106 @@
<?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("Voiceplan")?>">Sprachtarife</a></li>
<li class="breadcrumb-item"><a href="<?=self::getUrl("Voiceplan", "view", ["id" => $voiceplan->id])?>"></a></li>
<li class="breadcrumb-item active"><?=($plan->id) ? "Destination ".$destination->destination." bearbeiten" : "Neu" ?></li>
</ol>
</div>
<h4 class="page-title">Sprachtarife</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h4 class="header-title mb-2"><?=($destination->id) ? "Destination bearbeiten" : "Neues Destination"?></h4>
<form class="form-horizontal" method="post" action="<?=self::getUrl("Voiceplandestination", "save")?>">
<div class="card">
<div class="card-body">
<input type="hidden" name="id" value="<?=$destination->id?>" />
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="voiceplan_id">Tarifpaket</label>
<div class="col-lg-10">
<select name="voiceplan_id" class="form-control">
<option value=""></option>
<?php if($destination && $destination->voiceplan_id): ?>
<?php foreach($voiceplans as $vp): ?>
<option value="<?=$vp->id?>" <?=($destination->voiceplan_id == $vp->id) ? "selected='selected'" : ""?>><?=$vp->name?></option>
<?php endforeach; ?>
<?php elseif($voiceplan): ?>
<?php foreach($voiceplans as $vp): ?>
<option value="<?=$vp->id?>" <?=($vp->id == $voiceplan->id) ? "selected='selected'" : ""?>><?=$vp->name?></option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="name">Destination Name *</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="destination" id="destination" value="<?=$destination->destination?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="prefix">Prefix *</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="prefix" id="prefix" value="<?=$destination->prefix?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="purchase_price">Einkaufspreis *</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="purchase_price" id="purchase_price" value="<?=$destination->purchase_price?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="price">Verkaufspreis *</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="price" id="price" value="<?=$destination->price?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="name">Taktung *</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="increment" id="increment" value="<?=($destination->increment_first && $destination->increment) ? $destination->increment_first."/".$destination->increment : ""?>" placeholder="60/30" />
</div>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2"></label>
<div class="col-lg-10">
<button type="submit" class="btn btn-primary">Speichern</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -45,6 +45,9 @@
</head> </head>
<body> <body>
<script type="text/javascript">
baseurl = '<?=self::getResourcePath()?>';
</script>
<!-- Navigation Bar--> <!-- Navigation Bar-->
<header id="topnav"> <header id="topnav">

View File

@@ -38,4 +38,11 @@ class AdminController extends mfBaseController {
$this->redirect("Admin"); $this->redirect("Admin");
} }
protected function ivtImportMatchProductsAction() {
$this->layout()->setTemplate("Admin/ivtimport_product_match");
$ivtproducts = IvtProductModel::getAll();
$this->layout()->set("ivtproducts", $ivtproducts);
}
} }

View File

@@ -18,14 +18,22 @@ class ContractController extends mfBaseController {
protected function indexAction() { protected function indexAction() {
$this->layout()->setTemplate("Contract/Index"); $this->layout()->setTemplate("Contract/Index");
$rfilter = $this->request->filter; if($this->request->resetFilter) {
iF(!is_array($rfilter)) { unset($_SESSION[MFAPPNAME.'-Contract-filter']);
$rfilter = [];
} }
$this->layout->set("filter", $rfilter); $filter = [];
if(is_array($this->request->filter)) {
$filter = $this->request->filter;
$_SESSION[MFAPPNAME.'-Contract-filter'] = $filter;
} else {
if(array_key_exists(MFAPPNAME.'-Contract-filter', $_SESSION) && count($_SESSION[MFAPPNAME.'-Contract-filter'])) {
$filter = $_SESSION[MFAPPNAME.'-Contract-filter'];
}
}
$filter = $this->getPreparedFilter($rfilter); $this->layout->set("filter", $filter);
$filter = $this->getPreparedFilter($filter);
// pagination defaults // pagination defaults
$pagination = []; $pagination = [];
@@ -344,6 +352,18 @@ class ContractController extends mfBaseController {
} }
protected function cancelAction() {
$id = $this->request->contract_id;
if(!$id) $id = $this->request->id;
$this->layout()->setFlash("Not implemented", "error");
if($id) {
$this->redirect("Contract","view",["id" => $id]);
} else {
$this->redirect("Contract");
}
}
protected function addAction() { protected function addAction() {
$this->layout()->setTemplate("Contract/Form"); $this->layout()->setTemplate("Contract/Form");
$this->layout()->set("terminations", TerminationModel::getAll()); $this->layout()->set("terminations", TerminationModel::getAll());

View File

@@ -62,8 +62,10 @@ class CpeprovisioningController extends mfBaseController
} }
} }
if(array_key_exists($order->id, $orderproductsprefetch)) {
foreach ($orderproductsprefetch[$order->id] as $orderproduct) { foreach ($orderproductsprefetch[$order->id] as $orderproduct) {
if(!$orderproduct) continue;
if(!is_array($orderproduct)) continue;
if ($orderproduct['routerconfig_finished'] == 1) { if ($orderproduct['routerconfig_finished'] == 1) {
if (!$filter['routerconfig_finished']) continue; if (!$filter['routerconfig_finished']) continue;
@@ -95,6 +97,7 @@ class CpeprovisioningController extends mfBaseController
} }
} }
}
} }
$this->layout()->set("pagination", $pagination); $this->layout()->set("pagination", $pagination);

View File

@@ -40,6 +40,29 @@ class File extends mfBaseModel {
return false; return false;
} }
public function getFullPath() {
if(!is_numeric($this->id) || $this->id < 1) {
throw new Exception("File not found", 4040);
}
$filename = $this->store_filename;
$path = MFUPLOAD_FILE_SAVE_PATH;
$path .= ($this->subfolder) ? "/".$this->subfolder : "";
$path .= "/$filename";
if(!file_exists($path)) {
throw new Exception("File not found", 4041);
}
return $path;
}
public function getContents() {
$outname = $this->getFullPath();
return file_get_contents($outname);
}
public function getProperty($name) { public function getProperty($name) {
if($this->$name == null) { if($this->$name == null) {

View File

@@ -0,0 +1,37 @@
<?php
class IvtProduct extends mfBaseModel {
protected $forcestr = [];
/**
* Takes ID or DB row as arguments
* @param id or table row $_
*/
public function __construct($_=NULL) {
$this->log = mfLoghandler::singleton();
$this->data = new stdClass();
$this->table = "products";
$this->db = FronkDB::singleton(IVT_DBHOST, IVT_DBUSER, IVT_DBPASS, IVT_DBNAME);
if(is_numeric($_)) {
$this->fetch($_);
} elseif(is_object($_)) {
$this->load($_);
}
}
public function save() {
return true;
}
public function __debugInfo() {
$vars = get_object_vars($this);
if(is_object($vars['db'])) $vars['db'] = "object(FronkDB)";
if(is_object($vars['log'])) $vars['log'] = 'object(mfLoghandler)';
return $vars;
}
}

View File

@@ -0,0 +1,89 @@
<?php
class IvtProductModel {
public static function create(Array $data) {
throw new Exception("Please use IvtProductController to create IvtProducts");
}
public static function getAll() {
$items = [];
$db = FronkDB::singleton(IVT_DBHOST, IVT_DBUSER, IVT_DBPASS, IVT_DBNAME);
$res = $db->select("products", "*", "1=1 ORDER BY id");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new IvtProduct($data);
}
}
return $items;
}
public static function getFirst() {
$db = FronkDB::singleton(IVT_DBHOST, IVT_DBUSER, IVT_DBPASS, IVT_DBNAME);
$where = self::getSqlFilter($filter);
$res = $db->select("products", "*", "$where ORDER BY id LIMIT 1");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new IvtProduct($data);
if($item->id) {
return $item;
} else {
return null;
}
}
return null;
}
public static function search($filter, $limit = false) {
$items = [];
$db = FronkDB::singleton(IVT_DBHOST, IVT_DBUSER, IVT_DBPASS, IVT_DBNAME);
$where = self::getSqlFilter($filter);
$sql = "SELECT * FROM products $where ORDER by id";
mfLoghandler::singleton()->debug($sql);
if(is_array($limit) && count($limit)) {
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
} elseif(is_numeric($count)) {
$sql .= " LIMIT ".$limit['count'];
}
}
$res = $db->query($sql);
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new IvtProduct($data);
}
}
return $items;
}
private static function getSqlFilter($filter) {
$where = "1=1 ";
/*
if(array_key_exists("status_id", $filter)) {
$status_id = $filter['status_id'];
if(is_numeric($status_id)) {
$where .= " AND IvtProduct.status_id=$status_id";
}
}
if(array_key_exists("street", $filter)) {
$street = FronkDB::singleton()->escape($filter["street"]);
if($street) {
$where .= " AND street like '%$street%'";
}
}
*/
//var_dump($filter, $where);exit;
return $where;
}
}

View File

@@ -330,7 +330,6 @@ class ProductController extends mfBaseController {
private function findProductApi() { private function findProductApi() {
$search = trim($this->request->q); $search = trim($this->request->q);
$autocomplete = $this->request->autocomplete;
$products = []; $products = [];
@@ -341,8 +340,8 @@ class ProductController extends mfBaseController {
} }
} }
$wild_search = implode("%", explode(" ", $search));
$products = array_merge($products, ProductModel::search(["active" => 1, "name%" => $search])); $products = array_merge($products, ProductModel::search(["active" => 1, "name%" => $wild_search]));
if(!is_array($products) && !count($products)) { if(!is_array($products) && !count($products)) {
return false; return false;

View File

@@ -150,6 +150,9 @@ class TerminationController extends mfBaseController {
case "setValue": case "setValue":
$return = $this->setValueApi(); $return = $this->setValueApi();
break; break;
case "find":
$return = $this->findTerminationApi();
break;
default: default:
$return = false; $return = false;
} }
@@ -193,4 +196,12 @@ class TerminationController extends mfBaseController {
return ["msg" => "Saved successfully"]; return ["msg" => "Saved successfully"];
} }
private function findTerminationApi() {
$search = $this->request->search;
$terminations = [];
}
} }

View File

@@ -33,6 +33,67 @@ class Voicenumber extends mfBaseModel {
} }
} }
public function afterSave() {
// if contract_id is given, add number to contract
if($this->contract_id) {
if(is_array($this->contract->configvalues) && array_key_exists("voicenumberblock_voicenumber", $this->contract->configvalues)) {
$cc_item = $this->contract->configvalues["voicenumberblock_voicenumber"];
} else {
$cc_item = ContractconfigItemModel::getFirst(["name" => "voicenumberblock_voicenumber"]);
$cc_item->setContractId($this->contract_id);
}
$contract_numbers = [];
$numbers_json = $cc_item->value->json;
if($numbers_json) {
$contract_numbers = json_decode($numbers_json);
}
//var_dump($contract_numbers);
if(!in_array($this->number, $contract_numbers)) {
$contract_numbers[] = $this->number;
$cc_item->value->set($contract_numbers);
$cc_item->value->save();
}
// if contract_id was changed, remove number from old contract
if($this->_old_data->contract_id > 0 && $this->_old_data->contract_id != $this->contract_id) {
$old_contract = new Contract($this->_old_data->contract_id);
$cc_item = $old_contract->configvalues["voicenumberblock_voicenumber"];
$numbers_json = $cc_item->value->json;
if($numbers_json) {
$contract_numbers = json_decode($numbers_json);
$new_numbers = [];
foreach($contract_numbers as $cnum) {
if($this->number != $cnum) {
$new_numbers[] = $cnum;
}
}
$cc_item->value->set($new_numbers);
$cc_item->value->save();
}
}
} elseif($this->_old_data->contract_id > 0) {
// removed contract_id, so remove number from old contract
$old_contract = new Contract($this->_old_data->contract_id);
$cc_item = $old_contract->configvalues["voicenumberblock_voicenumber"];
$numbers_json = $cc_item->value->json;
if($numbers_json) {
$contract_numbers = json_decode($numbers_json);
$new_numbers = [];
foreach($contract_numbers as $cnum) {
if($this->number != $cnum) {
$new_numbers[] = $cnum;
}
}
$cc_item->value->set($new_numbers);
$cc_item->value->save();
}
}
}
public function getProperty($name) { public function getProperty($name) {
if($this->$name == null) { if($this->$name == null) {

View File

@@ -156,11 +156,19 @@ class VoicenumberController extends mfBaseController {
$number->update($number_data); $number->update($number_data);
$number_id = $number->save(); $number_id = $number->save();
if(!$number_id) { if(!$number_id) {
$this->layout()->setFlash("Fehler beim Speichern", "error"); $this->layout()->setFlash("Fehler beim Speichern", "error");
$this->redirect("Voicenumber", "edit", ["block_id" => $block_id, "number" => $num]); $this->redirect("Voicenumber", "edit", ["block_id" => $block_id, "number" => $num]);
} }
//var_dump($number->_old_data);exit;
// save number to contract
$this->layout()->setFlash("Rufnummer erfolgreich gespeichert", "success"); $this->layout()->setFlash("Rufnummer erfolgreich gespeichert", "success");
$this->redirect("Voicenumberblock", "Index", null, "block=".$block->id); $this->redirect("Voicenumberblock", "Index", null, "block=".$block->id);

View File

@@ -0,0 +1,110 @@
<?php
class Voiceplan extends mfBaseModel {
private $creator;
private $editor;
private $destinations;
public function importDestinationsFromCsv(File $file) {
if(!$this->id) {
return false;
}
try {
$i = 0;
$filename = $file->getFullPath();
$input = fopen($filename, "r");
while($csv = fgetcsv($input, 0, ",")) {
$i++;
if($i == 1) continue;
if(!trim($csv[0])) {
continue;
}
$name = trim($csv[0]);
$prefix = trim($csv[1]);
$price_ek = str_replace(",",".", trim($csv[2]));
$price_vk = str_replace(",",".", trim($csv[3]));
if(!$name || !$prefix || !$price_ek || !$price_vk) {
$this->log->warning("not Importing Voiceplandestination with empty value: destination: $name | prefix: $prefix | ek: $price_ek | vk: $price_vk");
continue;
}
$destination = VoiceplandestinationModel::getFirst(["voiceplan_id" => $this->id, "destination" => $name, "prefix" => $prefix]);
if($destination) {
$this->log->warning("Destination gibts schon, updateing prices: voiceplan_id: ".$this->id." | destination: $name | prefix: $prefix");
$destination->purchase_price = $price_ek;
$destination->price = $price_vk;
$destination->save();
continue;
}
$destination = VoiceplandestinationModel::create([
'voiceplan_id' => $this->id,
'destination' => $name,
'prefix' => $prefix,
'increment_first' => $this->increment_first,
'increment' => $this->increment,
'purchase_price' => $price_ek,
'price' => $price_vk
]);
$destination->save();
}
return true;
} catch(Exception $e) {
echo $e->getCode().": ".$e->getMessage();exit;
return false;
}
}
public function getProperty($name) {
if($this->$name == null) {
if($name == "destinations") {
$this->destinations = VoiceplandestinationModel::search(["voiceplan_id" => $this->id]);
return $this->destinations;
}
if($name == "creator") {
$user = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
if($user) {
$this->creator = $user;
return $this->creator;
}
$this->creator = new User($this->create_by);
if($this->creator->id) {
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
}
return $this->creator;
}
if($name == "editor") {
$this->editor = new User($this->edit_by);
return $this->editor;
}
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
if($this->$name === null) {
$this->$name = new $classname($this->$idfield);
}
if($this->$name->id) {
mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name);
return $this->$name;
} else {
return null;
}
}
return $this->$name;
}
}

View File

@@ -0,0 +1,195 @@
<?php
class VoiceplanController extends mfBaseController {
protected function init() {
$this->needlogin=true;
$me = new User();
$me->loadMe();
$this->me = $me;
$this->layout()->set("me",$me);
if(!$me->isAdmin()) {
$this->redirect("Dashboard");
}
}
protected function indexAction() {
$filter = [];
if(is_array($this->request->filter)) {
$filter = $this->request->filter;
}
$this->layout->set("filter", $filter);
if($filter) {
$filter = $this->getPreparedFilter($filter);
}
// pagination defaults
$pagination = [];
$pagination['start'] = 0;
$pagination['count'] = 20;
$pagination['maxItems'] = 0;
if(is_numeric($this->request->s)) {
$pagination['start'] = intval($this->request->s);
}
$pagination['maxItems'] = VoiceplanModel::count($filter);
$voiceplans = VoiceplanModel::getAll();
$this->layout()->set("voiceplans", $voiceplans);
$this->layout()->set("pagination", $pagination);
}
private function getPreparedFilter($filter) {
return $filter;
}
protected function viewAction() {
$this->layout()->setTemplate("Voiceplan/View");
$id = $this->request->id;
if(!is_numeric($id) || $id < 1) {
$this->layout()->setFlash("Tarifpaket nicht gefunden.", "error");
$this->redirect("Voiceplan");
}
$plan = new Voiceplan($id);
if(!$plan->id) {
$this->layout()->setFlash("Tarifpaket nicht gefunden.", "error");
$this->redirect("Voiceplan");
}
$this->layout()->set("plan", $plan);
$pagination = [];
$pagination['start'] = 0;
$pagination['count'] = 20;
$pagination['maxItems'] = 0;
if(is_numeric($this->request->s)) {
$pagination['start'] = intval($this->request->s);
}
$pagination['maxItems'] = VoiceplandestinationModel::count(['voiceplan_id' => $id]);
$destinations = VoiceplandestinationModel::search(['voiceplan_id' => $id], $pagination);
$this->layout()->set("destinations", $destinations);
$this->layout()->set("pagination", $pagination);
}
protected function addAction() {
$this->layout()->setTemplate("Voiceplan/Form");
}
protected function editAction() {
$id = $this->request->id;
if(!is_numeric($id) || $id < 1) {
$this->layout()->setFlash("Tarifpaket nicht gefunden.", "error");
$this->redirect("Voiceplan");
}
$plan = new Voiceplan($id);
if(!$plan->id) {
$this->layout()->setFlash("Tarifpaket nicht gefunden.", "error");
$this->redirect("Voiceplan");
}
$this->layout()->set("plan", $plan);
return $this->addAction();
}
protected function saveAction() {
$r = $this->request;
//var_dump($r);exit;
$id = $r->id;
if(is_numeric($id) && $id > 0) {
$mode = "edit";
$voiceplan = new Voiceplan($id);
if(!$voiceplan->id) {
$this->layout()->setFlash("Tarifpaket nicht gefunden", "error");
$this->redirect("Voiceplan");
}
} else {
$id = false;
$mode = "add";
}
$data = [];
$data['name'] = $r->name;
$data['description'] = $r->description;
if($r->increment) {
$increments = explode("/",$r->increment);
if(count($increments) != 2) {
$this->layout()->setFlash("Ungültige Taktung", "error");
return $this->editAction();
}
$data["increment_first"] = $increments[0];
$data["increment"] = $increments[1];
}
if(!$data['name']) {
$this->layout()->setFlash("Bitte Name eingeben", "error");
return $this->editAction();
}
if($mode == "edit") {
$voiceplan->update($data);
} else {
$voiceplan = VoiceplanModel::create($data);
}
$id = $voiceplan->save();
if(!$id) {
$this->layout()->setFlash("Fehler beim Speichern!", "error");
return $this->editAction();
}
if(is_array($_FILES) && array_key_exists("voiceplanfile", $_FILES) && !$_FILES['voiceplanfile']['error']) {
// look for uploaded import file
try {
// returns File object or throws Exception on error
$file = mfUpload::handleFormUpload("voiceplanfile");
} catch (Exception $ex) {
$this->layout()->setFlash("Fehler beim Dateiupload: ".$ex->getMessage(), "error");
return $this->editAction();
}
$vpf = VoiceplanFileModel::create([
'voiceplan_id' => $id,
'file_id' => $file->id,
'name' => "voiceplan-import-".date("Y-m-d_H-i-s").".csv",
]);
$voiceplanfile_id = $vpf->save();
if(!$voiceplanfile_id) {
$this->layout()->setFlash("Fehler beim Speichern der hochgeladenen Datei", "error");
return $this->editAction();
}
// if file was uploaded successfully, delete old destinations
foreach(VoiceplandestinationModel::search(['voiceplan_id' => $id]) as $destination) {
$destination->delete();
}
if(!$voiceplan->importDestinationsFromCsv($file)) {
$this->layout()->setFlash("Fehler beim Importieren!", "error");
return $this->editAction();
}
}
$this->layout()->setFlash("Sprachtarifpaket erfolgreich gespeichert!", "success");
$this->redirect("Voiceplan", "view", ["id" => $id]);
}
}

View File

@@ -0,0 +1,139 @@
<?php
class VoiceplanModel {
public $name;
public $description;
public $create_by;
public $edit_by;
public $create;
public $edit;
public static function create(Array $data) {
$model = new Voiceplan();
foreach($data as $field => $value) {
if(property_exists(get_called_class(), $field)) {
$model->$field = $value;
}
}
$me = new User();
$me->loadMe();
if($model->create_by === null) {
$model->create_by = $me->id;
}
if($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
public static function getAll() {
$items = [];
$db = FronkDB::singleton();
$res = $db->select("Voiceplan", "*", "1=1 ORDER BY name");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new Voiceplan($data);
}
}
return $items;
}
public static function getFirst($filter = null) {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
mfLoghandler::singleton()->debug($where);
$res = $db->select("Voiceplan", "*", "$where");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new Voiceplan($data);
if($item->id) {
return $item;
} else {
return null;
}
}
return null;
}
public static function count($filter) {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$sql = "SELECT COUNT(*) as cnt FROM Voiceplan
WHERE $where
";
$res = $db->query($sql);
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
return $data->cnt;
}
return 0;
}
public static function search($filter, $limit = false) {
$items = [];
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$sql = "SELECT * FROM Voiceplan
WHERE $where
ORDER BY name";
if(is_array($limit) && count($limit)) {
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
} elseif(is_numeric($count)) {
$sql .= " LIMIT ".$limit['count'];
}
}
$res = $db->query($sql);
//mfLoghandler::singleton()->debug($sql);
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new Voiceplan($data);
}
}
return $items;
}
private static function getSqlFilter($filter) {
$db = FronkDB::singleton();
$where = "1=1 ";
if(!is_array($filter)) {
return $where;
}
/*if(array_key_exists("block_id", $filter)) {
$block_id = $filter['block_id'];
if(is_numeric($block_id)) {
$where .= " AND voiceplanblock_id = $block_id";
}
}*/
if(array_key_exists("name", $filter)) {
$name = $db->escape($filter['name']);
if($name) {
$where .= " AND name like '%$name%'";
}
}
//var_dump($filter, $where);exit;
return $where;
}
}

View File

@@ -0,0 +1,39 @@
<?php
class VoiceplanFile extends mfBaseModel {
private $file;
private $creator;
private $editor;
public function getProperty($name) {
if($this->$name == null) {
if(!$this->id) {
return null;
}
if($name == "creator") {
$this->creator = new User($this->create_by);
return $this->creator;
}
if($name == "editor") {
$this->editor = new User($this->edit_by);
return $this->editor;
}
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = new $classname($this->$idfield);
if($this->$name->id) {
return $this->$name;
} else {
return null;
}
}
return $this->$name;
}
}

View File

@@ -0,0 +1,149 @@
<?php
class VoiceplanFileModel {
public $voiceplan_id;
public $file_id;
public $name;
public $description;
public $create_by = null;
public $edit_by = null;
public $create = null;
public $edit = null;
public static function create(Array $data) {
$model = new VoiceplanFile();
foreach($data as $field => $value) {
if(property_exists(get_called_class(), $field)) {
$model ->$field = $value;
}
}
$me = new User();
$me->loadMe();
if($model->create_by === null) {
$model->create_by = $me->id;
}
if($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
public static function getOne($id) {
if(!is_numeric($id) || !$id) {
throw new Exception("Invalid number", 400);
}
$item = [];
$db = FronkDB::singleton();
$res = $db->select("VoiceplanFile", "*", "id=$id LIMIT 1");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new VoiceplanFile($data);
}
return $item;
}
public static function getAll() {
$items = [];
$db = FronkDB::singleton();
$res = $db->select("VoiceplanFile", "*", "1=1 ORDER BY voiceplan_id, `create`");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new VoiceplanFile($data);
}
}
return $items;
}
public static function getFirst() {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("VoiceplanFile", "*", "$where ORDER BY voiceplan_id, `create`");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new VoiceplanFile($data);
if($item->id) {
return $item;
} else {
return null;
}
}
return null;
}
public static function search($filter) {
$items = [];
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$sql = "SELECT VoiceplanFile.* FROM VoiceplanFile
LEFT JOIN File ON (VoiceplanFile.file_id = File.id)
WHERE $where
ORDER BY voiceplan_id, `create`";
$res = $db->query($sql);
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new VoiceplanFile($data);
}
}
return $items;
}
private static function getSqlFilter($filter) {
$where = "1=1 ";
if(array_key_exists("file_id", $filter)) {
$file_id = $filter['file_id'];
if(is_numeric($file_id)) {
$where .= " AND file_id=$file_id";
}
}
if(array_key_exists("voiceplan_id", $filter)) {
$voiceplan_id = $filter['voiceplan_id'];
if(is_numeric($voiceplan_id)) {
$where .= " AND voiceplan_id=$voiceplan_id";
}
}
//var_dump($filter);exit;
if(array_key_exists("name", $filter)) {
$name = FronkDB::singleton()->escape($filter['name']);
if($name) {
$where .= " AND name='$name'";
}
}
if(array_key_exists("filename", $filter)) {
$filename = FronkDB::singleton()->escape($filter['filename']);
if($filename) {
$where .= " AND File.filename='$filename'";
}
}
if(array_key_exists("subfolder", $filter)) {
$subfolder = FronkDB::singleton()->escape($filter['subfolder']);
if($subfolder) {
$where .= " AND File.subfolder='$subfolder'";
}
}
//var_dump($filter, $where);exit;
return $where;
}
}

View File

@@ -0,0 +1,6 @@
<?php
class Voiceplandestination extends mfBaseModel {
protected $forcestr = ["name", "destination", "prefix"];
}

View File

@@ -0,0 +1,105 @@
<?php
class VoiceplandestinationController extends mfBaseController {
protected function init() {
$this->needlogin=true;
$me = new User();
$me->loadMe();
$this->me = $me;
$this->layout()->set("me",$me);
if(!$me->isAdmin()) {
$this->redirect("Dashboard");
}
}
protected function addAction() {
$this->layout()->setTemplate("Voiceplandestination/Form");
$voiceplans = VoiceplanModel::getAll();
$this->layout()->set("voiceplans", $voiceplans);
$voiceplan_id = $this->request->voiceplan_id;
if($voiceplan_id) {
$voiceplan = new Voiceplan($voiceplan_id);
$this->layout()->set("voiceplan", $voiceplan);
}
}
protected function editAction() {
$id = $this->request->id;
if(!is_numeric($id) || $id < 1) {
$this->layout()->setFlash("Destination nicht gefunden", "error");
$this->redirect("Voiceplan");
}
$destination = new Voiceplandestination($id);
if(!$destination->id) {
$this->layout()->setFlash("Destination nicht gefunden", "error");
$this->redirect("Voiceplan");
}
$this->layout()->set("destination", $destination);
return $this->addAction();
}
protected function saveAction() {
$r = $this->request;
var_dump($r);
$id = $r->id;
if(is_numeric($id) && $id > 0) {
$mode = "edit";
$destination = new Voiceplandestination($id);
if(!$destination->id) {
$this->layout()->setFlash("Destination nicht gefunden", "error");
$this->redirect("Voiceplan");
}
} else {
$id = false;
$mode = "add";
}
$data = [];
$data['voiceplan_id'] = $r->voiceplan_id;
$data['destination'] = $r->destination;
$data['prefix'] = intval($r->prefix);
$data['purchase_price'] = (str_replace(",",".",$r->purchase_price)) ? str_replace(",",".",$r->purchase_price) : 0;
$data['price'] = (str_replace(",",".",$r->price)) ? str_replace(",",".",$r->price) : 0;
if($r->increment) {
$increments = explode("/",$r->increment);
if(count($increments) != 2) {
$this->layout()->setFlash("Ungültige Taktung", "error");
$this->layout()->set("destination", VoiceplandestinationModel::create($data));
return $this->addAction();
}
$data["increment_first"] = $increments[0];
$data["increment"] = $increments[1];
}
if(!$data['destination'] || !$data['prefix'] || !$data['voiceplan_id']) {
$this->layout()->setFlash("Destination, Prefix und Tarifpaket sind erforderlich", "error");
$this->layout()->set("destination", VoiceplandestinationModel::create($data));
return $this->addAction();
}
if($mode == "edit") {
$destination->update($data);
} else {
$destination = VoiceplandestinationModel::create($data);
}
$id = $destination->save();
if(!$id) {
$this->layout()->setFlash("Fehler beim Speichern!", "error");
$this->layout()->set("destination", $destination);
return $this->addAction();
}
$this->redirect("Voiceplan", "view", ["id" => $destination->voiceplan_id]);
}
}

View File

@@ -0,0 +1,159 @@
<?php
class VoiceplandestinationModel {
public $voiceplan_id;
public $description;
public $destination;
public $prefix;
public $purchase_price;
public $price;
public $increment_first;
public $increment;
public $create_by;
public $edit_by;
public $create;
public $edit;
public static function create(Array $data) {
$model = new Voiceplandestination();
foreach($data as $field => $value) {
if(property_exists(get_called_class(), $field)) {
$model->$field = $value;
}
}
$me = new User();
$me->loadMe();
if($model->create_by === null) {
$model->create_by = $me->id;
}
if($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
public static function getAll() {
$items = [];
$db = FronkDB::singleton();
$res = $db->select("Voiceplandestination", "*", "1=1 ORDER BY destination,prefix");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new Voiceplandestination($data);
}
}
return $items;
}
public static function getFirst($filter = null) {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
mfLoghandler::singleton()->debug($where);
$res = $db->select("Voiceplandestination", "*", "$where ORDER BY destination,prefix");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new Voiceplandestination($data);
if($item->id) {
return $item;
} else {
return null;
}
}
return null;
}
public static function count($filter) {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$sql = "SELECT COUNT(*) as cnt FROM Voiceplandestination
WHERE $where
";
$res = $db->query($sql);
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
return $data->cnt;
}
return 0;
}
public static function search($filter, $limit = false) {
$items = [];
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$sql = "SELECT * FROM Voiceplandestination
WHERE $where
ORDER BY destination,prefix";
if(is_array($limit) && count($limit)) {
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
} elseif(is_numeric($count)) {
$sql .= " LIMIT ".$limit['count'];
}
}
$res = $db->query($sql);
//mfLoghandler::singleton()->debug($sql);
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new Voiceplandestination($data);
}
}
return $items;
}
private static function getSqlFilter($filter) {
$db = FronkDB::singleton();
$where = "1=1 ";
if(!is_array($filter)) {
return $where;
}
if(array_key_exists("voiceplan_id", $filter)) {
$voiceplan_id = $filter['voiceplan_id'];
if(is_numeric($voiceplan_id)) {
$where .= " AND voiceplan_id = $voiceplan_id";
}
}
if(array_key_exists("name", $filter)) {
$name = $db->escape($filter['name']);
if($name) {
$where .= " AND name like '%$name%'";
}
}
if(array_key_exists("destination", $filter)) {
$destination = $db->escape($filter['destination']);
if($destination) {
$where .= " AND destination like '%$destination%'";
}
}
if(array_key_exists("prefix", $filter)) {
$prefix = $db->escape($filter['prefix']);
if($prefix) {
$where .= " AND prefix like '%$prefix%'";
}
}
//var_dump($filter, $where);exit;
return $where;
}
}

View File

@@ -348,6 +348,9 @@ td.controls {
background-color: orange; background-color: orange;
} }
.bg-lightblue {
background-color: #f4faff;
}
.connected { .connected {
color: limegreen; color: limegreen;

View File

@@ -1 +0,0 @@
!function(o){"use strict";var e=function(){this.$body=o("body"),this.$modal=o("#event-modal"),this.$event="#external-events div.external-event",this.$calendar=o("#calendar"),this.$saveCategoryBtn=o(".save-category"),this.$categoryForm=o("#add-category form"),this.$extEvents=o("#external-events"),this.$calendarObj=null};e.prototype.onDrop=function(e,t){var n=e.data("eventObject"),a=e.attr("data-class"),l=o.extend({},n);l.start=t,a&&(l.className=[a]),this.$calendar.fullCalendar("renderEvent",l,!0),o("#drop-remove").is(":checked")&&e.remove()},e.prototype.onEventClick=function(t,e,n){var a=this,l=o("<form></form>");l.append("<label>Change event name</label>"),l.append("<div class='input-group m-b-15'><input class='form-control' type=text value='"+t.title+"' /><span class='input-group-append'><button type='submit' class='btn btn-success btn-md '><i class='fa fa-check'></i> Save</button></span></div>"),a.$modal.modal({backdrop:"static"}),a.$modal.find(".delete-event").show().end().find(".save-event").hide().end().find(".modal-body").empty().prepend(l).end().find(".delete-event").unbind("click").click(function(){a.$calendarObj.fullCalendar("removeEvents",function(e){return e._id==t._id}),a.$modal.modal("hide")}),a.$modal.find("form").on("submit",function(){return t.title=l.find("input[type=text]").val(),a.$calendarObj.fullCalendar("updateEvent",t),a.$modal.modal("hide"),!1})},e.prototype.onSelect=function(n,a,e){var l=this;l.$modal.modal({backdrop:"static"});var i=o("<form></form>");i.append("<div class='row'></div>"),i.find(".row").append("<div class='col-12'><div class='form-group'><label class='control-label'>Event Name</label><input class='form-control' placeholder='Insert Event Name' type='text' name='title'/></div></div>").append("<div class='col-12'><div class='form-group'><label class='control-label'>Category</label><select class='form-control' name='category'></select></div></div>").find("select[name='category']").append("<option value='bg-danger'>Danger</option>").append("<option value='bg-success'>Success</option>").append("<option value='bg-primary'>Primary</option>").append("<option value='bg-info'>Info</option>").append("<option value='bg-dark'>Dark</option>").append("<option value='bg-warning'>Warning</option></div></div>"),l.$modal.find(".delete-event").hide().end().find(".save-event").show().end().find(".modal-body").empty().prepend(i).end().find(".save-event").unbind("click").click(function(){i.submit()}),l.$modal.find("form").on("submit",function(){var e=i.find("input[name='title']").val(),t=(i.find("input[name='beginning']").val(),i.find("input[name='ending']").val(),i.find("select[name='category'] option:checked").val());return null!==e&&0!=e.length?(l.$calendarObj.fullCalendar("renderEvent",{title:e,start:n,end:a,allDay:!1,className:t},!0),l.$modal.modal("hide")):alert("You have to give a title to your event"),!1}),l.$calendarObj.fullCalendar("unselect")},e.prototype.enableDrag=function(){o(this.$event).each(function(){var e={title:o.trim(o(this).text())};o(this).data("eventObject",e),o(this).draggable({zIndex:999,revert:!0,revertDuration:0})})},e.prototype.init=function(){this.enableDrag();var e=new Date,t=(e.getDate(),e.getMonth(),e.getFullYear(),new Date(o.now())),n=[{title:"Hey!",start:new Date(o.now()+158e6),className:"bg-warning"},{title:"See John Deo",start:t,end:t,className:"bg-success"},{title:"Meet John Deo",start:new Date(o.now()+168e6),className:"bg-info"},{title:"Buy a Theme",start:new Date(o.now()+338e6),className:"bg-primary"}],a=this;a.$calendarObj=a.$calendar.fullCalendar({slotDuration:"00:15:00",minTime:"08:00:00",maxTime:"19:00:00",defaultView:"month",handleWindowResize:!0,height:o(window).height()-200,header:{left:"prev,next today",center:"title",right:"month,agendaWeek,agendaDay"},events:n,editable:!0,droppable:!0,eventLimit:!0,selectable:!0,drop:function(e){a.onDrop(o(this),e)},select:function(e,t,n){a.onSelect(e,t,n)},eventClick:function(e,t,n){a.onEventClick(e,t,n)}}),this.$saveCategoryBtn.on("click",function(){var e=a.$categoryForm.find("input[name='category-name']").val(),t=a.$categoryForm.find("select[name='category-color']").val();null!==e&&0!=e.length&&(a.$extEvents.append('<div class="external-event bg-'+t+'" data-class="bg-'+t+'" style="position: relative;"><i class="mdi mdi-checkbox-blank-circle mr-2 vertical-middle"></i>'+e+"</div>"),a.enableDrag())})},o.CalendarApp=new e,o.CalendarApp.Constructor=e}(window.jQuery),function(e){"use strict";window.jQuery.CalendarApp.init()}();

View File

@@ -1 +0,0 @@
!function(i){"use strict";var e=function(){};e.prototype.respChart=function(e,r,a,o){var t=e.get(0).getContext("2d"),n=i(e).parent();function s(){e.attr("width",i(n).width());switch(r){case"Line":new Chart(t,{type:"line",data:a,options:o});break;case"Doughnut":new Chart(t,{type:"doughnut",data:a,options:o});break;case"Pie":new Chart(t,{type:"pie",data:a,options:o});break;case"Bar":new Chart(t,{type:"bar",data:a,options:o});break;case"Radar":new Chart(t,{type:"radar",data:a,options:o});break;case"PolarArea":new Chart(t,{data:a,type:"polarArea",options:o})}}i(window).resize(s),s()},e.prototype.init=function(){this.respChart(i("#lineChart"),"Line",{labels:["January","February","March","April","May","June","July","August","September","October"],datasets:[{label:"Conversion Rate",fill:!1,backgroundColor:"#25b343",borderColor:"#25b343",data:[44,60,-33,58,-4,57,-89,60,-33,58]},{label:"Average Sale Value",fill:!1,backgroundColor:"#e3eaef",borderColor:"#e3eaef",borderDash:[5,5],data:[-68,41,86,-49,2,65,-64,86,-49,2]}]},{responsive:!0,tooltips:{mode:"index",intersect:!1},hover:{mode:"nearest",intersect:!0},scales:{xAxes:[{display:!0,gridLines:{color:"rgba(0,0,0,0.1)"}}],yAxes:[{gridLines:{color:"rgba(255,255,255,0.05)",fontColor:"#fff"},ticks:{max:100,min:-100,stepSize:20}}]}});this.respChart(i("#doughnut"),"Doughnut",{labels:["Bitcoin","Ethereum","Cardano"],datasets:[{data:[80,50,100],backgroundColor:["#02a8b5","#fd7e14","#e3eaef"],hoverBackgroundColor:["#02a8b5","#fd7e14","#e3eaef"],borderWidth:3,hoverBorderColor:"#fff"}]},{cutoutPercentage:80});this.respChart(i("#pie"),"Pie",{labels:["Desktops","Tablets","Mobiles"],datasets:[{data:[100,121,77],backgroundColor:["#d33319","#675aa9","#e3eaef"],hoverBackgroundColor:["#d33319","#675aa9","#e3eaef"],hoverBorderColor:"#fff"}]});this.respChart(i("#bar"),"Bar",{labels:["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15"],datasets:[{label:"Sales Analytics",backgroundColor:"#4b88e4",borderColor:"#4b88e4",borderWidth:1,hoverBackgroundColor:"#675aa9",hoverBorderColor:"#675aa9",data:[65,59,80,81,56,89,40,32,65,59,80,81,56,89,40,32,65,59,80,81,56,89,40,32,65,59,80,81,56,89,40]}]},{legend:{display:!1},scales:{yAxes:[{gridLines:{display:!1},ticks:{max:100,min:20,stepSize:20}}],xAxes:[{barPercentage:.3,gridLines:{color:"rgba(0,0,0,0.05)"}}]}});this.respChart(i("#radar"),"Radar",{labels:["Eating","Drinking","Sleeping","Designing","Coding","Cycling","Running"],datasets:[{label:"Desktops",backgroundColor:"rgba(179,181,198,0.2)",borderColor:"rgba(179,181,198,1)",pointBackgroundColor:"rgba(179,181,198,1)",pointBorderColor:"#fff",pointHoverBackgroundColor:"#fff",pointHoverBorderColor:"rgba(179,181,198,1)",data:[65,59,90,81,56,55,40]},{label:"Tablets",backgroundColor:"rgba(255,99,132,0.2)",borderColor:"rgba(255,99,132,1)",pointBackgroundColor:"rgba(255,99,132,1)",pointBorderColor:"#fff",pointHoverBackgroundColor:"#fff",pointHoverBorderColor:"rgba(255,99,132,1)",data:[28,48,40,19,96,27,100]}]});this.respChart(i("#polarArea"),"PolarArea",{datasets:[{data:[11,16,7,18],backgroundColor:["#297ef6","#45bbe0","#ebeff2","#1ea69a"],label:"My dataset",hoverBorderColor:"#fff"}],labels:["Series 1","Series 2","Series 3","Series 4"]})},i.ChartJs=new e,i.ChartJs.Constructor=e}(window.jQuery),function(e){"use strict";window.jQuery.ChartJs.init()}();

View File

@@ -0,0 +1,66 @@
var searchAddressTimer = false;
$(document).ready(function() {
/*
* Address search
*/
$("#owner_text").keyup(function() {
var search_string = $("#owner_text").val();
/*
* Rate limit search, by waiting 400 ms before really searching
* If input is received while waiting, clear timeout and set it anew
*/
// clear timeout if it is set
if(searchAddressTimer) {
clearTimeout(searchAddressTimer);
}
// wait for additional input before starting the search
searchAddressTimer = setTimeout(searchAddress, 400, "owner", search_string);
});
/*
* Prevent accidental submit
*/
$('#owner_text').keydown(function() {
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
});
function searchAddress(type = "owner", search_string) {
if(search_string.length < 2) return;
console.log("suchen...");
$.get(baseurl + "Address/Api",{
do: "findAddress",
search: search_string
},
function(success) {
console.log(success);
if(success.status != "OK") {
return;
}
showAddressResults(type, success.result);
},
"json");
$("#address_results").show();
}
function showAddressResults(type, result) {
console.log(type);
result.addresses.forEach(function(address) {
cnosole.log(address);
});
}

View File

@@ -1 +0,0 @@
!function(n){"use strict";var o=function(){};o.prototype.respChart=function(o,t,r,e){var i=o.get(0).getContext("2d"),a=n(o).parent();function l(){o.attr("width",n(a).width());switch(t){case"Doughnut":new Chart(i,{type:"doughnut",data:r,options:e});break;case"Bar":new Chart(i,{type:"bar",data:r,options:e})}}n(window).resize(l),l()},o.prototype.init=function(){this.respChart(n("#bar"),"Bar",{labels:["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"],datasets:[{label:"Sales Analytics",backgroundColor:"#00acc1",borderColor:"#00acc1",borderWidth:1,hoverBackgroundColor:"#d4570f",hoverBorderColor:"#d4570f",data:[65,59,80,81,56,89,40,32,65,59,80,81,56,89,40,32,65,59,80,81,56,89,40,32,65,59,80,81,56,89,40]}]},{legend:{display:!1},scales:{yAxes:[{gridLines:{display:!1},ticks:{max:100,min:20,stepSize:20}}],xAxes:[{barPercentage:.3,gridLines:{color:"rgba(0,0,0,0.05)"}}]}});this.respChart(n("#doughnut"),"Doughnut",{labels:["Bitcoin","Ethereum","Cardano"],datasets:[{data:[80,50,100],backgroundColor:["#02a8b5","#f1556c","#e3eaef"],hoverBackgroundColor:["#02a8b5","#f1556c","#e3eaef"],borderWidth:3,hoverBorderColor:"#fff"}]},{cutoutPercentage:80,legend:{position:"bottom",labels:{padding:30}}})},n.ChartJs=new o,n.ChartJs.Constructor=o}(window.jQuery),function(o){"use strict";window.jQuery.ChartJs.init()}(),$(document).ready(function(){var t,r=function(){$("#sparkline1").sparkline([25,23,26,24,25,32,30,24,19],{type:"line",width:"100%",height:"80",chartRangeMax:35,lineColor:"#f1556c",fillColor:"rgba(229, 43, 76, 0.3)",highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1,lineWidth:1}),$("#sparkline2").sparkline([0,23,43,35,44,45,56,37,40],{type:"line",width:"100%",height:"80",chartRangeMax:50,lineColor:"#00acc1",fillColor:"rgba(0, 172, 193, 0.2)",highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1,lineWidth:1}),$("#sparkline3").sparkline([25,23,26,24,25,32,30,24,19],{type:"line",width:"100%",height:"80",chartRangeMax:35,lineColor:"#f1556c",fillColor:"rgba(229, 43, 76, 0.3)",highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1,lineWidth:1}),$("#sparkline4").sparkline([0,23,43,35,44,45,56,37,40],{type:"line",width:"100%",height:"80",chartRangeMax:50,lineColor:"#00acc1",fillColor:"rgba(0, 172, 193, 0.2)",highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1,lineWidth:1})};r(),$(window).resize(function(o){clearTimeout(t),t=setTimeout(function(){r()},300)})});

View File

@@ -1 +0,0 @@
$(document).ready(function(){$("#basic-datatable").DataTable({language:{paginate:{previous:"<i class='mdi mdi-chevron-left'>",next:"<i class='mdi mdi-chevron-right'>"}},drawCallback:function(){$(".dataTables_paginate > .pagination").addClass("pagination-rounded")}});var a=$("#datatable-buttons").DataTable({lengthChange:!1,buttons:["copy","print"],language:{paginate:{previous:"<i class='mdi mdi-chevron-left'>",next:"<i class='mdi mdi-chevron-right'>"}},drawCallback:function(){$(".dataTables_paginate > .pagination").addClass("pagination-rounded")}});$("#selection-datatable").DataTable({select:{style:"multi"},language:{paginate:{previous:"<i class='mdi mdi-chevron-left'>",next:"<i class='mdi mdi-chevron-right'>"}},drawCallback:function(){$(".dataTables_paginate > .pagination").addClass("pagination-rounded")}}),$("#key-datatable").DataTable({keys:!0,language:{paginate:{previous:"<i class='mdi mdi-chevron-left'>",next:"<i class='mdi mdi-chevron-right'>"}},drawCallback:function(){$(".dataTables_paginate > .pagination").addClass("pagination-rounded")}}),a.buttons().container().appendTo("#datatable-buttons_wrapper .col-md-6:eq(0)")});

View File

@@ -1 +0,0 @@
!function(i){"use strict";var t=function(){};t.prototype.initCustomSelect=function(){i('[data-plugin="customselect"]').niceSelect()},t.prototype.initSwitchery=function(){i('[data-plugin="switchery"]').each(function(t,e){new Switchery(i(this)[0],i(this).data())})},t.prototype.initSelect2=function(){i('[data-toggle="select2"]').select2()},t.prototype.initMaxLength=function(){i("input#defaultconfig").maxlength({warningClass:"badge badge-success",limitReachedClass:"badge badge-danger"}),i("input#thresholdconfig").maxlength({threshold:20,warningClass:"badge badge-success",limitReachedClass:"badge badge-danger"}),i("input#alloptions").maxlength({alwaysShow:!0,separator:" out of ",preText:"You typed ",postText:" chars available.",validate:!0,warningClass:"badge badge-success",limitReachedClass:"badge badge-danger"}),i("textarea#textarea").maxlength({alwaysShow:!0,warningClass:"badge badge-success",limitReachedClass:"badge badge-danger"}),i("input#placement").maxlength({alwaysShow:!0,placement:"top-left",warningClass:"badge badge-success",limitReachedClass:"badge badge-danger"})},t.prototype.initDateRange=function(){var n={cancelClass:"btn-light",applyButtonClasses:"btn-success"};i('[data-toggle="date-picker"]').each(function(t,e){var a=i.extend({},n,i(e).data());i(e).daterangepicker(a)});var s={startDate:moment().subtract(29,"days"),endDate:moment(),ranges:{Today:[moment(),moment()],Yesterday:[moment().subtract(1,"days"),moment().subtract(1,"days")],"Last 7 Days":[moment().subtract(6,"days"),moment()],"Last 30 Days":[moment().subtract(29,"days"),moment()],"This Month":[moment().startOf("month"),moment().endOf("month")],"Last Month":[moment().subtract(1,"month").startOf("month"),moment().subtract(1,"month").endOf("month")]}};i('[data-toggle="date-picker-range"]').each(function(t,e){var a=i.extend({},s,i(e).data()),n=a.targetDisplay;i(e).daterangepicker(a,function(t,e){n&&i(n).html(t.format("MMMM D, YYYY")+" - "+e.format("MMMM D, YYYY"))})})},t.prototype.initMask=function(){i('[data-toggle="input-mask"]').each(function(t,e){var a=i(e).data("maskFormat"),n=i(e).data("reverse");null!=n?i(e).mask(a,{reverse:n}):i(e).mask(a)})},t.prototype.init=function(){this.initCustomSelect(),this.initSwitchery(),this.initSelect2(),this.initMaxLength(),this.initDateRange(),this.initMask()},i.Components=new t,i.Components.Constructor=t}(window.jQuery),function(t){"use strict";window.jQuery.Components.init()}();

View File

@@ -1 +0,0 @@
$(document).ready(function(){$("#summernote-editor").summernote({height:250,minHeight:null,maxHeight:null,focus:!1}),$("#summernote-inline").summernote({airMode:!0})});

View File

@@ -1 +0,0 @@
!function(e){"use strict";var a=function(){};a.prototype.createBasic=function(a){return new GMaps({div:a,lat:-12.043333,lng:-77.028333})},a.prototype.createMarkers=function(a){var e=new GMaps({div:a,lat:-12.043333,lng:-77.028333});return e.addMarker({lat:-12.043333,lng:-77.03,title:"Lima",details:{database_id:42,author:"HPNeo"},click:function(a){console.log&&console.log(a),alert("You clicked in this marker")}}),e.addMarker({lat:-12.042,lng:-77.028333,title:"Marker with InfoWindow",infoWindow:{content:"<p>HTML Content</p>"}}),e},a.prototype.createWithStreetview=function(a,e,t){return GMaps.createPanorama({el:a,lat:e,lng:t})},a.prototype.createMapByType=function(a,e,t){var n=new GMaps({div:a,lat:e,lng:t,mapTypeControlOptions:{mapTypeIds:["hybrid","roadmap","satellite","terrain","osm","cloudmade"]}});return n.addMapType("osm",{getTileUrl:function(a,e){return"http://tile.openstreetmap.org/"+e+"/"+a.x+"/"+a.y+".png"},tileSize:new google.maps.Size(256,256),name:"OpenStreetMap",maxZoom:18}),n.addMapType("cloudmade",{getTileUrl:function(a,e){return"http://b.tile.cloudmade.com/8ee2a50541944fb9bcedded5165f09d9/1/256/"+e+"/"+a.x+"/"+a.y+".png"},tileSize:new google.maps.Size(256,256),name:"CloudMade",maxZoom:18}),n.setMapTypeId("osm"),n},a.prototype.init=function(){var a=this;e(document).ready(function(){a.createBasic("#gmaps-basic"),a.createMarkers("#gmaps-markers"),a.createWithStreetview("#panorama",40.7295174,-73.9986496),a.createMapByType("#gmaps-types",-12.043333,-77.028333)})},e.GoogleMap=new a,e.GoogleMap.Constructor=a}(window.jQuery),function(a){"use strict";window.jQuery.GoogleMap.init()}(),function(a){"use strict";var e=function(){};e.prototype.init=function(){a("#world-map-markers").vectorMap({map:"world_mill_en",normalizeFunction:"polynomial",hoverOpacity:.7,hoverColor:!1,regionStyle:{initial:{fill:"#98a6ad"}},markerStyle:{initial:{r:9,fill:"#00acc1","fill-opacity":.9,stroke:"#fff","stroke-width":7,"stroke-opacity":.4},hover:{stroke:"#fff","fill-opacity":1,"stroke-width":1.5}},backgroundColor:"transparent",markers:[{latLng:[41.9,12.45],name:"Vatican City"},{latLng:[43.73,7.41],name:"Monaco"},{latLng:[-.52,166.93],name:"Nauru"},{latLng:[-8.51,179.21],name:"Tuvalu"},{latLng:[43.93,12.46],name:"San Marino"},{latLng:[47.14,9.52],name:"Liechtenstein"},{latLng:[7.11,171.06],name:"Marshall Islands"},{latLng:[17.3,-62.73],name:"Saint Kitts and Nevis"},{latLng:[3.2,73.22],name:"Maldives"},{latLng:[35.88,14.5],name:"Malta"},{latLng:[12.05,-61.75],name:"Grenada"},{latLng:[13.16,-61.23],name:"Saint Vincent and the Grenadines"},{latLng:[13.16,-59.55],name:"Barbados"},{latLng:[17.11,-61.85],name:"Antigua and Barbuda"},{latLng:[-4.61,55.45],name:"Seychelles"},{latLng:[7.35,134.46],name:"Palau"},{latLng:[42.5,1.51],name:"Andorra"},{latLng:[14.01,-60.98],name:"Saint Lucia"},{latLng:[6.91,158.18],name:"Federated States of Micronesia"},{latLng:[1.3,103.8],name:"Singapore"},{latLng:[.33,6.73],name:"São Tomé and Príncipe"}]}),a("#usa-vectormap").vectorMap({map:"us_merc_en",backgroundColor:"transparent",regionStyle:{initial:{fill:"#00acc1"}}}),a("#india-vectormap").vectorMap({map:"in_mill_en",backgroundColor:"transparent",regionStyle:{initial:{fill:"#00acc1"}}}),a("#australia-vectormap").vectorMap({map:"au_mill_en",backgroundColor:"transparent",regionStyle:{initial:{fill:"#00acc1"}}}),a("#chicago-vectormap").vectorMap({map:"us-il-chicago_mill_en",backgroundColor:"transparent",regionStyle:{initial:{fill:"#00acc1"}}})},a.VectorMap=new e,a.VectorMap.Constructor=e}(window.jQuery),function(a){"use strict";window.jQuery.VectorMap.init()}();

View File

@@ -1 +0,0 @@
$(document).ready(function(){$("#range_01").ionRangeSlider({skin:"modern"}),$("#range_02").ionRangeSlider({skin:"modern",min:100,max:1e3,from:550}),$("#range_03").ionRangeSlider({skin:"modern",type:"double",grid:!0,min:0,max:1e3,from:200,to:800,prefix:"$"}),$("#range_04").ionRangeSlider({skin:"modern",type:"double",grid:!0,min:-1e3,max:1e3,from:-500,to:500}),$("#range_05").ionRangeSlider({skin:"modern",type:"double",grid:!0,min:-1e3,max:1e3,from:-500,to:500,step:250}),$("#range_06").ionRangeSlider({skin:"modern",grid:!0,from:3,values:["January","February","March","April","May","June","July","August","September","October","November","December"]}),$("#range_07").ionRangeSlider({skin:"modern",grid:!0,min:1e3,max:1e6,from:2e5,step:1e3,prettify_enabled:!0}),$("#range_08").ionRangeSlider({skin:"modern",min:100,max:1e3,from:550,disable:!0}),$("#range_09").ionRangeSlider({skin:"modern",grid:!0,min:18,max:70,from:30,prefix:"Age ",max_postfix:"+"}),$("#range_10").ionRangeSlider({skin:"modern",type:"double",min:100,max:200,from:145,to:155,prefix:"Weight: ",postfix:" million pounds",decorate_both:!0}),$("#range_11").ionRangeSlider({skin:"modern",type:"single",grid:!0,min:-90,max:90,from:0,postfix:"°"}),$("#range_12").ionRangeSlider({skin:"modern",type:"double",min:1e3,max:2e3,from:1200,to:1800,hide_min_max:!0,hide_from_to:!0,grid:!0})});

View File

@@ -1 +0,0 @@
$(document).ready(function(){var o,l=function(){$("#sparkline1").sparkline([0,23,43,35,44,45,56,37,40],{type:"line",width:"100%",height:"165",chartRangeMax:50,lineColor:"#00acc1",fillColor:"rgba(0, 172, 193, 0.2)",highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1,lineWidth:1}),$("#sparkline1").sparkline([25,23,26,24,25,32,30,24,19],{type:"line",width:"100%",height:"165",chartRangeMax:40,lineColor:"#f1556c",fillColor:"rgba(229, 43, 76, 0.3)",composite:!0,highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1,lineWidth:1}),$("#sparkline2").sparkline([3,6,7,8,6,4,7,10,12,7,4,9,12,13,11,12],{type:"bar",height:"165",barWidth:"10",barSpacing:"3",barColor:"#00acc1"}),$("#sparkline3").sparkline([20,40,30,10],{type:"pie",width:"165",height:"165",sliceColors:["#00acc1","#4b88e4","#e3eaef","#fd7e14"]}),$("#sparkline4").sparkline([0,23,43,35,44,45,56,37,40],{type:"line",width:"100%",height:"165",chartRangeMax:50,lineColor:"#675aa9",fillColor:"transparent",lineWidth:2,highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1}),$("#sparkline4").sparkline([25,23,26,24,25,32,30,24,19],{type:"line",width:"100%",height:"165",chartRangeMax:40,lineColor:"#f672a7",fillColor:"transparent",composite:!0,lineWidth:2,maxSpotColor:!1,minSpotColor:!1,spotColor:!1,highlightLineColor:"rgba(0,0,0,1)",highlightSpotColor:"rgba(0,0,0,1)"}),$("#sparkline5").sparkline([4,6,7,7,4,3,2,1,4,4,5,6,3,4,5,8,7,6,9,3,2,4,1,5,6,4,3,7],{type:"discrete",width:"280",height:"165",lineColor:"#36404c"}),$("#sparkline6").sparkline([3,6,7,8,6,4,7,10,12,7,4,9,12,13,11,12],{type:"line",width:"100%",height:"165",lineColor:"#e3eaef",lineWidth:2,fillColor:"rgba(227,234,239,0.3)",highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)"}),$("#sparkline6").sparkline([3,6,7,8,6,4,7,10,12,7,4,9,12,13,11,12],{type:"bar",height:"165",barWidth:"10",barSpacing:"5",composite:!0,barColor:"#d33319"})};l(),$(window).resize(function(i){clearTimeout(o),o=setTimeout(function(){l()},300)})});

View File

@@ -1 +0,0 @@
!function(t){"use strict";var e=function(){};e.prototype.init=function(){t("#sa-basic").on("click",function(){Swal.fire({title:"Any fool can use a computer!",confirmButtonColor:"#00acc1"})}),t("#sa-title").click(function(){Swal.fire({title:"The Internet?",text:"That thing is still around?",type:"question",confirmButtonColor:"#00acc1"})}),t("#sa-success").click(function(){Swal.fire({title:"Good job!",text:"You clicked the button!",type:"success",confirmButtonColor:"#00acc1"})}),t("#sa-error").click(function(){Swal.fire({type:"error",title:"Oops...",text:"Something went wrong!",confirmButtonColor:"#00acc1",footer:'<a href="">Why do I have this issue?</a>'})}),t("#sa-long-content").click(function(){Swal.fire({imageUrl:"https://placeholder.pics/svg/300x1500",imageHeight:1500,imageAlt:"A tall image",confirmButtonColor:"#00acc1"})}),t("#sa-custom-position").click(function(){Swal.fire({position:"top-end",type:"success",title:"Your work has been saved",showConfirmButton:!1,timer:1500})}),t("#sa-warning").click(function(){Swal.fire({title:"Are you sure?",text:"You won't be able to revert this!",type:"warning",showCancelButton:!0,confirmButtonColor:"#00acc1",cancelButtonColor:"#f1556c",confirmButtonText:"Yes, delete it!"}).then(function(t){t.value&&Swal.fire("Deleted!","Your file has been deleted.","success")})}),t("#sa-params").click(function(){Swal.fire({title:"Are you sure?",text:"You won't be able to revert this!",type:"warning",showCancelButton:!0,confirmButtonText:"Yes, delete it!",cancelButtonText:"No, cancel!",confirmButtonClass:"btn btn-success mt-2",cancelButtonClass:"btn btn-danger ml-2 mt-2",buttonsStyling:!1}).then(function(t){t.value?Swal.fire({title:"Deleted!",text:"Your file has been deleted.",type:"success"}):t.dismiss===Swal.DismissReason.cancel&&Swal.fire({title:"Cancelled",text:"Your imaginary file is safe :)",type:"error"})})}),t("#sa-image").click(function(){Swal.fire({title:"Simulor",text:"Responsive Bootstrap 4 Admin Dashboard",imageUrl:"assets/images/logo-sm.png",imageHeight:50,animation:!1,confirmButtonColor:"#00acc1"})}),t("#sa-close").click(function(){var t;Swal.fire({title:"Auto close alert!",html:"I will close in <strong></strong> seconds.",timer:2e3,onBeforeOpen:function(){Swal.showLoading(),t=setInterval(function(){Swal.getContent().querySelector("strong").textContent=Swal.getTimerLeft()},100)},onClose:function(){clearInterval(t)}}).then(function(t){t.dismiss===Swal.DismissReason.timer&&console.log("I was closed by the timer")})}),t("#custom-html-alert").click(function(){Swal.fire({title:"<i>HTML</i> <u>example</u>",type:"info",html:'You can use <b>bold text</b>, <a href="//coderthemes.com/">links</a> and other HTML tags',showCloseButton:!0,showCancelButton:!0,confirmButtonColor:"#00acc1",cancelButtonColor:"#f1556c",confirmButtonText:'<i class="mdi mdi-thumb-up-outline"></i> Great!',cancelButtonText:'<i class="mdi mdi-thumb-down-outline"></i>'})}),t("#custom-padding-width-alert").click(function(){Swal.fire({title:"Custom width, padding, background.",width:600,padding:100,confirmButtonColor:"#00acc1",background:"#fff url(//subtlepatterns2015.subtlepatterns.netdna-cdn.com/patterns/geometry.png)"})}),t("#ajax-alert").click(function(){Swal.fire({title:"Submit your Github username",input:"text",inputAttributes:{autocapitalize:"off"},showCancelButton:!0,confirmButtonText:"Look up",confirmButtonColor:"#00acc1",cancelButtonColor:"#f1556c",showLoaderOnConfirm:!0,preConfirm:function(t){return fetch("//api.github.com/users/"+t).then(function(t){if(!t.ok)throw new Error(t.statusText);return t.json()}).catch(function(t){Swal.showValidationMessage("Request failed: "+t)})},allowOutsideClick:function(){Swal.isLoading()}}).then(function(t){t.value&&Swal.fire({title:t.value.login+"'s avatar",imageUrl:t.value.avatar_url})})}),t("#chaining-alert").click(function(){Swal.mixin({input:"text",confirmButtonText:"Next &rarr;",showCancelButton:!0,confirmButtonColor:"#00acc1",cancelButtonColor:"#f1556c",progressSteps:["1","2","3"]}).queue([{title:"Question 1",text:"Chaining swal2 modals is easy"},"Question 2","Question 3"]).then(function(t){t.value&&Swal.fire({title:"All done!",html:"Your answers: <pre><code>"+JSON.stringify(t.value)+"</code></pre>",confirmButtonText:"Lovely!"})})}),t("#dynamic-alert").click(function(){swal.queue([{title:"Your public IP",confirmButtonText:"Show my public IP",confirmButtonColor:"#00acc1",text:"Your public IP will be received via AJAX request",showLoaderOnConfirm:!0,preConfirm:function(){return new Promise(function(e){t.get("https://api.ipify.org?format=json").done(function(t){swal.insertQueueStep(t.ip),e()})})}}])})},t.SweetAlert=new e,t.SweetAlert.Constructor=e}(window.jQuery),function(t){"use strict";window.jQuery.SweetAlert.init()}();

View File

@@ -1 +0,0 @@
$(function(){var k,f=-1,m=0;$("#showtoast").click(function(){var t,o,e=$("#toastTypeGroup input:radio:checked").val(),a=$("#message1").val(),n=$("#title").val()||"",s=$("#showDuration"),i=$("#hideDuration"),r=$("#timeOut"),l=$("#extendedTimeOut"),c=$("#showEasing"),p=$("#hideEasing"),d=$("#showMethod"),h=$("#hideMethod"),u=m++,g=$("#addClear").prop("checked");toastr.options={closeButton:$("#closeButton").prop("checked"),debug:$("#debugInfo").prop("checked"),newestOnTop:$("#newestOnTop").prop("checked"),progressBar:$("#progressBar").prop("checked"),positionClass:$("#positionGroup input:radio:checked").val()||"toast-top-right",preventDuplicates:$("#preventDuplicates").prop("checked"),onclick:null},$("#addBehaviorOnToastClick").prop("checked")&&(toastr.options.onclick=function(){alert("You can perform some custom action after a toast goes away")}),s.val().length&&(toastr.options.showDuration=s.val()),i.val().length&&(toastr.options.hideDuration=i.val()),r.val().length&&(toastr.options.timeOut=g?0:r.val()),l.val().length&&(toastr.options.extendedTimeOut=g?0:l.val()),c.val().length&&(toastr.options.showEasing=c.val()),p.val().length&&(toastr.options.hideEasing=p.val()),d.val().length&&(toastr.options.showMethod=d.val()),h.val().length&&(toastr.options.hideMethod=h.val()),g&&(t=(t=a)||"Clear itself?",a=t+='<br /><br /><button type="button" class="btn btn-default clear">Yes</button>',toastr.options.tapToDismiss=!1),a||(++f===(o=["My name is Inigo Montoya. You killed my father. Prepare to die!","Are you the six fingered man?","Inconceivable!","I do not think that means what you think it means.","Have fun storming the castle!"]).length&&(f=0),a=o[f]),$("#toastrOptions").text('Command: toastr["'+e+'"]("'+a+(n?'", "'+n:"")+'")\n\ntoastr.options = '+JSON.stringify(toastr.options,null,2));var v=toastr[e](a,n);void 0!==(k=v)&&(v.find("#okBtn").length&&v.delegate("#okBtn","click",function(){alert("you clicked me. i was toast #"+u+". goodbye!"),v.remove()}),v.find("#surpriseBtn").length&&v.delegate("#surpriseBtn","click",function(){alert("Surprise! you clicked me. i was toast #"+u+". You could perform an action here.")}),v.find(".clear").length&&v.delegate(".clear","click",function(){toastr.clear(v,{force:!0})}))}),$("#clearlasttoast").click(function(){toastr.clear(k)}),$("#cleartoasts").click(function(){toastr.clear()})});