<?php
//print_r($_POST);
//$filter = ['id' => $_GET['econid']];
//print_r($user);
if (isset($_GET['id'])) {
    $data = ['id' => $_GET['id']];
    $product = $auth->getApiDataFilter("get/product", $data);
    $product = $product[0];
}
//print_r($product);
//$partners = $auth->getApiDataFilter("get/machine/full", $filter);
?>
<div class="col-lg-12 col-sm-12">
    <div class="card">
        <div class="card-header">
            <h4>Új Termék</h4>
        </div>
        <div class="card-body">
            <div class="form-group row">
                <div class="col-lg-4 div-sm-6">
                    <h5>Termék neve</h5>
                </div>
                <div class="col-lg-8 div-sm-6">
                    <?php echo (isset($product->productName)) ? $product->productName : ''; ?>
                </div>
            </div>
            <div class="form-group row">
                <div class="col-lg-4 div-sm-6">
                    <h5>Cikkszám</h5>
                </div>
                <div class="col-lg-8 div-sm-6">
                    <?php echo (isset($product->id)) ? $product->id : ''; ?>
                </div>
            </div>
            <div class="form-group row">
                <div class="col-lg-4 div-sm-6">
                    <h5>Termék leírás</h5>
                </div>
                <div class="col-lg-8 div-sm-6">
                    <?php echo (isset($product->productDescription)) ? $product->productDescription : ''; ?>
                </div>
            </div>
            <div class="form-group row">
                <div class="col-lg-4 div-sm-6">
                    <h5>Termékcsoportok</h5>
                </div>
                <div class="col-lg-8 div-sm-6">
                    <?php
                    $categories = $auth->getApiData("get/productcategory");
                    foreach ($categories as $category) :
                        echo (isset($product->productCategory) && $product->productCategory == $category->id) ? $category->productCategoryName : '';
                    ?>
                    <?php
                    endforeach;
                    ?>
                </div>
            </div>
            <div class="form-group row">
                <div class="col-lg-4 div-sm-6">
                    <h5>Ár</h5>
                </div>
                <div class="col-lg-8 div-sm-6">
                    <?php echo (isset($product->productPrice)) ? $product->productPrice : ''; ?> Ft
                </div>
            </div>
            <div class="form-group row">
                <div class="col-lg-4 div-sm-6">
                    <h5>Mennyiség</h5>
                </div>
                <div class="col-lg-8 div-sm-6">
                    <?php echo (isset($product->productQuantity)) ? $product->productQuantity : ''; ?> <?php echo (isset($product->productUnit)) ? getUnits($product->productUnit) : ''; ?>
                </div>
            </div>
            <div class="form-group row">
                <div class="col-lg-4 div-sm-6">
                    <h5>Típus növényvédőszer</h5>
                </div>
                <div class="col-lg-8 div-sm-6">
                    <?php echo (isset($product->productType)) ? $product->productType : ''; ?>
                </div>
            </div>
            <div class="form-group row">
                <div class="col-lg-4 div-sm-6">
                    <h5>Jutlék KATA</h5>
                </div>
                <div class="col-lg-8 div-sm-6">
                    <?php echo (isset($product->productComissionKata)) ? $product->productComissionKata : '0'; ?> Ft
                </div>
            </div>
            <div class="form-group row">
                <div class="col-lg-4 div-sm-6">
                    <h5>Jutlék Normál</h5>
                </div>
                <div class="col-lg-8 div-sm-6">
                    <?php echo (isset($product->productComission)) ? $product->productComission : '0'; ?> Ft
                </div>
            </div>
        </div>
    </div>
</div>