<?php

use auctionforge\inc\abs\ImageModel;

$currencyPrice = \auctionforge\inc\helpers\BS_API::getSettingsValue('currency', '$');
?>
<div id="additional-info-block"></div>
<script type="text/template" id="car-info-template">
    <table class="btc-table">
        <tbody>
            <% if (info.carType) { %>
            <tr>
                <th><?= __('Car type', 'auctionforge') ?></th>
                <td><%= info.carType %></td>
            </tr>
            <% } %>
            <% if (info.model) { %>
            <tr>
                <th><?= __('Model', 'auctionforge') ?></th>
                <td><%= info.model %></td>
            </tr>
            <% } %>
            <% if (info.manufacturer) { %>
            <tr>
                <th><?= __('Manufacturer', 'auctionforge') ?></th>
                <td><%= info.manufacturer %></td>
            </tr>
            <% } %>
            <% if (info.modelYear) { %>
            <tr>
                <th><?= __('Model year', 'auctionforge') ?></th>
                <td><%= info.modelYear %></td>
            </tr>
            <% } %>
            <% if (info.carNumber) { %>
            <tr>
                <th><?= __('Car number', 'auctionforge') ?></th>
                <td><%= info.carNumber %></td>
            </tr>
            <% } %>
            <% if (info.mileage) { %>
            <tr>
                <th><?= __('Mileage', 'auctionforge') ?></th>
                <td><%= new Intl.NumberFormat(data.lang).format(info.mileage) %> Km</td>
            </tr>
            <% } %>
            <% if (info.gear) { %>
            <tr>
                <th><?= __('Gear', 'auctionforge') ?></th>
                <td><%= info.gear %></td>
            </tr>
            <% } %>
            <% if (info.hand) { %>
            <tr>
                <th><?= __('Hand', 'auctionforge') ?></th>
                <td><%= info.hand %></td>
            </tr>
            <% } %>
            <% if (info.engine) { %>
            <tr>
                <th><?= __('Engine', 'auctionforge') ?></th>
                <td><%= info.engine %></td>
            </tr>
            <% } %>
            <% if (info.color) { %>
            <tr>
                <th><?= __('Color', 'auctionforge') ?></th>
                <td><%= info.color %></td>
            </tr>
            <% } %>
            <% if (info.location) { %>
            <tr>
                <th><?= __('Location', 'auctionforge') ?></th>
                <td><%= info.location %></td>
            </tr>
            <% } %>

            <% if (info.dateOnRoad) { %>
            <tr>
                <th><?= __('Date on road', 'auctionforge') ?></th>
                <td><%= info.dateOnRoad %></td>
            </tr>
            <% } %>
            <% if (info.additions) { %>
            <tr>
                <th><?= __('Additions', 'auctionforge') ?></th>
                <td><%= info.additions %></td>
            </tr>
            <% } %>
            <% if (info.ownership) { %>
            <tr>
                <th><?= __('Current owner', 'auctionforge') ?></th>
                <td><%= info.ownership %></td>
            </tr>
            <% } %>
            <% if (info.previousOwnership) { %>
            <tr>
                <th><?= __('Previous ownership', 'auctionforge') ?></th>
                <td><%= info.previousOwnership %></td>
            </tr>
            <% } %>
            <% if (info.hasKeys) { %>
            <tr>
                <th><?= __('Key', 'auctionforge') ?></th>
                <td><%= info.hasKeys %></td>
            </tr>
            <% } %>
            <% if (info.horsePower) { %>
            <tr>
                <th><?= __('Horse power', 'auctionforge') ?></th>
                <td><%= info.horsePower %></td>
            </tr>
            <% } %>
            <% if (info.engineVolumeCc) { %>
            <tr>
                <th><?= __('Engine volume', 'auctionforge') ?></th>
                <td><%= info.engineVolumeCc %>&nbsp;Cc</td>
            </tr>
            <% } %>
            <% if (info.finish) { %>
            <tr>
                <th><?= __('Finish', 'auctionforge') ?></th>
                <td><%= info.finish %></td>
            </tr>
            <% } %>
            <% if (info.drive) { %>
            <tr>
                <th><?= __('Drive', 'auctionforge') ?></th>
                <td><%= info.drive %></td>
            </tr>
            <% } %>
            <% if (info.tariffPrice) { %>
            <tr>
                <th><?= __('Tariff price', 'auctionforge') ?></th>
                <td><%= formattedPrice(info.tariffPrice, '<?= $currencyPrice ?>') %></td>
            </tr>
            <% } %>
            <% if (info.country) { %>
            <tr>
                <th><?= __('Country', 'auctionforge') ?></th>
                <td><%= info.country %></td>
            </tr>
            <% } %>
            <% if (info.vehicleClass) { %>
            <tr>
                <th><?= __('vehicleClass', 'auctionforge') ?></th>
                <td><%= info.vehicleClass %></td>
            </tr>
            <% } %>
            <% if (info.doors) { %>
            <tr>
                <th><?= __('Doors', 'auctionforge') ?></th>
                <td><%= info.doors %></td>
            </tr>
            <% } %>
            <% if (info.wheel) { %>
            <tr>
                <th><?= __('Wheel', 'auctionforge') ?></th>
                <td><%= info.wheel %></td>
            </tr>
            <% } %>
            <% if (info.certificate) { %>
            <tr>
                <th><?= __('Certificate', 'auctionforge') ?></th>
                <td><%= info.certificate %></td>
            </tr>
            <% } %>
            <% if (info.customs) { %>
            <tr>
                <th><?= __('Customs', 'auctionforge') ?></th>
                <td><%= info.customs %></td>
            </tr>
            <% } %>
            <% if (info.vin) { %>
            <tr>
                <th><?= __('vin', 'auctionforge') ?></th>
                <td><%= info.vin %></td>
            </tr>
            <% } %>
            <% if (info.importantNote) { %>
            <tr>
                <th><?= __('Important note', 'auctionforge') ?></th>
                <td><%= info.importantNote %></td>
            </tr>
            <% } %>
            <% if (info.debtorName) { %>
            <tr>
                <th><?= __('Debtor name', 'auctionforge') ?></th>
                <td><%= info.debtorName %></td>
            </tr>
            <% } %>
            <% if (info.overview) { %>
            <tr>
                <th><?= __('Overview', 'auctionforge') ?></th>
                <td><%= info.overview %></td>
            </tr>
            <% } %>
            <% if (info.notes) { %>
            <tr>
                <th><?= __('Notes', 'auctionforge') ?></th>
                <td><%= info.notes %></td>
            </tr>
            <% } %>
        </tbody>
    </table>
    <%
    var imageHost = "<?= ImageModel::IMAGE_HOST ?>";
    if (data.imagesCloned) {
        imageHost = "<?= ImageModel::IMAGE_HOST_CLONED ?>";
    }
    %>
    <% _.forEach(info, function(item, index) { %>
        <% if (index == 'documents') { %>
            <p><?= __("Documents", "auctionforge") ?></p>
            <table class="btc-table">
                <tbody>
                <% for (const [key, value] of Object.entries(item)) { %>
                    <% if (value !== "") { %>
                        <tr>
                            <th><%= key %></th>
                            <td><a target="_blank" href="<%= imageHost + value %>"><?= __("Download", "auctionforge") ?></a></td>
                        </tr>
                    <% } %>
                <% } %>
                </tbody>
        <% } %>
    <% }) %>
