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,27 +1656,27 @@ public class
var task = Get(id);
EditTask res;
if (task.SenderId == _authHelper.CurrentAccountId())
{
var query = _accountContext.Tasks.Include(x => x.Assigns).Where(x => x.id == id).Select(x => new EditTask()
{
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()
{
Description = x.Description,
Id = x.id,
Title = x.Title,
medias = _accountContext.TaskMedias.Include(z => z.Media).Where(e => e.TaskId == x.id).Select(m =>
new MediaViewModel()
{
Path = m.Media.Path,
Type = m.Media.Type,
Category = m.Media.Category,
Id = m.Media.id
}).ToList(),
ContractingPartyName = x.ContractingPartyName,
ReceiverId = _accountContext.Assigns.Where(a => a.TaskId == x.id).Select(a => a.AssignedId).ToList(),
SenderId = x.SenderId,
CreateDateFa = x.CreationDate.ToFarsi(),
TicketId = x.TicketId,
Description = x.Description,
Id = x.id,
Title = x.Title,
medias = _accountContext.TaskMedias.Include(z => z.Media).Where(e => e.TaskId == x.id).Select(m =>
new MediaViewModel()
{
Path = m.Media.Path,
Type = m.Media.Type,
Category = m.Media.Category,
Id = m.Media.id
}).ToList(),
ContractingPartyName = x.ContractingPartyName,
ReceiverId = _accountContext.Assigns.Where(a => a.TaskId == x.id).Select(a => a.AssignedId).ToList(),
SenderId = x.SenderId,
CreateDateFa = x.CreationDate.ToFarsi(),
TicketId = x.TicketId,
AssignViewModels = x.Assigns.Where(a => a.IsCanceledRequest || a.IsDoneRequest || a.TimeRequest).Select(
a => new AssignViewModel()
@@ -1692,20 +1692,19 @@ public class
AssignedId = a.AssignedId,
RequestDateFa = a.RequestDate.ToFarsi()
}).ToList(),
}).ToList(),
}).FirstOrDefault();
query.TicketViewModel = query.TicketId != null && query.TicketId > 0
? _ticketRepository.GetDetails(query.TicketId.Value)
: null;
}).FirstOrDefault();
return query;
}
else
return new();
}
query.TicketViewModel = query.TicketId != null && query.TicketId > 0
? _ticketRepository.GetDetails(query.TicketId.Value)
: null;
return query;
}
return new();
}
public string GetWebEnvironmentPath()
@@ -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,8 +237,8 @@ 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")}",
}).ToList();
TotalWorkingHours = $"{(int)x.TotalWorkingHoursSpan.TotalHours}:{(int)x.TotalWorkingHoursSpan.Minutes}",
}).ToList();
return new EmployeeRollCallsByMonthViewModel()
{
PersianMonthName = selectedMonthPersian.ToString("MMMM"),
@@ -362,8 +362,8 @@ 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,8 +443,8 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
EmployeeFullName = x.EmployeeFullName,
EmployeeId = x.EmployeeId,
TotalWorkingHours =
$"{x.TotalWorkingHoursSpan.TotalHours.ToString("0")}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}",
RollCallTimesList = x.RollCallTimesList
$"{(int)x.TotalWorkingHoursSpan.TotalHours}:{(int)x.TotalWorkingHoursSpan.Minutes}",
RollCallTimesList = x.RollCallTimesList
}).ToList();
//absent ones are those who are active and not on the roll call list

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,9 +58,17 @@ 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)
public IActionResult OnGet(TaskSearchModel searchModel)
{
if (_authHelper.GetPermissions().Any(x => x == 901))
{

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();