Order: highlighting Vororttermin if order has VOT product

This commit is contained in:
Frank Schubert
2022-11-16 15:08:58 +01:00
parent 08b29a4e13
commit 9265161644
3 changed files with 46 additions and 4 deletions

View File

@@ -285,7 +285,19 @@
<td onclick="toggleOrder(<?=$order->id?>)" colspan="6" class="pt-0" style="border-top: none;">
<div class="row">
<div class="mr-4 order-date-pill <?=($order->shippingdate) ? "active" : ""?>">Versandtermin: <span class="text-monospace"><?=($order->shippingdate) ? "<span class='text-success'>".date("d.m.Y", $order->shippingdate)."</span>" : "--.--.----"?></span></div>
<div class="order-date-pill <?=($order->install_date) ? "active" : ""?>">Vorortinstallation: <span class="text-monospace"><?=($order->install_date) ? "<span class='text-success'>".date("d.m.Y",$order->install_date)."</span>" : "--.--.----"?></span></div>
<?php if($order->install_date): ?>
<div id="date-pill-<?=$order->id?>-install_date" class="order-date-pill active" id="order-install-date-<?=$order->id?>">
<span class='text-success'>Vorortinstallation: <?=date("d.m.Y",$order->install_date)?></span>
<div>
<?php elseif(count($order->install_products)): ?>
<div id="date-pill-<?=$order->id?>-install_date" class="order-date-pill active" id="order-install-date-<?=$order->id?>">
<span class='text-success'>Vorortinstallation: --.--.----</span>
</div>
<?php else: ?>
<div id="date-pill-<?=$order->id?>-install_date" class="order-date-pill" id="order-install-date-<?=$order->id?>">
<span>Vorortinstallation: --.--.----</span>
</div>
<?php endif; ?>
</div>
</td>
</tr>
@@ -625,7 +637,6 @@
</tr>
<?php $order_count = 0; ?>
<?php foreach($orders as $order): ?>
<?php //$this->log->debug("blah: ".print_r($order->terminations[0]->workflowitems["customer_setup_date"]->value,true)); ?>
<tr class="order-list-tr pb-0 <?=($order_count % 2 == 0) ? "table-bg-even" : ""?>" id="order-<?=$order->id?>">
<td>
<?=($order->customer_type == "business") ? "<i class='fas fa-buildings text-primary mr-1' title='Businessprodukt vorhanden'></i>" : "<i class='fas fa-user text-danger mr-1' title='Nur Residential Produkte'></i>"?>
@@ -731,7 +742,22 @@
<div class="mr-4 order-date-pill <?=(count($order->terminations) && $order->terminations[0]->workflowitems["backbone_setup_date"]->value->value_string) ? "active" : ""?>">Leitungsbau Backbone: <span class="text-monospace"><?=(count($order->terminations) && $order->terminations[0]->workflowitems["backbone_setup_date"]->value->value_string) ? "<span class='text-success'>".$order->terminations[0]->workflowitems["backbone_setup_date"]->value->value_string."</span>" : "--.--.----"?></span></div>
<div class="mr-4 order-date-pill <?=(count($order->terminations) && $order->terminations[0]->getWorkflowvalue("customer_setup_date")) ? "active" : ""?>">Leitungsbau Kunde: <span class="text-monospace"><?=(count($order->terminations) && $order->terminations[0]->getWorkflowvalue("customer_setup_date")) ? "<span class='text-success'>".$order->terminations[0]->getWorkflowvalue("customer_setup_date")."</span>" : "--.--.----"?></span></div>
<div class="mr-4 order-date-pill <?=($order->shippingdate) ? "active" : ""?>">Versandtermin: <span class="text-monospace"><?=($order->shippingdate) ? "<span class='text-success'>".date("d.m.Y", $order->shippingdate)."</span>" : "--.--.----"?></span></div>
<div id="date-pill-<?=$order->id?>-install_date" class="order-date-pill <?=($order->install_date) ? "active" : ""?>" id="order-install-date-<?=$order->id?>">Vorortinstallation: <span class="text-monospace"><?=($order->install_date) ? "<span class='text-success'>".date("d.m.Y",$order->install_date)."</span>" : "--.--.----"?></span></div>
<?php if($order->install_date): ?>
<div id="date-pill-<?=$order->id?>-install_date" class="order-date-pill active" id="order-install-date-<?=$order->id?>">
<span class='text-success'>Vorortinstallation: <?=date("d.m.Y",$order->install_date)?></span>
<div>
<?php elseif(count($order->install_products)): ?>
<div id="date-pill-<?=$order->id?>-install_date" class="order-date-pill active" id="order-install-date-<?=$order->id?>">
<span class='text-success'>Vorortinstallation: --.--.----</span>
</div>
<?php else: ?>
<div id="date-pill-<?=$order->id?>-install_date" class="order-date-pill" id="order-install-date-<?=$order->id?>">
<span>Vorortinstallation: --.--.----</span>
</div>
<?php endif; ?>
</div>
</td>
</tr>

View File

@@ -9,6 +9,7 @@ class Order extends mfBaseModel {
private $contracts;
private $terminations;
private $journals;
private $install_products;
private $files;
private $creator;
private $editor;
@@ -269,6 +270,21 @@ class Order extends mfBaseModel {
return $this->products;
}
if($name == "install_products") {
$this->install_products = [];
foreach($this->getProperty("products") as $orderproduct) {
$product = $orderproduct->product;
//$atrribs = $product->attributes;
//var_dump($attribs);exit;
if(is_array($product->attributes) && array_key_exists("vot", $product->attributes) && $product->attributes["vot"] == 1) {
$this->install_products[] = $product;
}
}
//var_dump($this->install_products);exit;
return $this->install_products;
}
if($name == "customer_type") {
$this->customer_type = "residential";
foreach($this->getProperty("products") as $order_product) {

View File

@@ -9,7 +9,7 @@ class Product extends mfBaseModel {
public function loadAttributes() {
if(!$this->producttech_id) {
return false;
return [];
}
$this->attributes = [];