task changes from mahan

This commit is contained in:
SamSys
2024-09-16 19:48:56 +03:30
parent 12e96867d0
commit 774c0e8463
14 changed files with 78 additions and 51 deletions

View File

@@ -20,4 +20,5 @@ public interface IPositionApplication
OperationResult RemoveAccountListFromPosition(List<long> accountIdList, long PositionId);
List<PositionViewModel> GetLowerPosition();
int GetLastPositionValue();
bool HasPositionValue(long accountId);
}

View File

@@ -193,4 +193,9 @@ public class PositionApplication : IPositionApplication
{
return _positionRepository.GetLastPositionValue();
}
public bool HasPositionValue(long accountId)
{
return _positionRepository.HasPositionValue(accountId);
}
}

View File

@@ -21,5 +21,7 @@ public interface IPositionRepository : IRepository<long, Position>
void Remove(long id);
int GetLastPositionValue();
bool HasPositionValue(long accountId);
}

View File

@@ -108,4 +108,9 @@ public class PositionRepository : RepositoryBase<long, Position>, IPositionRepos
}
public bool HasPositionValue(long accountId)
{
var userPositionId= _accountContext.Accounts.Find(accountId);
return userPositionId.PositionId is > 0 && userPositionId.PositionIsActive == "true";
}
}

View File

@@ -35,9 +35,9 @@ public class TaskMessageRepository : RepositoryBase<long, TaskMessage>, ITaskMes
public List<TaskMessageViewModel> GetTaskMessages(long assignId)
{
var accountId = long.Parse(_contextAccessor.HttpContext.User.FindFirst("AccountId").Value);
var positionId =int.Parse(_contextAccessor.HttpContext.User.FindFirst("PositionValue").Value);
var raw = _accountContext.TaskMessages.Include(x => x.TaskMessageItemsList).Include(x => x.Assign).Where(x =>
x.AssignId == assignId &&
x.TaskMessageItemsList.Any(x => x.ReceiverAccountId == accountId || x.SenderAccountId == accountId)).Select(
x.AssignId == assignId ).Select(
x => new TaskMessageViewModel()
{
SenderId = x.TaskMessageItemsList.First().SenderAccountId,

View File

@@ -73,7 +73,7 @@ public class
AssignViewModels = x.Assigns.Select(a => new AssignViewModel()
{
Id = a.id,
EndTaskDateFa = a.EndTaskDate.ToFarsiFull(),
EndTaskDateFa = a.EndTaskDate.ToFarsi(),
IsCancel = a.IsCancel,
IsCanceledRequest = a.IsCanceledRequest,
IsDone = a.IsDone,
@@ -1656,7 +1656,7 @@ public class
var task = Get(id);
EditTask res;
if (task.SenderId == _authHelper.CurrentAccountId())
if (task.SenderId == _authHelper.CurrentAccountId()|| int.Parse(_contextAccessor.HttpContext.User.FindFirst("PositionValue").Value) == 1)
{
var query = _accountContext.Tasks.Include(x => x.Assigns).Where(x => x.id == id).Select(x => new EditTask()
{
@@ -1703,7 +1703,6 @@ public class
return query;
}
else
return new();
}
@@ -1779,7 +1778,7 @@ public class
.ThenInclude(x => x.Media)
.Where(x =>
x.Task.IsActiveString == "true" && (x.AssignerId == accountId && x.AssignedId == accountId) &&
(!x.IsCanceledRequest && !x.TimeRequest && !x.IsDoneRequest))
(!x.IsCanceledRequest && !x.TimeRequest && !x.IsDoneRequest) && x.Task.Assigns.Count == 1)
.Select(x =>
new TaskViewModel()
{

View File

@@ -622,7 +622,7 @@ public class InsuranceListApplication: IInsuranceListApplication
}
//farokhiChanges
if (item.EmployeeId == 42783)
employeeDetailsForInsuranceObj.MonthlyBenefits = 5382855;
employeeDetailsForInsuranceObj.MonthlyBenefits = 53082855;
employeeDetailsForInsuranceObj.BenefitsIncludedContinuous =employeeDetailsForInsuranceObj.MonthlyBenefits + employeeDetailsForInsuranceObj.MonthlySalary;
@@ -666,7 +666,7 @@ public class InsuranceListApplication: IInsuranceListApplication
employeeDetailsForInsuranceObj.StartWorkDateGr = item.StartWorkDateGr;
//farokhiChanges
if (item.EmployeeId == 42783)
employeeDetailsForInsuranceObj.MonthlyBenefits = 5382855;
employeeDetailsForInsuranceObj.MonthlyBenefits = 53082855;
list.Add(employeeDetailsForInsuranceObj);
}

View File

@@ -95,7 +95,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
{
StartDate = x.StartDate,
EndDate = x.EndDate,
TotalWorkingHours = $"{x.TotalhourseSpan.TotalHours.ToString("0")}:{x.TotalhourseSpan.Minutes.ToString("00")}",
TotalWorkingHours = $"{(int)x.TotalhourseSpan.TotalHours}:{(int)x.TotalhourseSpan.Minutes}",
DayOfWeek = x.DayOfWeek,
RollCallDateFa = x.RollCallDateFa,
DateTimeGr = x.DateTimeGr,
@@ -237,7 +237,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
IsHoliday = _holidayItemApplication.IsHoliday(x.DateGr),
IsAbsent = !x.RollCallTimesList.Any(),
RollCallTimesList = x.RollCallTimesList,
TotalWorkingHours = $"{x.TotalWorkingHoursSpan.TotalHours.ToString("0")}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}",
TotalWorkingHours = $"{(int)x.TotalWorkingHoursSpan.TotalHours}:{(int)x.TotalWorkingHoursSpan.Minutes}",
}).ToList();
return new EmployeeRollCallsByMonthViewModel()
{
@@ -362,7 +362,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
HasLeave = x.HasLeave,
IsAbsent = x.IsAbsent,
PersonnelCode = x.PersonnelCode,
TotalWorkingHours = $"{x.TotalWorkingHoursSpan.TotalHours.ToString("0")}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}"
TotalWorkingHours = $"{(int)x.TotalWorkingHoursSpan.TotalHours}:{(int)x.TotalWorkingHoursSpan.Minutes}",
});
return result;
}
@@ -443,7 +443,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
EmployeeFullName = x.EmployeeFullName,
EmployeeId = x.EmployeeId,
TotalWorkingHours =
$"{x.TotalWorkingHoursSpan.TotalHours.ToString("0")}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}",
$"{(int)x.TotalWorkingHoursSpan.TotalHours}:{(int)x.TotalWorkingHoursSpan.Minutes}",
RollCallTimesList = x.RollCallTimesList
}).ToList();

