652 lines
32 KiB
PHP
652 lines
32 KiB
PHP
|
|
<div class="card">
|
|
|
|
<div class="card-body" id="preorder-<?=$preorder->id?>-body">
|
|
<div class="row justify-content-center mt-2">
|
|
<div class="col-12">
|
|
<ul class="nav nav-tabs order-tab">
|
|
<li class="nav-item"><a class="nav-link active" href="#preorder-detail-<?=$preorder->id?>-detail" data-toggle="tab" aria-expanded="false">Details</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-address" data-toggle="tab" aria-expanded="false">Adressdetails</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-rimo" data-toggle="tab" aria-expanded="false">RIMO</a></li>
|
|
<?php if($me->is("Admin") && $preorder->adb_hausnummer->borderpoint_lat && $preorder->adb_hausnummer->borderpoint_long): ?>
|
|
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-map" data-toggle="tab" aria-expanded="false" onclick="loadBorderpointMap(<?=$preorder->id?>)">Übergabepunkt</a></li>
|
|
<?php endif; ?>
|
|
</ul>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="tab-content pt-0">
|
|
<div id="preorder-detail-<?=$preorder->id?>-detail" class="tab-pane show active">
|
|
<div class="row justify-content-center">
|
|
<div class="col-12">
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="card-header bg-info text-white pl-2 pr-2 pt-1 pb-1">Details</div>
|
|
|
|
<div class="row">
|
|
<div class="col-8">
|
|
<div class="loader-big hidden" ><img src="<?=self::getResourcePath()?>assets/images/loader-big.gif" /></div>
|
|
<h3>Allgemein</h3>
|
|
<table class="table table-sm table-striped">
|
|
<tr>
|
|
<th>ID:</th>
|
|
<td class="text-monospace"><?=$preorder->id?></td>
|
|
</tr><tr>
|
|
<th>Bestellcode:</th>
|
|
<td class="text-monospace"><?=$preorder->ucode?></td>
|
|
</tr><th>Kampagne:</th>
|
|
<td><?=$preorder->campaign->name?></td>
|
|
</tr><tr>
|
|
<th>Status:</th>
|
|
<td class="text-monospace">
|
|
<span id="preorder-detail-status-<?=$preorder->id?>-text" data-status-id="<?=$preorder->status_id?>"><span id="preorder-detail-status-<?=$preorder->id?>-statustext"><?=$preorder->status->code?> - <?=$preorder->status->name?></span> <a href="#" onclick="return toggleStatusControl(<?=$preorder->id?>)"><i class="fas fa-fw fa-edit"></i></a></span>
|
|
<div class="input-group" id="preorder-detail-status-<?=$preorder->id?>-input" style="display:none">
|
|
<select class="form-control">
|
|
<?php foreach(PreorderstatusModel::getAll() as $status): ?>
|
|
<option value="<?=$status->id?>" <?=($preorder->status_id == $status->id) ? "selected='selected'" : ""?>><?=$status->code?> - <?=$status->name?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<div class="input-group-append">
|
|
<button type="button" class="btn btn-primary" title="Speichern" onclick="savePreorderStatusControl(<?=$preorder->id?>, 'email')"><i class="fas fa-check"></i></button>
|
|
<button type="button" class="btn btn-secondary" title="Abbrechen" onclick="toggleStatusControl(<?=$preorder->id?>, 'email')"><i class="fas fa-times"></i></button>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr><tr>
|
|
<th>OAID:</th>
|
|
<td class="text-monospace text-pink"><?=$preorder->oaid?></td>
|
|
</tr><tr>
|
|
<th>Bestelltyp:</th>
|
|
<td><?=__($preorder->type, "preorder")?></td>
|
|
</tr><tr>
|
|
<th>Anschlusstyp:</th>
|
|
<td><?=__($preorder->connection_type, "preorder")?></td>
|
|
</tr><tr>
|
|
<th>Ist Zusatzbestellung:</th>
|
|
<td><?=($preorder->is_additional_order) ? "Ja" : "Nein"?></td>
|
|
</tr><tr>
|
|
<th>Partner:</th>
|
|
<td><?=$preorder->partner->getCompanyOrName()?></td>
|
|
</tr><tr>
|
|
<th>Erstellt:</th>
|
|
<td class="text-monospace"><?=date("d.m.Y H:i",$preorder->create)?> (<?=$preorder->creator->name?>)</td>
|
|
</tr><tr>
|
|
<th>Zuletzt bearbeitet:</th>
|
|
<td class="text-monospace"><?=date("d.m.Y H:i",$preorder->edit)?> (<?=$preorder->editor->name?>)</td>
|
|
</tr>
|
|
|
|
</table>
|
|
</div>
|
|
<div class="col-4">
|
|
|
|
<div class="row">
|
|
<div class="col">
|
|
|
|
<h3>Zustimmungen</h3>
|
|
<table class="table table-sm table-striped">
|
|
<tr>
|
|
<th>Zustimmung AGB:</th>
|
|
<td><?=($preorder->accept_agb) ? '<i class="fas fa-fw fa-check text-success"></i>' : '<i class="fas fa-fw fa-xmark text-danger"></i>'?></td>
|
|
</tr><tr>
|
|
<th>Zustimmung DSGVO:</th>
|
|
<td><?=($preorder->accept_dsgvo) ? '<i class="fas fa-fw fa-check text-success"></i>' : '<i class="fas fa-fw fa-xmark text-danger"></i>'?></td>
|
|
</tr><tr>
|
|
<th>Zustimmung Rücktrittsrecht:</th>
|
|
<td><?=($preorder->accept_withdrawal) ? '<i class="fas fa-fw fa-check text-success"></i>' : '<i class="fas fa-fw fa-xmark text-danger"></i>'?></td>
|
|
</tr><tr>
|
|
<th>Zustimmung Datenweitergabe:</th>
|
|
<td><?=($preorder->accept_marketing) ? '<i class="fas fa-fw fa-check text-success"></i>' : '<i class="fas fa-fw fa-xmark text-danger"></i>'?></td>
|
|
</tr><tr>
|
|
<th>Zustimmung Grabungsarbeiten:</th>
|
|
<td><?=($preorder->accept_digging) ? '<i class="fas fa-fw fa-check text-success"></i>' : '<i class="fas fa-fw fa-xmark text-danger"></i>'?></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col">
|
|
|
|
<h3>Starterpaket</h3>
|
|
<table class="table table-sm table-striped">
|
|
<tr>
|
|
<th>CIF Token:</th>
|
|
<td class="text-monospace"><?=$preorder->ciftoken?></td>
|
|
</tr><tr>
|
|
<th>CIF Kabelnachbestell-Url:</th>
|
|
<td class="text-monospace"><?=$preorder->cifcableurl?></td>
|
|
</tr><tr>
|
|
<th>Starterpaket versandt:</th>
|
|
<td class="text-monospace"><?=($preorder->logistics && $preorder->logistics->sent) ? '<i class="fas fa-fw fa-check text-success"></i> '.date("d.m.Y H:i", $preorder->logistics->sent) : '<i class="fas fa-fw fa-xmark text-danger"></i>'?></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-6">
|
|
<h3>Bestelldaten</h3>
|
|
<table class="table table-sm table-striped">
|
|
<tr>
|
|
<th>Extref:</th>
|
|
<td class="text-monospace"><?=htmlentities($preorder->extref)?></td>
|
|
</tr><tr>
|
|
<th>Adressinfo:</th>
|
|
<td><?=nl2br(htmlentities($preorder->address_info))?></td>
|
|
</tr><tr>
|
|
<th>Versand an:</th>
|
|
<td><?=($preorder->address_info == "address") ? "Anschlussadresse" : "Kontaktadresse"?></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="col-6">
|
|
<?php if($preorder->ordered_services): ?>
|
|
<h3>Bestellte Zusatzdienste</h3>
|
|
<table class="table table-sm table-striped">
|
|
<tr>
|
|
<th>Dienst</th>
|
|
<th>Bestellt</th>
|
|
<th>Daten</th>
|
|
</tr>
|
|
<?php foreach($preorder->ordered_services as $service): ?>
|
|
<tr>
|
|
<td><?=$service->service?></td>
|
|
<td><?=($service->ordered == true || $service->ordered == 1) ? "Ja" : "Nein"?></td>
|
|
<td class="text-monospace">
|
|
<?php if($service->data): ?>
|
|
<?php foreach($service->data as $data): ?>
|
|
<?=$data->name?>: <?=$data->value?><br />
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="preorder-detail-<?=$preorder->id?>-address" class="tab-pane">
|
|
<div class="row justify-content-center">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
|
|
<div class="card-header bg-info text-white pl-2 pr-2 pt-1 pb-1">Addressdetails</div>
|
|
|
|
<div class="row">
|
|
<div class="col-6">
|
|
|
|
<h3>Anschlussadresse</h3>
|
|
<table class="table table-sm table-striped">
|
|
<tr>
|
|
<th>ID</th>
|
|
<td class="text-monospace"><?=$preorder->adb_hausnummer_id?></td>
|
|
</tr><tr>
|
|
<th>OAID</th>
|
|
<td class="text-monospace text-pink"><?=$preorder->adb_hausnummer->oaid?></td>
|
|
</tr><tr>
|
|
<th>Status</th>
|
|
<td id="preorder-detail-building-status-<?=$preorder->id?>" class="text-monospace"><?=$preorder->adb_hausnummer->status->code?> - <?=$preorder->adb_hausnummer->status->name?></td>
|
|
|
|
</tr><tr>
|
|
<th>Extref</th>
|
|
<td class="text-monospace"><?=$preorder->adb_hausnummer->extref?></td>
|
|
</tr><tr>
|
|
<th>Straße/Hausnummer</th>
|
|
<td><?=$preorder->adb_hausnummer->strasse->name?> <?=$preorder->adb_hausnummer->hausnummer?></td>
|
|
</tr><tr>
|
|
<th>PLZ Ort</th>
|
|
<td><?=$preorder->adb_hausnummer->plz->plz?> <?=$preorder->adb_hausnummer->ortschaft->name?></td>
|
|
</tr><tr>
|
|
<th>Gemeinde</th>
|
|
<td><?=$preorder->adb_hausnummer->strasse->gemeinde->name?></td>
|
|
</tr><tr>
|
|
<th>Anzahl Wohneinheiten</th>
|
|
<td><?=(is_array($preorder->adb_hausnummer->wohneinheiten) && count($preorder->adb_hausnummer->wohneinheiten)) ? count($preorder->adb_hausnummer->wohneinheiten) : "0"?></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<h3>Nutzungseinheit</h3>
|
|
<table class="table table-sm table-striped">
|
|
<tr>
|
|
<th>ID</th>
|
|
<td class="text-monospace"><?=($preorder->adb_wohneinheit_id) ? $preorder->adb_wohneinheit_id : ""?></td>
|
|
</tr><tr>
|
|
<th>Status</th>
|
|
<td id="preorder-detail-unit-status-<?=$preorder->id?>" class="text-monospace"><?=$preorder->adb_wohneinheit->status->code?> - <?=$preorder->adb_wohneinheit->status->name?></td>
|
|
</tr><tr>
|
|
<th>OAID</th>
|
|
<td class="text-monospace text-pink"><?=$preorder->adb_wohneinheit->oaid?></td>
|
|
</tr><tr>
|
|
<th>Extref</th>
|
|
<td class="text-monospace"><?=$preorder->adb_wohneinheit->extref?></td>
|
|
</tr><tr>
|
|
<th>Block</th>
|
|
<td><?=$preorder->adb_wohneinheit->block?></td>
|
|
</tr><tr>
|
|
<th>Stiege</th>
|
|
<td><?=$preorder->adb_wohneinheit->stiege?></td>
|
|
</tr><tr>
|
|
<th>Stock</th>
|
|
<td><?=$preorder->adb_wohneinheit->stock?></td>
|
|
</tr><tr>
|
|
<th>Tür</th>
|
|
<td><?=$preorder->adb_wohneinheit->tuer?></td>
|
|
</tr><tr>
|
|
<th>Zusatz</th>
|
|
<td><?=$preorder->adb_wohneinheit->zusatz?></td>
|
|
</tr><tr>
|
|
<th>Bezeichner</th>
|
|
<td><?=$preorder->adb_wohneinheit->bezeichner?></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="col-6">
|
|
<h3>Kontaktadresse</h3>
|
|
<table class="table table-sm table-striped">
|
|
<tr>
|
|
<th>Firma</th>
|
|
<td><?=$preorder->company?></td>
|
|
</tr><tr>
|
|
<th>UID</th>
|
|
<td><?=$preorder->uidy?></td>
|
|
</tr><tr>
|
|
<th>Vorname</th>
|
|
<td><?=$preorder->firstname?></td>
|
|
</tr><tr>
|
|
<th>Nachname</th>
|
|
<td><?=$preorder->lastname?></td>
|
|
</tr><tr>
|
|
<th>Straße</th>
|
|
<td>
|
|
<?=$preorder->street?> <?=$preorder->housenumber?>
|
|
<?=($preorder->block) ? "/".$preorder->block : ""?>
|
|
<?=($preorder->stiege) ? "/".$preorder->stiege : ""?>
|
|
<?=($preorder->stock) ? "/".$preorder->stock : ""?>
|
|
<?=($preorder->tuer) ? "/".$preorder->tuer : ""?>
|
|
</td>
|
|
</tr><tr>
|
|
<th>PLZ</th>
|
|
<td><?=$preorder->zip?></td>
|
|
</tr><tr>
|
|
<th>Ort</th>
|
|
<td><?=$preorder->city?></td>
|
|
</tr><tr>
|
|
<th>Telefon</th>
|
|
<td><?=$preorder->phone?></td>
|
|
</tr><tr>
|
|
<th>Email</th>
|
|
<td><?=$preorder->email?></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="preorder-detail-<?=$preorder->id?>-rimo" class="tab-pane">
|
|
<div class="row justify-content-center">
|
|
<div class="col-12">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
|
<div class="card-header bg-info text-white pl-2 pr-2 pt-1 pb-1">RIMO</div>
|
|
|
|
<div class="row">
|
|
<div class="col-6">
|
|
<h3>Metadaten</h3>
|
|
<table class="table table-sm table-striped">
|
|
<tr>
|
|
<th>Building Name:</th>
|
|
<td class="text-monospace"><?=$preorder->adb_hausnummer->extref?>
|
|
</tr><tr>
|
|
<th>Building External ID:</th>
|
|
<td class="text-monospace"><?=$preorder->adb_hausnummer->rimo_id?>
|
|
</tr><tr>
|
|
<th>Home External ID:</th>
|
|
<td class="text-monospace"><?=$preorder->adb_wohneinheit->extref?>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="col-6">
|
|
<h3>FTU</h3>
|
|
<table class="table table-sm table-striped">
|
|
<tr>
|
|
<th>FTU Name:</th>
|
|
<td class="text-monospace"><?=$preorder->adb_wohneinheit->ftu_data["name"]?>
|
|
</tr><tr>
|
|
<th>FTU External ID:</th>
|
|
<td class="text-monospace"><?=$preorder->adb_wohneinheit->ftu_data["id"]?>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="row">
|
|
|
|
<div class="col-6">
|
|
<h3>Workorder</h3>
|
|
<?php if(is_object($preorder->adb_wohneinheit->rimo_workorder) && $preorder->adb_wohneinheit->rimo_workorder->id): ?>
|
|
<small id="preorder-detail-<?=$preorder->id?>-workorder-del"><a href="#" onclick="if(confirm('Achtung: Löscht die Workorder in thetool, aber NICHT in RIMO!')) return deleteWorkorder(<?=$preorder->id?>)" class="text-danger"><i class="far fa-times-circle"></i> Workorder löschen</a></small>
|
|
<table class="table table-sm table-striped" id="preorder-detail-<?=$preorder->id?>-workorder">
|
|
<tr>
|
|
<th>Name</th>
|
|
<td class="text-monospace"><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_name?></td>
|
|
</tr><tr>
|
|
<th>External ID</th>
|
|
<td class="text-monospace"><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_id?></td>
|
|
</tr><tr>
|
|
<th>Status</th>
|
|
<td><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_status?></td>
|
|
</tr><tr>
|
|
<th>Erstellt</th>
|
|
<td class="text-monospace"><?=(is_object($preorder->adb_wohneinheit->rimo_workorder)) ? date("d.m.Y H:i:s", $preorder->adb_wohneinheit->rimo_workorder->create) : ""?></td>
|
|
</tr>
|
|
</table>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-6">
|
|
<h3>
|
|
Patchposition
|
|
<?php if($preorder->adb_wohneinheit_id): ?>
|
|
<small id="preorder-detail-<?=$preorder->id?>-patchposition-edit"><a href="#" onclick="togglePortdata(<?=$preorder->id?>); return false;"><i class="fas fa-pencil"></i> Bearbeiten</a></small>
|
|
<span id="preorder-detail-<?=$preorder->id?>-patchposition-controls" class="hidden">
|
|
<button type="button" class="btn btn-sm btn-primary" onclick="savePortdata(<?=$preorder->id?>)"><i class="fas fa-check"></i></button>
|
|
<button type="button" class="btn btn-sm btn-secondary" onclick="togglePortdata(<?=$preorder->id?>)"><i class="fas fa-times"></i></button>
|
|
</span>
|
|
<?php endif; ?>
|
|
</h3>
|
|
<table class="table table-sm table-striped" id="preorder-detail-<?=$preorder->id?>-patchposition">
|
|
<tr>
|
|
<th>Equipment Name:</th>
|
|
<td>
|
|
<span id="preorder-detail-<?=$preorder->id?>-patchposition-string"><?=$preorder->adb_wohneinheit->getPatchEqString()?></span>
|
|
<table class="row hidden" id="preorder-detail-<?=$preorder->id?>-patchposition-data-form">
|
|
<tr>
|
|
<th>Cluster:</td>
|
|
<td><input type="text" class="form-control" name="patch_cluster"
|
|
data-default="<?=($preorder->adb_wohneinheit->patch_cluster) ? $preorder->adb_wohneinheit->patch_cluster : $preorder->adb_hausnummer->netzgebiet->extref?>"
|
|
/></td>
|
|
</tr><tr>
|
|
<th>Shelf:</td>
|
|
<td><input type="text" class="form-control" name="patch_shelf"
|
|
data-default="<?=$preorder->adb_wohneinheit->patch_shelf?>"
|
|
/></td>
|
|
</tr><tr>
|
|
<th>Module:</td>
|
|
<td><input type="text" class="form-control" name="patch_module"
|
|
data-default="<?=$preorder->adb_wohneinheit->patch_module?>"
|
|
/></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Equipment Port:</th>
|
|
<td>
|
|
<span id="preorder-detail-<?=$preorder->id?>-patchposition-port"><?=$preorder->adb_wohneinheit->patch_port?></span>
|
|
<table class="row hidden" id="preorder-detail-<?=$preorder->id?>-patchposition-port-form">
|
|
<tr>
|
|
<th>Port:</td>
|
|
<td><input type="text" class="form-control" name="patch_port" data-default="<?=$preorder->adb_wohneinheit->patch_port?>" /></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if($me->is("Admin")): ?>
|
|
<div
|
|
id="preorder-detail-<?=$preorder->id?>-map"
|
|
class="tab-pane"
|
|
data-lat="<?=$preorder->adb_hausnummer->borderpoint_lat?>"
|
|
data-long="<?=$preorder->adb_hausnummer->borderpoint_long?>"
|
|
data-blat="<?=$preorder->adb_hausnummer->gps_lat?>"
|
|
data-blong="<?=$preorder->adb_hausnummer->gps_long?>"
|
|
data-trench="<?=$preorder->adb_hausnummer->trenches?>"
|
|
data-home-trench="<?=$preorder->adb_hausnummer->home_trench?>"
|
|
>
|
|
<div class="row justify-content-center">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
|
|
<div class="row" id="map-row">
|
|
<div id="preorder-map-<?=$preorder->id?>" style="height:50vh; width: 100%"></div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
function togglePortdata(pid) {
|
|
$("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_cluster']").val($("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_cluster']").data("default"));
|
|
$("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_shelf']").val($("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_shelf']").data("default"));
|
|
$("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_module']").val($("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_module']").data("default"));
|
|
|
|
$("#preorder-detail-" + pid + "-patchposition-port-form input[name='patch_port']").val($("#preorder-detail-" + pid + "-patchposition-port-form input[name='patch_port']").data("default"));
|
|
|
|
|
|
$("#preorder-detail-" + pid + "-patchposition-data-form").toggle();
|
|
$("#preorder-detail-" + pid + "-patchposition-string").toggle();
|
|
|
|
$("#preorder-detail-" + pid + "-patchposition-port-form").toggle();
|
|
$("#preorder-detail-" + pid + "-patchposition-port").toggle();
|
|
|
|
$("#preorder-detail-" + pid + "-patchposition-edit").toggle();
|
|
$("#preorder-detail-" + pid + "-patchposition-controls").toggle();
|
|
|
|
}
|
|
|
|
function savePortdata(pid) {
|
|
if(!pid) return;
|
|
|
|
var cluster = $("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_cluster']").val();
|
|
var shelf = $("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_shelf']").val();
|
|
var module = $("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_module']").val();
|
|
var port = $("#preorder-detail-" + pid + "-patchposition-port-form input[name='patch_port']").val();
|
|
|
|
$.post("<?=self::getUrl("Preorder", "Api")?>", {
|
|
do: "savePatchposition",
|
|
id: pid,
|
|
cluster: cluster,
|
|
shelf: shelf,
|
|
module: module,
|
|
port: port
|
|
},
|
|
(success) => {
|
|
if(success.status == "OK") {
|
|
var pid = success.result.id;
|
|
var default_cluster = $("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_cluster']").data("default");
|
|
var cluster = $("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_cluster']").val();
|
|
var shelf = $("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_shelf']").val();
|
|
var module = $("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_module']").val();
|
|
var port = $("#preorder-detail-" + pid + "-patchposition-port-form input[name='patch_port']").val();
|
|
|
|
if(!cluster) cluster = default_cluster;
|
|
|
|
$("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_cluster']").data("default", cluster);
|
|
$("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_shelf']").data("default", shelf);
|
|
$("#preorder-detail-" + pid + "-patchposition-data-form input[name='patch_module']").data("default", module);
|
|
$("#preorder-detail-" + pid + "-patchposition-port-form input[name='patch_port']").data("default", port);
|
|
$("#preorder-detail-" + pid + "-patchposition-string").text(cluster + "-" + shelf + "-" + module);
|
|
$("#preorder-detail-" + pid + "-patchposition-port").text(port);
|
|
togglePortdata(pid);
|
|
|
|
}
|
|
},
|
|
"json"
|
|
);
|
|
}
|
|
|
|
function toggleStatusControl(pid, sid) {
|
|
// set select to current status id
|
|
$("#preorder-detail-status-" + pid + "-input select").val($("#preorder-detail-status-" + pid + "-text").data("status-id"));
|
|
|
|
// toggle controls
|
|
$("#preorder-detail-status-" + pid + "-text").toggle();
|
|
$("#preorder-detail-status-" + pid + "-input").toggle();
|
|
|
|
return false;
|
|
}
|
|
|
|
function savePreorderStatusControl(pid) {
|
|
if(!Number.isInteger(pid) || pid < 1) {
|
|
return false;
|
|
}
|
|
|
|
var value = $("#preorder-detail-status-" + pid + "-input select").val();
|
|
|
|
//console.log("add opacity-5 to ")
|
|
$("#preorder-" + pid + "-body").addClass("opacity-5");
|
|
$("#preorder-" + pid + "-body .loader-big").show();
|
|
|
|
// reset loading overlay if request times out
|
|
setTimeout(() => {
|
|
$("#preorder-" + pid + "-body").removeClass("opacity-5");
|
|
$("#preorder-" + pid + "-body .loader-big").hide();
|
|
}, 5000);
|
|
|
|
$.post("<?=self::getUrl("Preorder","Api")?>",
|
|
{
|
|
'do': "updateStatus",
|
|
id: pid,
|
|
status_id: value
|
|
},
|
|
function(success) {
|
|
if(success.status == "OK") {
|
|
var updates = success.result.updates;
|
|
//console.log(updates);
|
|
|
|
updates.forEach(function(u) {
|
|
//console.log(u);
|
|
// update detail status text
|
|
$("#preorder-detail-status-" + u.id + "-statustext").text(u.code + " - " + u.text);
|
|
$("#preorder-detail-status-" + u.id + "-text").addClass("text-success");
|
|
setTimeout(() => { $("#preorder-detail-status-" + u.id + "-text").removeClass("text-success") }, 1500);
|
|
|
|
// update list status text
|
|
$("#preorder-" + u.id + " .status").text(u.code + " - " + u.text);
|
|
$("#preorder-" + u.id + " .status").addClass("text-success");
|
|
setTimeout(() => { $("#preorder-" + u.id + " .status").removeClass("text-success") }, 1500);
|
|
|
|
// update status id data attribute
|
|
$("#preorder-detail-status-" + u.id + "-text").data("status-id", u.sid);
|
|
|
|
if(u.bcode) {
|
|
$("#preorder-detail-building-status-" + u.id).text(u.bcode + " - " + u.btext);
|
|
}
|
|
if(u.ucode) {
|
|
$("#preorder-detail-unit-status-" + u.id).text(u.ucode + " - " + u.utext);
|
|
}
|
|
});
|
|
/*
|
|
if("preorder" in update) {
|
|
// update detail status text
|
|
$("#preorder-detail-status-" + pid + "-statustext").text(update.preorder.status.code + " - " + update.preorder.status.text);
|
|
$("#preorder-detail-status-" + pid + "-text").addClass("text-success");
|
|
setTimeout(() => { $("#preorder-detail-status-" + pid + "-text").removeClass("text-success") }, 1500);
|
|
|
|
// update list status text
|
|
$("#preorder-" + pid + " .status").text(update.preorder.status.code + " - " + update.preorder.status.text);
|
|
$("#preorder-" + pid + " .status").addClass("text-success");
|
|
setTimeout(() => { $("#preorder-" + pid + " .status").removeClass("text-success") }, 1500);
|
|
|
|
// update status id data attribute
|
|
$("#preorder-detail-status-" + pid + "-text").data("status-id", update.preorder.status.id);
|
|
}
|
|
|
|
if("building" in update) {
|
|
// update building status text
|
|
$("#preorder-detail-building-status-" + pid).text(update.building.status.code + " - " + update.building.status.text);
|
|
}
|
|
if("unit" in update) {
|
|
// update unit status text
|
|
$("#preorder-detail-unit-status-" + pid).text(update.unit.status.code + " - " + update.unit.status.text);
|
|
}
|
|
*/
|
|
toggleStatusControl(pid);
|
|
|
|
}
|
|
|
|
$("#preorder-" + pid + "-body").removeClass("opacity-5");
|
|
$("#preorder-" + pid + "-body .loader-big").hide();
|
|
},
|
|
'json');
|
|
}
|
|
|
|
function deleteWorkorder(pid) {
|
|
console.log("in delete workorder");
|
|
if(!Number.isInteger(pid) || pid < 1) {
|
|
return false;
|
|
}
|
|
|
|
$.post("<?=self::getUrl("Preorder","Api")?>",
|
|
{
|
|
'do': "deleteWorkorder",
|
|
id: pid,
|
|
},
|
|
function(success) {
|
|
if(success.status == "OK") {
|
|
$("#preorder-detail-" + success.result.id + "-workorder td").each(function() {
|
|
$(this).html("<em class='text-monospace'>--gelöscht--</em>");
|
|
});
|
|
|
|
$("#preorder-detail-" + success.result.id + "-workorder-del").remove();
|
|
}
|
|
},
|
|
'json');
|
|
|
|
return false;
|
|
}
|
|
|
|
</script>
|