{{#Page}}
<div class="firstAccess-settings-header">
    <div class="admin-nav"></div>
    <div class="admin-text"> {{i18n 'FirstAccess.administrativeInterface'}}</div>
    <div class="admin-username">
        <span id="settings-user-name">{{PreferredNameAdmin}}</span><span>|</span> <a href="#" id="logout">{{i18n 'adminsetting.logout'}}</a>
    </div>
</div>
<div class="container">
    <div id="main">
        <form id="settings-form" action="" class="form-horizontal">
            <div class="nav-wrapper">
                <div id="nav">
                    <nav class="navbar navbar-default">
                        <div class="tab-container">
                            <div class="container">
                                <!-- Tabs --> 
                                <div id="myScrollspy">
                                    <ul id="tab-area" class="nav navbar-nav">
                                        <li class="active"><a href="#enable-patientaccess" data-bypass >{{i18n 'adminglobal.enablepatientaccess'}}</a></li>   
                                        <li><a href="#session-timeout" data-bypass >{{i18n 'adminglobal.sessiontimeout'}}</a></li>
                                        <li><a href="#custom-report" data-bypass >{{i18n 'adminglobal.customreport'}}</a></li>                                                  
                                        <li><a href="#profile" data-bypass >{{i18n 'adminglobal.profiles'}}</a></li>     
                                        <li><a href="#admin-settings" data-bypass>{{i18n 'adminglobal.adminSettings'}}</a></li>     
                                    </ul>
                                    <ul class="nav navbar-nav navbar-right">
                                        <li class="discard" >
                                            <a id="discard-info" class="discard" href="#" data-bypass>{{i18n 'adminsetting.discardChanges'}}</a>
                                        </li>
                                        <li><button id="save-btn" type="submit" class="btn btn-warning btn-sm savebtn" data-loading-text="{{i18n 'adminsetting.saving'}}">{{i18n 'adminsetting.save'}}</button></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </nav>
                    <div class="alert alert-success alert-dismissable hidden">
                        <a href="#" class="close" data-dismiss="alert" data-bypass>&times;</a> <strong>Success!</strong>
                        {{i18n 'adminglobal.messagesent'}}
                    </div>
                </div>
            </div>
            <!-- Tab Panels -->
            <div class="tab-content">
                <div id="alert-wrapper" hidden>
                </div>
                <!-- Enable PatientAccess tab -->
                <div class="anchor-dummy" role="" id="enable-patientaccess">
                    <h1>
                        {{i18n 'adminglobal.enablepatientaccess'}} <small class="gray"><i>{{i18n 'adminglobal.optional'}}</i></small>
                    </h1>
                </div>
                <div class="form-group">
                    <label for="toggle-patientaccess" class="col-xs-3 col-sm-3 col-md-3 col-lg-3 control-label">
                        {{i18n 'adminglobal.enablepatientaccess'}}
                    </label>
                    <div class="col-xs-4">
                        <input id="toggle-patientaccess" name="toggle-patientaccess" type="checkbox" {{#ifNotEquals EnablePatientAccess 0}}checked{{/ifNotEquals}} class="toggle-input" data-onstyle="warning">
                    </div>
                </div>
                <div class="form-group">
                    <label for="paURL" class="col-xs-3 col-sm-3 col-md-3 col-lg-3 control-label">
                        {{i18n 'adminglobal.paURL'}}
                    </label>
                    <div class="col-xs-7 col-sm-6 col-md-6 col-lg-6">
                        <input id="paURL" name="paURL" class="form-control" type="text" placeholder="{{i18n 'adminglobal.paURL.placeholder'}}" {{#ifNotEquals EnablePatientAccess 1}}disabled{{/ifNotEquals}} value="{{PatientAccessUrl}}">
                        <span class="margin-left help-block hidden"></span>
                    </div>
                </div>
                <!-- Session Timeout tab -->
                <div id="session-timeout" class="anchor-dummy" role="">
                    <h1>
                        {{i18n 'adminglobal.sessiontimeout'}}
                    </h1>
                    <div class="requiredWrapper">
                        <div class="col-lg-12 required">{{i18n 'FirstAccess.required'}}</div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-3 control-label">
                            <span class="asterix">*</span>
                            {{i18n 'adminglobal.timeoutAfterInactive'}}
                        </label>
                        <div class="col-xs-2">
                            <div class="numeric-input-block">
                                <input id="timeoutMinutes" name="timeoutMinutes" class="form-control" type="number" min="0" value="{{logoutTimeMinutes}}" />  
                            </div>
                            <div class="input-msg-block">
                                <span class="float-left margin-left" for="timeoutMinutes" >{{i18n 'adminglobal.minutes'}}</span>
                            </div>
                        </div>
                        <div class="numeric-input-block">
                            <input id="timeoutSeconds" name="timeoutSeconds" class="float-left form-control" type="number" min="0" value="{{logoutTimeSeconds}}" />
                        </div>
                        <div class="input-msg-block float-left col-xs-5">
                            <span class="float-left margin-left margin-right" for="timeoutSeconds" >{{i18n 'adminglobal.seconds'}}</span>
                            <span class="margin-left help-block hidden"></span>
                        </div>
                    </div>
                    <div class="paddingtop-30">
                        <div class="form-group" >
                            <label class="col-xs-3 control-label">
                                <span class="asterix">*</span>
                                {{i18n 'adminglobal.showTimeoutWarning'}}
                            </label>
                            <div class="col-xs-9">
                                <div class="numeric-input-block">
                                    <input id="timeoutLeadSeconds" name="timeoutLeadSeconds" class="form-control" value="{{logoutLeadTime}}" type="number" min="0" onkeypress="return (event.charCode === 0 || /\d/.test(String.fromCharCode(event.charCode)));" />
                                </div>
                                <div class="input-msg-block">
                                    <span class="float-left margin-left margin-right" for="timeoutLeadSeconds">{{i18n 'adminglobal.secondsBeforeClosing'}}</span>
                                    <span class="float-left margin-left help-block hidden"></span>
                                </div>                            
                            </div>
                        </div>
                    </div>
                </div>
                <!-- Custom Crystal Repoprt -->
                <div id="custom-report" role="" class="anchor-dummy" >
                    <h1>{{{i18n 'adminglobal.customcrystalreport'}}} <small class="gray"><i>{{i18n 'adminglobal.optional'}}</i></small></h1>  {{! Using triple Braces allow to include unicode characters  }}
                    <div class="form-group">
                        <div class="col-xs-12">
                            <div class="navbar navbar-default crystal-info">
                                {{i18n 'adminglobal.crystalreportdescrip'}}
                            </div>                        
                        </div>
                   </div>
                   <div class="form-group">
                      <label class="col-xs-3 control-label">
                         <span class="asterix">*</span>
                         {{i18n 'FirstAccess.LanguageLabel'}}
                         <p class="help-info">{{i18n 'adminglobal.crystalLangExplain'}}</p>
                      </label>
                      <div id="CrystalRepLang" class="col-xs-2">
                      </div>
                   </div>
                   <div class="form-group">
                        <label class="col-xs-3 control-label">
                            {{i18n 'adminglobal.crystalreportinuse'}}
                        </label>                             
                        <div class="col-xs-7 col-md-6 crystal-text">
                            <span id="report-inuse" ></span><br/>
                            <a id="restorecrystalreport" class="discard restore-default">{{i18n 'adminglobal.restoresystemdefault'}}</a>
                        </div>                            
                    </div>    
                    <div class="form-group">
                        <label class="col-xs-3 control-label">
                            {{i18n 'adminglobal.lastmod'}}
                        </label>
                       <div class="col-xs-3 col-md-2 crystal-text">
                          <span id="crystal-lastmod-text"></span>
                       </div>
                    </div>    
                    <div class="form-group crystal-text">
                        <label class="col-xs-3 control-label">
                            {{i18n 'adminglobal.crystalreportselected'}}
                        </label>              
                        <div class="col-xs-5 col-sm-5 col-lg-5">
                            <div class="input-group">
                                <input type="text" class="form-control" readonly>
                                <span class="input-group-btn">
                                    <span class="btn btn-default-gray btn-file">
                                        {{i18n 'adminglobal.choosefile'}}<input type="file" id="selectCrystalReport" name="selectCrystalReport" accept=".rpt" title="Choose File">
                                    </span>
                                </span>
                            </div>                            
                        </div>
                        <span class="margin-left help-block hidden crystal-text"></span>    <!-- Error message -->
                    </div>
                </div>                
                <!-- Profile tab -->
                <div class="anchor-dummy" role="" id="profile">
                    <h1 >
                        {{i18n 'adminglobal.profiles'}}
                    </h1>
                    <div class="text-right">
                        <a class="btn btn-default" id="add-profile" href="/v2/FirstAccess/adminsettings">{{i18n 'adminglobal.add'}}</a>
                    </div>
                    <table class="table table-striped">
                        <thead>
                            <tr>
                                <th>
                                    #
                                </th>
                                <th class="col-xs-2">
                                    {{i18n 'adminglobal.name'}}
                                </th>
                                <th class="paEnabled">
                                    {{i18n 'adminglobal.allowpatientaccess'}}
                                </th>
                                <th class="paDisabled">
                                    {{i18n 'adminglobal.allowpatientaccess'}}
                                </th>
                                <th class="col-xs-2">
                                    {{i18n 'adminglobal.languages'}}
                                </th>
                                <th>
                                    {{i18n 'adminglobal.kioskurl'}}
                                </th>
                                <th>
                                    &nbsp;
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            {{#each profiles}}
                            <tr>
                                <td >
                                    {{Number}}
                                </td>
                                <th class="col-xs-2" scope="row">
                                    {{Name}}
                                </th>
                                <td class="paEnabled">
                                    {{#ifEquals AllowPatientAccess 1}}
                                        {{i18n 'yes'}}
                                    {{else}}
                                        {{i18n 'no'}}
                                    {{/ifEquals}}
                                </td>
                                <td class="paDisabled">
                                    {{i18n 'adminglobal.disabled'}}
                                </td>
                                <th class="col-xs-2 languages">
                                   {{languagesText}}
                                </th>
                                <td>
                                    <a href="{{Url}}" target="_blank" data-bypass>{{Url}}</a>
                                </td>
                                <td class="col-xs-2 text-right">
                                    <button  class="btn btn-link no-padding edit-btn black-text" value="{{Profile}} Edit">
                                        <span class="fa fa-pencil edit-icon"></span> {{i18n 'FirstAccess.edit'}}
                                    </button>
                                    <span class="gray-pipe">  |  </span>
                                    <button type="button" class="btn btn-link no-padding delete-btn black-text" value="{{Profile}} Delete">
                                    <span class="fa fa-times delete-icon"></span> {{i18n 'FirstAccess.delete'}}</button>
                                </td>
                            </tr>
                            {{/each}}
                        </tbody>
                    </table>
                </div>
                <!-- Admin Settings tab -->
                <div id="admin-settings" class="form-group anchor-dummy" role="">
                    <h1 id="role">
                        {{i18n 'adminglobal.adminSettings'}}
                    </h1>
                    <div class="requiredWrapper">
                        <div class="col-lg-12 required">{{i18n 'FirstAccess.required'}}</div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-3 control-label">
                            <span class="asterix">*</span>
                            {{i18n 'adminglobal.securityRoleReqd'}}
                            <p class="help-info">{{i18n 'adminglobal.warnSecurityRole'}}</p>
                        </label>
                        <div class="col-xs-3">
                            <select id="accessRole" name="accessRole" class="form-control">
                                {{#each UserRoles}}
                                <option value="{{Id}}" {{#ifEquals Id ../AdminAccessRole}}selected="selected"{{/ifEquals}}>
                                    {{Description}}
                                </option>
                                {{/each}}
                            </select>
                        </div>
                        <div class="col-xs-3 gray">{{i18n 'adminglobal.changesEffectiveNextTime'}}</div>
                        <span class="float-left margin-left help-block hidden"></span>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
{{/Page}} 