Added Productattrib type salespartner
This commit is contained in:
@@ -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: ""
|
||||
|
||||
@@ -75,12 +75,21 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="attributes_<?=$attribute->id?>_name">Name <small class="text-monospace">[a-z0-9._-]</small></label>
|
||||
<input type="text" class="form-control" id="attributes_<?=$attribute->id?>_name" name="attributes[<?=$attribute->id?>][name]" value="<?=$attribute->name?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-group">
|
||||
<label for="attributes_<?=$attribute->id?>_type">Typ</label>
|
||||
<select class="form-control" name="attributes[<?=$attribute->id?>][type]" id="attributes_<?=$attribute->id?>_type">
|
||||
<option value="text" <?=($attribute->type == "text") ? "selected='selected'" : ""?>>Text</option>
|
||||
<option value="salespartner" <?=($attribute->type == "salespartner") ? "selected='selected'" : ""?>>Vertriebspartner</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="attributes_<?=$attribute->id?>_displayname">Anzeigename</label>
|
||||
|
||||
@@ -34,6 +34,7 @@ class Product extends mfBaseModel {
|
||||
$attrib->note = $pta->note;
|
||||
}
|
||||
$attrib->name = $pta->name;
|
||||
$attrib->type = $pta->type;
|
||||
$attrib->displayname = $pta->displayname;
|
||||
$attrib->description = $pta->description;
|
||||
$this->attributes[$attrib->name] = $attrib;
|
||||
|
||||
@@ -84,10 +84,11 @@ class ProducttechController extends mfBaseController {
|
||||
if(!trim($attribute['name']) || !trim($attribute['displayname'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$a = [];
|
||||
$a['name'] = $attribute['name'];
|
||||
$a['producttech_id'] = $new_id;
|
||||
$a['type'] = $attribute['type'];
|
||||
$a['displayname'] = htmlentities($attribute['displayname']);
|
||||
$a['value'] = $attribute['value'];
|
||||
$a['description'] = htmlentities($attribute['description']);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class ProducttechAttributeAddType extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("ProducttechAttribute");
|
||||
$table->addColumn("type", "string", ["null" => false, "default" => "text", "limit" => 64, "after" => "name"]);
|
||||
$table->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("ProducttechAttribute")->removeColumn("type")->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user