RemoveSetting Completed

This commit is contained in:
SamSys
2025-11-17 17:35:04 +03:30
parent a481e941c5
commit f5cb6b276e
14 changed files with 617 additions and 115 deletions

View File

@@ -7,7 +7,24 @@ namespace Company.Domain.SmsResultAgg;
public interface ISmsSettingsRepository : IRepository<long, SmsSetting>
{
/// <summary>
/// ویرایش پیامک خودکار
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<EditSmsSetting> GetSmsSettingToEdit(long id);
/// <summary>
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<SmsSettingViewModel> GetSmsSettingsByType(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// حذف از دیتابیس
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task RemoveItem(long id);
}

View File

@@ -0,0 +1,49 @@
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
namespace CompanyManagment.App.Contracts.SmsResult;
public interface ISmsSettingApplication
{
/// <summary>
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public Task<SmsSettingViewModel> GetSmsSettingsByType(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// ایجاد تنظیمات پیامک یادآور
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<OperationResult> CreateSmsSetting(int dayOfMonth, string timeOfDay, TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// ویرایش پیامک خودکار
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<EditSmsSetting> GetSmsSettingToEdit(long id);
/// <summary>
/// ایجاد تنظیمات پیامک یادآور
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<OperationResult> EditeSmsSetting(EditSmsSetting command);
/// <summary>
/// حذف از دیتابیس
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task RemoveSetting(long id);
}

View File

@@ -0,0 +1,106 @@
using System;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using Company.Domain.SmsResultAgg;
using CompanyManagment.App.Contracts.SmsResult;
namespace CompanyManagment.Application;
public class SmsSettingApplication : ISmsSettingApplication
{
private readonly ISmsSettingsRepository _smsSettingsRepository;
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository)
{
_smsSettingsRepository = smsSettingsRepository;
}
public async Task<SmsSettingViewModel> GetSmsSettingsByType(TypeOfSmsSetting typeOfSmsSetting)
{
return await _smsSettingsRepository.GetSmsSettingsByType(typeOfSmsSetting);
}
/// <summary>
/// ایجاد تنظیمات پیامک یادآور
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<OperationResult> CreateSmsSetting(int dayOfMonth, string timeOfDay,
TypeOfSmsSetting typeOfSmsSetting)
{
var op = new OperationResult();
var timeSpan = new TimeSpan();
if (string.IsNullOrWhiteSpace(timeOfDay))
return op.Failed("ساعت وارد نشده است");
try
{
timeSpan = TimeSpan.ParseExact(timeOfDay, @"hh\:mm", null);
}
catch (Exception e)
{
return op.Failed("فرمت ساعت اشتباه است");
}
if (dayOfMonth < 1 || dayOfMonth > 31)
{
return op.Failed("عدد روز می بایست بین 1 تا 31 باشد");
}
if (_smsSettingsRepository.Exists(x => x.DayOfMonth == dayOfMonth && x.TimeOfDay == timeSpan && x.TypeOfSmsSetting == typeOfSmsSetting))
return op.Failed("رکورد ایجاد شده تکراری است");
var create = new SmsSetting(typeOfSmsSetting, dayOfMonth, timeSpan);
await _smsSettingsRepository.CreateAsync(create);
await _smsSettingsRepository.SaveChangesAsync();
return op.Succcedded();
}
public async Task<EditSmsSetting> GetSmsSettingToEdit(long id)
{
return await _smsSettingsRepository.GetSmsSettingToEdit(id);
}
public async Task<OperationResult> EditeSmsSetting(EditSmsSetting command)
{
var op = new OperationResult();
var timeSpan = new TimeSpan();
if (string.IsNullOrWhiteSpace(command.TimeOfDayDisplay))
return op.Failed("ساعت وارد نشده است");
try
{
timeSpan = TimeSpan.ParseExact(command.TimeOfDayDisplay, @"hh\:mm", null);
}
catch (Exception e)
{
return op.Failed("فرمت ساعت اشتباه است");
}
if (command.DayOfMonth < 1 || command.DayOfMonth > 31)
{
return op.Failed("عدد روز می بایست بین 1 تا 31 باشد");
}
if (_smsSettingsRepository.Exists(x => x.DayOfMonth == command.DayOfMonth && x.TimeOfDay == timeSpan && x.TypeOfSmsSetting == command.TypeOfSmsSetting && x.id != command.Id))
return op.Failed("رکورد ایجاد شده تکراری است");
var editSmsSetting = _smsSettingsRepository.Get(command.Id);
editSmsSetting.Edit(command.DayOfMonth, timeSpan);
await _smsSettingsRepository.SaveChangesAsync();
return op.Succcedded();
}
public async Task RemoveSetting(long id)
{
await _smsSettingsRepository.RemoveItem(id);
}
}

View File

@@ -16,8 +16,32 @@ public class SmsSettingsRepository : RepositoryBase<long, SmsSetting>, ISmsSetti
_context = context;
}
/// <summary>
/// ویرایش پیامک خودکار
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<EditSmsSetting> GetSmsSettingToEdit(long id)
{
var edit = new EditSmsSetting();
var getItem = await _context.SmsSettings.FirstOrDefaultAsync(x => x.id == id);
if (getItem != null)
{
edit.Id = getItem.id;
edit.TimeOfDayDisplay = getItem.TimeOfDay.ToString(@"hh\:mm");
edit.DayOfMonth = getItem.DayOfMonth;
edit.TypeOfSmsSetting = getItem.TypeOfSmsSetting;
}
return edit;
}
/// <summary>
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<SmsSettingViewModel> GetSmsSettingsByType(TypeOfSmsSetting typeOfSmsSetting)
{
var result = new SmsSettingViewModel();
@@ -37,4 +61,11 @@ public class SmsSettingsRepository : RepositoryBase<long, SmsSetting>, ISmsSetti
return result;
}
public async Task RemoveItem(long id)
{
var removeItem = Get(id);
_context.SmsSettings.Remove(removeItem);
await _context.SaveChangesAsync();
}
}

