Added stuff to order form

This commit is contained in:
Frank Schubert
2021-08-03 20:20:10 +02:00
parent 0a5e447587
commit 86b69bd7a0
6 changed files with 97 additions and 37 deletions

View File

@@ -260,6 +260,27 @@
<input type="text" class="form-control" name="order_date" id="order_date" value="<?=($order->order_date) ? date("d.m.Y", $order->order_date) : date("d.m.Y")?>" />
</div>
</div>
<div class="card">
<div class="card-body">
<h4 class="header-title">Verzögerte Herstellung</h4>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="finish_after">Herstellbar ab</label>
<div class="col-lg-4">
<input type="text" class="form-control" name="finish_after" id="finish_after" value="<?=($order->finish_after) ? date("d.m.Y", $order->finish_after) : ""?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="finish_after_comment">Verzögerungsgrund</label>
<div class="col-lg-4">
<textarea class="form-control" name="finish_after_comment" id="finish_after_comment" placeholder="Verzögerungsgrund"><?=$order->finish_after_comment?></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -377,8 +398,16 @@
</div>
<?php if(array_key_exists(TT_ATTRIB_TERMINATION_REQUIRED_NAME, $product->product->attributes) && $product->product->attributes[TT_ATTRIB_TERMINATION_REQUIRED_NAME] == 1): ?>
<div class="row mt-1 mb-2">
<?php if(
(is_array($product->product->attributes) && count($product->product->attributes))
&& (array_key_exists(TT_ATTRIB_TERMINATION_REQUIRED_NAME, $product->product->attributes)
&& $product->product->attributes[TT_ATTRIB_TERMINATION_REQUIRED_NAME] == 1)
|| $product->termination_id
): ?>
<div class="row mt-1 mb-2" id="termination_id-<?=$product->id?>-line">
<?php else: ?>
<div class="row mt-1 mb-2 hidden" id="termination_id-<?=$product->id?>-line">
<?php endif; ?>
<!-- line to choose termination -->
<div class="col-12">
<label class="form-label" for="termination_id-<?=$product->id?>">Anschluss</label>
@@ -390,7 +419,7 @@
</select>
</div>
</div>
<?php endif; ?>
<div class="row mt-1 mb-2">
@@ -401,7 +430,7 @@
</div>
<div class="col-2">
<label class="form-label" for="billing_delay-<?=$product->id?>" >Verzögerter Verrechnungsstart</label>
<input type="text" class="form-control" name="products[<?=$product->id?>][billing_delay]" id="billing_delay-<?=$product->id?>" value="" placeholder="(Monate)" />
<input type="text" class="form-control" name="products[<?=$product->id?>][billing_delay]" id="billing_delay-<?=$product->id?>" value="<?=$product->billing_delay?>" placeholder="Freimonate" />
</div>
</div>
@@ -477,7 +506,7 @@
<div class="col-2">
<label class="form-label" for="billing_delay-new" >Verzögerter Verrechnungsstart</label>
<input type="text" class="form-control" name="products[new][billing_delay]" id="billing_delay-new" value="" placeholder="(in Monaten)" />
<input type="text" class="form-control" name="products[new][billing_delay]" id="billing_delay-new" value="" placeholder="Freimonate" />
</div>
</div>
@@ -636,7 +665,15 @@
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
});
$('#finish_after').datepicker({
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
// disable mousewheel on input number field when in focus
@@ -668,17 +705,18 @@
$('#price_setup-' + id).val(p.price_setup);
console.log(p.attributes);
console.log("form_id: " + id);
if(typeof p.attributes === 'object' && "termination_required" in p.attributes && p.attributes.termination_required == 1) {
console.log("termination_required");
$('#termination_id-new-line').show();
console.log($('#termination_id-new').val());
$('#termination_id-new').select2({
$('#termination_id-' + id + '-line').show();
console.log($('#termination_id-' + id).val());
$('#termination_id-' + id).select2({
allowClear: true,
placeholder: ""
});
} else {
$('#termination_id-new-line').hide();
$('#termination_id-' + id + '-line').hide();
//$('#termination_id-' + id + '-line').hide();
}
},
'json');