Added Productattrib type salespartner

This commit is contained in:
Frank Schubert
2024-01-30 15:18:30 +01:00
parent 9b694ed1e9
commit 9feb1c5fdf
5 changed files with 58 additions and 3 deletions

View File

@@ -222,7 +222,16 @@
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="attributes_<?=$attrib->producttechattribute_id?>"><?=$attrib->displayname?></label>
<div class="col-lg-10">
<input type="text" class="form-control" name="attributes[<?=$attrib->producttechattribute_id?>]" id="attributes_<?=$attrib->producttechattribute_id?>" value="<?=$attrib->value?>" />
<?php if($attrib->type == "salespartner"): ?>
<select class="form-control select2" name="attributes[<?=$attrib->producttechattribute_id?>]" id="attributes_<?=$attrib->producttechattribute_id?>">
<option value=""></option>
<?php foreach(AddressModel::search(["addresstype" => ["salespartner"]]) as $address): ?>
<option value="<?=$address->id?>" <?=($attrib->value && $address->id == $attrib->value) ? "selected='selected'" : ""?>><?=$address->getCompanyOrName()?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<input type="text" class="form-control" name="attributes[<?=$attrib->producttechattribute_id?>]" id="attributes_<?=$attrib->producttechattribute_id?>" value="<?=$attrib->value?>" />
<?php endif; ?>
<?php if($attrib->description): ?>
<small><?=$attrib->description?></small>
<?php endif; ?>
@@ -263,6 +272,10 @@
<script type="text/javascript">
$(".select2").select2({
allowClear: true,
placeholder: ""
});
$("#productgroup_id").select2({
allowClear: true,
placeholder: ""