View File

@@ -535,6 +535,7 @@ public class PersonalBootstrapper
#region SmsSettings
services.AddTransient<ISmsSettingsRepository, SmsSettingsRepository>();
services.AddTransient<ISmsSettingApplication, SmsSettingApplication>();
#endregion
//=========End Of Main====================================

View File

@@ -1,5 +1,8 @@
@page
@using _0_Framework.Application.Enums
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model ServiceHost.Areas.Admin.Pages.Company.SmsResult.SmsSettingsModel
@Html.AntiForgeryToken()
@{
string adminVersion = _0_Framework.Application.Version.AdminVersion;
@@ -121,7 +124,19 @@
$(document).ready(function () {
$('.time-input').mask('00:00', {
translation: {
'0': {pattern: /[0-9]/},
// برای اولین رقم ساعت فقط 0-2
'H': {pattern: /[0-2]/},
// اگر اولین رقم 2 باشد دومین رقم فقط 0-3
'h': {pattern: /[0-3]/},
// برای دقیقه
'M': {pattern: /[0-5]/},
'm': {pattern: /[0-9]/},
}
});
// پیش‌فرض: لود تب اول با workshopId
@@ -181,7 +196,38 @@
function remove(id){
var urlAjaxToRemove = '@Url.Page("/Company/SmsResult/SmsSettings", "RemoveSetting")';
$.ajax({
dataType: 'json',
type: 'GET',
url: urlAjaxToRemove,
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: { id: id },
success: function (response) {
if(response.isSuccess){
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
setTimeout(function () {
$(".li-wizard.step.active").trigger("click");
}, 500);
}else{
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
}
},
failure: function (response) {
//console.log(5, response);
}
});
}
</script>
}

View File

@@ -1,17 +1,19 @@
using _0_Framework.Application.Enums;
using Company.Domain.SmsResultAgg;
using CompanyManagment.App.Contracts.SmsResult;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using ServiceHost.Areas.Admin.Pages.Company.Bill;
namespace ServiceHost.Areas.Admin.Pages.Company.SmsResult
{
public class SmsSettingsModel : PageModel
{
private readonly ISmsSettingsRepository _smsSettingsRepository;
private readonly ISmsSettingApplication _smsSettingApplication;
public SmsSettingsModel(ISmsSettingsRepository smsSettingsRepository)
public SmsSettingsModel(ISmsSettingApplication smsSettingApplication)
{
_smsSettingsRepository = smsSettingsRepository;
_smsSettingApplication = smsSettingApplication;
}
public void OnGet()
@@ -19,53 +21,123 @@ namespace ServiceHost.Areas.Admin.Pages.Company.SmsResult
}
//=================================== ایجاد ========================================//
#region Create
/// <summary>
/// لود مدال ایجاد پیامک خودکار
/// </summary>
/// <returns></returns>
public async Task<IActionResult> OnGetCreateSmsSetting(TypeOfSmsSetting typeOfSmsSetting)
{
var createModel = new CreateSmsSetting();
createModel.TypeOfSmsSetting = typeOfSmsSetting;
return Partial("_SmsSettingPartials/_CreateSmsSetting", createModel);
}
/// <summary>
/// ذخیره مدال ایجاد پیامک خودکار
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<JsonResult> OnPostCreateSmsSetting(int dayOfMonth, string timeOfDay, TypeOfSmsSetting typeOfSmsSetting)
{
var result = await _smsSettingApplication.CreateSmsSetting(dayOfMonth, timeOfDay, typeOfSmsSetting);
return new JsonResult(new
{
isSuccess = result.IsSuccedded,
message = result.Message
});
}
#endregion
//=================================== ویرایش ========================================//
#region Edit
/// <summary>
/// لود مدال ویرایش پیامک خودکار
/// </summary>
/// <returns></returns>
public async Task<IActionResult> OnGetEditSmsSettings(long id, TypeOfSmsSetting typeOfSmsSetting)
{
var editModel = await _smsSettingApplication.GetSmsSettingToEdit(id);
return Partial("_SmsSettingPartials/_EditSmsSetting", editModel);
}
/// <summary>
/// ذخیره مودال ویرایش پیامک خودکار
/// </summary>
/// <param name="id"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<JsonResult> OnPostEditSmsSettings(EditSmsSetting command)
{
var result = await _smsSettingApplication.EditeSmsSetting(command);
return new JsonResult(new
{
isSuccess = result.IsSuccedded,
message = result.Message
});
}
#endregion
//=================================== حذف ========================================//
/// <summary>
/// حذف از دیتابیس
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<IActionResult> OnGetRemoveSetting(long id)
{
try
{
await _smsSettingApplication.RemoveSetting(id);
return new JsonResult(new
{
isSuccess = true,
message = "حذف شد"
});
}
catch (Exception e)
{
return new JsonResult(new
{
isSuccess = false,
message = "خطا در حذف اطلاعات"
});
}
}
//=================================== تب ها ========================================//
#region Tabs
/// <summary>
/// تب پیامک یادآور
/// </summary>
/// <returns></returns>
public IActionResult OnGetInstitutionContractDebtReminderTab()
public async Task<IActionResult> OnGetInstitutionContractDebtReminderTab()
{
var modelData = _smsSettingsRepository.GetSmsSettingsByType(TypeOfSmsSetting.InstitutionContractDebtReminder).GetAwaiter().GetResult();
var modelData = await _smsSettingApplication.GetSmsSettingsByType(TypeOfSmsSetting.InstitutionContractDebtReminder);
return Partial("_SmsSettingPartials/ReminderSmsListData", modelData);
}
/// <summary>
/// لود مدال ایجاد پیامک یاد آور
/// </summary>
/// <returns></returns>
public IActionResult OnGetCreateReminderSetting()
{
return Partial("_SmsSettingPartials/_CreateReminderSms");
}
/// <summary>
/// ذخیره مدال ایجاد پیامک یاد آور
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <returns></returns>
public IActionResult OnPostCreateReminderSetting(int dayOfMonth, string timeOfDay)
{
var timeSpan = TimeSpan.ParseExact(timeOfDay, @"hh\:mm", null);
var create = new SmsSetting(TypeOfSmsSetting.InstitutionContractDebtReminder, dayOfMonth, timeSpan);
_smsSettingsRepository.Create(create);
_smsSettingsRepository.SaveChanges();
return new JsonResult(new
{
isSuccess = true,
message = "با موفقیت ذخیره شد"
});
}
/// <summary>
/// تب پیامک مسدودی
/// </summary>
/// <returns></returns>
public IActionResult OnGetBlockContractingPartyTab()
public async Task<IActionResult> OnGetBlockContractingPartyTab()
{
var modelData = _smsSettingsRepository.GetSmsSettingsByType(TypeOfSmsSetting.BlockContractingParty).GetAwaiter().GetResult();
var modelData = await _smsSettingApplication.GetSmsSettingsByType(TypeOfSmsSetting.BlockContractingParty);
return Partial("_SmsSettingPartials/BlockSmsListData", modelData);
}
@@ -73,9 +145,9 @@ namespace ServiceHost.Areas.Admin.Pages.Company.SmsResult
/// تب پیامک اقدام قضائی
/// </summary>
/// <returns></returns>
public IActionResult OnGetLegalActionTab()
public async Task<IActionResult> OnGetLegalActionTab()
{
var modelData = _smsSettingsRepository.GetSmsSettingsByType(TypeOfSmsSetting.LegalAction).GetAwaiter().GetResult();
var modelData = await _smsSettingApplication.GetSmsSettingsByType(TypeOfSmsSetting.LegalAction);
return Partial("_SmsSettingPartials/LegalActionSmsListData", modelData);
}
@@ -84,11 +156,12 @@ namespace ServiceHost.Areas.Admin.Pages.Company.SmsResult
/// تب پیامک هشدار قضایی
/// </summary>
/// <returns></returns>
public IActionResult OnGetWarningTab()
public async Task<IActionResult> OnGetWarningTab()
{
var modelData = _smsSettingsRepository.GetSmsSettingsByType(TypeOfSmsSetting.Warning).GetAwaiter().GetResult();
var modelData = await _smsSettingApplication.GetSmsSettingsByType(TypeOfSmsSetting.Warning);
return Partial("_SmsSettingPartials/WarningSmsListData", modelData);
}
}
#endregion
}
}