</script>
<script type="text/template" id="apartment-info-template">
    <table class="btc-table">
        <tbody>
        <% if (info.city) { %>
        <tr>
            <th><?= __('City', 'auctionforge') ?></th>
            <td><%= info.city %></td>
        </tr>
        <% } %>
        <% if (info.address) { %>
        <tr>
            <th><?= __('Address', 'auctionforge') ?></th>
            <td><%= info.address %></td>
        </tr>
        <% } %>
        <% if (info.appraiserEstimate) { %>
        <tr>
            <th><?= __('Appraiser estimate', 'auctionforge') ?></th>
            <td><%= info.appraiserEstimate.toLocaleString() %>Kz</td>
        </tr>
        <% } %>
        <% if (info.minBidPrice) { %>
        <tr>
            <th><?= __('minBidPrice', 'auctionforge') ?></th>
            <td><%= info.minBidPrice.toLocaleString() %>Kz</td>
        </tr>
        <% } %>
        <% if (info.airCondition) { %>
        <tr>
            <th><?= __('airCondition', 'auctionforge') ?></th>
            <td><%= info.airCondition %></td>
        </tr>
        <% } %>
        <% if (info.block) { %>
        <tr>
            <th><?= __('block', 'auctionforge') ?></th>
            <td><%= info.block %></td>
        </tr>
        <% } %>
        <% if (info.disabledAccess) { %>
        <tr>
            <th><?= __('disabledAccess', 'auctionforge') ?></th>
            <td><%= info.disabledAccess %></td>
        </tr>
        <% } %>
        <% if (info.elevator) { %>
        <tr>
            <th><?= __('elevator', 'auctionforge') ?></th>
            <td><%= info.elevator %></td>
        </tr>
        <% } %>
        <% if (info.grate) { %>
        <tr>
            <th><?= __('grate', 'auctionforge') ?></th>
            <td><%= info.grate %></td>
        </tr>
        <% } %>
        <% if (info.latestDateForBidsHour) { %>
        <tr>
            <th><?= __('latestDateForBidsHour', 'auctionforge') ?></th>
            <td><%= info.latestDateForBidsHour %></td>
        </tr>
        <% } %>
        <% if (info.mamad) { %>
        <tr>
            <th><?= __('mamad', 'auctionforge') ?></th>
            <td><%= info.mamad %></td>
        </tr>
        <% } %>
        <% if (info.neighborhood) { %>
        <tr>
            <th><?= __('neighborhood', 'auctionforge') ?></th>
            <td><%= info.neighborhood %></td>
        </tr>
        <% } %>
        <% if (info.notes) { %>
        <tr>
            <th><?= __('notes', 'auctionforge') ?></th>
            <td><%= info.notes %></td>
        </tr>
        <% } %>

        <% if (info.parking) { %>
        <tr>
            <th><?= __('parking', 'auctionforge') ?></th>
            <td><%= info.parking %></td>
        </tr>
        <% } %>
        <% if (info.plot) { %>
        <tr>
            <th><?= __('plot', 'auctionforge') ?></th>
            <td><%= info.plot %></td>
        </tr>
        <% } %>
        <% if (info.plotField) { %>
        <tr>
            <th><?= __('plotField', 'auctionforge') ?></th>
            <td><%= info.plotField %></td>
        </tr>
        <% } %>
        <% if (info.propertyCondition) { %>
        <tr>
            <th><?= __('propertyCondition', 'auctionforge') ?></th>
            <td><%= info.propertyCondition %></td>
        </tr>
        <% } %>
        <% if (info.propertyType) { %>
        <tr>
            <th><?= __('propertyType', 'auctionforge') ?></th>
            <td><%= info.propertyType %></td>
        </tr>
        <% } %>
        <% if (info.rooms) { %>
        <tr>
            <th><?= __('rooms', 'auctionforge') ?></th>
            <td><%= info.rooms %></td>
        </tr>
        <% } %>
        <% if (info.storeroom) { %>
        <tr>
            <th><?= __('storeroom', 'auctionforge') ?></th>
            <td><%= info.storeroom %></td>
        </tr>
        <% } %>
        <% if (info.subPlot) { %>
        <tr>
            <th><?= __('subPlot', 'auctionforge') ?></th>
            <td><%= info.subPlot %></td>
        </tr>
        <% } %>
        <% if (info.size) { %>
        <tr>
            <th><?= __('size', 'auctionforge') ?></th>
            <td><%= info.size %>㎡</td>
        </tr>
        <% } %>
        </tbody>
    </table>
    <% console.log(data) %>
    <% _.forEach(info, function(item, index) { %>
        <% console.log(item, index) %>
    <% }) %>
