Added Setup products to Preorder
This commit is contained in:
@@ -138,25 +138,46 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="setup_product_id" id="setup_product_id" value="<?=$preorder->setup_product_id?>" />
|
||||
|
||||
<?php if(is_array($campaign->setup_products) && count($campaign->setup_products)): ?>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="setup_product_id">Anschlussprodukt (Herstellung) *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="hidden" name="setup_product_id" value="<?=$preorder->setup_product_id?>" />
|
||||
<input type="text" id="setup_product_id_text" class="form-control <?=(count($campaign->setup_products) == 1) ? "hidden" : "" ?>" value="<?=(count($campaign->setup_products)) ? $campaign->setup_products[0]->name : ""?>" readonly="readonly" />
|
||||
|
||||
<select class="form-control <?=(count($setup_products) < 2) ? "hidden" : "" ?>" id="setup_product_id_select" onchange="updateSetupProduct()">
|
||||
<option value=""></option>
|
||||
<?php foreach($setup_products as $sp): ?>
|
||||
<option value="<?=$sp->id?>" <?=($sp->product_id == $sp->id) ? "selected='selected'" : ""?>><?=$sp->name?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?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?>" <?=($sp->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]?>" 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?>" <?=($sp->product_id == $sp->id) ? "selected='selected'" : ""?>><?=$sp->name?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="product_id">Produkt *</label>
|
||||
<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>
|
||||
@@ -296,6 +317,13 @@
|
||||
$('#building-search-selected').hide();
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($preorder->type != "provision"): ?>
|
||||
$('#setup-provision').hide();
|
||||
<?php endif; ?>
|
||||
<?php if($preorder->type != "order"): ?>
|
||||
$('#setup-activation').hide();
|
||||
<?php endif; ?>
|
||||
|
||||
$("#product_id").select2({
|
||||
allowClear: true,
|
||||
placeholder: ""
|
||||
@@ -348,9 +376,55 @@
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#type').change(function() {
|
||||
var type = $('#type').val();
|
||||
var pid = 0;
|
||||
var price = 0;
|
||||
|
||||
if(type == "interest") {
|
||||
$('#setup-provision').hide();
|
||||
$('#setup-activation').hide();
|
||||
$('#setup_product_id').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");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
function listSearchresults(data) {
|
||||
resetSearchresults();
|
||||
var count = data.buildings.length;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<th>Typ</th>
|
||||
<th>Kunde</th>
|
||||
<th>Adresse</th>
|
||||
<th>Partner ID</th>
|
||||
<th>Partner</th>
|
||||
<th>Anschluss</th>
|
||||
<th>Erstellt</th>
|
||||
<th>Zuletzt bearbeitet</th>
|
||||
|
||||
Reference in New Issue
Block a user