View File

@@ -1,9 +1,11 @@
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@Html.AntiForgeryToken()
@{
int index = 1;
<style>
.head-table{
.head-table {
font-size: 14px;
background-color: #2dbcbc;
padding: 4px 1px;
@@ -12,7 +14,7 @@
margin-bottom: 9px;
}
.tr-table{
.tr-table {
background-color: #ddf4f4;
border-radius: 5px;
padding: 4px 1px;
@@ -23,7 +25,8 @@
div.tr-table:nth-of-type(even) {
background-color: #b0e0e08f !important;
}
.row-number{
.row-number {
background-color: rgb(187, 240, 240);
color: #0B5959;
width: 24px;
@@ -33,12 +36,12 @@
border-radius: 5px;
}
.icon-span {
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: 14px;
line-height: 14px;
border-radius: 5px;
padding: 2px;
}
@@ -51,26 +54,26 @@
}
<div class="card card-pattern m-t-10">
<a class="btn btn-success"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateBlockSetting")">
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateSmsSetting", new {typeOfSmsSetting = TypeOfSmsSetting.BlockContractingParty})">
<span class="icon-span">
<span class="icon-span">
<svg width="19" height="19" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round" />
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round" />
</svg>
<span style="margin-right:4px"> ایجاد پیامک پلاک </span>
<span style="margin-right:4px"> ایجاد پیامک مسدودی </span>
</span>
</a>
<a class="btn btn-success instantSendSms"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "InstantSendBlockSms")">
<span class="icon-span">
@@ -86,10 +89,10 @@
<span style="margin-right:4px"> ارسال آنی پیامک مسدودی </span>
</span>
</a>
</div>
<div class="card card-pattern m-t-10">
@if (Model.EditSmsSettings.Any())
{
<div class="container-fluid">
@@ -110,14 +113,14 @@
<div class="col-2 col-md-1"><div class="row-number">@index</div></div>
<div class="col-10 col-md-3">@item.DayOfMonth</div>
<div class="col-6 col-md-2">@item.TimeOfDayDisplay</div>
@{
index++;
}
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
<a href="#"
style="border-radius:5px;">
<a href="#" onclick="remove(@item.Id);"
style="border-radius:5px;" return false;>
<span class="icon-span" style="background-color:#ddd3e0">
<svg width="19" height="18" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.523438 0.523438)" fill="#DDD3E0"></rect>
@@ -130,7 +133,7 @@
</a>
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings" ,new {id = item.Id})">
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings" ,new {id = item.Id, typeOfSmsSetting = item.TypeOfSmsSetting})">
<span class="icon-span" style="background-color:#ade7f2">
<svg width="19" height="18" viewBox="0 0 19 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.074707 0.679688)" fill="#ADE7F2"></rect>
@@ -142,7 +145,7 @@
</a>
</div>
</div>
@@ -151,6 +154,7 @@
}
</div>
}
</div>
</div>

View File

@@ -1,4 +1,5 @@
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@{
int index = 1;
@@ -50,27 +51,28 @@
</style>
}
<div class="card card-pattern m-t-10">
<a class="btn btn-success"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateLegalActionSetting")">
<span class="icon-span">
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateSmsSetting", new {typeOfSmsSetting = TypeOfSmsSetting.LegalAction})">
<span class="icon-span">
<svg width="19" height="19" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round" />
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round" />
</svg>
<span style="margin-right:4px"> ایجاد پیامک اقدام قضائی </span>
<span style="margin-right:4px"> ایجاد پیامک قدام قضائی </span>
</span>
</a>
<a class="btn btn-success instantSendSms"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "InstantSendLegalActionSms")">
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "InstantSendBlockSms")">
<span class="icon-span">
<svg width="20px" height="20px" viewBox="-11.26 -11.26 49.32 49.32" xmlns="http://www.w3.org/2000/svg" fill="#000000" transform="matrix(-1, 0, 0, 1, 0, 0)rotate(0)" stroke="#000000" stroke-width="0.00026804">
@@ -85,8 +87,7 @@
<span style="margin-right:4px"> ارسال آنی پیامک اقدام قضائی </span>
</span>
</a>
</div>
<div class="card card-pattern m-t-10">
@@ -116,8 +117,8 @@
}
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
<a href="#"
style="border-radius:5px;">
<a href="#" onclick="remove(@item.Id);"
style="border-radius:5px;" return false;>
<span class="icon-span" style="background-color:#ddd3e0">
<svg width="19" height="18" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.523438 0.523438)" fill="#DDD3E0"></rect>
@@ -130,7 +131,7 @@
</a>
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings" ,new {id = item.Id})">
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings" ,new {id = item.Id, typeOfSmsSetting = item.TypeOfSmsSetting})">
<span class="icon-span" style="background-color:#ade7f2">
<svg width="19" height="18" viewBox="0 0 19 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.074707 0.679688)" fill="#ADE7F2"></rect>