View File

@@ -844,7 +844,7 @@ public class IndexModel : PageModel
if (workingDaysL == endMonthCurrentDayL) benefitsIncludedContinuousL = sum;
//farokhiChanges
if (employeeId == 42783)
benefitsIncludedContinuousL = 5382855;
benefitsIncludedContinuousL = 53082855;
if (workingDaysL < endMonthCurrentDayL)
{
if (endMonthCurrentDayL == 29)

View File

@@ -17,6 +17,7 @@ using CompanyManagment.Application;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Newtonsoft.Json.Linq;
@@ -57,7 +58,15 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.Task
public int UserPositionValue { get; set; }
public List<string> YearlyList { get; set; }
public override void OnPageHandlerExecuting(PageHandlerExecutingContext context)
{
bool hasAccessToTask = _positionApplication.HasPositionValue(_authHelper.CurrentAccountId());
if (!hasAccessToTask)
{
context.Result = Forbid();
}
base.OnPageHandlerExecuting(context);
}
public IActionResult OnGet(TaskSearchModel searchModel)
{

Binary file not shown.

Binary file not shown.

View File

@@ -19,8 +19,8 @@
"sqlDebugging": true,
"dotnetRunMessages": "true",
"nativeDebugging": true,
//"applicationUrl": "https://localhost:5004;http://localhost:5003;http://192.168.0.118:82;https://192.168.0.118:83",
"applicationUrl": "https://localhost:5004;http://localhost:5003",
"applicationUrl": "https://localhost:5004;http://localhost:5003;http://192.168.0.118:82;https://192.168.0.118:83",
//"applicationUrl": "https://localhost:5004;http://localhost:5003",
"jsWebView2Debugging": false,
"hotReloadEnabled": true
},

View File

@@ -1,4 +1,5 @@
$(document).ready(function () {
$(document).ready(function () {
if ($(window).width() > 992) {
$('#desktopDisplay').show();
$('#mobileDisplay').hide();
@@ -520,6 +521,11 @@ function inCom(employeeId) {
// ------------------------------------------------------------- keyboard number
$(document).ready(function () {
//const androidUserAgentString = window.navigator.userAgent.slice(window.navigator.userAgent.indexOf("Android"));
//const androidDeviceName = androidUserAgentString.slice(androidUserAgentString.indexOf("; ") + 1, androidUserAgentString.indexOf(")"));
//console.log(androidDeviceName);
$('#errorMessage').text(androidUserAgentString);
$('.keypad-numbers .item').click(function () {
let number = $(this).text().trim();