<!--
Copyright 2020 Netsyms Technologies.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->

<div class="page" data-name="machine">

    <div class="navbar">
        <div class="navbar-bg"></div>
        <div class="navbar-inner">
            <div class="left">
                <a href="#" class="link icon-only" onclick="router.navigate('/')">
                    <i class="icon icon-back"></i>
                </a>
            </div>
            <div class="title"><i class="{{icon}}"></i> {{type.label}} #{{machineid}}</div>
        </div>
    </div>

    {{#if editable}}
    <div class="fab fab-right-bottom" id="edit-fab">
        <a href="#" onclick="openMachineEditor('{{machineid}}');">
            <span class="material-icons">edit</span>
        </a>
    </div>
    {{/if}}

    <div class="page-content">
        <div class="card elevation-4">
            <div class="card-content">
                <div class="list">
                    <ul>
                        {{#each machineprops}}
                        {{#if value}}
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title" style="white-space: normal !important;">
                                        <div class="item-header"><i class="{{icon}}"></i> {{label}}</div>
                                        {{value}}
                                    </div>
                                </div>
                            </div>
                        </li>
                        {{/if}}
                        {{/each}}
                    </ul>
                </div>
            </div>
        </div>

        {{#if clientinfo}}
        {{#with clientinfo}}
        <div class="card">
            <div class="card-header"><h4 class="no-margin"><i class="fas fa-user"></i> Client</h4></div>

            <div class="card-content">
                <div class="list">
                    <ul>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title">
                                        {{name}}
                                    </div>
                                </div>
                            </div>
                        </li>
                        {{#if phone}}
                        <li>
                            <a class="item-content item-link" href="tel:{{phonestripped}}">
                                <div class="item-inner">
                                    <div class="item-title">
                                        <div class="item-header">Phone</div>
                                        {{phone}}
                                    </div>
                                </div>
                            </a>
                        </li>
                        {{/if}}
                        {{#if billingaddress}}
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title">
                                        <div class="item-header">Billing Address</div>
                                        {{billingaddress}}
                                    </div>
                                </div>
                            </div>
                        </li>
                        {{/if}}
                        {{#if mailingaddress}}
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title">
                                        <div class="item-header">Mailing Address</div>
                                        {{mailingaddress}}
                                    </div>
                                </div>
                            </div>
                        </li>
                        {{/if}}
                    </ul>
                </div>
            </div>
        </div>
        {{/with}}
        {{/if}}
    </div>

    <script>
        var machineid = "{{machineid}}";
    </script>
</div>