Instan Send Block Sms Completed
This commit is contained in:
@@ -68,4 +68,11 @@ public interface ISmsSettingApplication
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> InstantSendReminderSms(List<SmsListData> command);
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک مسدودس
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> InstantSendBlockSms(List<BlockSmsListData> command);
|
||||
}
|
||||
@@ -144,4 +144,22 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
|
||||
|
||||
}
|
||||
|
||||
public async Task<OperationResult> InstantSendBlockSms(List<BlockSmsListData> command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
string typeOfSms = "اعلام مسدودی طرف حساب";
|
||||
string sendMessStart = "شروع مسدودی آنی";
|
||||
string sendMessEnd = "پایان مسدودی آنی ";
|
||||
if (command.Any())
|
||||
{
|
||||
await _institutionContractRepository.SendBlockSmsToContractingParties(command, typeOfSms, sendMessStart,
|
||||
sendMessEnd);
|
||||
return op.Succcedded();
|
||||
}
|
||||
else
|
||||
{
|
||||
return op.Failed("موردی انتخاب نشده است");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3585,6 +3585,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
Thread.Sleep(1000);
|
||||
await _smsService.Alarm("09111485044", sendMessStart);
|
||||
Thread.Sleep(1000);
|
||||
int successProcess = 1;
|
||||
int countList = smsListData.Count;
|
||||
|
||||
foreach (var item in smsListData)
|
||||
{
|
||||
@@ -3606,7 +3608,12 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
await _smsService.Alarm("09114221321", errMess);
|
||||
|
||||
}
|
||||
Thread.Sleep(600);
|
||||
var percent = (successProcess / (double)countList) * 100;
|
||||
await _hubContext.Clients.Group(SendSmsHub.GetGroupName(10))
|
||||
.SendAsync("showStatus", (int)percent);
|
||||
|
||||
successProcess += 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -161,13 +161,38 @@ namespace ServiceHost.Areas.Admin.Pages.Company.SmsResult
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// لود مودال ارسال پیامک مسدودس
|
||||
/// لود مودال ارسال پیامک مسدودی
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IActionResult> OnGetInstantBlockSendSms(TypeOfSmsSetting typeOfSmsSetting)
|
||||
public async Task<IActionResult> OnGetInstantBlockSms(TypeOfSmsSetting typeOfSmsSetting)
|
||||
{
|
||||
return Partial("_SmsSettingPartials/InstantSms");
|
||||
return Partial("_SmsSettingPartials/InstantBlockSms");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// لود دیتای ارسال پیامک مسدودس آنی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IActionResult> OnGetInstantBlockSendSms()
|
||||
{
|
||||
var dataModel = await _smsSettingApplication.GetBlockSmsListData(TypeOfSmsSetting.InstitutionContractDebtReminder);
|
||||
return Partial("_SmsSettingPartials/_InstantSendBlockSms", dataModel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک مسدودی آنی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<JsonResult> OnPostInstantBlockSendSms([FromBody] List<BlockSmsListData> command)
|
||||
{
|
||||
|
||||
var result = await _smsSettingApplication.InstantSendBlockSms(command);
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccess = result.IsSuccedded,
|
||||
message = result.Message
|
||||
});
|
||||
}
|
||||
//=================================== تب ها ========================================//
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
|
||||
<a class="btn btn-success instantSendSms"
|
||||
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "InstantSendBlockSms")">
|
||||
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "InstantBlockSms")">
|
||||
|
||||
|
||||
<span class="icon-span">
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
@Html.AntiForgeryToken()
|
||||
@{
|
||||
<style>
|
||||
.modal .modal-dialog .modal-content{
|
||||
padding-bottom: 10px !important;
|
||||
}
|
||||
.modal-title{
|
||||
position: absolute;
|
||||
width: 291px;
|
||||
font-size: 18px;
|
||||
background-color: inherit;
|
||||
left: 47%;
|
||||
top: 19px;
|
||||
margin-left: -100px;
|
||||
text-align: center;
|
||||
color: black;
|
||||
border: 1px solid #00000030;
|
||||
border-radius: 9px;
|
||||
padding: 2px 0px;
|
||||
}
|
||||
.skeleton-loader {
|
||||
width: 100%;
|
||||
height: 35px;
|
||||
background: linear-gradient(90deg, #EEEEEE 25%, #DEDEDE 50%, #EEEEEE 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: loading 2s infinite ease-in-out;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 3px
|
||||
}
|
||||
|
||||
|
||||
.progBar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#createProcess {
|
||||
background-color: #fdfdfd;
|
||||
height: 70px;
|
||||
border-radius: 7px;
|
||||
margin: 4px 2px 4px 2px;
|
||||
box-shadow: 0px 1px 7px 0 #155c5c;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
color: #fff !important;
|
||||
font-size: 17px !important;
|
||||
line-height: 23px !important;
|
||||
border-radius: 10px !important;
|
||||
}
|
||||
|
||||
@@keyframes loading {
|
||||
0% {
|
||||
background-position: 200% 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
background-position: -200% 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">ارسال آنی پیامک یادآور</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="بستن">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="card card-pattern m-t-10" style="border-radius: 15px 15px 0px 0px;">
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- هدر -->
|
||||
<div class="row fw-bold mb-2 head-table">
|
||||
<div class="col-2 col-md-1">ردیف</div>
|
||||
<div class="col-10 col-md-3"> نام طرف حساب </div>
|
||||
<div class="col-6 col-md-3"> شماره تماس </div>
|
||||
<div class="col-6 col-md-3" style="text-align:left; left:1.2%"> مبلغ بدهی </div>
|
||||
<div class="col-12 col-md-2" style="float:right;text-align:right; direction:ltr; left: 1.2%">
|
||||
تیک ارسال
|
||||
<label class="switch">
|
||||
<input id="checkAll" type="checkbox" checked />
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="createProcess" class="row progress-bar-striped progBar">
|
||||
<div class="form-group" style="padding: 0px 10px;">
|
||||
<span style="text-align: center">
|
||||
<h3 style="font-size: 15px;color: #767575;margin-top: 3px;margin-bottom:0px">درصد ارسال پیامک ها</h3>
|
||||
</span>
|
||||
|
||||
|
||||
<div class="progress" style="height: 20px">
|
||||
<div id="progress-bar-w" style="background-color: rgb(16 170 18)" class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="card card-pattern " style="margin-top:2px;height:600px; overflow-y:scroll; border-radius: 0 0 15px 15px">
|
||||
|
||||
|
||||
<div class="container-fluid" id="partialAppendBlockList">
|
||||
|
||||
|
||||
<div id="loading">
|
||||
|
||||
@for (var j = 0; j < 16; j++)
|
||||
{
|
||||
<div class="skeleton-loader"></div>
|
||||
}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal-footer border-0">
|
||||
<button type="button" onclick="sendToSms()" 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>
|
||||
$(document).ready(function () {
|
||||
var url = "/Admin/Company/SmsResult/SmsSettings?handler=InstantBlockSendSms";
|
||||
$.get(url, function (data) {
|
||||
$("#loading").hide();
|
||||
$("#partialAppendBlockList").html(data);
|
||||
|
||||
});
|
||||
|
||||
var gNo = Number(10);
|
||||
setTimeout(function () {
|
||||
|
||||
connectToGroupW(gNo);
|
||||
|
||||
},
|
||||
2000);
|
||||
|
||||
});
|
||||
console.log('befor start ...');
|
||||
var connection = new signalR.HubConnectionBuilder().withUrl("/trackingSendSmsHub").build();
|
||||
|
||||
|
||||
connection.start().then(function () {
|
||||
console.log("connect.....!");
|
||||
}).catch(function (err) {
|
||||
return console.error(err.toString());
|
||||
});
|
||||
|
||||
function connectToGroupW(id) {
|
||||
connection.invoke("send", id)
|
||||
.catch(function (err) {
|
||||
console.error(err.toString());
|
||||
});
|
||||
console.log(`connected to group...${id}`);
|
||||
|
||||
}
|
||||
|
||||
connection.on('showStatus',
|
||||
function (percent) {
|
||||
$('#progress-bar-w').css("width", percent + "%");
|
||||
$('#progress-bar-w').text(percent + '%');
|
||||
});
|
||||
//ارسال پیامک
|
||||
function sendToSms() {
|
||||
const recordItems = document.querySelectorAll(".record");
|
||||
const command = [];
|
||||
|
||||
recordItems.forEach(recordItem => {
|
||||
|
||||
const checkbox = recordItem.querySelector('input[type="checkbox"]');
|
||||
|
||||
if (checkbox && checkbox.checked) {
|
||||
|
||||
const SmsListData = {
|
||||
PhoneNumber: checkbox.dataset.phonenumber,
|
||||
PartyName: checkbox.dataset.partyname,
|
||||
Amount: checkbox.dataset.amount,
|
||||
ContractingPartyId: Number(checkbox.dataset.contractingpartyid),
|
||||
AccountType: checkbox.dataset.accountType,
|
||||
InstitutionContractId: Number(checkbox.dataset.institutioncontractid),
|
||||
AproveId: checkbox.dataset.aproveid,
|
||||
};
|
||||
|
||||
command.push(SmsListData);
|
||||
}
|
||||
});
|
||||
|
||||
if (command.length === 0) {
|
||||
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "هیچ موردی انتخاب نشده است");
|
||||
return;
|
||||
}
|
||||
$('#createProcess').removeClass("progBar");
|
||||
var urlAjaxToSendSms = '@Url.Page("/Company/SmsResult/SmsSettings", "InstantBlockSendSms")';
|
||||
|
||||
$.ajax({
|
||||
url: urlAjaxToSendSms,
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
|
||||
data: JSON.stringify(command),
|
||||
success: function (response) {
|
||||
if (response.isSuccess) {
|
||||
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
|
||||
} else {
|
||||
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
|
||||
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "خطا در ارسال اطلاعات");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
//روشن یا خاموش کردن تیک برای همه
|
||||
$('#checkAll').on('change', function () {
|
||||
const status = this.checked; // true یا false
|
||||
$('input[type="checkbox"]').each(function () {
|
||||
|
||||
|
||||
$(this).prop('checked', status);
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,100 @@
|
||||
@model List<CompanyManagment.App.Contracts.InstitutionContract.BlockSmsListData>
|
||||
@{
|
||||
int countIndex = 1;
|
||||
|
||||
<style>
|
||||
/* Toggle Switch */
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 46px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
transition: .3s;
|
||||
border-radius: 34px;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
left: 3px;
|
||||
bottom: 3px;
|
||||
background-color: white;
|
||||
transition: .3s;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #28a745; /* رنگ سبز مشابه Bootstrap */
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
transform: translateX(22px);
|
||||
}
|
||||
|
||||
</style>
|
||||
}
|
||||
|
||||
|
||||
<!-- لیست -->
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
|
||||
|
||||
<div class="row align-items-center p-2 tr-table record">
|
||||
|
||||
<div class="col-2 col-md-1"><div class="row-number">@countIndex</div></div>
|
||||
<div class="col-10 col-md-3">@item.PartyName</div>
|
||||
<div class="col-6 col-md-3">@item.PhoneNumber</div>
|
||||
<div class="col-6 col-md-3" style="text-align:left;">@item.Amount</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<label class="switch">
|
||||
<input data-id="@countIndex"
|
||||
type="checkbox" checked
|
||||
|
||||
data-PhoneNumber="@item.PhoneNumber"
|
||||
data-PartyName="@item.PartyName"
|
||||
data-Amount="@item.Amount"
|
||||
data-ContractingPartyId="@item.ContractingPartyId"
|
||||
data-AccountType="@item.AccountType"
|
||||
data-InstitutionContractId="@item.InstitutionContractId"
|
||||
data-AproveId="@item.AproveId"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@{
|
||||
countIndex++;
|
||||
}
|
||||
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user