{extends "../window.tpl"}

{block js append}
   <script type="text/javascript" src="static/js/jquery.mjs.nestedSortable.min.js"></script>
   <script src="static/js/chosen.image.js"></script>
   <script type="text/javascript" src="static/js/blocks.js?2"></script>
{/block}

{block tabs}
    {windowTab id='flap1' label="{'tabAuthor'|translate}"}
    {if $body.acn =="edit"}
        {windowTab id='flap2' label="{'tabAuthorArticles'|translate}"}
    {/if}

    {windowTab id='flapBlocks'}
{/block}

{block tabsContent}
    <div id="flap1" class="tab-pane fade active in boxStatic box">
        <h1 class="h4 main-panel-title">{'titleAuthorData'|translate}</h1>
                <div class="form-group">
                    <div class="col-md-2 control-label"><label>{'labelFirstName'|translate}</label></div>
                    <div class="col-md-4">
                        <input type="text" class="form-control input-sm" name="data[name]" value="{$body.data.name}" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2 control-label"><label>{'labelLastName'|translate}</label></div>
                    <div class="col-md-4"><input type="text" class="form-control input-sm" name="data[surname]" size="30"
                               value="{$body.data.surname}" maxlength="50"></div>
                </div>
                <div class="form-group">
                    <div class="col-md-2 control-label"><label>{'labelNickName'|translate}</label></div>
                    <div class="col-md-4"><input type="text" class="form-control input-sm" name="data[nick]"
                               value="{$body.data.nick}" maxlength="50"></div>
                </div>

               <div class="form-group">
                  <div class="col-md-2 control-label"><label>Obrázek:</label></div>
                  {if $body.acn =="edit" && !empty($body.data.photo)}
                     <div class="col-md-2">
                        <img src="{static_url url=$body.data.photo.src}" alt="{$body.data.name}" class="img-responsive">
                     </div>
                     <div class="col-md-4">
                        <a class="btn btn-danger btn-sm"
                           href="launch.php?s=artauthors.php&amp;acn=erasephoto&amp;ID={$body.data.id}&amp;IDsec={$body.data.id}">{'deletePhoto'|translate:"producers"}</a>
                        <a href="javascript:nw('imageEditor', '{$body.data.id}', 'type=articles_authors');" class="btn btn-sm"><span
                                   class="glyphicon glyphicon-cog m-r-1"></span> Upravit</a>
                     </div>
                  {else}
                     <div class="col-md-4">
                        <input type="file" class="filestyle" name="picture" data-iconName="glyphicon-folder-open" data-buttonText="{'chooseImg'|translate:"sections"}"/>
                        <span class="help-block">{'fileTypeNote'|translate:'producers'}</span>
                     </div>
                     <div class="col-md-2">
                        <input type="submit" class="btn btn-primary btn-block btn-sm" value="{'submitNewPhoto'|translate:'producers'}" name="Submit"/>
                     </div>
                  {/if}
                  {block "photo-info"}{* hannah - img dimensions *}{/block}
               </div>
                <div class="form-group">
                    <div class="col-md-2 control-label"><label>{'labelNote'|translate}</label></div>
                    <div class="col-md-4">
                        <textarea name="data[note]" class="form-control input-sm">{$body.data.note}</textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2 control-label"><label>{'labelAddress'|translate}</label></div>
                    <div class="col-md-4">
                        <textarea name="data[address]" class="form-control input-sm">{$body.data.address}</textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2 control-label"><label>{'labelEmail'|translate}</label></div>
                    <div class="col-md-4">
                        <input type="text" class="form-control input-sm" name="data[email]" size="30" maxlength="100" value="{$body.data.email}" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2 control-label"><label>{'labelPhone'|translate}</label></div>
                    <div class="col-md-4">
                        <input type="text" class="form-control input-sm" name="data[phone]" size="20" maxlength="20" value="{$body.data.phone}" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2 control-label"><label>{'labelBirthday'|translate}</label></div>
                    <div class="col-md-4">
                        <input type="text" class="form-control input-sm" name="data[date_borned]" id="date_borned" size="10" maxlength="10" value="{$body.data.date_borned|format_date:'admin'}" autocomplete="off" />
                        {insert_calendar selector='#date_borned' format='date'}
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2 control-label"><label>{'labelGender'|translate}</label></div>
                    <div class="col-md-10">
                        <div class="radio pull-left">
                            <label for="s1"><input type="radio" name="data[sex]" value="M" class="check" {"M"|checked:$body.data.sex} id="s1" /> {'radioMale'|translate}</label>
                        </div>
                        <div class="radio pull-left">
                            <label for="s2"><input type="radio" name="data[sex]" value="F" class="check" {"F"|checked:$body.data.sex} id="s2" /> {'radioFemale'|translate}</label>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2 control-label"><label>{'labelActive'|translate}</label></div>
                    <div class="col-md-10">
                        {print_toggle name="active"}
                       {* <div class="radio pull-left">
                            <label for="s1"><input type="radio" name="data[active]" value="Y" class="check" {checked string="Y" value=$body.data.active} id="s1" /> Ano</label>
                        </div>
                        <div class="radio pull-left">
                            <label for="s2"><input type="radio" name="data[active]" value="N" class="check" {checked string="N" value=$body.data.active} id="s2" /> Ne</label>
                        </div>*}
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-2 control-label"><label>{'labelRegistrationDate'|translate}</label></div>
                    <div class="col-md-4">
                        <input type="text" class="form-control input-sm" name="data[date_reg]" value="{$body.data.date_reg|format_date:'admin'}" readonly/>
                    </div>
                </div>
    </div>

    {if $body.acn =="edit"}
        <div id="flap2" class="tab-pane fade boxFlex">
            <h1 class="h4 main-panel-title">{'tabAuthorArticles'|translate}</h1>
                <iframe name="articles" class="iframeBorder" width="100%" height="300"
                        src="launch.php?s=list.php&amp;type=articles&amp;IDauth={$body.data.id}"></iframe>
        </div>
    {/if}
   <div id="flapBlocks" class="tab-pane fade boxFlex">
       {include "utils/blocks.tpl" identifiers=$cfg.Blocks.identifiers blocks=$body.data.blocks photos=$body.data.photos acn=$body.acn editLink=$body.sectionURL}

       {include "utils/blocksHistory.tpl"}
   </div>
{/block}