View File

@@ -1,4 +1,5 @@
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@{
int index = 1;
@@ -52,7 +53,7 @@
<div class="card card-pattern m-t-10">
<a class="btn btn-success"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateReminderSetting")">
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateSmsSetting", new {typeOfSmsSetting = TypeOfSmsSetting.InstitutionContractDebtReminder})">
<span class="icon-span">
@@ -111,8 +112,8 @@
}
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
<a href="#"
style="border-radius:5px;">
<a href="#" onclick="remove(@item.Id);"
style="border-radius:5px;" return false;>
<span class="icon-span" style="background-color:#ddd3e0">
<svg width="19" height="18" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.523438 0.523438)" fill="#DDD3E0"></rect>
@@ -125,7 +126,7 @@
</a>
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings" ,new {id = item.Id})">
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings" ,new {id = item.Id, typeOfSmsSetting = item.TypeOfSmsSetting})">
<span class="icon-span" style="background-color:#ade7f2">
<svg width="19" height="18" viewBox="0 0 19 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.074707 0.679688)" fill="#ADE7F2"></rect>

View File

@@ -1,4 +1,5 @@
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@{
int index = 1;
@@ -50,14 +51,12 @@
</style>
}
<div class="card card-pattern m-t-10">
<a class="btn btn-success"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateWarningSetting")">
<span class="icon-span">
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateSmsSetting", new {typeOfSmsSetting = TypeOfSmsSetting.Warning})">
<span class="icon-span">
<svg width="19" height="19" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round" />
@@ -67,10 +66,12 @@
</span>
</a>
<a class="btn btn-success instantSendSms"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "InstantSendWarningSms")">
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "InstantSendBlockSms")">
<span class="icon-span">
@@ -86,6 +87,7 @@
<span style="margin-right:4px"> ارسال آنی پیامک هشدار قضائی </span>
</span>
</a>
</div>
<div class="card card-pattern m-t-10">
@@ -115,8 +117,8 @@
}
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
<a href="#"
style="border-radius:5px;">
<a href="#" onclick="remove(@item.Id);"
style="border-radius:5px;" return false;>
<span class="icon-span" style="background-color:#ddd3e0">
<svg width="19" height="18" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.523438 0.523438)" fill="#DDD3E0"></rect>
@@ -129,7 +131,7 @@
</a>
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings" ,new {id = item.Id})">
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings" ,new {id = item.Id, typeOfSmsSetting = item.TypeOfSmsSetting})">
<span class="icon-span" style="background-color:#ade7f2">
<svg width="19" height="18" viewBox="0 0 19 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.074707 0.679688)" fill="#ADE7F2"></rect>

