<template name="projectDetail">
    <div class="col-sm-9">
        <div class="bootcards-cards entity-box project-border">
            <div class="entity-sub">
                <h3>{{name}}
                    {{#if isAutherOrGrantedRole 'admin'}}
                        <a href="{{pathFor 'projectEdit'}}" class="btn btn-info edit">
                            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit </a>
                    {{/if}}
                </h3>
            </div>
            <div class="entity-sub">
                <!--<a href="{{pathFor 'buyProject'}}" class="discuss btn btn-primary buy">Buy</a>-->

                <!--<h4>ID : {{_id}}</h4>-->

                <p>{{desc}}</p>

                {{#if show_chart}}
                    <p>Visualization : {{show_chart}}</p>
                {{/if}}

                <p>Author : {{ author_user_id}}</p>

                <p>Create at : {{ formatDate create_time}} , Update at : {{ formatDate last_update_time}}</p>
            </div>

            <div class="entity-box sub-border">
                <div class="col-sm-12 bootcards-cards">
                    <h4>Images
                        {{#if isAutherOrGrantedRole 'admin'}}
                            <a href="{{pathFor 'projectImagesSelect'}}" class="btn btn-info select">
                                <span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit </a>
                        {{/if}}
                    </h4>

                    {{#each img_ids}}
                        <div class="col-sm-4">
                            {{> thumbnail id=this}}
                        </div>
                    {{/each}}
                </div>
            </div>

            <!--<div class="entity-box sub-border">-->
            <!--<div class="col-sm-12 bootcards-cards">-->
            <!--<h4>Used Modules-->
                <!--{{#if isAutherOrGrantedRole 'admin'}}-->
            <!--<a href="{{pathFor 'projectModulesSelect'}}" class="btn btn-info select">-->
            <!--<span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit </a>-->
                <!--{{/if}}-->
            <!--</h4>-->
                <!--{{#each module_ids}}-->
            <!--{{> projectModule id=this}}-->
                <!--{{/each}}-->
            <!--</div>-->
            <!--</div>-->
            <!--<div class="entity-box sub-border">-->
            <!--<div class="col-sm-12 bootcards-cards">-->
            <!--<h4>Source Code-->
                <!--{{#if isAutherOrGrantedRole 'admin'}}-->
            <!--<a href="{{pathFor 'projectSourcesSelect'}}" class="btn btn-info select">-->
            <!--<span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit </a>-->
                <!--{{/if}}-->
            <!--</h4>-->
                <!--{{#each source_ids}}-->
            <!--{{> projectSource id=this}}-->
                <!--{{/each}}-->
            <!--</div>-->
            <!--</div>-->
            <div class="entity-box sub-border">
                <div class="col-sm-12 bootcards-cards">
                    <h4>Data Points
                        {{#if isAutherOrGrantedRole 'admin'}}
                            <a href="{{pathFor 'dataPointEdit'}}" class="btn btn-info create">
                                <span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit </a>
                        {{/if}}
                    </h4>

                    {{#if show_chart}}
                        <p><b>Data Chart : </b>{{ show_chart }}</p>
                    {{/if}}

                    {{#each data_points}}
                        {{> dataPoint}}
                    {{/each}}
                </div>
            </div>

            <div class="entity-box sub-border">
                <div class="col-sm-12 bootcards-cards">
                    <h4>Control Points
                        {{#if isAutherOrGrantedRole 'admin'}}
                            <a href="{{pathFor 'controlPointEdit'}}" class="btn btn-info select">
                                <span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit </a>
                        {{/if}}
                    </h4>

                    {{#each control_points}}
                        {{> controlPoint}}
                    {{/each}}
                </div>
            </div>

            {{#if isAutherOrGrantedRole 'admin'}}
                <a href="" class="btn btn-danger align-right remove">
                    <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Remove </a>
            {{/if}}
        </div>
    </div>

    <div class="col-sm-3 array-editor">
        {{#if currentUser}}
            <div class="entity-box device-border">
                <div class="entity-title">
                    <h3>My Devices</h3>
                </div>
                <div class="entity-sub">
                    <div>
                        {{#each myDevices}}
                            <div class="row">
                                {{> deviceSummarySimple}}
                            </div>
                        {{/each}}

                        {{#if Template.subscriptionsReady}}
                            {{#if hasMoreEntities}}
                                <div class="col-sm-12">
                                    <a class="load-more" href="#">Load More</a>
                                </div>
                            {{/if}}
                        {{else}}
                            <div class="col-sm-12">
                                <div class="loading">{{>spinner}}</div>
                            </div>
                        {{/if}}
                    </div>
                </div>
                <div class="col-sm-6 text-left">
                    <a href="{{pathFor 'devicesList'}}" class="btn btn-info align-right">
                        <span class="glyphicon glyphicon-ice-lolly-tasted" aria-hidden="true"></span> More... </a>
                </div>
                <div class="col-sm-6 text-right">
                    <a href="{{pathFor 'deviceSubmit'}}" class="btn btn-success assemble">
                        <span class="glyphicon glyphicon-ice-lolly-tasted" aria-hidden="true"></span> Made It </a>
                </div>
            </div>
        {{/if}}

        <div class="bootcards-cards entity-box device-border">
            <div class="entity-sub">
                <h3>Other's Devices</h3>

                {{#each publicDevices}}
                    <div class="col-sm-12">
                        {{> deviceSummarySimple}}
                    </div>
                {{/each}}
            </div>
            <div class="col-sm-6 text-left">
                <a href="{{pathFor 'devicesListPublic'}}" class="btn btn-info align-right">
                    <span class="glyphicon glyphicon-ice-lolly-tasted" aria-hidden="true"></span> All </a>
            </div>
            {{#if hasGPS}}
                <div class="col-sm-6 text-right">
                    <a href="{{pathFor 'projectDeviceMapMarkers'}}" class="btn btn-success">
                        <span class="glyphicon glyphicon-ice-lolly-tasted" aria-hidden="true"></span> Map </a>
                </div>
            {{/if}}
        </div>
    </div>
</template>
