{{:ModuleInclude('public/header')}}

<div class="am-padding-sm am-background-white">
    {{if !empty($data)}}
        <legend class="am-padding-horizontal-xs am-padding-bottom-xs">
            <img src="{{if empty($data['logo'])}}{{:StaticAttachmentUrl('default-images-mini.png')}}{{else /}}{{$data.logo}}{{/if}}" class="am-img-thumbnail am-radius page-top-nav-logo" />
            <span class="page-top-nav-title">
                <span class="am-text-xs">{{if !empty($data['name'])}}{{$data.name}}{{/if}}</span>
                <a href="javascript:;" class="iconfont icon-edit-wide am-text-xs am-margin-left-xs" data-am-modal="{target: '#popup-saveinfo'}"></a>
            </span>
            <a href="{{:MyUrl('index/design/index', ['id'=>$data['id']])}}" target="_blank" rel="noopener noreferrer" class="am-fr am-text-xs am-margin-top-sm">{{:MyLang('view_title')}} >></a>
        </legend>
        <div class="am-padding-bottom-sm">
            <div class="layout-operate-container am-fr" data-save-url="{{:MyUrl('admin/design/save')}}" data-json="{{:urlencode(json_encode($data))}}">
                <a href="javascript:;" class="am-btn am-btn-warning am-btn-xs am-radius window-close-event" data-msg="{{:MyLang('save_close_page_confirm_tips')}}">
                    <i class="am-icon-close"></i>
                    <span>{{:MyLang('close_title')}}</span>
                </a>
                <button type="button" class="am-btn am-btn-success am-btn-xs am-radius am-margin-left-sm" data-am-loading="{spinner: 'circle-o-notch', loadingText:'{{:MyLang('save_title')}}'}">
                    <i class="am-icon-check"></i>
                    <span>{{:MyLang('save_title')}}</span>
                </button>
            </div>
            {{:ModuleInclude('../../../module/view/layout/base')}}
        </div>

        <!-- 页面编辑-->
        {{:ModuleInclude('design/popup_saveinfo')}}
    {{else /}}
        <div class="table-no">
            <i class="am-icon-skyatlas am-icon-lg"></i>
            <p>{{:MyLang('no_data')}}</p>
        </div>
    {{/if}}
</div>

<!-- footer start -->
{{:ModuleInclude('public/footer')}}
<script type="text/javascript">
// 基础数据保存回调处理
function FormBackSaveinfoEdit(e)
{
    var $page = $('.layout-operate-container');
    $page.attr('data-json', encodeURIComponent(JSON.stringify(e)));

    // logo
    $('.page-top-nav-logo').attr('src', e.logo || "{{:StaticAttachmentUrl('default-images-mini.png')}}");

    // 名称
    $('.page-top-nav-title span').text(e.name || '{{:MyLang("common_service.design.create_name_default")}}');

    // 关闭弹窗
    $('#popup-saveinfo').modal('close');
}
</script>

<!-- layout formback -->
{{:ModuleInclude('../../../module/view/layout/form_back')}}