View File

@@ -1,4 +1,5 @@
@model CompanyManagment.App.Contracts.SmsResult.CreateSmsSetting
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.CreateSmsSetting
@Html.AntiForgeryToken()
@{
@@ -9,13 +10,42 @@
}
.modal .modal-dialog .modal-content{
padding-bottom : 10px;
padding-bottom : 10px !important;
}
.modal-dialog{
width: 27% !important;
max-width: 27% !important;
}
input{
text-align:center;
}
</style>
}
<div class="modal-header">
<h5 class="modal-title">ایجاد پیامک یاد آور</h5>
@{
switch (Model.TypeOfSmsSetting)
{
case TypeOfSmsSetting.InstitutionContractDebtReminder:
<h5 class="modal-title">ایجاد پیامک یاد آور</h5>
break;
case TypeOfSmsSetting.BlockContractingParty:
<h5 class="modal-title">ایجاد پیامک مسدودی</h5>
break;
case TypeOfSmsSetting.LegalAction:
<h5 class="modal-title">ایجاد پیامک اقدام قضائی</h5>
break;
case TypeOfSmsSetting.Warning:
<h5 class="modal-title">ایجاد پیامک هشدار قضائی</h5>
break;
}
}
<button type="button" class="close" data-dismiss="modal" aria-label="بستن">
<span aria-hidden="true">&times;</span>
</button>
@@ -29,12 +59,12 @@
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"> روز ارسال</label>
<input type="number" id="dayOfMonth" name="dayOfMonth" class="form-control" />
<input placeholder="31 ~ 1" type="number" id="dayOfMonth" name="dayOfMonth" class="form-control" />
</div>
<div class="col-md-6 mb-3">
<label class="form-label">ساعت ارسال</label>
<input text="text" id="timeOfDay" name="TimeOfDay" class="form-control" />
<input class="form-control time-input" placeholder="00:00" text="text" id="timeOfDay" name="TimeOfDay" class="form-control" />
</div>
</div>
@@ -54,26 +84,39 @@
<script>
function saveBtn(){
var urlAjaxToSave = '@Url.Page("/Company/SmsResult/SmsSettings", "CreateReminderSetting")';
var urlAjaxToSave = '@Url.Page("/Company/SmsResult/SmsSettings", "CreateSmsSetting")';
var dayOfMonth = Number( $('#dayOfMonth').val());
var timeOfDay = $('#timeOfDay').val();
var typeOfSmsSetting = '@Model.TypeOfSmsSetting';
$.ajax({
dataType: 'json',
type: 'POST',
url: urlAjaxToSave,
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: {"dayOfMonth" : dayOfMonth, "timeOfDay" : timeOfDay},
data: {"dayOfMonth" : dayOfMonth, "timeOfDay" : timeOfDay, "typeOfSmsSetting" : typeOfSmsSetting},
success: function (response) {
if(response.isSuccess){
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
$('.close').click();
setTimeout(function () {
$('#institutionContractDebtReminderTab').click();
if(typeOfSmsSetting == '@TypeOfSmsSetting.InstitutionContractDebtReminder'){
$('#institutionContractDebtReminderTab').click();
}else if(typeOfSmsSetting == '@TypeOfSmsSetting.BlockContractingParty'){
$('#blockContractingPartyTab').click();
}else if(typeOfSmsSetting == '@TypeOfSmsSetting.LegalAction'){
$('#legalActionTab').click();
}else if(typeOfSmsSetting == '@TypeOfSmsSetting.Warning'){
$('#warningTab').click();
}
}, 1000);
}, 500);
}else{
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
}

View File

@@ -0,0 +1,132 @@
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.EditSmsSetting
@Html.AntiForgeryToken()
@{
<style>
.modal-footer {
padding: 0.5rem 1rem !important; /* کوچکتر کردن فاصله */
margin-top: -10px; /* کمی بالا آوردن */
}
.modal .modal-dialog .modal-content{
padding-bottom : 10px !important;
}
.modal-dialog {
width: 27% !important;
max-width: 27% !important;
}
input{
text-align:center;
}
</style>
}
<div class="modal-header">
@{
switch (Model.TypeOfSmsSetting)
{
case TypeOfSmsSetting.InstitutionContractDebtReminder:
<h5 class="modal-title">ویرایش پیامک یاد آور</h5>
break;
case TypeOfSmsSetting.BlockContractingParty:
<h5 class="modal-title">ویرایش پیامک مسدودی</h5>
break;
case TypeOfSmsSetting.LegalAction:
<h5 class="modal-title">ویرایش پیامک اقدام قضائی</h5>
break;
case TypeOfSmsSetting.Warning:
<h5 class="modal-title">ویرایش پیامک هشدار قضائی</h5>
break;
}
}
<button type="button" class="close" data-dismiss="modal" aria-label="بستن">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="card shadow-sm border-0">
<div class="card-body">
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"> روز ارسال</label>
<input placeholder="31 ~ 1" type="number" id="dayOfMonth" asp-for="DayOfMonth" class="form-control" />
</div>
<div class="col-md-6 mb-3">
<label class="form-label">ساعت ارسال</label>
<input class="form-control time-input" placeholder="00:00" text="text" id="timeOfDay" asp-for="TimeOfDayDisplay" class="form-control" />
</div>
</div>
<div class="lineDiv"></div>
</div>
</div>
</div>
<div class="modal-footer border-0">
<button type="button" onclick="saveBtn()" class="btn btn-success px-4 rounded-pill">ذخیره</button>
<button type="button" class="btn btn-outline-secondary px-4 rounded-pill" data-dismiss="modal">بستن</button>
</div>
<script>
function saveBtn(){
var urlAjaxToSave = '@Url.Page("/Company/SmsResult/SmsSettings", "EditSmsSettings")';
let modelTypeOfSmsSetting = '@Model.TypeOfSmsSetting';
const command = {
id: '@Model.Id',
dayOfMonth: Number($('#dayOfMonth').val()),
timeOfDayDisplay: $('#timeOfDay').val(),
typeOfSmsSetting: modelTypeOfSmsSetting,
};
$.ajax({
dataType: 'json',
type: 'POST',
url: urlAjaxToSave,
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: command,
success: function (response) {
if(response.isSuccess){
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
$('.close').click();
setTimeout(function () {
if(modelTypeOfSmsSetting == '@TypeOfSmsSetting.InstitutionContractDebtReminder'){
$('#institutionContractDebtReminderTab').click();
}else if(modelTypeOfSmsSetting == '@TypeOfSmsSetting.BlockContractingParty'){
$('#blockContractingPartyTab').click();
}else if(modelTypeOfSmsSetting == '@TypeOfSmsSetting.LegalAction'){
$('#legalActionTab').click();
}else if(modelTypeOfSmsSetting == '@TypeOfSmsSetting.Warning'){
$('#warningTab').click();
}
}, 500);
}else{
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
}
},
failure: function (response) {
//console.log(5, response);
}
});
}
</script>

View File

@@ -60,8 +60,6 @@
</ItemGroup>
<ItemGroup>
<Content Remove="Areas\Admin\Pages\Company\SmsResult\_SmsSettingPartials\LegalActionSmsListData.cshtml" />
<Content Remove="Areas\Admin\Pages\Company\SmsResult\_SmsSettingPartials\WarningSmsListData.cshtml" />
<Content Remove="wwwroot\AssetsAdmin\page\Workshop\js\EditWorkshopAdmin.js" />
</ItemGroup>
@@ -173,8 +171,6 @@
<None Include="Areas\Admin\Pages\Company\PersonnelInfo\Index.cshtml" />
<None Include="Areas\Admin\Pages\Company\PersonnelInfo\PrintAll.cshtml" />
<None Include="Areas\Admin\Pages\Company\Reports\Index.cshtml" />
<None Include="Areas\Admin\Pages\Company\SmsResult\_SmsSettingPartials\WarningSmsListData.cshtml" />
<None Include="Areas\Admin\Pages\Company\SmsResult\_SmsSettingPartials\LegalActionSmsListData.cshtml" />
<None Include="Areas\Admin\Pages\Company\SmsResult\_SmsSettingPartials\ReminderSmsListData.cshtml" />
<None Include="Areas\Admin\Pages\Company\Workshops\_CreateForms\FormPermissionAccount.cshtml" />
<None Include="Areas\Admin\Pages\Company\Workshops\_EditForms\FormPermissionAccount.cshtml" />