Files
thetool/Layout/default/Admin/ivtimport_product_match.php
2023-10-03 20:02:13 +02:00

104 lines
4.0 KiB
PHP

<?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 -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);"><?=MFAPPNAME_SLUG?></a></li>
<li class="breadcrumb-item active"><a href="<?=self::getUrl("Admin")?>">Admin</a></li>
<li class="breadcrumb-item active">IVT Product Match</li>
</ol>
</div>
<h4 class="page-title">IVT Product Match</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<form method="post" action="<?=self::getUrl("Admin", "saveIvtImportMatchProducts")?>">
<input type="hidden" name="s" value="<?=$pagination['start']?>" />
<?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>IVT ID</th>
<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): ?>
<?php $match = false; ?>
<tr>
<td><?=$ip->id?></td>
<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($ip->match): ?>
<option value="<?=$p->id?>" <?=($p->id == $ip->match->product_id) ? "selected='selected'" : ""?>><?=$p->name?></option>
<?php else: ?>
<?php if($p->ivt_id == $ip->id) $match = "prod"; ?>
<option value="<?=$p->id?>" <?=($p->ivt_id == $ip->id) ? "selected='selected'" : ""?>><?=$p->name?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
</td>
<td><?=($match == "prod") ? "<i class='fas fa-check text-success'></i>" : ""?></td>
</tr>
<?php endforeach; ?>
</table>
<div class="text-right">
<button type="submit" class="btn btn-success">Speichern</button>
</div>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
</form>
</div>
</div>
<script type="text/javascript">
<?php
/*
var products = [
<?php foreach(ProductModel::getActive() as $product): ?>
{id: <?=$product->id?>, name: '<?=$product->name?>'},
<?php endforeach; ?>
];
var new_options = "";
products.forEach(function(product) {
new_options += '<option value=' + product.id + '>' + product.name +'</option>';
});
$("select[name^=product").append(new_options);
*/
?>
$("select[name^=product").select2({placeholder: ""});
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>