{extends file="admin-layout.tpl"}

{block name="page-title"}{intl l='My places' d="pointretrait"}{/block}

{block name="check-access"}update{/block}
{block name="check-module"}PointRetrait{/block}

{block name="after-bootstrap-css"}
<link rel="stylesheet"
      href="{stylesheet file='assets/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css'}">
{/block}

{block name="main-content"}
<div id="wrapper" class="container">
    {assign "place_id" $smarty.get.place_id}

    <div class="general-block-decorator">
        <div class="title title-without-tabs">
            {intl l="Edit a place" d="pointretrait"}&nbsp;: <b>{loop name="places" type="pdr_places" id={$place_id}}{$TITLE}{/loop}</b>
        </div>

        <ul class="nav nav-tabs" id="tabbed-menu">
            {loop name="auth-general" type="auth" role="ADMIN" resource="admin" access="VIEW" module="PointRetrait"}
            <li class="active"><a href="#main" data-toggle="tab">{intl l="Main" d="pointretrait"}</a></li>
            {/loop}
            {loop name="auth-schedule" type="auth" role="ADMIN" resource="admin.schedule" access="VIEW" module="PointRetrait"}
            <li><a href="#schedule" data-toggle="tab">{intl l="Schedule" d="pointretrait"}</a></li>
            {/loop}
        </ul>

        <div class="tab-content">
            {loop name="auth-general-tab" type="auth" role="ADMIN" resource="admin" access="VIEW" module="PointRetrait"}
            <div class="tab-pane fade in active" id="general">
                {include file="includes/main.html"}
            </div>
            {/loop}
            {loop name="auth-schedule-tab" type="auth" role="ADMIN" resource="admin.schedule" access="VIEW" module="PointRetrait"}
            <div class="tab-pane fade" id="schedule">
{*
                {include file="includes/schedule.html"}
                *}
            </div>
            {/loop}
        </div>
    </div>
</div>

{*
{include file="modal/schedule-modal.html"}
*}

{/block}

{block name="javascript-initialization"}
{javascripts file='assets/js/moment-with-locales.min.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
<script src="{$asset_url}"></script>
<script>
    $(function() {
        $(".toggle-active").on('switch-change', function (event, data) {
            $("#active").val(data['value'] ? 1 : 0);
        });

        var hash = location.hash.slice(1);
        if (!hash) hash = "main";
        $('#tabbed-menu a[href="#' + hash + '"]').tab('show');
    });
</script>
{/javascripts}
{include file="js/main-js.html"}
{*
{include file="js/schedule-js.html"}
*}
{/block}
