123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- @using WeApp.Authorization
- @using WeApp.Configuration
- @using WeApp.Helpers
- @using WeApp.Views.Shared.Modals
- @{
- var settingName = new Func<string, string>((s) => L(s.Replace(".", "")));
- }
- <!-- Control Sidebar -->
- <aside class="control-sidebar control-sidebar-light" style="background:transparent; border: none;">
- <div class="card card-iwb card-tabs">
- <div class="card-header p-0 pt-1 border-bottom-0" style="border-radius: 0;padding-left: 5px !important;">
- <ul class="nav nav-tabs" id="" role="tablist">
- <li class="nav-item">
- <a class="nav-link active" id="" data-toggle="pill" href="#control-setting">@(L("UserSetting"))</a>
- </li>
- @if (AbpSession.UserType == UsersAndRolesTypeDefinition.Supper || AbpSession.UserType == UsersAndRolesTypeDefinition.System)
- {
- <li class="nav-item">
- <a class="nav-link" id="custom-tabs-two-messages-tab" data-toggle="pill" href="#control-other">@(L("UserCache"))</a>
- </li>
- }
- </ul>
- </div>
- <div class="card-body">
- <div class="tab-content" id="">
- <div class="tab-pane fade active show" id="control-setting">
- <button class="btn btn-iwb btn-block" id="LoginImage" type="button"> @(settingName(PermissionNames.PagesUserSysSettingLoginImage)) </button>
- <button class="btn btn-iwb btn-block" id="HomeImage" type="button"> @(settingName(PermissionNames.PagesUserSysSettingHomeImage)) </button>
- <button class="btn btn-iwb btn-block" id="" type="button" onclick="NotificationSetting()"> @(L("NotificationSetting")) </button>
- </div>
- @if (AbpSession.UserType == UsersAndRolesTypeDefinition.Supper || AbpSession.UserType == UsersAndRolesTypeDefinition.System)
- {
- <div class="tab-pane fade" id="control-other">
- <button class="btn btn-iwb btn-block" id="RefreshCache"> @(settingName(PermissionNames.PagesUserSysSettingRefreshCache)) </button>
- <button class="btn btn-iwb btn-block" id="RefreshLang"> @(settingName(PermissionNames.PagesUserSysSettingRefreshLang)) </button>
- </div>
- }
- </div>
- </div>
- <!-- /.card -->
- </div>
- </aside>
- <!-- /.control-sidebar -->
- @{
- var imageModal = new ModalViewModel(L("SettingImage"), "", new ModalBodyViewModel(new List<Input>()
- {
- new InputFile("image",L("SettingImagePath")).SetImageOption("ImageInfo","ImageName","ImageExt")
- },"image-form"), "image-modal");
- @Html.Partial("Modals/_Modal", imageModal)
- //超级管理员和管理员才可操作
- if (AbpSession.UserType == UsersAndRolesTypeDefinition.Supper)
- {
- var cacheModal = new ModalViewModel("清除缓存", "", new ModalBodyViewModel(new List<Input>()
- {
- new Input("id",L("SettingCacheName")).SetNotRequired().SetSelectOptions(IwbCacheNames.GetCacheList(),isAddBlank:false)
- },"cache-form"), "cache-modal");
- @Html.Partial("Modals/_Modal", cacheModal);
- }
- var notificationSettingModal = new ModalViewModel(L("NotificationSetting"), "",new ModalBodyViewModel(new List<Input>(),"notificationSetting-form"), "notificationSetting-modal",0,"");
- @Html.Partial("Modals/_Modal", notificationSettingModal)
- }
- @using (Html.BeginScripts())
- {
- <!-- Control Sidebar-->
- <script>
- $(function() {
- $('#LoginImage').on('click', function () {
- $('#image-modal .iwb-file-label').text('@L("SelectFile")');
- window.OpenModal({
- modal: 'image-modal',
- url: '@(IwbConsts.ApiAppUrl)'+'Settings/LoginImage'
- });
- });
- $('#HomeImage').on('click',function() {
- $('#image-modal .iwb-file-label').text('@L("SelectFile")');
- window.OpenModal({
- modal: 'image-modal',
- url: '@(IwbConsts.ApiAppUrl)'+'Settings/HomeImage'
- });
- });
- $('#RefreshCache').on('click',function() {
- window.OpenModal({
- modal: 'cache-modal',
- url: '@(IwbConsts.ApiAppUrl)'+'Settings/CacheRefresh'
- });
- });
- $('#RefreshLang').on('click',function() {
- $.iwbAjax1({ url: '@(IwbConsts.ApiAppUrl)' + 'Settings/LangRefresh' });
- });
- });
- function NotificationSetting() {
- $.iwbAjax4({
- url: abp.appUrl + 'Notification/GetNotificationSettings',
- success: function(res) {
- var template = $('#NotificationSettingTemplate').html();
- Mustache.parse(template);
- var rendered = Mustache.render(template, res);
- $('#notificationSetting-form').html(rendered);
- window.OpenModal({
- modal: 'notificationSetting-modal',
- table:null,
- url: abp.appUrl + 'Notification/UpdateNotificationSettings',
- dataFun:GetNotificationSetting
- });
- }
- });
- }
- function ReceiveNotification(that) {
- var $that = $(that);
- if ($that.is(':checked')) {
- $that.closest("form").find('.s-box').fadeIn();
- } else {
- $that.closest("form").find('.s-box').fadeOut();
- $('.sub').prop('checked',false);
- }
- }
- function GetNotificationSetting() {
- var data = {};
- data.ReceiveNotifications = $('input[name="receiveNotifications"]').is(":checked");
- data.Notifications = [];
- $('.sub').each(function() {
- var $this = $(this);
- data.Notifications.push({ name: $this.attr('name'), isSubscribed: $this.is(":checked") });
- });
- console.log(data);
- return data;
- }
- </script>
- <script id="NotificationSettingTemplate" type="x-tmpl-mustache">
- <div style=" padding:5px;">
- <div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
- <input type="checkbox" class="custom-control-input" id="receiveNotifications" name="receiveNotifications" {{#receiveNotifications}} checked {{/receiveNotifications}}>
- <label class="custom-control-label" for="receiveNotifications">@(L("ReceiveNotificationsSetting"))</label>
- </div>
-
- </div>
- <div class="s-box" style=" {{^receiveNotifications}} display:none; {{/receiveNotifications}}padding:2px;">
- <hr style=" margin-top:5px;margin-bottom:8px;" />
- <h6 class="text-d text-center" style="font-size:0.875rem;">@(L("TickNotificationsToSubscribe"))</h6>
- {{#notifications}}
- <div class="custom-control custom-switch" style="width:33%;float:left;">
- <input type="checkbox" class="custom-control-input sub" id="N_{{name}}" name="{{name}}" {{#isSubscribed}} checked {{/isSubscribed}}>
- <label class="custom-control-label" for="N_{{name}}">{{displayName}}</label>
- </div>
-
- {{/notifications}}
- </div>
-
-
- </script>
- <!-- /.Control Sidebar -->
- }
|