Added admin tool for ivt product import

This commit is contained in:
Frank Schubert
2023-05-05 13:53:30 +02:00
parent 8214acd3e9
commit 93727c3bf9
4 changed files with 104 additions and 20 deletions
@@ -1,3 +1,8 @@
<?php
$pagination_baseurl = $this->getUrl($Mod,"ivtImportMatchProducts");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "IVT Products";
?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<!-- start page title -->
@@ -19,33 +24,50 @@
<div class="row">
<div class="col-12">
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<table class="table table-sm table-striped table-hover">
<tr>
<th class="text-right">IVT Produkt</th>
<th>Preis</th>
<th>Interval</th>
<th>Typ</th>
<th></th>
<th style="border-left: 1px solid #000">thetool Produkt</th>
<th>ivt_id hinterlegt</th>
</tr>
<?php foreach($ivtproducts as $ip): ?>
<tr>
<td class="text-right"><?=$ip->name?></td>
<td><?=$ip->price?></td>
<td><?=$ip->interval?></td>
<td><?=$ip->typ?></td>
<td style="border-left: 1px solid #000">
<select class="form-control" name="product[<?=$ip->id?>]" id="product_<?=$ip->id?>">
<option></option>
</select>
</td>
</tr>
<?php $match = false; ?>
<tr>
<td class="text-right"><?=$ip->name?></td>
<td><?=$ip->price?></td>
<td><?=$ip->interval?></td>
<td><?=$ip->typ?></td>
<td><?=$ip->id?></td>
<td style="border-left: 1px solid #000">
<select class="form-control" name="product[<?=$ip->id?>]" id="product_<?=$ip->id?>">
<option></option>
<?php foreach($products as $p): ?>
<?php if($p->ivt_id == $ip->id) $match = "prod"; ?>
<option value="<?=$p->id?>" <?=($p->ivt_id == $ip->id) ? "selected='selected'" : ""?>><?=$p->name?></option>
<?php endforeach; ?>
</select>
</td>
<td><?=($match == "prod") ? "<i class='fas fa-check text-success'></i>" : ""?></td>
</tr>
<?php endforeach; ?>
</table>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
</div>
</div>
<script type="text/javascript">
<?php
/*
var products = [
<?php foreach(ProductModel::getActive() as $product): ?>
{id: <?=$product->id?>, name: '<?=$product->name?>'},
@@ -58,6 +80,9 @@
});
$("select[name^=product").append(new_options);
*/
?>
$("select[name^=product").select2({placeholder: ""});
</script>