<?php /*a:1:{s:62:"D:\phpstudy\WWW\12xz\app\admin\view/default\role\saveinfo.html";i:1782629701;}*/ ?>
<?php echo ModuleInclude('public/header'); ?>

<!-- right content start  -->
<div class="content-right">
	<div class="content">
        <!-- nav start -->
        <?php echo ModuleInclude('public/admin_nav', [
            'title'     => MyLang('role.base_nav_title').(empty($data['id']) ? MyLang('created_title') : MyLang('edit_title')),
            'back_url'  => MyUrl('admin/role/index', $params)
        ]); ?>
        <!-- nav end -->
        <!-- form start -->
        <form class="am-form form-validation am-form-full-screen am-form-popup-sticky" action="<?php echo MyUrl('admin/role/save'); ?>" method="POST" request-type="ajax-url" request-value="<?php echo MyUrl('admin/role/index', $params); ?>">
            <div class="am-form-group">
                <label><?php echo MyLang('common_service.role.form_item_name'); ?><span class="am-form-group-label-tips-must">*</span></label>
                <input type="text" placeholder="<?php echo MyLang('common_service.role.form_item_name_message'); ?>" name="name" minlength="1" maxlength="60" data-validation-message="<?php echo MyLang('common_service.role.form_item_name_message'); ?>" class="am-radius" <?php if(!empty($data['name'])): ?>value="<?php echo htmlentities((string) $data['name']); ?>"<?php endif; ?> required />
            </div>
            <?php echo ModuleInclude('lib/is_enable'); ?>
            
            <?php echo ModuleInclude('public/nav_switch_btn', [
                'nav_data' => [
                    [
                        'name' => MyLang('common_service.role.form_item_menu'),
                        'key'  => 'role-form-item-menu',
                    ],
                    [
                        'name' => MyLang('common_service.role.form_item_plugins'),
                        'key'  => 'role-form-item-plugins',
                    ]
                ]
            ]); ?>
            <div class="nav-content">
                <div class="item am-active" data-key="role-form-item-menu">
                    <div class="am-form-group">
                        <ul class="tree-list am-nbfc am-radius-lg" data-is-two-check-find="0" data-is-three-check-parent="0">
                            <?php if(!empty($power['power'])): foreach($power['power'] as $v): ?>
                                    <li>
                                        <div class="item-content am-padding-sm">
                                            <label class="am-checkbox-inline">
                                                <input type="checkbox" name="power_id" value="<?php echo htmlentities((string) $v['id']); ?>" <?php if($v['is_power'] == 1): ?>checked<?php endif; ?> data-am-ucheck />
                                                <span class="<?php if($v['is_show'] == 0): ?>am-color-999<?php endif; ?>"><?php echo htmlentities((string) $v['name']); ?></span>
                                            </label>
                                        </div>
                                        <?php if(!empty($v['item'])): ?>
                                            <ul class="list-find">
                                                <?php foreach($v['item'] as $vs): ?>
                                                    <li class="am-flex am-flex-row am-flex-justify-between am-flex-items-center am-flex-warp">
                                                        <div class="item-content am-padding-sm">
                                                            <label class="am-checkbox-inline">
                                                                <input type="checkbox" name="power_id" value="<?php echo htmlentities((string) $vs['id']); ?>" <?php if($vs['is_power'] == 1): ?>checked<?php endif; ?> data-am-ucheck />
                                                                <span class="<?php if($vs['is_show'] == 0): ?>am-color-999<?php endif; ?>"><?php echo htmlentities((string) $vs['name']); ?></span>
                                                            </label>
                                                        </div>
                                                        <?php if(!empty($vs['item'])): ?>
                                                            <div class="list-find-three am-padding-sm am-flex am-flex-justify-right am-flex-grow am-flex-items-center am-flex-warp am-gap-1">
                                                                <?php foreach($vs['item'] as $vss): ?>
                                                                    <label class="am-checkbox-inline">
                                                                        <input type="checkbox" name="power_id" value="<?php echo htmlentities((string) $vss['id']); ?>" <?php if($vss['is_power'] == 1): ?>checked<?php endif; ?> data-am-ucheck>
                                                                        <span class="<?php if($vss['is_show'] == 0): ?>am-color-999<?php endif; ?>"><?php echo htmlentities((string) $vss['name']); ?></span>
                                                                    </label>
                                                                <?php endforeach; ?>
                                                            </div>
                                                        <?php endif; ?>
                                                    </li>
                                                <?php endforeach; ?>
                                            </ul>
                                        <?php endif; ?>
                                    </li>
                                <?php endforeach; else: ?>
                                <p class="am-text-warning"><?php echo MyLang('common_service.role.form_item_menu_no_data_tips'); ?></p>
                            <?php endif; ?>
                        </ul>
                    </div>
                </div>

                <div class="item" data-key="role-form-item-plugins">
                    <div class="am-form-group">
                        <div class="tree-plugins am-padding-bottom-sm am-padding-left-sm am-checkbox-group am-flex am-flex-warp-re am-flex-items-center am-gap-12">
                            <label class="am-checkbox-inline am-text-truncate">
                                <input type="checkbox" name="plugins" value="" data-am-ucheck />
                                <span>全选</span>
                            </label>
                            <span class="am-color-red"><?php echo MyLang('common_service.role.form_item_plugins_tips'); ?></span>
                        </div>
                        <ul class="tree-list am-nbfc am-radius-lg" data-is-two-check-find="0" data-is-three-check-parent="0">
                            <?php if(!empty($power['plugins'])): foreach($power['plugins'] as $v): ?>
                                    <li>
                                        <div class="item-content am-padding-sm">
                                            <label class="am-checkbox-inline">
                                                <input type="checkbox" name="plugins[<?php echo htmlentities((string) $v['plugins']); ?>][plugins]" value="<?php echo htmlentities((string) $v['plugins']); ?>" <?php if(isset($v['is_power']) and $v['is_power'] == 1): ?>checked<?php endif; ?> data-am-ucheck />
                                                <span><?php echo htmlentities((string) $v['name']); ?></span>
                                            </label>
                                        </div>
                                        <?php if(!empty($v['item'])): ?>
                                            <ul class="list-find">
                                                <?php foreach($v['item'] as $vs): ?>
                                                    <li class="am-flex am-flex-row am-flex-justify-between am-flex-items-center am-flex-warp">
                                                        <div class="item-content am-padding-sm">
                                                            <label class="am-checkbox-inline">
                                                                <input type="checkbox" name="plugins[<?php echo htmlentities((string) $v['plugins']); ?>][power]" value="<?php echo htmlentities((string) $vs['control']); ?>-<?php echo htmlentities((string) $vs['action']); ?>" <?php if(isset($vs['is_power']) and $vs['is_power'] == 1): ?>checked<?php endif; ?> data-am-ucheck />
                                                                <span><?php echo htmlentities((string) $vs['name']); ?></span>
                                                            </label>
                                                        </div>
                                                        <?php if(!empty($vs['item'])): ?>
                                                            <div class="list-find-three am-padding-sm am-flex am-flex-justify-right am-flex-grow am-flex-items-center am-flex-warp am-gap-1">
                                                                <?php foreach($vs['item'] as $vss): ?>
                                                                    <label class="am-checkbox-inline">
                                                                        <input type="checkbox" name="plugins[<?php echo htmlentities((string) $v['plugins']); ?>][power]" value="<?php echo htmlentities((string) $vs['control']); ?>-<?php echo htmlentities((string) $vss['action']); ?>" <?php if(isset($vs['is_power']) and $vss['is_power'] == 1): ?>checked<?php endif; ?> data-am-ucheck>
                                                                        <span><?php echo htmlentities((string) $vss['name']); ?></span>
                                                                    </label>
                                                                <?php endforeach; ?>
                                                            </div>
                                                        <?php endif; ?>
                                                    </li>
                                                <?php endforeach; ?>
                                            </ul>
                                        <?php endif; ?>
                                    </li>
                                <?php endforeach; else: ?>
                                <p class="am-text-warning"><?php echo MyLang('plugins_no_data_tips'); ?></p>
                            <?php endif; ?>
                        </ul>
                    </div>
                </div>
            </div>

            <!-- 插件扩展数据 start -->
            <?php if(isset($shopxo_is_develop) and $shopxo_is_develop == true): ?>
                <div class="plugins-tag">
                    <span>plugins_view_admin_role_save</span>
                </div>
            <?php endif; if(!empty($plugins_view_admin_role_save_data) and is_array($plugins_view_admin_role_save_data)): ?>
                <div class="am-alert am-alert-secondary">
                    <label class="am-text-sm am-text-warning"><?php echo MyLang('plugins_view_region_config_tips'); ?></label>
                    <div>
                        <?php foreach($plugins_view_admin_role_save_data as $hook): if(is_string($hook) or is_int($hook)): ?>
                                <?php echo $hook; ?>
                            <?php endif; ?>
                        <?php endforeach; ?>
                    </div>
                </div>
            <?php endif; ?>
            <!-- 插件扩展数据 end -->

            <div class="am-form-popup-submit">
                <input type="hidden" name="id" <?php if(!empty($data['id'])): ?>value="<?php echo htmlentities((string) $data['id']); ?>"<?php endif; ?> />
                <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner: 'circle-o-notch', loadingText:'<?php echo MyLang('save_title'); ?>'}">
                    <i class="am-icon-save"></i>
                    <span><?php echo MyLang('save_title'); ?></span>
                </button>
            </div>
        </form>
        <!-- right form end  -->
	</div>
</div>
<!-- right content end  -->

<!-- footer start -->
<?php echo ModuleInclude('public/footer'); ?>