| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- @using VberZero
- @model VberZero.AppService.Notifications.Dto.NotificationSettingsDto
- <div class="menu-item px-5" data-kt-menu-trigger="hover" data-kt-menu-placement="left-start" data-kt-menu-flip="bottom, top">
- <a href="#" class="menu-link px-5">
- <span class="menu-title">
- <span class="fas fa-envelope-open-text pe-2"></span>
- 我的订阅
- </span>
- <span class="menu-arrow"></span>
- </a>
- <div class="menu-sub menu-sub-dropdown w-175px py-4">
- @if (Model?.Notifications.Count > 0)
- {
- foreach (var notification in Model.Notifications)
- {
- var isCheck = notification.IsSubscribed ? "checked=\"checked\"" : "";
- <div class="menu-content px-3">
- <label class="form-check form-switch form-check-custom form-check-solid">
- <input class="form-check-input w-30px h-20px" type="checkbox" value="" name="@(notification.Name)" @(isCheck) onchange="UpdateNotificationSetting(this)"/>
- <span class="form-check-label text-muted fs-7">@(notification.DisplayName)</span>
- </label>
- </div>
- }
- }
- @{
- var isReceive = Model is {ReceiveNotifications: true } ? "checked=\"checked\"" : "";
- }
- <div class="separator my-2"></div>
- <div class="menu-item px-3">
- <div class="menu-content px-3">
- <label class="form-check form-switch form-check-custom form-check-solid">
- <input class="form-check-input w-30px h-20px" name="receiveNotifications" type="checkbox" @(isReceive) onchange="UpdateNotificationSetting(this)"/>
- <span class="form-check-label text-muted fs-7">订阅通知</span>
- </label>
- </div>
- </div>
- </div>
- </div>
- <script>
- function UpdateNotificationSetting(that) {
- let $this = $(that), name = $this.attr("name"), isCheck = $this.is(":checked");
- console.log(name, isCheck);
- abp.ajax({
- url: '@(VzConsts.ApiAppUrl)Notification/UpdateNotificationSetting',
- data: JSON.stringify({
- name: name,
- isSubscribed: isCheck
- }),
- success:() => {
- abp.notify.success("更改成功!");
- },
- error:() => {
- $this.prop("checked", !isCheck);
- }
-
- });
}
- </script>
|