<!-- change password form -->
<script type="text/x-just" data-just="change_password_form">
    <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h4 class="modal-title">Change password</h4>
      </div>
      <!-- Основное содержимое модального окна -->
      <div class="modal-body">
                <label class="control-label">New password</label>
                <input type="password" class="form-control" placeholder="Enter new password" id="new_password" value="">
                <br>
                <label class="control-label">Confirm password</label>
                <input type="password" class="form-control" placeholder="Enter new password again" id="new_password_confirm" value="">
      </div>
      <!-- Футер модального окна -->
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
        <button type="button" class="btn btn-primary" onclick="pmUsers.changePassword(<%- item_id %>)">Save</button>
      </div>
    </div>
  </div>
</script>


<!-- Страница сущьности -->
<script type="text/x-just" data-just="profile_page">

    <!-- items_page -->
    <section class="content-header">
        <h1>
            <a href="<% if(pmObj.model.profile_page.back_link){ %><%- pmObj.model.profile_page.back_link.apply(pmObj, [item_id, opt]) %><% }else{ %><%- polemarch.opt.host %>/?<%- pmObj.model.name %><% } %>"
                onclick="return spajs.openURL(this.href);" class="btn btn-default" >
                <span class="glyphicon glyphicon-arrow-left"></span>
            </a>

            <span class="h1-header" ><%= pmObj.model.profile_page.title.apply(pmObj, [item_id, opt]) %></span>

        </h1>
        <ol class="breadcrumb">
            <li><a href="<%- polemarch.opt.host %>" onclick="return spajs.openURL(this.href);" ><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="<%- polemarch.opt.host %>/?<%- pmObj.model.name %>" onclick="return spajs.openURL(this.href);" ><%= pmObj.model.page_list.short_title %></a></li>
            <li class="active"><%= pmObj.model.profile_page.short_title.apply(pmObj, [item_id, opt]) %></li>
        </ol>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-lg-12">
                <% if(pmObj.model.profile_page.buttons){ %>
                    <% for(var i in  pmObj.model.profile_page.buttons){ %>
                        <% if(pmObj.model.profile_page.buttons[i].tpl){ %>
                            <%= pmObj.model.profile_page.buttons[i].tpl.apply(pmObj, [item_id, opt]) %>
                        <% }else{ %>
                            <a
                                class="top-line-btn <% if(typeof pmObj.model.profile_page.buttons[i].class == 'function'){ %>
                                            <%- pmObj.model.profile_page.buttons[i].class.apply(pmObj, [item_id, opt]) %>
                                       <% }else{ %>
                                            <%- pmObj.model.profile_page.buttons[i].class %>
                                       <% } %>"
                                href="<%- pmObj.model.profile_page.buttons[i].link.apply(pmObj, [item_id, opt]) %>"
                                title="<% if(typeof pmObj.model.profile_page.buttons[i].help == 'function'){ %>
                                            <%- pmObj.model.profile_page.buttons[i].help.apply(pmObj, [item_id, opt]) %>
                                       <% }else{ %>
                                            <%- pmObj.model.profile_page.buttons[i].help || '' %>
                                       <% } %>"
                                onclick="<%- pmObj.model.profile_page.buttons[i].function.apply(pmObj, [item_id, opt]) %>" >
                                    <% if(typeof pmObj.model.profile_page.buttons[i].title == 'function'){ %>
                                        <%= pmObj.model.profile_page.buttons[i].title.apply(pmObj, [item_id, opt]) %>
                                    <% }else{ %>
                                        <%= pmObj.model.profile_page.buttons[i].title %>
                                    <% } %>
                            </a>
                        <% } %>
                    <% } %>
                <% } %>
            </div>
        </div>
        <br>

        <div class="row">
            <section class="col-lg-12">
                <div class="box box-info collapsed-box">
                    <div class="box-header with-border">
                        User settings<br>
                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i> </button>
                        </div>
                    </div>
                    <div class="box-body">
                        <% for(var i in pmObj.model.profile_page.fileds){ %>
                            <div class="row">
                                <% for(var j in pmObj.model.profile_page.fileds[i]){ var filed = pmObj.model.profile_page.fileds[i][j]; %>
                                        <%= filed.filed.render(pmObj, filed, item_id, opt) %>
                                <% } %>
                            </div>
                        <% } %>
                    </div>
                    <div class="box-footer">
                        <div class="row">
                            <div class="form-group col-lg-1">
                                <span class="btn btn-primary" onclick="spajs.showLoader(pmUsers.updateItem(<%= item_id %>));  return false;">Save</span>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
            <% if(pmObj.model.profile_page.sections){ %>
                <% for(var i in pmObj.model.profile_page.sections){ %>
                    <%= pmObj.model.profile_page.sections[i].apply(pmObj, [pmObj.model.profile_page.sections[i], item_id, opt]) %>
                <% } %>
            <% } %>
        </div>
    </section>
    <!-- /items_page -->
</script>


<!-- Форма настройки отображения линий на графике -->
<script type="text/x-just" data-just="chart_line_settings">
    <section class="col-lg-12">
        <div class="box box-info collapsed-box">
            <div class="box-header with-border">
                Dashboard chart lines settings<br>
                <div class="box-tools pull-right">
                    <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i> </button>
                </div>
            </div>
            <div class="box-body">
                <table class="table table-bordered" id="chart_line_settings_table">
                    <tbody>
                        <tr>
                            <th>Name</th>
                            <th>Is active</th>
                        </tr>

                         <% for(var i in pmDashboard.model.ChartLineSettings) {
                            var chartLine = pmDashboard.model.ChartLineSettings[i]; %>
                            <tr rowname="<%= chartLine.name %>">
                                <% if(chartLine.title){ %>
                                    <td><%= chartLine.title %></td>
                                <% } %>
                                <td class="boolean-select" valuename="active">
                                <div class="form-control <% if(chartLine.active){ %> selected <% } %>" onclick="$(this).toggleClass('selected');" onselectstart="return false" onmousedown="return false" style="cursor: pointer;">
                                    <div class="ico-on fa fa-toggle-on"></div>
                                    <div class="ico-off fa  fa-toggle-off"></div>
                                 </div>
                                </td>
                            </tr>
                        <% } %>
                    </tbody>
                </table>
            </div>
            <div class="box-footer">
                <div class="row">
                    <div class="form-group col-lg-1">
                        <span class="btn btn-primary" onclick="spajs.showLoader(pmDashboard.saveChartLineSettingsFromProfile());  return false;">Save</span>
                    </div>
                </div>
            </div>
        </div>
    </section>
</script>