</script>
<script type="text/template" id="industrial-info-template">
    <table class="btc-table">
        <tbody>
        <% if (data.name) { %>
        <tr>
            <th><?= __('Machine name', 'auctionforge') ?></th>
            <td><%= data.name %></td>
        </tr>
        <% } %>
        <% if (info.manufacturer) { %>
        <tr>
            <th><?= __('Manufacturer', 'auctionforge') ?></th>
            <td><%= info.manufacturer %></td>
        </tr>
        <% } %>
        <% if (info.model) { %>
        <tr>
            <th><?= __('Model', 'auctionforge') ?></th>
            <td><%= info.model %></td>
        </tr>
        <% } %>
        <% if (info.machineSerialNumber) { %>
        <tr>
            <th><?= __('Machine Serial Number', 'auctionforge') ?></th>
            <td><%= info.machineSerialNumber %></td>
        </tr>
        <% } %>
        <% if (info.machineIdentifyingCode) { %>
        <tr>
            <th><?= __('Machine Identifying Code', 'auctionforge') ?></th>
            <td><%= info.machineIdentifyingCode %></td>
        </tr>
        <% } %>
        <% if (info.engine) { %>
        <tr>
            <th><?= __('Engine', 'auctionforge') ?></th>
            <td><%= info.engine %></td>
        </tr>
        <% } %>
        <% if (info.volume) { %>
        <tr>
            <th><?= __('Volume', 'auctionforge') ?></th>
            <td><%= info.volume %></td>
        </tr>
        <% } %>
        <% if (info.volumeUnit) { %>
        <tr>
            <th><?= __('Volume Unit', 'auctionforge') ?></th>
            <td><%= info.volumeUnit %></td>
        </tr>
        <% } %>
        <% if (info.size) { %>
        <tr>
            <th><?= __('Size', 'auctionforge') ?></th>
            <td><%= info.size %></td>
        </tr>
        <% } %>
        <% if (info.diameter) { %>
        <tr>
            <th><?= __('Diameter', 'auctionforge') ?></th>
            <td><%= info.diameter %></td>
        </tr>
        <% } %>
        <% if (info.diameterUnit) { %>
        <tr>
            <th><?= __('DiameterUnit', 'auctionforge') ?></th>
            <td><%= info.diameterUnit %></td>
        </tr>
        <% } %>
        <% if (info.location) { %>
        <tr>
            <th><?= __('Location', 'auctionforge') ?></th>
            <td><%= info.location %></td>
        </tr>
        <% } %>
        <% if (info.notes) { %>
        <tr>
            <th><?= __('Notes', 'auctionforge') ?></th>
            <td><%= info.notes %></td>
        </tr>
        <% } %>
        <% if (info.additionalInfo) { %>
        <tr>
            <th><?= __('Additional Info', 'auctionforge') ?></th>
            <td><%= info.additionalInfo %></td>
        </tr>
        <% } %>
        </tbody>
    </table>
    <% console.log(data) %>
    <% _.forEach(info, function(item, index) { %>
    <% console.log(item, index) %>
    <% }) %>
</script>