Products in Order Form now dynamic
This commit is contained in:
@@ -408,7 +408,7 @@
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="card-body" id="products-form">
|
||||
<h4>Produkte</h4>
|
||||
|
||||
<div class="row col-12 mt-2 mb-2">
|
||||
@@ -416,6 +416,7 @@
|
||||
</div>
|
||||
<div></div>
|
||||
|
||||
<?php $i = 1; ?>
|
||||
<?php if(is_array($order->products) && count($order->products)): ?>
|
||||
<?php foreach($order->products as $product): ?>
|
||||
<?php
|
||||
@@ -424,22 +425,25 @@
|
||||
if($product->product->external == 1) {
|
||||
$includes_external_product = true;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<div class="row product-container" id="position-<?=$product->id?>">
|
||||
<input type="hidden" name="products[<?=$product->id?>][delete]" id="products-<?=$product->id?>-delete" value="0" />
|
||||
<div class="col-md-1 product-<?=$product->id?>">
|
||||
<div class="row product-container" id="position-<?=$i?>">
|
||||
<input type="hidden" name="products[<?=$i?>][delete]" id="products-<?=$i?>-delete" value="0" />
|
||||
<input type="hidden" name="products[<?=$i?>][orderproduct_id]" value="<?=$product->id?>" />
|
||||
<div class="col-md-1 product-<?=$i?>">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<!-- pos number -->
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="pos-<?=$product->id?>">Position</label>
|
||||
<input type="number" class="form-control" name="products[<?=$product->id?>][pos]" id="pos-<?=$product->id?>" value="<?=$product->pos?>" placeholder="Position" />
|
||||
<label class="form-label" for="pos-<?=$i?>">Position</label>
|
||||
<input type="number" class="form-control" name="products[<?=$i?>][pos]" id="pos-<?=$i?>" value="<?=$i?>" placeholder="Position" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12 delete-button-container">
|
||||
<i class="btn btn-outline-danger fas fa-trash-can pointer" style="font-size: 1.5em" onclick="toggleDeletePos(<?=$product->id?>)"></i>
|
||||
<i class="btn btn-outline-danger fas fa-trash-can pointer" style="font-size: 1.5em" onclick="toggleDeletePos(<?=$i?>)"></i>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -451,8 +455,8 @@
|
||||
<div class="row">
|
||||
<!-- line 1 -->
|
||||
<div class="col-4">
|
||||
<label class="form-label" for="product_id-<?=$product->id?>">Produkt</label>
|
||||
<select name="products[<?=$product->id?>][product_id]" id="product_id-<?=$product->id?>" class="form-control" onchange="updateProduct(<?=$product->id?>)">
|
||||
<label class="form-label" for="product_id-<?=$i?>">Produkt</label>
|
||||
<select name="products[<?=$i?>][product_id]" id="product_id-<?=$i?>" class="form-control select2" onchange="updateProduct(<?=$i?>)">
|
||||
<option></option>
|
||||
<?php foreach($products as $p): ?>
|
||||
<option value="<?=$p->id?>" <?=($p->id == $product->product_id) ? "selected='selected'" : ""?>><?=$p->name?></option>
|
||||
@@ -461,23 +465,23 @@
|
||||
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="amount-<?=$product->id?>">Anzahl/Menge</label>
|
||||
<input type="number" class="form-control" name="products[<?=$product->id?>][amount]" id="amount-<?=$product->id?>" value="<?=($product) ? $product->formatAmount() : ""?>" placeholder="Anzahl/Menge" />
|
||||
<label class="form-label" for="amount-<?=$i?>">Anzahl/Menge</label>
|
||||
<input type="number" class="form-control" name="products[<?=$i?>][amount]" id="amount-<?=$i?>" value="<?=($product) ? $product->formatAmount() : ""?>" placeholder="Anzahl/Menge" />
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="billing_period-<?=$product->id?>">Verrechungsperiode</label>
|
||||
<select class="form-control" name="products[<?=$product->id?>][billing_period]" id="billing_period-<?=$product->id?>" placeholder="Verrechnungsperiode">
|
||||
<label class="form-label" for="billing_period-<?=$i?>">Verrechungsperiode</label>
|
||||
<select class="form-control" name="products[<?=$i?>][billing_period]" id="billing_period-<?=$i?>" placeholder="Verrechnungsperiode">
|
||||
<option value="1" <?=($product->billing_period == 1) ? "selected='selected'" : ""?>>Monatlich</option>
|
||||
<option value="12" <?=($product->billing_period == 12) ? "selected='selected'" : ""?>>Jährlich</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="price-<?=$product->id?>">Preis p. Periode</label>
|
||||
<input type="text" class="form-control" name="products[<?=$product->id?>][price]" id="price-<?=$product->id?>" value="<?=$this::dotToComma($product->price)?>" placeholder="Preis p. Periode" />
|
||||
<label class="form-label" for="price-<?=$i?>">Preis p. Periode</label>
|
||||
<input type="text" class="form-control" name="products[<?=$i?>][price]" id="price-<?=$i?>" value="<?=$this::dotToComma($product->price)?>" placeholder="Preis p. Periode" />
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="price_setup-<?=$product->id?>">Preis Setup</label>
|
||||
<input type="text" class="form-control" name="products[<?=$product->id?>][price_setup]" id="price_setup-<?=$product->id?>" value="<?=$this::dotToComma($product->price_setup)?>" placeholder="Preis Setup" />
|
||||
<label class="form-label" for="price_setup-<?=$i?>">Preis Setup</label>
|
||||
<input type="text" class="form-control" name="products[<?=$i?>][price_setup]" id="price_setup-<?=$i?>" value="<?=$this::dotToComma($product->price_setup)?>" placeholder="Preis Setup" />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -489,14 +493,14 @@
|
||||
&& $product->product->attributes[TT_ATTRIB_TERMINATION_REQUIRED_NAME]->value == 1)
|
||||
|| $product->termination_id
|
||||
): ?>
|
||||
<div class="row mt-1 mb-2" id="termination_id-<?=$product->id?>-line">
|
||||
<div class="row mt-1 mb-2" id="termination_id-<?=$i?>-line">
|
||||
<?php else: ?>
|
||||
<div class="row mt-1 mb-2 hidden" id="termination_id-<?=$product->id?>-line">
|
||||
<div class="row mt-1 mb-2 hidden" id="termination_id-<?=$i?>-line">
|
||||
<?php endif; ?>
|
||||
<!-- line to choose termination -->
|
||||
<div class="col-12">
|
||||
<label class="form-label" for="termination_id-<?=$product->id?>">Anschluss</label>
|
||||
<select name="products[<?=$product->id?>][termination_id]" id="termination_id-<?=$product->id?>" class="form-control select2">
|
||||
<label class="form-label" for="termination_id-<?=$i?>">Anschluss</label>
|
||||
<select name="products[<?=$i?>][termination_id]" id="termination_id-<?=$i?>" class="form-control select2">
|
||||
<option></option>
|
||||
<?php foreach($terminations as $t): ?>
|
||||
<option value="<?=$t->id?>" <?=($t->id == $product->termination_id) ? "selected='selected'" : ""?>><?=$t->code?> - <?=$t->getAddress()?></option>
|
||||
@@ -510,35 +514,137 @@
|
||||
<div class="row mt-1 mb-2">
|
||||
<!-- line 2 -->
|
||||
<div class="col-8">
|
||||
<label class="form-label" for="description-<?=$product->id?>" >Zusatztext</label>
|
||||
<textarea class="form-control" name="products[<?=$product->id?>][description]" id="description-<?=$product->id?>" placeholder="Zusatztext"><?=$product->description?></textarea>
|
||||
<label class="form-label" for="description-<?=$i?>" >Zusatztext</label>
|
||||
<textarea class="form-control" name="products[<?=$i?>][description]" id="description-<?=$i?>" placeholder="Zusatztext"><?=$product->description?></textarea>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="billing_delay-<?=$product->id?>" >Verzögerter Verrechnungsstart</label>
|
||||
<input type="number" class="form-control" name="products[<?=$product->id?>][billing_delay]" id="billing_delay-<?=$product->id?>" value="<?=$product->billing_delay?>" placeholder="Freimonate" />
|
||||
<label class="form-label" for="billing_delay-<?=$i?>" >Verzögerter Verrechnungsstart</label>
|
||||
<input type="number" class="form-control" name="products[<?=$i?>][billing_delay]" id="billing_delay-<?=$i?>" value="<?=$product->billing_delay?>" placeholder="Freimonate" />
|
||||
<small>Max. 6 Monate</small>
|
||||
</div>
|
||||
<?php if($me->is("Admin")): ?>
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="price_nne-<?=$product->id?>">Preis NNE</label>
|
||||
<input type="text" class="form-control" name="products[<?=$product->id?>][price_nne]" id="price_nne-<?=$product->id?>" value="<?=$this::dotToComma($product->price_nne)?>" placeholder="NNE" />
|
||||
<label class="form-label" for="price_nne-<?=$i?>">Preis NNE</label>
|
||||
<input type="text" class="form-control" name="products[<?=$i?>][price_nne]" id="price_nne-<?=$i?>" value="<?=$this::dotToComma($product->price_nne)?>" placeholder="NNE" />
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="price_nbe-<?=$product->id?>">Preis NBE</label>
|
||||
<input type="text" class="form-control" name="products[<?=$product->id?>][price_nbe]" id="price_nne-<?=$product->id?>" value="<?=$this::dotToComma($product->price_nbe)?>" placeholder="NBE" />
|
||||
<label class="form-label" for="price_nbe-<?=$i?>">Preis NBE</label>
|
||||
<input type="text" class="form-control" name="products[<?=$i?>][price_nbe]" id="price_nne-<?=$i?>" value="<?=$this::dotToComma($product->price_nbe)?>" placeholder="NBE" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="row product-container">
|
||||
|
||||
<!-- New position -->
|
||||
<div class="row product-container" id="position-<?=$i?>">
|
||||
<div class="col-md-1 product-<?=$i?>">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<!-- pos number -->
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="pos-<?=$i?>">Position</label>
|
||||
<input type="number" class="form-control" name="products[<?=$i?>][pos]" id="pos-<?=$i?>" value="<?=$i?>" placeholder="Position" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12 delete-button-container">
|
||||
<i class="btn btn-outline-info fas fa-trash-can pointer" title="Inhalte löschen" style="font-size: 1.5em" onclick="clearNewPos(<?=$i?>)"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-11">
|
||||
<!-- product lines -->
|
||||
<div class="row">
|
||||
<!-- line 1 -->
|
||||
<div class="col-4">
|
||||
<label class="form-label" for="product_id-<?=$i?>">Produkt</label>
|
||||
<select name="products[<?=$i?>][product_id]" id="product_id-<?=$i?>" class="form-control select2" onchange="updateProduct(<?=$i?>)">
|
||||
<option></option>
|
||||
<?php foreach($products as $p): ?>
|
||||
<option value="<?=$p->id?>"><?=$p->name?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="amount-<?=$i?>">Anzahl/Menge</label>
|
||||
<input type="number" class="form-control" name="products[<?=$i?>][amount]" id="amount-<?=$i?>" value="" placeholder="Anzahl/Menge" />
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="billing_period-<?=$i?>">Verrechungsperiode</label>
|
||||
<select class="form-control" name="products[<?=$i?>][billing_period]" id="billing_period-<?=$i?>" placeholder="Verrechnungsperiode">
|
||||
<option value="1">Monatlich</option>
|
||||
<option value="12">Jährlich</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="price-<?=$i?>">Preis p. Periode</label>
|
||||
<input type="text" class="form-control" name="products[<?=$i?>][price]" id="price-<?=$i?>" value="" placeholder="Preis p. Periode" />
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="price_setup-<?=$i?>">Preis Setup</label>
|
||||
<input type="text" class="form-control" name="products[<?=$i?>][price_setup]" id="price_setup-<?=$i?>" value="" placeholder="Preis Setup" />
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row mt-1 mb-2 hidden" id="termination_id-<?=$i?>-line">
|
||||
<!-- line to choose termination -->
|
||||
<div class="col-12">
|
||||
<label class="form-label" for="termination_id-<?=$i?>">Anschluss</label>
|
||||
<select name="products[<?=$i?>][termination_id]" id="termination_id-<?=$i?>" class="form-control select2">
|
||||
<option></option>
|
||||
<?php foreach($terminations as $t): ?>
|
||||
<option value="<?=$t->id?>"><?=$t->code?> - <?=$t->getAddress()?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row mt-1 mb-2">
|
||||
<!-- line 2 -->
|
||||
<div class="col-8">
|
||||
<label class="form-label" for="description-<?=$i?>" >Zusatztext</label>
|
||||
<textarea class="form-control" name="products[<?=$i?>][description]" id="description-<?=$i?>" placeholder="Zusatztext"></textarea>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="billing_delay-<?=$i?>" >Verzögerter Verrechnungsstart</label>
|
||||
<input type="number" class="form-control" name="products[<?=$i?>][billing_delay]" id="billing_delay-<?=$i?>" value="" placeholder="Freimonate" />
|
||||
<small>Max. 6 Monate</small>
|
||||
</div>
|
||||
<?php if($me->is("Admin")): ?>
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="price_nne-<?=$i?>">Preis NNE</label>
|
||||
<input type="text" class="form-control" name="products[<?=$i?>][price_nne]" id="price_nne-<?=$i?>" value="" placeholder="NNE" />
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="price_nbe-<?=$i?>">Preis NBE</label>
|
||||
<input type="text" class="form-control" name="products[<?=$i?>][price_nbe]" id="price_nne-<?=$i?>" value="" placeholder="NBE" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!--<div class="row product-container" id="position-<?=$i?>">
|
||||
|
||||
<div class="col-md-1 product-new">
|
||||
<!-- pos number -->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="pos-new" >Position</label>
|
||||
<input type="number" class="form-control" name="products[new][pos]" id="pos-new" value="<?=$order->products['new']['pos']?>" placeholder="Position" />
|
||||
@@ -546,9 +652,9 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-11">
|
||||
<!-- product lines -->
|
||||
|
||||
<div class="row">
|
||||
<!-- line 1 -->
|
||||
|
||||
<div class="col-4">
|
||||
<label class="form-label" for="product_id-new">Produkt</label>
|
||||
<select name="products[new][product_id]" id="product_id-new" class="form-control" onchange="updateProduct('new')">
|
||||
@@ -584,7 +690,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row mt-1 mb-2 <?=($order->action != "Save") ? "hidden" : ""?>" id="termination_id-new-line">
|
||||
<!-- line to choose termination -->
|
||||
|
||||
<div class="col-12">
|
||||
<label class="form-label" for="termination_id-new">Anschluss</label>
|
||||
<select name="products[new][termination_id]" id="termination_id-new" class="form-control">
|
||||
@@ -597,7 +703,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row mt-1 mb-2">
|
||||
<!-- line 2 -->
|
||||
|
||||
<div class="col-8">
|
||||
<label class="form-label" for="description-new" >Zusatztext</label>
|
||||
<textarea class="form-control" name="products[new][description]" id="description-new" placeholder="Zusatztext"><?=$order->products['new']['description']?></textarea>
|
||||
@@ -623,7 +729,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -739,7 +845,8 @@
|
||||
<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>
|
||||
<button type="submit" name="return" value="form" class="btn btn-primary mr-1">Speichern</button>
|
||||
<button type="submit" name="return" value="index" class="btn btn-primary">Speichern und zur Übersicht</button>
|
||||
<span id="form-error" class="text-danger hidden">Bitte alle benötigten Felder ausfüllen!</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -758,10 +865,10 @@
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
/*$("#owner_id").select2({
|
||||
$(".select2").select2({
|
||||
allowClear: true,
|
||||
placeholder: ""
|
||||
});*/
|
||||
});
|
||||
/*$("#billingaddress_id").select2({
|
||||
allowClear: true,
|
||||
placeholder: ""
|
||||
@@ -1004,6 +1111,8 @@
|
||||
},
|
||||
'json');
|
||||
|
||||
addNewProductLine(Number(id) + 1);
|
||||
|
||||
}
|
||||
|
||||
/*********************
|
||||
@@ -1197,7 +1306,11 @@
|
||||
$("#files-table a.delete-button").removeAttr("href").removeAttr("onclick");
|
||||
$("#contract-readonly-notice").show();
|
||||
<?php endif; ?>
|
||||
});
|
||||
|
||||
$('.product-container input').each(function() {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function toggleDeletePos(id) {
|
||||
@@ -1230,6 +1343,130 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function addNewProductLine(i) {
|
||||
if(!i) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("new_line num " + i);
|
||||
|
||||
if($('#position-' + i).length) {
|
||||
console.log("gibts scho");
|
||||
return;
|
||||
}
|
||||
|
||||
var new_line = '<div class="row product-container" id="position-' + i +'"> \
|
||||
<div class="col-md-1 product-' + i +'"> \
|
||||
<div class="row"> \
|
||||
<div class="col-md-12"> \
|
||||
<div class="form-group"> \
|
||||
<label class="form-label" for="pos-' + i +'">Position</label> \
|
||||
<input type="number" class="form-control" name="products[' + i +'][pos]" id="pos-' + i +'" value="' + i +'" placeholder="Position" /> \
|
||||
</div> \
|
||||
</div> \
|
||||
</div> \
|
||||
<div class="row"> \
|
||||
<div class="col-md-12 delete-button-container"> \
|
||||
<i class="btn btn-outline-info fas fa-trash-can pointer" title="Inhalte löschen" style="font-size: 1.5em" onclick="clearNewPos(' + i +')"></i> \
|
||||
</div> \
|
||||
</div> \
|
||||
</div> \
|
||||
\
|
||||
<div class="col-md-11"> \
|
||||
<!-- product lines --> \
|
||||
<div class="row"> \
|
||||
<!-- line 1 --> \
|
||||
<div class="col-4"> \
|
||||
<label class="form-label" for="product_id-' + i +'">Produkt</label> \
|
||||
<select name="products[' + i +'][product_id]" id="product_id-' + i +'" class="form-control select2" onchange="updateProduct(' + i +')"> \
|
||||
<option></option>';
|
||||
<?php foreach($products as $p): ?>
|
||||
new_line += '<option value="<?=$p->id?>"><?=$p->name?></option>';
|
||||
<?php endforeach; ?>
|
||||
|
||||
new_line += '</select> \
|
||||
\
|
||||
</div> \
|
||||
<div class="col-2"> \
|
||||
<label class="form-label" for="amount-' + i +'">Anzahl/Menge</label> \
|
||||
<input type="number" class="form-control" name="products[' + i +'][amount]" id="amount-' + i +'" value="" placeholder="Anzahl/Menge" /> \
|
||||
</div> \
|
||||
<div class="col-2"> \
|
||||
<label class="form-label" for="billing_period-' + i +'">Verrechungsperiode</label> \
|
||||
<select class="form-control" name="products[' + i +'][billing_period]" id="billing_period-' + i +'" placeholder="Verrechnungsperiode"> \
|
||||
<option value="1">Monatlich</option> \
|
||||
<option value="12">Jährlich</option> \
|
||||
</select> \
|
||||
</div> \
|
||||
<div class="col-2"> \
|
||||
<label class="form-label" for="price-' + i +'">Preis p. Periode</label> \
|
||||
<input type="text" class="form-control" name="products[' + i +'][price]" id="price-' + i +'" value="" placeholder="Preis p. Periode" /> \
|
||||
</div> \
|
||||
<div class="col-2"> \
|
||||
<label class="form-label" for="price_setup-' + i +'">Preis Setup</label> \
|
||||
<input type="text" class="form-control" name="products[' + i +'][price_setup]" id="price_setup-' + i +'" value="" placeholder="Preis Setup" /> \
|
||||
</div> \
|
||||
</div> \
|
||||
\
|
||||
<div class="row mt-1 mb-2 hidden" id="termination_id-' + i +'-line"> \
|
||||
<!-- line to choose termination --> \
|
||||
<div class="col-12"> \
|
||||
<label class="form-label" for="termination_id-' + i +'">Anschluss</label> \
|
||||
<select name="products[' + i +'][termination_id]" id="termination_id-' + i +'" class="form-control select2"> \
|
||||
<option></option>';
|
||||
|
||||
<?php foreach($terminations as $t): ?>
|
||||
new_line += '<option value="<?=$t->id?>"><?=$t->code?> - <?=$t->getAddress(true)?></option>';
|
||||
<?php endforeach; ?>
|
||||
new_line += '</select> \
|
||||
</div> \
|
||||
</div> \
|
||||
\
|
||||
<div class="row mt-1 mb-2"> \
|
||||
<!-- line 2 --> \
|
||||
<div class="col-8"> \
|
||||
<label class="form-label" for="description-' + i +'" >Zusatztext</label> \
|
||||
<textarea class="form-control" name="products[' + i +'][description]" id="description-' + i +'" placeholder="Zusatztext"></textarea> \
|
||||
</div> \
|
||||
<div class="col-2"> \
|
||||
<label class="form-label" for="billing_delay-' + i +'" >Verzögerter Verrechnungsstart</label> \
|
||||
<input type="number" class="form-control" name="products[' + i +'][billing_delay]" id="billing_delay-' + i + '" value="" placeholder="Freimonate" /> \
|
||||
<small>Max. 6 Monate</small> \
|
||||
</div> \
|
||||
<?php if($me->is("Admin")): ?>
|
||||
<div class="col-1"> \
|
||||
<label class="form-label" for="price_nne-' + i +'">Preis NNE</label> \
|
||||
<input type="text" class="form-control" name="products[' + i +'][price_nne]" id="price_nne-' + i +'" value="" placeholder="NNE" /> \
|
||||
</div> \
|
||||
<div class="col-1"> \
|
||||
<label class="form-label" for="price_nbe-' + i +'">Preis NBE</label> \
|
||||
<input type="text" class="form-control" name="products[' + i +'][price_nbe]" id="price_nne-' + i +'" value="" placeholder="NBE" /> \
|
||||
</div> \
|
||||
<?php endif; ?>
|
||||
\
|
||||
</div> \
|
||||
</div> \
|
||||
</div> \
|
||||
';
|
||||
|
||||
$('#products-form').append(new_line);
|
||||
|
||||
$("#product_id-" + i).select2({
|
||||
allowClear: true,
|
||||
placeholder: ""
|
||||
});
|
||||
}
|
||||
|
||||
function clearNewPos(i) {
|
||||
if(!$('#position-' + i).length) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('#position-' + i).remove();
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
|
||||
@@ -277,6 +277,7 @@
|
||||
<li class="nav-item"><a class="nav-link" href="#order-detail-<?=$order->id?>-contact" data-toggle="tab" aria-expanded="false">Kontakt</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#order-detail-<?=$order->id?>-details" data-toggle="tab" aria-expanded="false">Details</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#order-detail-<?=$order->id?>-files" data-toggle="tab" aria-expanded="false">Dokumente</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#order-detail-<?=$order->id?>-technician" data-toggle="tab" aria-expanded="false">Technische Herstellung</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -538,6 +539,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="order-detail-<?=$order->id?>-technician" class="tab-pane">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-xl-8 col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -57,6 +57,13 @@
|
||||
<option value="true" <?=(isset($user) && $user->isAdmin() || $user->id == 1) ? "selected='selected'" : ""?>>Yes</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="technician">Techniker:</label>
|
||||
<select name="technician" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("Technician")) ? "selected='selected'" : ""?>>No</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("Technician")) ? "selected='selected'" : ""?>>Yes</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" id="password" name="password" class="form-control" value="" />
|
||||
|
||||
@@ -646,14 +646,17 @@ class OrderController extends mfBaseController {
|
||||
//var_dump($r->products);exit;
|
||||
// validate and add products
|
||||
if(is_array($r->products) && count($r->products)) {
|
||||
foreach($r->products as $product_id => $p) {
|
||||
//var_dump($p);
|
||||
if(!$product_id || !$p["product_id"]) {
|
||||
foreach($r->products as $pos => $p) {
|
||||
$orderproduct_id = $p["orderproduct_id"];
|
||||
|
||||
//var_dump($r);exit;
|
||||
//var_dump($pos, $p);exit;
|
||||
if(!$p["product_id"]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($p['delete'] == 1) {
|
||||
$product = new OrderProduct($product_id);
|
||||
$product = new OrderProduct($orderproduct_id);
|
||||
$product->delete();
|
||||
continue;
|
||||
}
|
||||
@@ -661,6 +664,7 @@ class OrderController extends mfBaseController {
|
||||
$prod = new Product($p['product_id']);
|
||||
if(!$prod->id) {
|
||||
$this->log->warn(__CLASS__."::save() Invalid product: ".$p['product_id']);
|
||||
continue;
|
||||
}
|
||||
|
||||
$product_data = [];
|
||||
@@ -706,10 +710,10 @@ class OrderController extends mfBaseController {
|
||||
}
|
||||
|
||||
|
||||
if($product_id == "new") {
|
||||
if(!$orderproduct_id) {
|
||||
$product = OrderProductModel::create($product_data);
|
||||
} else {
|
||||
$product = new OrderProduct($product_id);
|
||||
$product = new OrderProduct();
|
||||
$product->update($product_data);
|
||||
}
|
||||
|
||||
@@ -886,11 +890,18 @@ class OrderController extends mfBaseController {
|
||||
if($r->filter) {
|
||||
$query["filter"] = $r->filter;
|
||||
}
|
||||
if($r->return != "index") {
|
||||
$query['id'] = $new_id;
|
||||
}
|
||||
|
||||
$qs = http_build_query($query);
|
||||
|
||||
$this->layout()->setFlash("Bestellung erfolgreich gespeichert.", "success");
|
||||
$this->redirect("Order", "Index", $qs, "order=$new_id-details");
|
||||
if($r->return == "index") {
|
||||
$this->redirect("Order", "Index", $qs, "order=$new_id-details");
|
||||
} else {
|
||||
$this->redirect("Order", "edit", $qs, "order=$new_id-details");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -389,6 +389,7 @@ class OrderModel {
|
||||
$status_parts[] = "(Building.network_id = $net_id AND Terminationstatus.code >= ".TT_TERMSTATUS_CONNECTED.")";
|
||||
}
|
||||
if($filter['network_linked_status'][$net_id] == "building_connected") {
|
||||
// sometimes terminations are of higher status when buildings are not yet finished, so we get them as well
|
||||
$status_parts[] = "(Building.network_id = $net_id AND (Buildingstatus.code >= ".TT_BUILDINGSTATUS_CONNECTED." OR Terminationstatus.code >= ".TT_TERMSTATUS_ASSIGNED."))";
|
||||
}
|
||||
if($filter['network_linked_status'][$net_id] == "pipework_needed") {
|
||||
|
||||
@@ -133,6 +133,13 @@ class UserController extends mfBaseController {
|
||||
} else {
|
||||
$user->permissions->admin = "false";
|
||||
}
|
||||
|
||||
if($r->technician == "true") {
|
||||
$user->permissions->technician = "true";
|
||||
} else {
|
||||
$user->permissions->technician = "false";
|
||||
}
|
||||
|
||||
$user->permissions->save();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
class WorkerPermission extends mfBaseModel {
|
||||
public $isAdmin = false;
|
||||
public $isTicketadmin = false;
|
||||
public $isTechnician = false;
|
||||
|
||||
public function loadByUserId($userid) {
|
||||
$res = $this->db->select($this->table,"*","worker_id=$userid");
|
||||
@@ -25,6 +26,9 @@ class WorkerPermission extends mfBaseModel {
|
||||
if($this->ticketadmin == 'true') {
|
||||
$this->isTicketadmin = true;
|
||||
}
|
||||
if($this->technician == 'true') {
|
||||
$this->isTechnician = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user