chnage pm shift duration method on domain

This commit is contained in:
SamSys
2025-12-14 15:11:39 +03:30
parent 097d5a6e86
commit a01a927f6f
3 changed files with 139 additions and 22 deletions

View File

@@ -22,7 +22,9 @@ public class WorkingHours
PersianDayOfWeek = persianDayOfWeek;
IsActiveDay = isActiveDay;
ComputeShiftDuration(startShiftOne, endShiftOne, startShiftTwo, endShiftTwo, restTime, hasShiftOne, hasShiftTwo,hasRestTime);
var computeResult = ComputeShiftDuration(startShiftOne, endShiftOne, startShiftTwo, endShiftTwo, restTime, hasShiftOne, hasShiftTwo,hasRestTime);
ShiftDuration = computeResult.shiftDuration;
}
@@ -109,10 +111,11 @@ public class WorkingHours
/// <param name="startShift"></param>
/// <param name="endShift"></param>
/// <returns></returns>
private void ComputeShiftDuration(TimeSpan startShift, TimeSpan endShift, TimeSpan startShiftTwo, TimeSpan endShiftTwo, TimeSpan restTime, bool hasShiftOne, bool hasShiftTwo, bool hasRestTime)
public static (TimeSpan shiftDuration, int shiftDurationInMinutes) ComputeShiftDuration(TimeSpan startShift, TimeSpan endShift, TimeSpan startShiftTwo, TimeSpan endShiftTwo, TimeSpan restTime, bool hasShiftOne, bool hasShiftTwo, bool hasRestTime)
{
var now = DateTime.Now.Date;
TimeSpan shiftDurationResult = new TimeSpan();
int shiftDurationInMinutesResult = 0;
if (hasShiftOne && !hasShiftTwo)
{
DateTime startOne = new DateTime(now.Year, now.Month, now.Day, startShift.Hours, startShift.Minutes,0);
@@ -123,7 +126,8 @@ public class WorkingHours
endOne = endOne.AddDays(1);
var shiftDuration = (endOne - startOne);
ShiftDuration = hasRestTime ? (shiftDuration - restTime) : shiftDuration;
shiftDurationResult = hasRestTime ? (shiftDuration - restTime) : shiftDuration;
shiftDurationInMinutesResult = (int)shiftDurationResult.TotalMinutes;
}
else if (!hasShiftOne && hasShiftTwo)
{
@@ -134,7 +138,8 @@ public class WorkingHours
endTow = endTow.AddDays(1);
ShiftDuration = (endTow - startTow);
shiftDurationResult = (endTow - startTow);
shiftDurationInMinutesResult = (int)shiftDurationResult.TotalMinutes;
}
else if (hasShiftOne && hasShiftTwo)
{
@@ -152,13 +157,12 @@ public class WorkingHours
endTow = endTow.AddDays(1);
var shiftDurationTow = (endTow - startTow);
ShiftDuration = shiftOneDuration.Add(shiftDurationTow);
}
else
{
ShiftDurationInMinutes = 0;
shiftDurationResult = shiftOneDuration.Add(shiftDurationTow);
shiftDurationInMinutesResult = (int)shiftDurationResult.TotalMinutes;
}
return (shiftDurationResult, shiftDurationInMinutesResult);
}
}

View File

@@ -3,10 +3,15 @@
@Html.AntiForgeryToken()
@{
string adminVersion = _0_Framework.Application.Version.AdminVersion;
<link href="~/admintheme/css/workshop-create.css?ver=@adminVersion" rel="stylesheet" />
<link href="~/admintheme/page/SmsSettings/css/SmsSettings.css?ver=@adminVersion" rel="stylesheet" />
var adminVersion = _0_Framework.Application.Version.AdminVersion;
@section Styles {
<link href="~/admintheme/css/workshop-create.css?ver=@adminVersion" rel="stylesheet" />
<link href="~/AssetsAdmin/page/SmsSettings/css/SmsSettings.css?ver=@adminVersion" rel="stylesheet" />
}
}
<div class="container">
@@ -46,7 +51,7 @@
<span> پیامک مسدودی </span>
</a>
</li>
<li class="li-wizard step" id="warningTab" data-url="/Admin/Company/SmsResult/SmsSettings?handler=WarningTab">
<a class="nav-link">
@@ -58,7 +63,7 @@
<span> پیامک هشدار برای اقدام قضائی </span>
</a>
</li>
<li class="li-wizard step" id="legalActionTab" data-url="/Admin/Company/SmsResult/SmsSettings?handler=LegalActionTab">
<a class="nav-link">
<div class="success-icon" id="success-icon2" style="display:none;">
@@ -73,8 +78,8 @@
</ul>
</div>
<div class="partial-tabs" id="partialContainer"></div>
@@ -96,7 +101,115 @@
var urlAjaxToRemove = '@Url.Page("/Company/SmsResult/SmsSettings", "RemoveSetting")';
var antiforgeryToken = $('@Html.AntiForgeryToken()').val();
// $(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
// loadPartial("/Admin/Company/SmsResult/SmsSettings?handler=InstitutionContractDebtReminderTab");
// $("#institutionContractDebtReminderTab").addClass("active");
// // کلیک روی تب‌ها
// $("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").click(function (e) {
// e.preventDefault();
// let url = $(this).data("url");
// switch (this.id) {
// case "institutionContractDebtReminderTab":
// loadPartial(url);
// $("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").removeClass("active");
// $(this).addClass("active");
// break;
// case "blockContractingPartyTab":
// loadPartial(url);
// $("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").removeClass("active");
// $(this).addClass("active");
// break;
// case "legalActionTab":
// loadPartial(url);
// $("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").removeClass("active");
// $(this).addClass("active");
// break;
// case "warningTab":
// loadPartial(url);
// $("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").removeClass("active");
// $(this).addClass("active");
// break;
// }
// });
// function loadPartial(url) {
// $.get(url, function (data) {
// $("#partialContainer").html(data);
// });
// }
// });
// function remove(id) {
// $.ajax({
// dataType: 'json',
// type: 'GET',
// url: urlAjaxToRemove,
// headers: { "RequestVerificationToken": antiforgeryToken },
// 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>
<script src="~/AssetsAdmin/page/SmsSettings/js/SmsSettings.js?ver=@adminVersion"></script>
}

View File

@@ -59,10 +59,6 @@
<None Remove="wwwroot\webcamjs\flash\**" />
</ItemGroup>
<ItemGroup>
<Content Remove="wwwroot\AssetsAdmin\page\SmsSettings\js\SmsSettings.js" />
<Content Remove="wwwroot\AssetsAdmin\page\Workshop\js\EditWorkshopAdmin.js" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AccountManagement.Configuration\AccountManagement.Configuration.csproj" />
@@ -110,7 +106,11 @@
<Folder Include="wwwroot\AdminTheme\js\faceApi\" />
<Folder Include="wwwroot\AdminTheme\static\img\" />
<Folder Include="wwwroot\AssetsAdmin\page\Account\css\" />
<Folder Include="wwwroot\AssetsAdmin\page\Account\js\" />
<Folder Include="wwwroot\AssetsAdmin\page\Report\css\" />
<Folder Include="wwwroot\AssetsAdmin\page\Report\js\" />
<Folder Include="wwwroot\AssetsAdmin\page\SmsSettings\css\" />
<Folder Include="wwwroot\AssetsAdmin\page\SmsSettings\js\" />
<Folder Include="wwwroot\less\" />
<Folder Include="wwwroot\webcamjs\" />
</ItemGroup>