774 lines
41 KiB
PHP
774 lines
41 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")?>">Vorbestellung</a></li>
|
|
<li class="breadcrumb-item active"><?=($preorder->id) ? "bearbeiten" : "Neu" ?></li>
|
|
</ol>
|
|
</div>
|
|
<h4 class="page-title">Vorbestellung</h4>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- end page title -->
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
|
|
<div class="card bg-light">
|
|
<div class="card-body">
|
|
<h4 class="header-title mb-2"><?=($preorder->id) ? "Vorbestellung bearbeiten" : "Neue Vorbestellung"?></h4>
|
|
|
|
<form class="form-horizontal" method="post" action="<?=self::getUrl("Preorder", "save", ['preordercampaign_id' => $campaign->id])?>">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
|
|
<input type="hidden" name="id" value="<?=$preorder->id?>" />
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="network_id">Vorbestellkampagne</label>
|
|
<div class="col-lg-10">
|
|
<input type="hidden" name="campaign_id" id="campaign_id" value="<?=$campaign->id?>" />
|
|
<input type="text" class="form-control" value="<?=$campaign->name?>" readonly="readonly"/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="network_id">Netzgebiet</label>
|
|
<div class="col-lg-10">
|
|
<input type="hidden" name="network_id" id="network_id" value="<?=$campaign->network_id?>" />
|
|
<input type="text" class="form-control" value="<?=$campaign->network->name?>" readonly="readonly" />
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="adb_hausnummer_id">Adresse *</label>
|
|
<div class="col-lg-10">
|
|
<select class="form-control" name="adb_hausnummer_id" id="adb_hausnummer_id" <?=($preorder && $preorder->adb_wohneinheit_id && is_array($preorder->adb_wohneinheit->rimo_workorders) && count($preorder->adb_wohneinheit->rimo_workorders)) ? "disabled='disabled'" : ""?>>
|
|
<?php if($preorder->adb_hausnummer_id): ?>
|
|
<option value="<?=$preorder->adb_hausnummer_id?>" selected="selected"><?=$preorder->adb_hausnummer->plz->plz?> <?=$preorder->adb_hausnummer->strasse->ortschaft->name?>, <?=$preorder->adb_hausnummer->strasse->name?> <?=$preorder->adb_hausnummer->hausnummer?></option>
|
|
<?php endif; ?>
|
|
</select>
|
|
|
|
<div id="new-address-toggle" class="alert alert-info mt-1 mb-1 pb-1 pt-1 hidden">
|
|
<h5><i class="icon fas fa-info-circle"></i> Adresse nicht gefunden?</h5>
|
|
Vertippt? Richtiges Netzgebiet (<strong><?=$campaign->network->name?></strong>) ?<br /><br /><a href="#" onclick="toggleNewAddress()"><i class="far fa-plus-square"></i> Hier klickem um die Adresse neu anzulegen</a>
|
|
|
|
<div id="new-address" class="mt-0 mb-4 hidden">
|
|
<hr />
|
|
<div class="row" id="new-address-form">
|
|
<div class="col-7 border">
|
|
<div class="mb-3">
|
|
<h4>Neue Adresse in Adress-Datenbank eintragen:</h4>
|
|
<small class="text-danger">Alle mit * markierten Felder sind Pflichtfelder</small>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-3 col-form-label" for="street">Straße <span class="text-danger">*</span> / Hausnummer <span class="text-danger">*</span></label>
|
|
<div class="col-lg-6">
|
|
<input type="text" class="form-control basicAutoComplete" autocomplete="off" data-url="<?=self::getUrl('AddressDB','api')?>?do=findStreets&autocomplete=1" name="new_address_street" id="new_address_street" value="<?=$preorder->new_address_street?>" placeholder="Straße" />
|
|
</div>
|
|
<div class="col-lg-3">
|
|
<input type="text" class="form-control" name="new_address_housenumber" id="new_address_housenumber" value="<?=$preorder->new_address_housenumber?>" placeholder="Hausnummer" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-3 col-form-label" for="zip">PLZ <span class="text-danger">*</span> / Ort <span class="text-danger">*</span></label>
|
|
<div class="col-lg-2">
|
|
<input type="text" class="form-control basicAutoComplete" autocomplete="off" data-url="<?=self::getUrl('AddressDB','api')?>?do=findZips&campaign_id=<?=$campaign->id?>&autocomplete=1" name="new_address_zip" id="new_address_zip" value="<?=$preorder->new_address_zip?>" placeholder="PLZ" />
|
|
</div>
|
|
<div class="col-lg-7">
|
|
<input type="text" class="form-control basicAutoComplete" autocomplete="off" data-url="<?=self::getUrl('AddressDB','api')?>?do=findCities&campaign_id=<?=$campaign->id?>&autocomplete=1" name="new_address_city" id="new_address_city" value="<?=$preorder->new_address_city?>" placeholder="Ort" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-3 col-form-label" for="zip">Ortsteil <span class="text-danger">*</span></label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control basicAutoComplete" autocomplete="off" data-url="<?=self::getUrl('AddressDB','api')?>?do=findDistricts&campaign_id=<?=$campaign->id?>&autocomplete=1" name="new_address_district" id="new_address_district" value="<?=$preorder->new_address_zip?>" placeholder="Ortsteil" />
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-3 col-form-label" for="">Wohneinheit</label>
|
|
<div class="col-lg-4">
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label text-right" for="">Block:</label>
|
|
<div class="col-lg-6">
|
|
<input type="text" class="form-control" name="new_address_block" id="new_address_block" value="<?=$preorder->block?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-4">
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label text-right" for="">Stiege:</label>
|
|
<div class="col-lg-6">
|
|
<input type="text" class="form-control" name="new_address_stiege" id="new_address_stiege" value="<?=$preorder->stiege?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-3 col-form-label" for=""></label>
|
|
<div class="col-lg-4">
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label text-right" for="">Stock:</label>
|
|
<div class="col-lg-6">
|
|
<input type="text" class="form-control" name="new_address_stock" id="new_address_stock" value="<?=$preorder->stock?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-4">
|
|
<div class="form-group row">
|
|
<label class="col-lg-4 col-form-label text-right" for="">Tür:</label>
|
|
<div class="col-lg-6">
|
|
<input type="text" class="form-control" name="new_address_tuer" id="new_address_tuer" value="<?=$preorder->tuer?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="form-group row" id="wohneinheit_row">
|
|
<label class="col-lg-2 col-form-label" for="adb_wohneinheit_id">Wohneinheit *</label>
|
|
<div class="col-lg-10">
|
|
<select class="form-control" name="adb_wohneinheit_id" id="adb_wohneinheit_id" <?=($preorder && $preorder->adb_wohneinheit_id && is_array($preorder->adb_wohneinheit->rimo_workorders) && count($preorder->adb_wohneinheit->rimo_workorders)) ? "disabled='disabled'" : ""?>>
|
|
<?php if($preorder->adb_wohneinheit_id): ?>
|
|
<option value="<?=$preorder->adb_wohneinheit_id?>" selected="selected"><?=$preorder->adb_hausnummer->strasse->name?> <?=$preorder->adb_hausnummer->hausnummer?> <?=$preorder->adb_wohneinheit?><?=($preorder->adb_wohneinheit->extref) ? " (".$preorder->adb_wohneinheit->extref.")" : ""?></option>
|
|
<?php endif; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="product_id">Vertriebspartner</label>
|
|
<div class="col-lg-10">
|
|
<select class="form-control" name="partner_id" id="partner_id">
|
|
<option value=""></option>
|
|
<?php if($preorder->id): ?>
|
|
<?php foreach($partners as $partner): ?>
|
|
<option value="<?=$partner->id?>" <?=($preorder->partner_id == $partner->id) ? "selected='selected'" : ""?>><?=$partner->getCompanyOrName()?></option>
|
|
<?php endforeach; ?>
|
|
<?php else: ?>
|
|
<?php foreach($partners as $partner): ?>
|
|
<option value="<?=$partner->id?>" <?=($me->address_id == $partner->id) ? "selected='selected'" : ""?>><?=$partner->getCompanyOrName()?></option>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="preorder-form" class="mt-4">
|
|
<h4>Vorbestellung & Produkt</h4>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="type">Vorbestelltyp *</label>
|
|
<div class="col-lg-10">
|
|
<select class="form-control" name="type" id="type">
|
|
<?php if(array_key_exists("interest", $campaign->types)): ?><option value="interest" <?=($preorder->type == "interest") ? "selected='selected'" : ""?>>Interessensbekundung</option><?php endif; ?>
|
|
<?php if(array_key_exists("provision", $campaign->types)): ?><option value="provision" <?=($preorder->type == "provision") ? "selected='selected'" : ""?>>Vorsorgeanschluss</option><?php endif; ?>
|
|
<?php if(array_key_exists("order", $campaign->types)): ?><option value="order" <?=($preorder->type == "order") ? "selected='selected'" : ""?>>Vollanschluss</option><?php endif; ?>
|
|
<?php if(array_key_exists("legacytransfer", $campaign->types)): ?><option value="legacytransfer" <?=($preorder->type == "legacytransfer") ? "selected='selected'" : ""?>>Bestandsübernahme</option><?php endif; ?>
|
|
<?php if(array_key_exists("reorder", $campaign->types)): ?><option value="reorder" <?=($preorder->type == "reorder") ? "selected='selected'" : ""?>>Nachbestellung</option><?php endif; ?>
|
|
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="connection_type">Anschlusstyp *</label>
|
|
<div class="col-lg-10">
|
|
<select class="form-control" name="connection_type" id="connection_type">
|
|
<option value="single-dwelling" <?=($preorder->connection_type == "single-dwelling") ? "selected='selected'" : ""?>>Einfamilienhaus</option>
|
|
<option value="multi-dwelling" <?=($preorder->connection_type == "multi-dwelling") ? "selected='selected'" : ""?>>Mehrfamilienhaus</option>
|
|
<option value="apartment-building" <?=($preorder->connection_type == "apartment-building") ? "selected='selected'" : ""?>>Mehrparteienhaus</option>
|
|
<option value="apartment" <?=($preorder->connection_type == "apartment") ? "selected='selected'" : ""?>>Wohneinheit in Mehrparteienhaus</option>
|
|
<option value="business" <?=($preorder->connection_type == "business") ? "selected='selected'" : ""?>>Gewerbebetrieb</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="connection_count">Anzahl Anschlüsse</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="connection_count" id="connection_count" value="<?=$preorder->connection_count?>" placeholder="1" />
|
|
</div>
|
|
</div>
|
|
|
|
<input type="hidden" name="setup_product_id" id="setup_product_id" value="<?=$preorder->setup_product_id?>" />
|
|
|
|
<?php if($campaign->product_type != "no_setup" && is_array($campaign->setup_products) && count($campaign->setup_products)): ?>
|
|
<?php if(is_array($campaign->setup_products['provision']) && count($campaign->setup_products['provision'])): ?>
|
|
<div class="form-group row" id="setup-provision">
|
|
<label class="col-lg-2 col-form-label" for="">Anschlussprodukt (Herstellung) *</label>
|
|
<div class="col-lg-10">
|
|
<input type="hidden" class="form-control value <?=(count($campaign->setup_products['provision']) == 1) ? "" : "hidden" ?>" data-price="<?=$campaign->setup_products['provision'][0]->price_setup?>" value="<?=(count($campaign->setup_products['provision']) == 1) ? $campaign->setup_products['provision'][0]->id : ""?>" readonly="readonly" />
|
|
<input type="text" class="form-control text <?=(count($campaign->setup_products['provision']) == 1) ? "" : "hidden" ?>" value="<?=(count($campaign->setup_products['provision'])) ? $campaign->setup_products['provision'][0]->name : ""?>" readonly="readonly" />
|
|
|
|
<select class="form-control select <?=(count($campaign->setup_products['provision']) < 2) ? "hidden" : "" ?>" onchange="updateSetupProduct('provision')">
|
|
<option value="0"></option>
|
|
<?php foreach($campaign->setup_products['provision'] as $sp): ?>
|
|
<option data-price="<?=$sp->price_setup?>" value="<?=$sp->id?>" <?=($preorder->setup_product_id == $sp->id) ? "selected='selected'" : ""?>><?=$sp->name?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if(is_array($campaign->setup_products['activation']) && count($campaign->setup_products['activation'])): ?>
|
|
<div class="form-group row" id="setup-activation">
|
|
<label class="col-lg-2 col-form-label" for="">Anschlussprodukt (Herstellung) *</label>
|
|
<div class="col-lg-10">
|
|
<input type="hidden" class="form-control value <?=(count($campaign->setup_products['activation']) == 1) ? "" : "hidden" ?>" data-price="<?=$campaign->setup_products['activation'][0]->price_setup?>" value="<?=(count($campaign->setup_products['activation']) == 1) ? $campaign->setup_products['activation'][0]->id : ""?>" readonly="readonly" />
|
|
<input type="text" class="form-control text <?=(count($campaign->setup_products['activation']) == 1) ? "" : "hidden" ?>" value="<?=(count($campaign->setup_products['activation'])) ? $campaign->setup_products['activation'][0]->name : ""?>" readonly="readonly" />
|
|
|
|
<select class="form-control select <?=(count($campaign->setup_products['activation']) < 2) ? "hidden" : "" ?>" onchange="updateSetupProduct('activation')">
|
|
<option value="0"></option>
|
|
<?php foreach($campaign->setup_products['activation'] as $sp): ?>
|
|
<option data-price="<?=$sp->price_setup?>" value="<?=$sp->id?>" <?=($preorder->setup_product_id == $sp->id) ? "selected='selected'" : ""?>><?=$sp->name?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
|
|
<?php if($campaign->product_type != "setup_only"): ?>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="product_id">Internetprodukt</label>
|
|
<div class="col-lg-10">
|
|
<select class="form-control" name="product_id" id="product_id" onchange="updateProduct()">
|
|
<option value=""></option>
|
|
<?php foreach($products as $product): ?>
|
|
<option value="<?=$product->id?>" <?=($preorder->product_id == $product->id) ? "selected='selected'" : ""?>><?=$product->name?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="price_setup">Netto Preis Setup *</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="price_setup" id="price_setup" value="<?=$preorder->price_setup?>" />
|
|
</div>
|
|
</div>
|
|
|
|
<?php if($campaign->product_type != "setup_only"): ?>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="price">Netto Preis Periodisch</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="price" id="price" value="<?=$preorder->price?>" />
|
|
</div>
|
|
</div>
|
|
|
|
<?php if($me->isAdmin()): ?>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="price_nne">Preis NNE</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="price_nne" id="price_nne" value="<?=$preorder->price_nne?>" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="price_nbe">Preis NBE</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="price_nbe" id="price_nbe" value="<?=$preorder->price_nbe?>" />
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="billing_delay">Verzögerter Verrechnungsstart</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="billing_delay" id="billing_delay" placeholder="Freimonate" value="<?=$preorder->billing_delay?>" />
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<h4 class="mt-4">Zustimmungen</h4>
|
|
<div class="form-group row">
|
|
<div class="col-lg-2"></div>
|
|
<div class="col-lg-10">
|
|
<label><input type="checkbox" name="accept_agb" id="accept_agb" value="1" disabled="disabled" checked="checked" /> AGB akzeptiert</label><br />
|
|
<label><input type="checkbox" name="accept_dsgvo" id="accept_dsgvo" value="1" disabled="disabled" checked="checked" /> DSGVO akzeptiert</label><br />
|
|
<label><input type="checkbox" name="accept_withdrawal" id="accept_withdrawal" value="1" disabled="disabled" checked="checked" /> Rücktrittsrecht akzeptiert</label><br />
|
|
<label><input type="checkbox" name="accept_marketing" id="accept_marketing" value="1" <?=($preorder->accept_marketing) ? "checked='checked'" : ""?> /> Datenweitergabe akzeptiert</label><br />
|
|
<label><input type="checkbox" name="accept_digging" id="accept_digging" value="1" <?=($preorder->accept_digging) ? "checked='checked'" : ""?> /> Zustimmung zu Grabungsarbeiten</label>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<h4 class="mt-4">Kundendaten</h4>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="company">Firma</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="company" id="company" value="<?=$preorder->company?>" placeholder="Firma" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="uid">UID</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="uid" id="uid" value="<?=$preorder->uid?>" placeholder="UID" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="firstname">Vorname *</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="firstname" id="firstname" value="<?=$preorder->firstname?>" placeholder="Vorname" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="lastname">Nachname *</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="lastname" id="lastname" value="<?=$preorder->lastname?>" placeholder="Nachname" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="street">Straße / Hausnummer *</label>
|
|
<div class="col-lg-5">
|
|
<input type="text" class="form-control" name="street" id="street" value="<?=$preorder->street?>" placeholder="Straße" />
|
|
</div>
|
|
<div class="col-lg-5">
|
|
<input type="text" class="form-control" name="housenumber" id="housenumber" value="<?=$preorder->housenumber?>" placeholder="Hausnummer" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for=""></label>
|
|
<div class="col-lg-1">
|
|
<div class="form-group row">
|
|
<label class="col-lg-6 col-form-label text-right" for="">Block:</label>
|
|
<div class="col-lg-6">
|
|
<input type="text" class="form-control" name="block" id="block" value="<?=$preorder->block?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-1">
|
|
<div class="form-group row">
|
|
<label class="col-lg-6 col-form-label text-right" for="">Stiege:</label>
|
|
<div class="col-lg-6">
|
|
<input type="text" class="form-control" name="stiege" id="stiege" value="<?=$preorder->stiege?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-1">
|
|
<div class="form-group row">
|
|
<label class="col-lg-6 col-form-label text-right" for="">Stock:</label>
|
|
<div class="col-lg-6">
|
|
<input type="text" class="form-control" name="stock" id="stock" value="<?=$preorder->stock?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-1">
|
|
<div class="form-group row">
|
|
<label class="col-lg-6 col-form-label text-right" for="">Tür:</label>
|
|
<div class="col-lg-6">
|
|
<input type="text" class="form-control" name="tuer" id="tuer" value="<?=$preorder->tuer?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="zip">PLZ / Ort *</label>
|
|
<div class="col-lg-3">
|
|
<input type="text" class="form-control" name="zip" id="zip" value="<?=$preorder->zip?>" placeholder="PLZ" />
|
|
</div>
|
|
<div class="col-lg-7">
|
|
<input type="text" class="form-control" name="city" id="city" value="<?=$preorder->city?>" placeholder="Ort" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="phone">Telefon</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="phone" id="phone" value="<?=$preorder->phone?>" placeholder="Telefon" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="email">Email</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="email" id="email" value="<?=$preorder->email?>" placeholder="Email" />
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
|
|
<div class="col-lg-10">
|
|
<textarea id="note" class="form-control" name="note" rows="5"><?=$preorder->note?></textarea>
|
|
</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>
|
|
|
|
<?php if($preorder->submit_type == "api" && $preorder->submit_request): ?>
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label">Raw API Request</label>
|
|
<div class="col-lg-10 text-monospace border" style="max-height: 512px; line-break: auto; overflow: auto; white-space: pre"><script>document.write(JSON.stringify(JSON.parse('<?=str_replace(["\n","\r"],"",$preorder->submit_request)?>'), null, "\t"));</script></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
|
|
|
<?php if($preorder->type != "provision"): ?>
|
|
$('#setup-provision').hide();
|
|
<?php endif; ?>
|
|
<?php if($preorder->type != "order"): ?>
|
|
$('#setup-activation').hide();
|
|
<?php endif; ?>
|
|
|
|
|
|
if($('#type').val() == "provision") {
|
|
$('#setup-provision').show();
|
|
if(!$("#price_setup").val()) {
|
|
$("#price_setup").val($("#setup-provision input.value").data("price"));
|
|
}
|
|
<?php if(count($campaign->setup_products['provision']) == 1): ?>
|
|
$("#setup_product_id").val($("#setup-provision input.value").val());
|
|
<?php endif; ?>
|
|
}
|
|
|
|
if($('#type').val() == "order") {
|
|
$('#setup-activation').show();
|
|
if(!$("#price_setup").val()) {
|
|
$("#price_setup").val($("#setup-provision input.value").data("price"));
|
|
}
|
|
<?php if(count($campaign->setup_products['activation']) == 1): ?>
|
|
$("#setup_product_id").val($("#setup-activation input.value").val());
|
|
<?php endif; ?>
|
|
}
|
|
|
|
$('#new_address_street').autoComplete({minLength: 2}).keydown(preventEnter).change(updateCustomerAddressFromNewAddress).on("autocomplete.select", updateCustomerAddressFromNewAddress);
|
|
$('#new_address_zip').autoComplete({minLength: 1}).keydown(preventEnter).change(updateCustomerAddressFromNewAddress).on("autocomplete.select", updateCustomerAddressFromNewAddress);
|
|
$('#new_address_city').autoComplete({minLength: 2}).keydown(preventEnter).change(updateCustomerAddressFromNewAddress).on("autocomplete.select", updateCustomerAddressFromNewAddress);
|
|
$('#new_address_district').autoComplete({minLength: 2}).keydown(preventEnter);
|
|
$('#new_address_housenumber').keydown(preventEnter).change(updateCustomerAddressFromNewAddress).on("autocomplete.select", updateCustomerAddressFromNewAddress);
|
|
$('#new_address_block').keydown(preventEnter);
|
|
$('#new_address_stiege').keydown(preventEnter);
|
|
$('#new_address_stock').keydown(preventEnter);
|
|
$('#new_address_tuer').keydown(preventEnter);
|
|
|
|
|
|
function preventEnter() {
|
|
if(event.keyCode == 13) {
|
|
event.preventDefault();
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
$("#product_id").select2({
|
|
allowClear: true,
|
|
placeholder: ""
|
|
});
|
|
$("#partner_id").select2({
|
|
allowClear: true,
|
|
placeholder: ""
|
|
});
|
|
|
|
/**********************
|
|
* Event handler
|
|
**********************/
|
|
// show Building Search when selecting Network
|
|
$('#network_id').change(function() {
|
|
var network_id = $('#network_id').val();
|
|
if(network_id) {
|
|
$('#building-search').show();
|
|
$('#building_id_search').focus();
|
|
} else {
|
|
$('#building-search').hide();
|
|
resetBuildingSearch();
|
|
}
|
|
});
|
|
|
|
|
|
$('#adb_hausnummer_id').select2({
|
|
ajax: {
|
|
url: '<?=self::getUrl("AddressDB", "api", ["do" => "findAddress", "campaign_id" => $campaign->id])?>',
|
|
delay: 250,
|
|
dataType: 'json'
|
|
},
|
|
minimumInputLength: 3,
|
|
placeholder: "Suche nach Straße, Hausnummer, Ort",
|
|
allowClear: true
|
|
});
|
|
|
|
$('#adb_hausnummer_id').on('select2:close', function(e) {
|
|
if(!$('#adb_hausnummer_id').val()) {
|
|
$('#new-address-toggle').show();
|
|
}
|
|
|
|
});
|
|
|
|
|
|
$('#adb_hausnummer_id').change(function() {
|
|
var hausnummer_id = $('#adb_hausnummer_id').val();
|
|
if(!hausnummer_id) return;
|
|
|
|
$('#new-address-toggle').hide();
|
|
$('#new-address').hide();
|
|
|
|
$.get('<?=self::getUrl("AddressDB", "Api")?>',
|
|
{
|
|
do: "getAddressByHousenumber",
|
|
hausnummer_id: hausnummer_id
|
|
},
|
|
function(success) {
|
|
if(success.status != "OK") {
|
|
return;
|
|
}
|
|
var address = success.result;
|
|
console.log(address);
|
|
$('#new_address_street').val(address.strasse);
|
|
$('#new_address_housenumber').val(address.hausnummer);
|
|
$('#new_address_zip').val(address.plz);
|
|
$('#new_address_city').val(address.ort);
|
|
$('#new_address_district').val(address.ortschaft);
|
|
},
|
|
'json');
|
|
|
|
|
|
$.get('<?=self::getUrl("AddressDB", "Api")?>',
|
|
{
|
|
do: "getUnits",
|
|
hausnummer_id: hausnummer_id
|
|
},
|
|
function(success) {
|
|
if(success.status != "OK") {
|
|
return;
|
|
}
|
|
|
|
$('#adb_wohneinheit_id').empty();
|
|
$('#adb_wohneinheit_id').append("<option></option>")
|
|
|
|
success.result.units.forEach(function(unit) {
|
|
let opt = "<option value='" + unit.id + "'>";
|
|
opt += unit.zip + " " + unit.city + ", " + unit.street + " " + unit.housenumber;
|
|
if(unit.extra) {
|
|
opt += " " + unit.extra;
|
|
}
|
|
if(unit.extref) opt += " (" + unit.extref + ")";
|
|
|
|
/*let extras = new Array();
|
|
if(unit.block) extras.push("Block " + unit.block);
|
|
if(unit.stiege) extras.push("Stiege " + unit.stiege);
|
|
if(unit.stock) extras.push("Stock " + unit.stock);
|
|
if(unit.tuer) extras.push("Tür " + unit.tuer);
|
|
if(unit.zusatz) extras.push(unit.zusatz);
|
|
|
|
if(extras.length) {
|
|
opt += " " + extras.join(", ");
|
|
}*/
|
|
|
|
if(unit.nutzung) {
|
|
opt += " " + unit.nutzung;
|
|
}
|
|
|
|
opt += "</option>";
|
|
$('#adb_wohneinheit_id').append(opt);
|
|
$('#adb_wohneinheit_id').addClass("is-invalid");
|
|
$('#adb_wohneinheit_id')
|
|
.data("extref", unit.extref)
|
|
.data("zip", unit.zip)
|
|
.data("city", unit.city)
|
|
.data("street", unit.street)
|
|
.data("housenumber", unit.housenumber)
|
|
.data("block", unit.block)
|
|
.data("stiege", unit.stiege)
|
|
.data("stock", unit.stock)
|
|
.data("tuer", unit.tuer)
|
|
.data("zusatz", unit.zusatz);
|
|
|
|
afterHausnummerChange();
|
|
|
|
});
|
|
|
|
},
|
|
"json");
|
|
});
|
|
|
|
function updateCustomerAddressFromNewAddress() {
|
|
$('input[name=street]').val($('#new_address_street').val());
|
|
$('input[name=housenumber]').val($('#new_address_housenumber').val());
|
|
$('input[name=zip]').val($('#new_address_zip').val());
|
|
$('input[name=city]').val($('#new_address_city').val());
|
|
}
|
|
|
|
|
|
$('#adb_wohneinheit_id').change(function() {
|
|
val = $('#adb_wohneinheit_id').val();
|
|
|
|
if($('#adb_wohneinheit_id option').length < 2) return;
|
|
|
|
if(val) {
|
|
$('#adb_wohneinheit_id').removeClass("is-invalid");
|
|
|
|
if(!$('input[name=street]').val() && !$('input[name=zip]').val() && !$('input[name=city]').val()) {
|
|
$('input[name=street]').val($('#adb_wohneinheit_id').data("street") + " " + $('#adb_wohneinheit_id').data("housenumber"));
|
|
$('input[name=zip]').val($('#adb_wohneinheit_id').data("zip"));
|
|
$('input[name=city]').val($('#adb_wohneinheit_id').data("city"));
|
|
}
|
|
|
|
} else {
|
|
$('#adb_wohneinheit_id').addClass("is-invalid");
|
|
}
|
|
});
|
|
|
|
$('#type').change(function() {
|
|
var type = $('#type').val();
|
|
var pid = 0;
|
|
var price = 0;
|
|
|
|
$("#price_setup").val("");
|
|
|
|
if(type == "interest") {
|
|
$('#setup-provision').hide();
|
|
$('#setup-activation').hide();
|
|
$('#setup_product_id').val("");
|
|
$("#price_setup").val("");
|
|
} else if(type == "provision") {
|
|
$('#setup-provision').show();
|
|
$('#setup-activation').hide();
|
|
$('#setup_product_id').val("");
|
|
if($("#setup-provision input.value").val()) {
|
|
pid = $("#setup-provision input.value").val();
|
|
price = $("#setup-provision input.value").data("price");
|
|
$("#setup_product_id").val(pid);
|
|
$("#price_setup").val(price);
|
|
}
|
|
$("#setup-activation select").val("0");
|
|
} else if(type == "order") {
|
|
$('#setup-provision').hide();
|
|
$('#setup-activation').show();
|
|
$('#setup_product_id').val("");
|
|
if($("#setup-activation input.value").val()) {
|
|
pid = $("#setup-activation input.value").val();
|
|
price = $("#setup-activation input.value").data("price");
|
|
$("#setup_product_id").val(pid);
|
|
$("#price_setup").val(price);
|
|
}
|
|
$("#setup-provision select").val("0");
|
|
}
|
|
});
|
|
|
|
|
|
<?php if($preorder->adb_hausnummer_id): ?>
|
|
console.log("Hausnummer");
|
|
$('#adb_hausnummer_id').trigger("change");
|
|
// afterHausnummerChange() will be called by change event
|
|
<?php endif; ?>
|
|
});
|
|
|
|
|
|
|
|
function afterHausnummerChange() {
|
|
<?php if($preorder->adb_wohneinheit_id): ?>
|
|
console.log("selecting wohneinheit");
|
|
$('#adb_wohneinheit_id option[value=<?=$preorder->adb_wohneinheit_id?>]').prop("selected", true);
|
|
$('#adb_wohneinheit_id').trigger("change");
|
|
<?php endif; ?>
|
|
}
|
|
|
|
function updateSetupProduct(type) {
|
|
if(type == "provision") {
|
|
$('#setup_product_id').val($("#setup-provision select").val());
|
|
var price = $("#setup-provision select option:selected").data("price");
|
|
$("#price_setup").val(price);
|
|
} else if(type == "activation") {
|
|
$('#setup_product_id').val($("#setup-activation select").val());
|
|
var price = $("#setup-activation select option:selected").data("price");
|
|
$("#price_setup").val(price);
|
|
} else {
|
|
$("#price_setup").val("");
|
|
}
|
|
}
|
|
|
|
|
|
function showPreorderForm() {
|
|
|
|
}
|
|
|
|
function showTerminationSearch() {
|
|
|
|
}
|
|
|
|
|
|
function updateProduct() {
|
|
var pid = $('#product_id').val();
|
|
if(!pid) {
|
|
return false;
|
|
}
|
|
|
|
$.get("<?=self::getUrl("Product", "Api")?>",
|
|
{
|
|
"do": "getProduct",
|
|
product_id: pid,
|
|
form_id: 0
|
|
},
|
|
function (success) {
|
|
//console.log(success);
|
|
p = success.result.product;
|
|
|
|
$('#billing_delay').val(p.billing_delay);
|
|
$('#billing_period').val(p.billing_period);
|
|
$('#price').val(p.price);
|
|
//$('#price_setup').val(p.price_setup);
|
|
$('#price_nne').val(p.price_nne);
|
|
$('#price_nbe').val(p.price_nbe);
|
|
},
|
|
'json');
|
|
|
|
}
|
|
|
|
function toggleNewAddress() {
|
|
$('#new-address').toggle();
|
|
$('#wohneinheit_row').toggle();
|
|
event.preventDefault();
|
|
}
|
|
</script>
|
|
|
|
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|