poya changesc added

This commit is contained in:
SamSys
2024-08-29 15:00:22 +03:30
parent 4d0370aa70
commit 9eec22e9e4
61 changed files with 8530 additions and 1300 deletions

View File

@@ -17,4 +17,6 @@ public interface ICameraAccountApplication
OperationResult Active(long id);
OperationResult DeActive(long id);
OperationResult ChangePass(ChangePassword command);
bool HasCameraAccount(long workshopId, long accountId);
OperationResult CheckUsername(string username);
}

View File

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.Account;
using AccountManagement.Application.Contracts.CameraAccount;
using AccountManagement.Domain.AccountAgg;
using AccountManagement.Domain.CameraAccountAgg;
namespace AccountManagement.Application;
@@ -14,11 +15,13 @@ public class CameraAccountApplication : ICameraAccountApplication
{
private readonly ICameraAccountRepository _cameraAccountRepository;
private readonly IPasswordHasher _passwordHasher;
private readonly IAccountRepository _accountRepository;
public CameraAccountApplication(ICameraAccountRepository cameraAccountRepository, IPasswordHasher passwordHasher)
public CameraAccountApplication(ICameraAccountRepository cameraAccountRepository, IPasswordHasher passwordHasher, IAccountRepository accountRepository)
{
_cameraAccountRepository = cameraAccountRepository;
_passwordHasher = passwordHasher;
_accountRepository = accountRepository;
}
public OperationResult Create(CreateCameraAccount command)
@@ -51,6 +54,19 @@ public class CameraAccountApplication : ICameraAccountApplication
return _cameraAccountRepository.GetDetails(id);
}
public bool HasCameraAccount(long workshopId, long accountId)
{
return _cameraAccountRepository.Exists(x => x.WorkshopId == workshopId && x.AccountId == accountId);
}
public OperationResult CheckUsername(string username)
{
var operation = new OperationResult();
if (_cameraAccountRepository.Exists(x => x.Username == username) || _accountRepository.Exists(x => x.Username == username))
return operation.Failed("نام کاربری تکراری است");
return operation.Succcedded();
}
public OperationResult Active(long id)
{
var opration = new OperationResult();

View File

@@ -13,7 +13,11 @@ namespace Company.Domain.RollCallAgg
{
EditRollCall GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId);
EditRollCall GetById(long id);
List<RollCallViewModel> GetCurrentDay(RollCallSearchModel searchModel);
RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel);
List<RollCallViewModel> Search(RollCallSearchModel searchModel);
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId);
List<CheckoutDailyRollCallViewModel> GetEmployeeRollCallsForDuration(long employeeId, long workshopId, DateTime startDate, DateTime endDate);
long Flag(long employeeId, long workshopId);

View File

@@ -10,6 +10,7 @@ public interface IRollCallEmployeeRepository : IRepository<long, RollCallEmploye
EditRollCallEmployee GetDetails(long id);
RollCallEmployeeViewModel GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId);
List<RollCallEmployeeViewModel> GetPersonnelRollCallList(long workshopId);
//rollcallEmployeeIncludeStatus
RollCallEmployee GetWithRollCallStatus(long id);
int activedPerson(long workshopId);
}

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Domain;
using Company.Domain.RollCallEmployeeStatusAgg;
namespace Company.Domain.RollCallEmployeeAgg;
@@ -24,7 +25,7 @@ public class RollCallEmployee : EntityBaseWithoutCreationDate
public string EmployeeFullName { get; private set; }
public string IsActiveString { get; private set; }
public string HasUploadedImage { get; private set; }
public List<RollCallEmployeeStatus> EmployeesStatus { get; private set; }
public void HasImage()
{

View File

@@ -0,0 +1,11 @@
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
using System.Collections.Generic;
namespace Company.Domain.RollCallEmployeeStatusAgg
{
public interface IRollCallEmployeeStatusRepository : IRepository<long, RollCallEmployeeStatus>
{
List<RollCallEmployeeStatusViewModel> GetAll();
}
}

View File

@@ -0,0 +1,40 @@
using _0_Framework.Application;
using _0_Framework.Domain;
using Company.Domain.RollCallEmployeeAgg;
using System;
namespace Company.Domain.RollCallEmployeeStatusAgg
{
public class RollCallEmployeeStatus : EntityBaseWithoutCreationDate
{
public long RollCallEmployeeId { get; private set; }
public RollCallEmployee RollCallEmployee { get; private set; }
public DateTime StartDate { get; private set; }
public DateTime EndDate { get; private set; }
public RollCallEmployeeStatus(long rollCallEmployeeId, DateTime startDate, DateTime endDate)
{
RollCallEmployeeId = rollCallEmployeeId;
StartDate = startDate;
EndDate = endDate;
}
public RollCallEmployeeStatus(long rollCallEmployeeId, DateTime startDate)
{
RollCallEmployeeId = rollCallEmployeeId;
StartDate = startDate;
EndDate = Tools.GetUndefinedDateTime();
}
public void Edit(DateTime startDate, DateTime endDate)
{
StartDate = startDate;
EndDate = endDate;
}
public void Deactivate(DateTime endDate)
{
EndDate = endDate;
}
}
}

View File

@@ -0,0 +1,10 @@
namespace CompanyManagment.App.Contracts.RollCall;
public class AbsentEmployeeViewModel
{
public long EmployeeId { get; set; }
public string EmployeeFullName { get; set; }
public string PersonnelCode { get; set; }
public string Reason { get; set; }
}

View File

@@ -0,0 +1,24 @@
using System;
namespace CompanyManagment.App.Contracts.RollCall
{
#region Pooya
public class CheckoutDailyRollCallViewModel
{
public string RollCallDateFa { get; set; }
public string StartDate { get; set; }
public string EndDate { get; set; }
public DateTime DateTimeGr { get; set; }
//منقطع بودن شیفت کاری
public bool IsSliced { get; set; }
public string TotalWorkingHours { get; set; }
public string DayOfWeek { get; set; }
}
#endregion
}

View File

@@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.RollCall
{
public class CurrentDayRollCall
{
public List<RollCallViewModel> PresentEmployees { get; set; }
public List<AbsentEmployeeViewModel> AbsentEmployees { get; set; }
}
}

View File

@@ -13,8 +13,15 @@ namespace CompanyManagment.App.Contracts.RollCall
OperationResult Edit(long id);
EditRollCall GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId);
List<CheckoutDailyRollCallViewModel> GetActiveEmployeeRollCallsForDuration(long employeeId, long workshopId,
DateTime startDate, DateTime endDate);
EditRollCall GetById(long id);
List<RollCallViewModel> Search(RollCallSearchModel searchModel);
List<RollCallViewModel> GetCurrentDay(RollCallSearchModel searchModel);
List<RollCallViewModel> GetHistoryCase(RollCallSearchModel searchModel);
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId);
RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel);
long Flag(long employeeId, long workshopId);
}
}

View File

@@ -12,4 +12,16 @@ public class RollCallSearchModel
public DateTime? EndDate { get; set; }
public int Year { get; set; }
public int Month { get; set; }
public int PageIndex { get; set; }
#region Pooya
public int DateIndex { get; set; }
#endregion
#region Mahan
public string StarDateFa { get; set; }
public string EndDateFa { get; set; }
public string ExactDateFa { get; set; }
#endregion
}

View File

@@ -0,0 +1,10 @@
using System;
namespace CompanyManagment.App.Contracts.RollCall;
public class RollCallTimeViewModel
{
public string StartDate { get; set; }
public string EndDate { get; set; }
public TimeSpan TotalHours { get; set; }
}

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.RollCall;
@@ -6,12 +7,21 @@ public class RollCallViewModel
{
public long Id { get; set; }
public long WorkshopId { get; set; }
public string Reason { get; set; }
public long EmployeeId { get; set; }
public string PersonnelCode { get; set; }
public string EmployeeFullName { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
public string DateFa { get; set; }
public DateTime DateGr { get; set; }
public int Year { get; set; }
public int Month { get; set; }
public TimeSpan ShiftSpan { get; set; }
public DateTime CreationDate { get; set; }
public string StartDateFa { get; set; }
public string EndDateFa { get; set; }
public IEnumerable<RollCallTimeViewModel> RollCallTimesList { get; set; }
public double TotalWorkingHours { get; set; }
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.RollCall
{
public class RollCallsByDateViewModel
{
public string DateFa { get; set; }
public DateTime DateGr { get; set; }
public IEnumerable<RollCallViewModel> ActiveEmployees { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace CompanyManagment.App.Contracts.RollCallEmployeeStatus
{
public class CreateRollCallEmployeeStatus
{
public long RollCallEmployeeId { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System;
namespace CompanyManagment.App.Contracts.RollCallEmployeeStatus
{
public class EditRollCallEmployeeStatus
{
public long Id { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.RollCallEmployeeStatus
{
public interface IRollCallEmployeeStatusApplication
{
OperationResult Create(CreateRollCallEmployeeStatus cmd);
OperationResult Deactivate(long id);
OperationResult Edit(EditRollCallEmployeeStatus cmd);
}
}

View File

@@ -0,0 +1,9 @@
namespace CompanyManagment.App.Contracts.RollCallEmployeeStatus
{
public class RollCallEmployeeStatusViewModel
{
public long Id { get; set; }
public string StartDate { get; set; }
public string EndDate { get; set; }
}
}

View File

@@ -53,6 +53,15 @@ public class RollCallApplication : IRollCallApplication
return _rollCallRepository.GetByEmployeeIdAndWorkshopId(employeeId, workshopId);
}
public List<CheckoutDailyRollCallViewModel> GetActiveEmployeeRollCallsForDuration(long employeeId, long workshopId, DateTime startDate, DateTime endDate)
{
if (startDate >= endDate)
return new();
return _rollCallRepository.GetEmployeeRollCallsForDuration(employeeId, workshopId, startDate, endDate);
}
public EditRollCall GetById(long id)
{
return _rollCallRepository.GetById(id);
@@ -63,6 +72,26 @@ public class RollCallApplication : IRollCallApplication
return _rollCallRepository.Search(searchModel);
}
public List<RollCallViewModel> GetCurrentDay(RollCallSearchModel searchModel)
{
return _rollCallRepository.GetCurrentDay(searchModel);
}
public List<RollCallViewModel> GetHistoryCase(RollCallSearchModel searchModel)
{
return _rollCallRepository.GetCurrentDay(searchModel);
}
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId)
{
return _rollCallRepository.GetWorkshopCurrentDayRollCalls(workshopId);
}
public RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel)
{
return _rollCallRepository.GetWorkshopRollCallHistory(searchModel);
}
public long Flag(long employeeId, long workshopId)
{
return _rollCallRepository.Flag(employeeId, workshopId);

View File

@@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.Linq;
using _0_Framework.Application;
using Company.Domain.EmployeeAgg;
using Company.Domain.RollCallEmployeeAgg;
using CompanyManagment.App.Contracts.RollCallEmployee;
using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
namespace CompanyManagment.Application;
@@ -10,11 +12,13 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication
{
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
private readonly IEmployeeRepository _employeeRepository;
private readonly IRollCallEmployeeStatusApplication _rollCallEmployeeStatusApplication;
public RollCallEmployeeApplication(IRollCallEmployeeRepository rollCallEmployeeRepository, IEmployeeRepository employeeRepository)
public RollCallEmployeeApplication(IRollCallEmployeeRepository rollCallEmployeeRepository, IEmployeeRepository employeeRepository, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication)
{
_rollCallEmployeeRepository = rollCallEmployeeRepository;
_employeeRepository = employeeRepository;
_rollCallEmployeeStatusApplication = rollCallEmployeeStatusApplication;
}
public OperationResult Create(CreateRollCallEmployee command)
@@ -39,20 +43,26 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication
var emp = _rollCallEmployeeRepository.Get(id);
if (emp == null)
return opreation.Failed("پرسنل یافت نشد");
if(emp.HasUploadedImage == "false")
return opreation.Failed("لطفا ابتدا عکس پرسنل را آپلود کنید");
emp.Active();
_rollCallEmployeeRepository.SaveChanges();
_rollCallEmployeeStatusApplication.Create(new CreateRollCallEmployeeStatus() { RollCallEmployeeId = id });
return opreation.Succcedded();
}
public OperationResult DeActive(long id)
{
var opreation = new OperationResult();
var emp = _rollCallEmployeeRepository.Get(id);
var emp = _rollCallEmployeeRepository.GetWithRollCallStatus(id);
if (emp == null)
return opreation.Failed("پرسنل یافت نشد");
var lastStatus = emp.EmployeesStatus.MaxBy(x => x.StartDate);
if (!lastStatus.EndDate.IsDateUndefined())
return opreation.Failed("حضور و غیاب کارمند قبلا غیر فعال شده است");
emp.DeActive();
_rollCallEmployeeRepository.SaveChanges();
_rollCallEmployeeStatusApplication.Deactivate(lastStatus.id);
return opreation.Succcedded();
}

View File

@@ -0,0 +1,74 @@
using _0_Framework.Application;
using Company.Domain.LeftWorkAgg;
using Company.Domain.RollCallEmployeeAgg;
using Company.Domain.RollCallEmployeeStatusAgg;
using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
using System;
using System.Collections.Generic;
namespace CompanyManagment.Application
{
public class RollCallEmployeeStatusApplication : IRollCallEmployeeStatusApplication
{
private readonly IRollCallEmployeeStatusRepository _employeeRollCallStatusRepository;
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
private readonly ILeftWorkRepository _leftWorkRepository;
public RollCallEmployeeStatusApplication(IRollCallEmployeeStatusRepository employeeStatusRepository, IRollCallEmployeeRepository rollCallEmployeeRepository, ILeftWorkRepository leftWorkRepository)
{
_employeeRollCallStatusRepository = employeeStatusRepository;
_rollCallEmployeeRepository = rollCallEmployeeRepository;
_leftWorkRepository = leftWorkRepository;
}
public OperationResult Create(CreateRollCallEmployeeStatus cmd)
{
OperationResult op = new();
RollCallEmployee employee = _rollCallEmployeeRepository.Get(cmd.RollCallEmployeeId);
if (employee == null)
return op.Failed("کارمند مجاز نیست");
if (!_leftWorkRepository.Exists(x => x.EmployeeId == employee.EmployeeId && x.WorkshopId == employee.WorkshopId &&
x.LeftWorkDate.Date > DateTime.Now.Date && x.StartWorkDate.Date < DateTime.Now.Date))
return op.Failed("کارمند در کارگاه شروع به کار نکرده است");
if (_employeeRollCallStatusRepository.Exists(x => x.EndDate >= DateTime.Now.Date && employee.id == x.RollCallEmployeeId))
return op.Failed("تکراری است");
RollCallEmployeeStatus newRecord = new(employee.id, DateTime.Now.Date);
_employeeRollCallStatusRepository.Create(newRecord);
_employeeRollCallStatusRepository.SaveChanges();
return op.Succcedded();
}
public OperationResult Deactivate(long id)
{
OperationResult op = new();
RollCallEmployeeStatus entity = _employeeRollCallStatusRepository.Get(id);
if (entity == null)
return op.Failed(ApplicationMessages.RecordNotFound);
if (!entity.EndDate.IsDateUndefined())
return op.Failed("کارمند قبلا غیر فعال شده است");
entity.Deactivate(DateTime.Now.Date);
_employeeRollCallStatusRepository.SaveChanges();
return op.Succcedded();
}
public OperationResult Edit(EditRollCallEmployeeStatus cmd)
{
OperationResult op = new();
RollCallEmployeeStatus entity = _employeeRollCallStatusRepository.Get(cmd.Id);
if (entity == null)
return op.Failed(ApplicationMessages.RecordNotFound);
entity.Edit(cmd.StartDate, cmd.EndDate);
_employeeRollCallStatusRepository.SaveChanges();
return op.Succcedded();
}
public List<RollCallEmployeeStatusViewModel> GetAll()
{
return _employeeRollCallStatusRepository.GetAll();
}
}
}

View File

@@ -68,6 +68,7 @@ using Company.Domain.ProceedingSession;
using Company.Domain.RepresentativeAgg;
using Company.Domain.RollCallAgg;
using Company.Domain.RollCallEmployeeAgg;
using Company.Domain.RollCallEmployeeStatusAgg;
using Company.Domain.RollCallPlanAgg;
using Company.Domain.RollCallServiceAgg;
using Company.Domain.SmsResultAgg;
@@ -132,6 +133,7 @@ public class CompanyContext : DbContext
public DbSet<TaxLeftWorkItem> TaxLeftWorkItems { get; set; }
public DbSet<TaxLeftWorkCategory> TaxLeftWorkCategories { get; set; }
public DbSet<TaxJobCategory> TaxJobCategories { get; set; }
public DbSet<RollCallEmployeeStatus> RollCallEmployeesStatus { get; set; }
public DbSet<RollCallEmployee> RollCallEmployees { get; set; }
public DbSet<RollCallPlan> RollCallPlans { get; set; }
public DbSet<InstitutionPlan> InstitutionPlans { get; set; }

View File

@@ -16,6 +16,9 @@ public class RollCallEmployeeMapping : IEntityTypeConfiguration<RollCallEmployee
builder.Property(x => x.EmployeeFullName).HasMaxLength(100);
builder.Property(x => x.IsActiveString).HasMaxLength(5);
builder.Property(x => x.HasUploadedImage).HasMaxLength(5);
builder.HasMany(x => x.EmployeesStatus)
.WithOne(x => x.RollCallEmployee)
.HasForeignKey(x => x.RollCallEmployeeId);
}
}

View File

@@ -0,0 +1,21 @@
using Company.Domain.RollCallEmployeeStatusAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping
{
public class RollCallEmployeeStatusMapping : IEntityTypeConfiguration<RollCallEmployeeStatus>
{
public void Configure(EntityTypeBuilder<RollCallEmployeeStatus> builder)
{
builder.HasKey(x => x.id);
builder.Property(x => x.EndDate).IsRequired();
builder.Property(x => x.StartDate).IsRequired();
builder.Property(x => x.RollCallEmployeeId).IsRequired();
builder.HasOne(x => x.RollCallEmployee)
.WithMany(x => x.EmployeesStatus).HasForeignKey(x => x.RollCallEmployeeId);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class RollCallEmployeeStatus : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "RollCallEmployeesStatus",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RollCallEmployeeId = table.Column<long>(type: "bigint", nullable: false),
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
EndDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RollCallEmployeesStatus", x => x.id);
table.ForeignKey(
name: "FK_RollCallEmployeesStatus_RollCallEmployees_RollCallEmployeeId",
column: x => x.RollCallEmployeeId,
principalTable: "RollCallEmployees",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_RollCallEmployeesStatus_RollCallEmployeeId",
table: "RollCallEmployeesStatus",
column: "RollCallEmployeeId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RollCallEmployeesStatus");
}
}
}

View File

@@ -3389,6 +3389,30 @@ namespace CompanyManagment.EFCore.Migrations
b.ToTable("RollCallEmployees", (string)null);
});
modelBuilder.Entity("Company.Domain.RollCallEmployeeStatusAgg.RollCallEmployeeStatus", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<DateTime>("EndDate")
.HasColumnType("datetime2");
b.Property<long>("RollCallEmployeeId")
.HasColumnType("bigint");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.HasKey("id");
b.HasIndex("RollCallEmployeeId");
b.ToTable("RollCallEmployeesStatus");
});
modelBuilder.Entity("Company.Domain.RollCallPlanAgg.RollCallPlan", b =>
{
b.Property<long>("id")
@@ -5146,6 +5170,17 @@ namespace CompanyManagment.EFCore.Migrations
b.Navigation("Board");
});
modelBuilder.Entity("Company.Domain.RollCallEmployeeStatusAgg.RollCallEmployeeStatus", b =>
{
b.HasOne("Company.Domain.RollCallEmployeeAgg.RollCallEmployee", "RollCallEmployee")
.WithMany("EmployeesStatus")
.HasForeignKey("RollCallEmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RollCallEmployee");
});
modelBuilder.Entity("Company.Domain.RollCallServiceAgg.RollCallService", b =>
{
b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop")
@@ -5503,6 +5538,11 @@ namespace CompanyManagment.EFCore.Migrations
b.Navigation("FileEmployerList");
});
modelBuilder.Entity("Company.Domain.RollCallEmployeeAgg.RollCallEmployee", b =>
{
b.Navigation("EmployeesStatus");
});
modelBuilder.Entity("Company.Domain.SubtitleAgg.EntitySubtitle", b =>
{
b.Navigation("Chapters");

View File

@@ -1,9 +1,12 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.RollCallEmployeeAgg;
using CompanyManagment.App.Contracts.RollCallEmployee;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
@@ -11,9 +14,14 @@ namespace CompanyManagment.EFCore.Repository;
public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>, IRollCallEmployeeRepository
{
private readonly CompanyContext _context;
public RollCallEmployeeRepository(CompanyContext context) : base(context)
private readonly IPasswordHasher _passwordHasher;
private readonly IWebHostEnvironment _webHostEnvironment;
public RollCallEmployeeRepository(CompanyContext context, IPasswordHasher passwordHasher, IWebHostEnvironment webHostEnvironment) : base(context)
{
_context = context;
_passwordHasher = passwordHasher;
_webHostEnvironment = webHostEnvironment;
}
public List<RollCallEmployeeViewModel> GetByWorkshopId(long workshopId)
@@ -46,30 +54,152 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
public RollCallEmployeeViewModel GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId)
{
return _context.RollCallEmployees.Select(x => new RollCallEmployeeViewModel()
return _context.RollCallEmployees.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x => new RollCallEmployeeViewModel()
{
Id = x.id,
WorkshopId = x.WorkshopId,
EmployeeFullName = x.EmployeeFullName,
IsActiveString = x.IsActiveString,
HasUploadedImage = x.HasUploadedImage
}).FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId);
}).FirstOrDefault();
}
public List<RollCallEmployeeViewModel> GetPersonnelRollCallList(long workshopId)
{
var nowFa = DateTime.Now;
var employee = _context.Employees.Include(x => x.LeftWorks).Where(l => l.LeftWorks.Any(c => c.StartWorkDate <= nowFa && c.LeftWorkDate > nowFa && c.WorkshopId == workshopId));
//var nowFa = DateTime.Now;
//var employee = _context.Employees.Include(x => x.LeftWorks).Where(l => l.LeftWorks.Any(c => c.StartWorkDate <= nowFa && c.LeftWorkDate > nowFa && c.WorkshopId == workshopId));
return employee.Select(x => new RollCallEmployeeViewModel
//return employee.Select(x => new RollCallEmployeeViewModel
//{
// WorkshopId = workshopId,
// EmployeeId = x.id,
// EmployeeFullName= x.FName + ' ' + x.LName,
// NationalCode = x.NationalCode,
// IsActiveString = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == workshopId && r.IsActiveString == "true") ? "true" : "false",
// HasUploadedImage = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == workshopId && r.HasUploadedImage == "true") ? "true" : "false",
//}).ToList();
var leftDate = new DateTime(2121, 3, 21);
var join = new List<RollCallEmployeeViewModel>();
var contractLeftWork = _context.LeftWorkList.Select(x => new RollCallEmployeeViewModel()
{
WorkshopId = workshopId,
EmployeeId = x.id,
EmployeeFullName= x.FName + ' ' + x.LName,
NationalCode = x.NationalCode,
IsActiveString = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == workshopId && r.IsActiveString == "true") ? "true" : "false",
HasUploadedImage = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == workshopId && r.HasUploadedImage == "true") ? "true" : "false",
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
PersonName = x.EmployeeFullName,
PersonelCode = 0,
ContractPerson = true,
ContractLeft = x.LeftWorkDate != leftDate,
StartWork = x.StartWorkDate
}).Where(x => x.WorkshopId == workshopId).OrderByDescending(x => x.StartWork).ToList();
contractLeftWork = contractLeftWork.Select(x => new RollCallEmployeeViewModel()
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
PersonName = x.PersonName,
PersonelCode = _context.PersonnelCodeSet.Any(p => p.EmployeeId == x.EmployeeId && p.WorkshopId == x.WorkshopId) ?
_context.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.EmployeeId && p.WorkshopId == x.WorkshopId)!.PersonnelCode : 0,
ContractPerson = true,
ContractLeft = x.ContractLeft,
StartWork = x.StartWork
}).ToList();
var insuranceLeftWork = _context.LeftWorkInsuranceList.Select(x => new RollCallEmployeeViewModel()
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
PersonName = x.EmployeeFullName,
PersonelCode = 0,
InsurancePerson = true,
InsurancetLeft = x.LeftWorkDate != null,
StartWork = x.StartWorkDate
}).Where(x => x.WorkshopId == workshopId).OrderByDescending(x => x.StartWork).ToList();
insuranceLeftWork = insuranceLeftWork.Select(x => new RollCallEmployeeViewModel()
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
PersonName = x.PersonName,
PersonelCode = _context.PersonnelCodeSet.Any(p => p.EmployeeId == x.EmployeeId && p.WorkshopId == x.WorkshopId) ?
_context.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.EmployeeId && p.WorkshopId == x.WorkshopId)!.PersonnelCode : 0,
InsurancePerson = true,
InsurancetLeft = x.InsurancetLeft,
StartWork = x.StartWork
}).ToList();
var joinEqualList = contractLeftWork.Join(insuranceLeftWork, x => x.EmployeeId, c => c.EmployeeId,
(first, second) => new RollCallEmployeeViewModel
{
EmployeeId = first.EmployeeId,
ContractPerson = first.ContractPerson,
ContractLeft = first.ContractLeft,
InsurancePerson = second.InsurancePerson,
InsurancetLeft = second.InsurancetLeft
}).ToList();
if (contractLeftWork.Any() && !insuranceLeftWork.Any())
{
join = contractLeftWork.ToList();
}
else if (!contractLeftWork.Any() && insuranceLeftWork.Any())
{
join = insuranceLeftWork.ToList();
}
else if (contractLeftWork.Any() && insuranceLeftWork.Any())
{
join = contractLeftWork.Concat(insuranceLeftWork).ToList();
}
if (joinEqualList.Count == 0)
return join;
join = join.GroupBy(x => x.EmployeeId).Select(d => d.First()).ToList();
var finalList = join.Select(x => new RollCallEmployeeViewModel()
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
PersonName = x.PersonName,
PersonelCode = x.PersonelCode,
ContractPerson = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.ContractPerson : x.ContractPerson,
InsurancePerson = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.InsurancePerson : x.InsurancePerson,
ContractLeft = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.ContractLeft : x.ContractLeft,
InsurancetLeft = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.InsurancetLeft : x.InsurancetLeft,
Black = false,
}).ToList();
var f = finalList.GroupBy(x => x.EmployeeId).Select(x => x.First()).ToList();
var res = f.Select(x => new RollCallEmployeeViewModel
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
Id = _context.RollCallEmployees.FirstOrDefault(r => r.EmployeeId == x.EmployeeId && r.WorkshopId == workshopId) == null ? 0 :
_context.RollCallEmployees.FirstOrDefault(r => r.EmployeeId == x.EmployeeId && r.WorkshopId == workshopId).id,
EmployeeFullName = x.PersonName,
EmployeeSlug = _passwordHasher.SlugHasher(x.EmployeeId),
NationalCode = _context.Employees.FirstOrDefault(e => e.id == x.EmployeeId)?.NationalCode,
PersonName = x.PersonName,
IsActiveString = _context.RollCallEmployees.Any(r => r.EmployeeId == x.EmployeeId && r.WorkshopId == workshopId && r.IsActiveString == "true") ? "true" : "false",
HasUploadedImage = _context.RollCallEmployees.Any(r => r.EmployeeId == x.EmployeeId && r.WorkshopId == workshopId && r.HasUploadedImage == "true") ? "true" : "false",
ImagePath = (System.IO.File.Exists(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", x.WorkshopId.ToString(), x.EmployeeId.ToString(), "1.jpg")))
? Tools.ResizeImage(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", x.WorkshopId.ToString(), x.EmployeeId.ToString(), "1.jpg"), 150, 150)
: "",
// ImagePath = x.HasUploadedImage == "true" ? Convert.ToBase64String(System.IO.File.ReadAllBytes($"{_webHostEnvironment.ContentRootPath}\\Faces\\{x.WorkshopId}\\{x.EmployeeId}\\1.jpg")) : "",
ContractPerson = x.ContractPerson,
InsurancePerson = x.InsurancePerson,
ContractLeft = x.ContractLeft,
InsurancetLeft = x.InsurancetLeft,
Black = ((x.ContractPerson && x.InsurancePerson && x.InsurancetLeft && x.ContractLeft) || (x.ContractPerson && !x.InsurancePerson && x.ContractLeft) || (x.InsurancePerson && !x.ContractPerson && x.InsurancetLeft)) ? true : false
}).ToList();
return res.Where(x => !x.Black).ToList();
}
public RollCallEmployee GetWithRollCallStatus(long id)
{
return _context.RollCallEmployees.Include(x => x.EmployeesStatus)
.FirstOrDefault(x => x.id == id);
}
public int activedPerson(long workshopId)

View File

@@ -0,0 +1,29 @@
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.RollCallEmployeeStatusAgg;
using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
using System.Collections.Generic;
using System.Linq;
namespace CompanyManagment.EFCore.Repository
{
public class RollCallEmployeeStatusRepository : RepositoryBase<long, RollCallEmployeeStatus>, IRollCallEmployeeStatusRepository
{
private readonly CompanyContext _context;
public RollCallEmployeeStatusRepository(CompanyContext context) : base(context)
{
_context = context;
}
public List<RollCallEmployeeStatusViewModel> GetAll()
{
return _context.RollCallEmployeesStatus.Select(x => new RollCallEmployeeStatusViewModel()
{
StartDate = x.StartDate.ToFarsi(),
EndDate = x.EndDate.ToFarsi(),
Id = x.id
}).ToList();
}
}
}

View File

@@ -1,9 +1,12 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.RollCallAgg;
using CompanyManagment.App.Contracts.RollCall;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
@@ -25,11 +28,321 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
throw new NotImplementedException();
}
public List<RollCallViewModel> GetCurrentDay(RollCallSearchModel searchModel)
{
//PersonnelCode = _context.PersonnelCodeSet.FirstOrDefault(e => e.EmployeeId == x.EmployeeId && e.WorkshopId == x.WorkshopId).PersonnelCode.ToString(),
var rawQuery = _context.RollCalls.Where(x => x.WorkshopId == searchModel.WorkshopId && x.StartDate >= DateTime.Now.Date).Select(x => new RollCallViewModel()
{
EmployeeId = x.EmployeeId,
WorkshopId = x.WorkshopId,
EmployeeFullName = x.EmployeeFullName,
Id = x.id,
Month = x.Month,
Year = x.Year,
StartDate = x.StartDate,
EndDate = x.EndDate,
PersonnelCode = _context.PersonnelCodeSet
.FirstOrDefault(a => a.EmployeeId == x.EmployeeId && a.WorkshopId == x.WorkshopId).PersonnelCode
.ToString(),
});
var groupedQuery = rawQuery.GroupBy(x => x.EmployeeId).Select(x => new RollCallViewModel()
{
EmployeeId = x.First().EmployeeId,
WorkshopId = x.First().WorkshopId,
EmployeeFullName = x.First().EmployeeFullName,
Id = x.First().Id,
Month = x.First().Month,
Year = x.First().Year,
RollCallTimesList = x.Select(d => new RollCallTimeViewModel()
{
StartDate = d.StartDate != null ? d.StartDate.Value.ToString("HH:mm") : "--:--",
EndDate = d.EndDate != null ? d.EndDate.Value.ToString("HH:mm") : "--:--"
}).ToList(),
PersonnelCode = x.First().PersonnelCode,
}).AsEnumerable();
var orderedEnum = groupedQuery.OrderBy(x => Convert.ToInt32(x.PersonnelCode));
var query = orderedEnum.Select(x => new RollCallViewModel()
{
EmployeeId = x.EmployeeId,
WorkshopId = x.WorkshopId,
EndDate = x.EndDate,
StartDate = x.StartDate,
Id = x.Id,
EmployeeFullName = x.EmployeeFullName,
Month = x.Month,
Year = x.Year,
RollCallTimesList = x.RollCallTimesList,
PersonnelCode = x.PersonnelCode
});
return query.Skip(searchModel.PageIndex).Take(30).ToList();
}
public List<RollCallViewModel> Search(RollCallSearchModel searchModel)
{
throw new NotImplementedException();
}
#region Pooya
//حضور غیاب فیش حقوقی
public List<CheckoutDailyRollCallViewModel> GetEmployeeRollCallsForDuration(long employeeId, long workshopId, DateTime startMonthDay, DateTime endMonthDay)
{
var rollCalls = _context.RollCalls.Where(x =>
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate != null && x.EndDate != null &&
x.StartDate.Value.Date >= startMonthDay && x.StartDate.Value.Date <= endMonthDay).ToList();
var year = Convert.ToInt32(startMonthDay.ToFarsi().Substring(0, 4));
var month = Convert.ToInt32(startMonthDay.ToFarsi().Substring(5, 2));
var firstDayOfCurrentMonth = new DateTime(year, month, 1, new PersianCalendar());
if (month == 12)
{
year += 1;
month = 1;
}
else
month += 1;
var nextMonthDate = new DateTime(year, month, 1, new PersianCalendar());
var lastDayOfCurrentMonth = nextMonthDate.AddDays(-1);
int dateRange = (int)(lastDayOfCurrentMonth - firstDayOfCurrentMonth).TotalDays + 1;
//all the dates from start to end, to be compared with present days to get absent dates
var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => startMonthDay.AddDays(offset).Date);
var absentRecords = completeDaysList
.ExceptBy(rollCalls.Select(x => x.StartDate!.Value.Date), y => y.Date.Date)
.Select(x => new CheckoutDailyRollCallViewModel()
{
StartDate = null,
EndDate = null,
DateTimeGr = x.Date.Date,
DayOfWeek = x.Date.DayOfWeek.ToString(),
TotalWorkingHours = Convert.ToString(0),
RollCallDateFa = x.Date.ToFarsi()
});
var presentDays = rollCalls.GroupBy(x => x.StartDate!.Value.Date).Select(x => new CheckoutDailyRollCallViewModel()
{
StartDate = x.Min(y => y.StartDate)!.Value.ToString("HH:mm"),
EndDate = x.Max(y => y.EndDate)!.Value.ToString("HH:mm"),
TotalWorkingHours = x.Where(y => y.EndDate != null).Sum(y => (y.EndDate - y.StartDate)!.Value.TotalHours).ToString("F2"),
DayOfWeek = x.Key.DayOfWeek.DayOfWeeKToPersian(),
RollCallDateFa = x.Key.Date.ToFarsi(),
DateTimeGr = x.Key.Date,
IsSliced = x.Count() > 1
});
return presentDays.Concat(absentRecords).OrderBy(x => x.DateTimeGr).ToList();
}
//سوابق حضور غیاب کارگاه
public RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel)
{
//initialize
DateTime searchDurationStart = DateTime.Now.AddDays(-1).Date;
DateTime searchDurationEnd = searchDurationStart.AddDays(-16);
//override if user has entered inputs (dates must be validated in the application layer)
if (!string.IsNullOrWhiteSpace(searchModel.StarDateFa) && !string.IsNullOrWhiteSpace(searchModel.StarDateFa))
{
searchDurationStart = searchModel.StarDateFa.ToGeorgianDateTime().Date;
searchDurationEnd = searchModel.EndDateFa.ToGeorgianDateTime().AddDays(-1).Date;
}
else
if (!string.IsNullOrWhiteSpace(searchModel.ExactDateFa))
{
searchDurationStart = searchModel.ExactDateFa.ToGeorgianDateTime().Date;
searchDurationEnd = searchModel.ExactDateFa.ToGeorgianDateTime().AddDays(-1).Date;
}
if (searchDurationStart < searchDurationEnd)
return new();
DateTime dateIndex = searchDurationStart.AddDays(-1 * (searchModel.DateIndex)).Date;
if (dateIndex <= searchDurationEnd)
return new();
//get leaves for workshop that have been activated in dateIndex date
var leavesQuery = _context.LeaveList.Where(x => x.WorkshopId == searchModel.WorkshopId &&
x.IsAccepted && (x.LeaveType == "استعلاجی" || (x.LeaveType == "استحقاقی" && x.PaidLeaveType == "روزانه")) &&
x.EndLeave.Date >= dateIndex && x.StartLeave.Date <= dateIndex);
//roll calls for current workshop where shift start is in dateIndex date (filters today's shifts)
var rollCallsQuery = _context.RollCalls
.Where(x => x.WorkshopId == searchModel.WorkshopId && x.StartDate.HasValue && x.EndDate.HasValue && x.StartDate < DateTime.Now.Date &&
x.StartDate.Value.Date == dateIndex.Date);
//get active employees of workshop in dateIndex date
var activeEmployeesQuery =
_context.RollCallEmployees.Include(x => x.EmployeesStatus)
.Where(x => x.WorkshopId == searchModel.WorkshopId && x.EmployeesStatus.Any(y => y.EndDate.Date >= dateIndex && y.StartDate.Date <= dateIndex));
if (searchModel.EmployeeId > 0)
{
rollCallsQuery = rollCallsQuery.Where(x => x.EmployeeId == searchModel.EmployeeId);
activeEmployeesQuery = activeEmployeesQuery.Where(x => x.EmployeeId == searchModel.EmployeeId);
leavesQuery = leavesQuery.Where(x => x.EmployeeId == searchModel.EmployeeId);
}
var personnelCodeList =
_context.PersonnelCodeSet.Where(x => activeEmployeesQuery.Any(y => y.EmployeeId == x.EmployeeId));
var rollCallsList = rollCallsQuery.ToList();
var activatedEmployeesList = activeEmployeesQuery.ToList();
var leavesList = leavesQuery.ToList();
rollCallsList = rollCallsList.Where(x => leavesList.All(y => y.EmployeeId != x.EmployeeId)).ToList();
var result = new RollCallsByDateViewModel()
{
DateGr = dateIndex,
DateFa = dateIndex.ToFarsi(),
ActiveEmployees = activatedEmployeesList.Select(x =>
{
var leave = leavesList.FirstOrDefault(y => y.EmployeeId == x.EmployeeId);
var employeeRollCallsForDate = rollCallsList.Where(y => y.EmployeeId == x.EmployeeId).ToList();
return new RollCallViewModel()
{
EmployeeFullName = x.EmployeeFullName,
EmployeeId = x.EmployeeId,
Reason = leave == null ? "" : $"{leave.LeaveType}-{leave.PaidLeaveType}",
RollCallTimesList = employeeRollCallsForDate.Select(y => new RollCallTimeViewModel()
{
EndDate = y.EndDate!.Value.ToString("HH:mm:ss"),
StartDate = y.StartDate!.Value.ToString("HH:mm:ss")
}),
TotalWorkingHours = employeeRollCallsForDate.Sum(y => (y.EndDate!.Value - y.StartDate!.Value).TotalHours),
PersonnelCode = personnelCodeList.FirstOrDefault(y => y.EmployeeId == x.EmployeeId)?.PersonnelCode.ToString()
};
})
};
return result;
}
//گزارش آنلاین حضور غیاب کارگاه
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId)
{
//get today's roll calls
var rollCallsQuery = _context.RollCalls.Where(x =>
x.WorkshopId == workshopId && x.StartDate.Value.Date == DateTime.Now.Date);
//get active leaves for workshop which are active today and accepted and are either روزانه and استحقاقی or استعلاجی
var leaves = _context.LeaveList.Where(x => x.WorkshopId == workshopId && x.EndLeave.Date >= DateTime.Now.Date && x.StartLeave.Date <= DateTime.Now.Date &&
x.IsAccepted && (x.LeaveType == "استعلاجی" || (x.LeaveType == "استحقاقی" && x.PaidLeaveType == "روزانه")));
//get currently working employees with leftWork table
var workingEmployees =
_context.LeftWorkList.Where(x => x.WorkshopId == workshopId && x.StartWorkDate < DateTime.Now.Date && x.LeftWorkDate.Date > DateTime.Now.Date);
//get activated employees
var activeEmployees =
_context.RollCallEmployees.Include(x => x.EmployeesStatus)
.Where(x => x.WorkshopId == workshopId && x.EmployeesStatus.Any(y =>
y.StartDate.Date <= DateTime.Now.Date &&
y.EndDate.Date >= DateTime.Now.Date));
var mustBePresent = activeEmployees.Where(x => !leaves.Any(y => y.EmployeeId == x.EmployeeId) &&
workingEmployees.Any(y => y.EmployeeId == x.EmployeeId));
//filter roll calls for active and currently working employees only
var filteredRollCallQuery = rollCallsQuery.Where(x => mustBePresent
.Any(y => x.EmployeeId == y.EmployeeId))
.Where(x => workingEmployees.Any(y => y.EmployeeId == x.EmployeeId)).ToList();
//presents list is ready
var presentEmployees = filteredRollCallQuery.GroupBy(x => x.EmployeeId).Select(x => new RollCallViewModel()
{
EmployeeFullName = x.FirstOrDefault()!.EmployeeFullName,
EmployeeId = x.FirstOrDefault()!.EmployeeId,
TotalWorkingHours = x.Where(y => y.EndDate != null).Sum(y => (y.EndDate!.Value - y.StartDate!.Value).TotalHours),
RollCallTimesList = x.Select(y => new RollCallTimeViewModel()
{
StartDate = y.StartDate!.Value.ToString("HH:mm:ss"),
EndDate = y.EndDate?.ToString("HH:mm:ss")
}).ToList()
}).ToList();
//absent ones are those who are active and not on the roll call list
var absentsQuery = activeEmployees.AsEnumerable()
.ExceptBy(presentEmployees.Select(x => x.EmployeeId), e => e.EmployeeId).ToList();
//get today's active leaves
var employeesWithLeave = _context.LeaveList.Where(x =>
x.EndLeave.Date >= DateTime.Now.Date && x.StartLeave.Date <= DateTime.Now.Date &&
x.WorkshopId == workshopId && (x.LeaveType == "استعلاجی" || (x.LeaveType == "استحقاقی" && x.PaidLeaveType == "روزانه")))
.AsEnumerable()
.Where(x => absentsQuery.Any(y => y.EmployeeId == x.EmployeeId))
.Select(x => new { x.EmployeeId, x.LeaveType }).ToList();
//join leave and absents
var absentsViewModel = absentsQuery.Select(x => new AbsentEmployeeViewModel()
{
PersonnelCode = _context.PersonnelCodeSet
.FirstOrDefault(y => y.EmployeeId == x.EmployeeId && y.WorkshopId == workshopId)
!.PersonnelCode.ToString(),
EmployeeId = x.EmployeeId,
EmployeeFullName = x.EmployeeFullName,
Reason = employeesWithLeave.Any(y => y.EmployeeId == x.EmployeeId)
? employeesWithLeave.FirstOrDefault(y => y.EmployeeId == x.EmployeeId)!.LeaveType
: ""
}).ToList();
return new CurrentDayRollCall()
{
AbsentEmployees = absentsViewModel.ToList(),
PresentEmployees = presentEmployees.ToList()
};
}
#endregion
public long Flag(long employeeId, long workshopId)
{
var checkDate = DateTime.Now.AddDays(-3);

View File

@@ -164,6 +164,8 @@ using Company.Domain.TaxJobCategoryAgg;
using Company.Domain.WorkshopAccountAgg;
using CompanyManagment.App.Contracts.ReportClient;
using CompanyManagment.App.Contracts.TaxJobCategory;
using Company.Domain.RollCallEmployeeStatusAgg;
using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
namespace PersonalContractingParty.Config;
@@ -346,6 +348,9 @@ public class PersonalBootstrapper
services.AddTransient<IRollCallMandatoryRepository, RollCallMandatoryRepository>();
services.AddTransient<IRollCallMandatoryApplication, RollCallMandatoryApplication>();
services.AddTransient<IWorkshopAccountRepository, WorkshopAccountRepository>();
services.AddTransient<IRollCallEmployeeStatusRepository, RollCallEmployeeStatusRepository>();
services.AddTransient<IRollCallEmployeeStatusApplication, RollCallEmployeeStatusApplication>();
//=========End Of Main====================================
//---File Project------------------------------------

View File

@@ -1 +1,262 @@
@page
@model ServiceHost.Areas.Client.Pages.Company.RollCall.CaseHistoryModel
@using Version = _0_Framework.Application.Version
@{
ViewData["Title"] = " - " + "سوابق حضور و غیاب";
int index = 1;
int i = 0;
}
@section Styles {
<link href="~/assetsclient/css/table-style.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/assetsclient/css/table-responsive.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/assetsclient/css/rollcall-list-table.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/assetsclient/css/operation-button.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/AssetsClient/css/dropdown.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/AssetsClient/css/select2.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/AssetsClient/css/filter-search.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/assetsclient/pages/rollcall/css/casehistory.css" rel="stylesheet" />
}
<div class="content-container">
<div class="container-fluid">
<div class="row p-2">
<div class="col p-0 m-0 d-flex align-items-center justify-content-between">
<div class="col">
<h4 class="title d-flex align-items-center">سوابق حضور و غیاب</h4>
<div class="title d-flex align-items-center">@Model.WorkshopFullName</div>
</div>
<div>
<a asp-page="/Company/RollCall/Index" class="back-btn" type="button">
<span>بازگشت</span>
</a>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row px-2">
<div class="col-12 p-0 mb-2 d-none d-md-block">
<div class="search-box card border-0">
<div class="d-flex align-items-center gap-2">
<div class="col-3 col-xl-2">
<div class="wrapper-dropdown-normal btn-dropdown">
<span class="selected-display">تاریخ براساس یک روز</span>
<svg id="drp-arrow" class="arrow transition-all ml-auto rotate-180" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7 14.5l5-5 5 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
<ul class="dropdown-normal dropdown-days boxes">
<li class="item" value-data-normal="OneDay">تاریخ براساس یک روز</li>
<li class="item" value-data-normal="RangeDays">تاریخ براساس بازه ی زمانی</li>
</ul>
</div>
</div>
<div class="">
<div class="d-flex align-items-center gap-2">
<div><input type="text" class="form-control date start-date text-center" id="StartDate" placeholder="تاریخ شروع"></div>
<div class="d-flex align-items-center d-none" id="endDateRollcall">
<div class="me-2 elay">الی</div>
<input type="text" class="form-control date end-date text-center" id="EndDate" placeholder="تاریخ پایان">
</div>
</div>
</div>
<div class="col-3 col-xl-2">
<select class="form-select select2Option" aria-label="انتخاب پرسنل ..." id="employeeSelect">
<option value="">انتخاب پرسنل ...</option>
@foreach (var itemEmployee in Model.RollCallEmployeeList)
{
<option value="@itemEmployee.PersonName">@itemEmployee.PersonName</option>
}
</select>
</div>
<button class="btn-search btn-w-size btn-search-click text-nowrap d-flex align-items-center justify-content-center" id="searchBtn" type="submit">
<span>جستجو</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<circle cx="11" cy="11" r="6" stroke="white" />
<path d="M20 20L17 17" stroke="white" stroke-linecap="round" />
</svg>
</button>
<a asp-page="/Company/Employees/Leave" class="btn-clear-filter btn-w-size text-nowrap d-flex align-items-center justify-content-center disable" id="filterRemove" style="padding: 7px 10px;">
<span>حذف جستجو</span>
</a>
</div>
</div>
</div>
</div>
</div>
<!-- List Items -->
<div class="container-fluid">
<div class="row p-lg-2">
<div class="card">
@if (@Model.RollCallViewModels.Any())
{
<div class="wrapper table-rollcall">
<div class="rollcall-list Rtable Rtable--5cols Rtable--collapse px-1">
<div class="Rtable-row Rtable-row--head align-items-center d-flex">
<div class="Rtable-cell column-heading width1">ردیف</div>
<div class="Rtable-cell column-heading width2">نام پرسنل</div>
<div class="Rtable-cell column-heading width3">شماره پرسنلی</div>
<div class="Rtable-cell column-heading width3">تاریخ</div>
<div class="Rtable-cell column-heading d-md-block d-none width4 text-center">ساعت ورود</div>
<div class="Rtable-cell column-heading d-md-block d-none width5 text-center">ساعت خروج</div>
<div class="Rtable-cell column-heading d-md-none d-block width6 text-center"></div>
@* <div class="Rtable-cell column-heading d-md-block d-none width5">تاخیر در ورود</div>
<div class="Rtable-cell column-heading d-md-block d-none width5">تعجیل در خروج</div> *@
</div>
@foreach (var item in Model.RollCallViewModels)
{
<div class="Rtable-row align-items-center position-relative openAction">
<div class="Rtable-cell width1">
<div class="Rtable-cell--heading d-none">
ردیف
</div>
<div class="Rtable-cell--content">
<div class="d-flex justify-content-center align-items-center table-number">
@(index++)
</div>
</div>
</div>
<div class="Rtable-cell width2">
<div class="Rtable-cell--heading d-none">نام پرسنل</div>
<div class="Rtable-cell--content">
@item.EmployeeFullName
</div>
</div>
<div class="Rtable-cell width3">
<div class="Rtable-cell--content text-center">
<div class="d-md-none d-none">شماره پرسنلی: </div>
<div class="d-flex ms-1">@item.PersonnelCode</div>
</div>
</div>
<div class="Rtable-cell width3">
<div class="Rtable-cell--heading d-none">تاریخ</div>
<div class="Rtable-cell--content">
@item.DateFa
</div>
</div>
<div class="Rtable-cell d-md-block d-none width4 position-relative">
@foreach (var itemTime in item.RollCallTimesList)
{
<div class="Rtable-cell--heading">ساعت ورود</div>
<div style="direction: ltr; z-index: 6; position: relative" class="Rtable-cell--content text-center">
<div>@itemTime.StartDate</div>
</div>
}
</div>
<div class="Rtable-cell d-md-block d-none width5 position-relative">
@foreach (var itemTime in item.RollCallTimesList)
{
<div class="Rtable-cell--heading">ساعت خروج</div>
<div style="direction: ltr; z-index: 6; position: relative" class="Rtable-cell--content text-center">
<div>@itemTime.EndDate</div>
</div>
}
</div>
<div class="Rtable-cell d-md-none d-block width6 text-end">
<button class="btn-taskmanager-more position-relative">
<span class="mx-1 align-items-center d-flex justify-content-center">
<p class="my-0 mx-1">مشاهده</p>
</span>
</button>
@* <div class="v-line"></div> *@
</div>
</div>
<div class="operation-div d-md-none d-block w-100">
<div class="operations-btns">
<div class="row rollcall-list-mobile">
<div class="col-6">
<div class="d-md-none d-block position-relative">
<div class="Rtable-cell--heading text-center">ساعت ورود</div>
@foreach (var itemTime in item.RollCallTimesList)
{
<div style="direction: ltr;" class="Rtable-cell--content text-center">
<div>@itemTime.StartDate</div>
</div>
}
</div>
</div>
<div class="col-6">
<div class="d-md-none d-block position-relative">
<div class="Rtable-cell--heading text-center">ساعت خروج</div>
@foreach (var itemTime in item.RollCallTimesList)
{
<div style="direction: ltr;" class="Rtable-cell--content text-center">
<div>@itemTime.EndDate</div>
</div>
}
</div>
</div>
@* <div class="col-4">
<div class="d-md-none d-block position-relative">
<div class="Rtable-cell--heading">تاخیر در ورود</div>
@foreach (var itemTime in item.RollCallTimesList)
{
<div style="direction: ltr;" class="Rtable-cell--content text-center">
<div>@itemTime.StartDate</div>
</div>
}
</div>
</div>
<div class="col-4">
<div class="d-md-none d-block position-relative">
<div class="Rtable-cell--heading">تعجیل در خروج</div>
@foreach (var itemTime in item.RollCallTimesList)
{
<div style="direction: ltr;" class="Rtable-cell--content text-center">
<div>@itemTime.StartDate</div>
</div>
}
</div>
</div> *@
</div>
</div>
</div>
}
</div>
</div>
}
else
{
<div class="empty text-center bg-white d-flex align-items-center justify-content-center">
<div class="">
<img src="~/assetsclient/images/empty.png" alt="" class="img-fluid" />
<h5>اطلاعاتی وجود ندارد.</h5>
</div>
</div>
}
</div>
</div>
</div>
</div>
@section Script {
<script src="~/AssetsClient/js/dropdown.js?ver=@Version.StyleVersion"></script>
<script src="~/assetsclient/pages/rollcall/js/casehistory.js"></script>
}

View File

@@ -50,7 +50,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
WorkshopId = workshopId,
};
//RollCallViewModels = _rollCallApplication.GetHistoryCase(searchModel);
RollCallViewModels = _rollCallApplication.GetHistoryCase(searchModel);
return Page();
}
else

View File

@@ -1 +1,197 @@
@page
@model ServiceHost.Areas.Client.Pages.Company.RollCall.CurrentDayModel
@using Version = _0_Framework.Application.Version
@{
ViewData["Title"] = " - " + "لیست حضور و غیاب جاری";
int index = 1;
int i = 0;
}
@section Styles {
<link href="~/assetsclient/css/table-style.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/assetsclient/css/table-responsive.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/assetsclient/css/rollcall-list-table.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/assetsclient/css/operation-button.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/AssetsClient/css/dropdown.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/AssetsClient/css/filter-search.css?ver=@Version.StyleVersion" rel="stylesheet" />
<link href="~/assetsclient/pages/rollcall/css/currentday.css" rel="stylesheet" />
}
<div class="content-container">
<div class="container-fluid">
<div class="row p-2">
<div class="col p-0 m-0 d-flex align-items-center justify-content-between">
<div class="col">
<h4 class="title d-flex align-items-center">ساعات حضور و غیاب جاری</h4>
<div class="title d-flex align-items-center">@Model.WorkshopFullName <span class="ms-3">تاریخ امروز @Model.NowDate</span></div>
</div>
<div>
<a asp-page="/Company/RollCall/Index" class="back-btn" type="button">
<span>بازگشت</span>
</a>
</div>
</div>
</div>
</div>
<!-- List Items -->
<div class="container-fluid">
<div class="row p-lg-2">
<div class="card">
@if (@Model.RollCallViewModels.Any())
{
<div class="wrapper table-rollcall">
<div class="rollcall-list Rtable Rtable--5cols Rtable--collapse px-1">
<div class="Rtable-row Rtable-row--head align-items-center d-flex">
<div class="Rtable-cell column-heading width1">ردیف</div>
<div class="Rtable-cell column-heading width2">نام پرسنل</div>
<div class="Rtable-cell column-heading width3">شماره پرسنلی</div>
<div class="Rtable-cell column-heading d-md-block d-none width4 text-center">ساعت ورود</div>
<div class="Rtable-cell column-heading d-md-block d-none width5 text-center">ساعت خروج</div>
<div class="Rtable-cell column-heading d-md-none d-block width6 text-center"></div>
@* <div class="Rtable-cell column-heading d-md-block d-none width5">تاخیر در ورود</div>
<div class="Rtable-cell column-heading d-md-block d-none width5">تعجیل در خروج</div> *@
</div>
@foreach (var item in Model.RollCallViewModels)
{
<div class="Rtable-row align-items-center position-relative openAction">
<div class="Rtable-cell width1">
<div class="Rtable-cell--heading d-none">
ردیف
</div>
<div class="Rtable-cell--content">
<div class="d-flex justify-content-center align-items-center table-number">
@(index++)
</div>
</div>
</div>
<div class="Rtable-cell width2">
<div class="Rtable-cell--heading d-none">نام پرسنل</div>
<div class="Rtable-cell--content">
@item.EmployeeFullName
</div>
</div>
<div class="Rtable-cell width3">
<div class="Rtable-cell--content text-center">
<div class="d-md-none d-none">شماره پرسنلی: </div>
<div class="d-flex ms-1">@item.PersonnelCode</div>
</div>
</div>
<div class="Rtable-cell d-md-block d-none width4 position-relative">
@foreach (var itemTime in item.RollCallTimesList)
{
<div class="Rtable-cell--heading">ساعت ورود</div>
<div style="direction: ltr; z-index: 6; position: relative" class="Rtable-cell--content text-center">
<div>@itemTime.StartDate</div>
</div>
}
</div>
<div class="Rtable-cell d-md-block d-none width5 position-relative">
@foreach (var itemTime in item.RollCallTimesList)
{
<div class="Rtable-cell--heading">ساعت خروج</div>
<div style="direction: ltr; z-index: 6; position: relative" class="Rtable-cell--content text-center">
<div>@itemTime.EndDate</div>
</div>
}
</div>
<div class="Rtable-cell d-md-none d-block width6 text-end">
<button class="btn-taskmanager-more position-relative">
<span class="mx-1 align-items-center d-flex justify-content-center">
<p class="my-0 mx-1">مشاهده</p>
</span>
</button>
@* <div class="v-line"></div> *@
</div>
</div>
<div class="operation-div d-md-none d-block w-100">
<div class="operations-btns">
<div class="row rollcall-list-mobile">
<div class="col-6">
<div class="d-md-none d-block position-relative">
<div class="Rtable-cell--heading text-center">ساعت ورود</div>
@foreach (var itemTime in item.RollCallTimesList)
{
<div style="direction: ltr;" class="Rtable-cell--content text-center">
<div>@itemTime.StartDate</div>
</div>
}
</div>
</div>
<div class="col-6">
<div class="d-md-none d-block position-relative">
<div class="Rtable-cell--heading text-center">ساعت خروج</div>
@foreach (var itemTime in item.RollCallTimesList)
{
<div style="direction: ltr;" class="Rtable-cell--content text-center">
<div>@itemTime.EndDate</div>
</div>
}
</div>
</div>
@* <div class="col-4">
<div class="d-md-none d-block position-relative">
<div class="Rtable-cell--heading">تاخیر در ورود</div>
@foreach (var itemTime in item.RollCallTimesList)
{
<div style="direction: ltr;" class="Rtable-cell--content text-center">
<div>@itemTime.StartDate</div>
</div>
}
</div>
</div>
<div class="col-4">
<div class="d-md-none d-block position-relative">
<div class="Rtable-cell--heading">تعجیل در خروج</div>
@foreach (var itemTime in item.RollCallTimesList)
{
<div style="direction: ltr;" class="Rtable-cell--content text-center">
<div>@itemTime.StartDate</div>
</div>
}
</div>
</div> *@
</div>
</div>
</div>
}
</div>
</div>
}
else
{
<div class="empty text-center bg-white d-flex align-items-center justify-content-center">
<div class="">
<img src="~/assetsclient/images/empty.png" alt="" class="img-fluid" />
<h5>اطلاعاتی وجود ندارد.</h5>
</div>
</div>
}
</div>
</div>
</div>
</div>
@section Script {
<script src="~/AssetsClient/js/dropdown.js?ver=@Version.StyleVersion"></script>
<script src="~/assetsclient/pages/rollcall/js/currentday.js"></script>
}

View File

@@ -52,7 +52,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
WorkshopId = workshopId,
};
//RollCallViewModels = _rollCallApplication.GetCurrentDay(searchModel);
RollCallViewModels = _rollCallApplication.GetCurrentDay(searchModel);
return Page();
}
else
@@ -80,11 +80,11 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
WorkshopId = workshopId,
};
//var list= _rollCallApplication.GetCurrentDay(searchModel);
var list= _rollCallApplication.GetCurrentDay(searchModel);
return new JsonResult(new
{
isSuccess = true,
list
});
}
}

View File

@@ -247,121 +247,12 @@
<input type="hidden" asp-for="@Model.HasEmployees" value="@Model.HasEmployees" id="hasEmployee" />
@section Script {
<script src="~/assetsclient/js/site.js?ver=@Version.StyleVersion"></script>
<script>
$(document).ready(function () {
$('.loadingButton').on('click', function () {
var button = $(this);
var loadingDiv = button.find('.loading');
loadingDiv.show();
});
});
function ModalUploadPics(employeeID)
{
//window.location.href = `#showmodal=/Client/Company/RollCall/EmployeeUploadPic?employeeSlug=${employeeSlug}&handler=ModalTakeImages`;
$.ajax({
async: false,
dataType: 'json',
url: '@Url.Page("EmployeeUploadPicture", "CheckModalTakeImage")',
type: 'GET',
success: function (response) {
if (response.isSuccedded) {
window.location.href = `#showmodal=/Client/Company/RollCall/EmployeeUploadPicture?employeeId=${employeeID}&handler=ModalTakeImages`;
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
error: function (err) {
console.log(err);
}
});
}
function deactivePersonnel(id) {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: '@Url.Page("./EmployeeUploadPicture", "DeActivePersonnel")',
headers: { "RequestVerificationToken": $('@Html.AntiForgeryToken()').val() },
data: { id: Number(id) },
success: function (response) {
console.log(response)
if (response.isSuccedded) {
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('');
window.location.reload();
}, 2000);
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
error: function (err) {
console.log(err);
}
});
}
function activePersonnel(id, hasUploadedImage) {
// if (hasUploadedImage === "true") {
// console.log("yes");
// } else {
// console.log("no");
// }
console.log(id);
if (hasUploadedImage === "true") {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: '@Url.Page("./EmployeeUploadPicture", "ActivePersonnel")',
headers: { "RequestVerificationToken": $('@Html.AntiForgeryToken()').val() },
data: { id: Number(id) },
success: function (response) {
if (response.isSuccedded) {
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('');
window.location.reload();
}, 2000);
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
error: function (err) {
console.log(err);
}
});
} else {
var errorText = "برای این پرسنل، هنوز هیچ عکسی آپلود نشده است. بعد از آپلود عکس بطور خودکار فعال خواهد شد";
$('.alert-msg').show();
$('.alert-msg p').text(errorText);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
}
<script src="~/assetsclient/js/site.js?ver=@Version.StyleVersion"></script>
<script>
var antiForgeryToken = $('@Html.AntiForgeryToken()').val();
var checkModalTakeImageAjax = `@Url.Page("EmployeeUploadPicture", "CheckModalTakeImage")`;
var deActivePersonnelAjax = `@Url.Page("./EmployeeUploadPicture", "DeActivePersonnel")`;
var activePersonnelAjax = `@Url.Page("./EmployeeUploadPicture", "ActivePersonnel")`;
</script>
<script src="~/assetsclient/pages/rollcall/js/employeeuploadpicture.js"></script>
}

View File

@@ -307,40 +307,5 @@
@section Script {
<script src="~/assetsclient/js/site.js?ver=@Version.StyleVersion"></script>
<script>
$(".openAction").click(function() {
$(this).next().find(".operations-btns").slideToggle(500);
$(".operations-btns").not($(this).next().find(".operations-btns")).slideUp(500);
});
$(document).ready(function() {
$(this).find(".operations-btns").first().slideToggle(500);
});
$(document).ready(function () {
$('.loadingButton').on('click', function () {
var button = $(this);
var loadingDiv = button.find('.loading');
loadingDiv.show();
});
});
// function AjaxPlans(id) {
// $.ajax({
// url: '@Url.Page("./Plans")',
// type: 'GET',
// headers: {
// 'workshopId': id
// },
// success: function (response) {
// window.location.href = '@Url.Page("./Plans")'
// },
// error: function (e) {
// console.log('error: ' + e)
// }
// });
// }
</script>
<script src="~/assetsclient/pages/rollcall/js/index.js"></script>
}

View File

@@ -49,9 +49,9 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
if (rollCall != null)
{
var accountId = _authHelper.CurrentAccountId();
//var cameraAccount = _cameraAccountApplication.HasCameraAccount(workshopId, accountId);
//if (cameraAccount)
// HasCameraAccount = "true";
var cameraAccount = _cameraAccountApplication.HasCameraAccount(workshopId, accountId);
if (cameraAccount)
HasCameraAccount = "true";
CheckRollCallService = true;
RollCallServicePersonnelActive = _rollCallEmployeeApplication.activedPerson(workshopId) > 0 ? "true" : "false";
@@ -122,10 +122,11 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
public IActionResult OnGetCheckAccount(string username)
{
//var result = _cameraAccountApplication.CheckUsername(username);
var result = _cameraAccountApplication.CheckUsername(username);
return new JsonResult(new
{
Success = result.IsSuccedded,
message = result.Message,
});
}
}

View File

@@ -150,230 +150,9 @@
</form>
<script>
$('.loading').hide();
document.getElementById("MainModal").style.visibility = "visible";
$(".toggle").click(function(){
$(".sidebar-navigation").toggleClass("small")
// $(".main-wrapper").toggleClass("small");
$(".sidebar").toggleClass("active-sidebar-navigation");
$(".header-container").toggleClass("main-wrapper ");
$(".header-container").toggleClass("small");
$(".content-container").toggleClass("small");
// $(".content-container").toggleClass("");
$('#overlay').toggleClass("overlay");
});
$("#close-sidemenu-mobile").click(function(){
$(".sidebar-navigation").toggleClass("small")
$(".sidebar").toggleClass("active-sidebar-navigation");
$(".header-container").toggleClass("main-wrapper ");
$(".header-container").toggleClass("small");
$(".content-container").toggleClass("small");
$('#overlay').toggleClass("overlay");
});
$("#overlay").click(function(){
$(".sidebar-navigation").toggleClass("small")
$(".sidebar").toggleClass("active-sidebar-navigation");
$(".header-container").toggleClass("main-wrapper ");
$(".header-container").toggleClass("small");
$(".content-container").toggleClass("small");
$('#overlay').toggleClass("overlay");
});
$(document).ready(function(){
if ($(window).width() < 992) {
$(".sidebar-navigation").toggleClass("small");
// $(".main-wrapper").toggleClass("small");
$(".sidebar").toggleClass("active-sidebar-navigation");
$(".header-container").toggleClass("main-wrapper ");
$(".header-container").toggleClass("small");
$(".content-container").toggleClass("small");
// $(".content-container").toggleClass("");
}
if ($(window).width() > 992){
$('#overlay').toggleClass("overlay");
}
});
var eyeShow = $('.eyeShow');
var eyeClose = $('.eyeClose');
var reEyeShow = $('.reEyeShow');
var reEyeClose = $('.reEyeClose');
eyeShow.show();
eyeClose.hide();
reEyeShow.show();
reEyeClose.hide();
$(document).on('click','#accountModalModal button', function() {
// alert($(this));
// $(this).find('input').type ? 'text' : 'password';
// document.getElementById('hybrid').type = 'password';
$("#accountModalModal button").find('input').attr("type", "text");
// var input=document.getElementById(some-id);
// var input2= input.cloneNode(false);
// input2.type='password';
// input.parentNode.replaceChild(input2,input);
});
function passFunction() {
var x = document.getElementById("signupInputPassword");
if (x.type === "password") {
x.type = "text";
eyeShow.hide();
eyeClose.show();
} else {
x.type = "password";
eyeShow.show();
eyeClose.hide();
}
}
function rePassFunction() {
var x = document.getElementById("repeat_password");
if (x.type === "password") {
x.type = "text";
reEyeShow.hide();
reEyeClose.show();
} else {
x.type = "password";
reEyeShow.show();
reEyeClose.hide();
}
}
function passwordCheck(password) {
if (password.length >= 8)
strength += 1;
if (password.match(/(?=.*[0-9])/))
strength += 1;
if (password.match(/(?=.*[!,%,&,@@,#,$,^,*,?,_,~,<,>,])/))
strength += 1;
if (password.match(/(?=.*[A-Z])/))
strength += 1;
displayBar(strength);
}
function displayBar(strength) {
$(".password-strength-group").attr('data-strength', strength);
}
$("#signupInputPassword").keyup(function () {
strength = 0;
var password = $(this).val();
passwordCheck(password);
});
$(document).ready(function() {
$("#username").keyup(function () {
var username = $('#username').val();
if (username.length >= 6) {
$.ajax({
async: false,
dataType: 'json',
type: 'GET',
url: '@Url.Page("./Index", "CheckAccount")',
data: { username: username },
success: function (response) {
if (response.success) {
$('#errorSvg').addClass("d-none");
$('#successSvg').removeClass("d-none");
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('');
}, 2000);
} else {
$('#successSvg').addClass("d-none");
$('#errorSvg').removeClass("d-none");
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 2000);
}
},
error: function (err) {
console.log(err);
}
});
} else {
$('.alert-msg').show();
$('.alert-msg p').text("نام کاربری حداقل باید 6 حرف باشد");
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
$('#successSvg').addClass("d-none");
$('#errorSvg').removeClass("d-none");
}
});
});
function save() {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: '@Url.Page("./Index", "SaveCameraAccount")',
headers: { "RequestVerificationToken": $('@Html.AntiForgeryToken()').val() },
data: $('#create-form').serialize(),
success: function (response) {
if (response.Success) {
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('');
}, 3500);
window.location.reload();
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
error: function (err) {
console.log(err);
}
});
}
</script>
var antiForgeryToken = $('@Html.AntiForgeryToken()').val();
var checkAccountAjax = `@Url.Page("./Index", "CheckAccount")`;
var saveCameraAccountAjax = `@Url.Page("./Index", "SaveCameraAccount")`;
</script>
<script src="~/assetsclient/pages/rollcall/js/modalcameraaccount.js?ver=asdasd"></script>

View File

@@ -178,262 +178,12 @@
</div>
</form>
@section Script
{
}
@* <script src="~/assetsclient/libs/jquery-steps/jquery.steps.min.js"></script> *@
<script>
var dateTimeNow = '';
$(document).ready(function () {
$('#rule').click(function () {
if ($(this).is(':checked')) {
$('#btnSmsReciver').prop("disabled", false);
$('#btnSmsReciver').removeClass("disable");
$(this).prop("disabled", true);
} else {
$('#btnSmsReciver').prop("disabled", true);
$('#btnSmsReciver').addClass("disable");
}
});
$("#next-step").on("click", function () {
$('#step-form1').hide();
$('#step-form2').show();
$('#prev-step').text('مرحله قبل');
$('#next-step').text('ثبت');
// $('#next-step').addClass('disable')
$('#step-2').removeClass('not-step');
});
$("#prev-step").on("click", function () {
$('#step-form1').show();
if ($('#step-form2').is(":hidden")) {
$("#MainModal").modal("hide");
}
$('#step-form2').hide();
$('#prev-step').text('انصراف');
$('#next-step').text('مرحله بعد');
$('#step-2').addClass('not-step');
});
$("#time-code").on('input', function () {
var value = $(this).val();
$(this).val(convertPersianNumbersToEnglish(value));
}).mask("000000");
$('#changeDuration').on('change', function () {
if (this.value == "1Mount") {
$('#Duration').val('یک ماهه');
} else if (this.value == "3Mount") {
$('#Duration').val('سه ماهه');
} else if (this.value == "6Mount") {
$('#Duration').val('شش ماهه');
} else if (this.value == "12Mount") {
$('#Duration').val('یک ساله');
}
$.ajax({
async: false,
dataType: 'json',
url: '@Url.Page("Plans", "ComputeMoneyByMount")',
type: 'GET',
data: { "mount": this.value, "money": $('#AmountFaReal').val() },
success: function (response) {
console.log(response);
if (response.isSuccedded) {
$('#AmountFaWithout').text(response.cumputeWithout);
$('#AmountFaDiscount').text(response.cumputeDiscount);
$('#AmountFaWith').text(response.cumpute);
$('#AmountFaTotal').text(response.cumpute);
$('#AmountFa').text(response.cumpute);
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
error: function (err) {
console.log(err);
}
});
});
$('#btnSmsReciver').on("click", function () {
$('#btnSmsReciver').prop("disabled", true);
$('#btnSmsReciver').addClass("disable");
sendVerifyCode();
});
function sendVerifyCode() {
$.ajax({
dataType: 'json',
type: 'POST',
url: '@Url.Page("./Plans", "SendSms")',
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
success: function (response) {
if (response.isSuccess) {
$('#CodeDiv').removeClass("disable");
$('#next-step').removeClass('disable');
$('#next-step').attr('onclick', 'confirmCodeToLogin()');
// codeTimer();
dateTimeNow = new Date().toJSON();
startTimer(2);
} else {
$('.loading').hide();
$('#btnSmsReciver').show();
}
},
failure: function (response) {
console.log(5, response);
}
});
}
function startTimer(minutes) {
var timer = minutes * 60, display = $('#timer');
var interval = setInterval(function () {
var minutes = parseInt(timer / 60, 10);
var seconds = parseInt(timer % 60, 10);
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
display.text(minutes + ":" + seconds);
if (--timer < 0) {
clearInterval(interval);
$('#btnSmsReciver').prop("disabled", false);
$('#btnSmsReciver').removeClass("disable");
$('#btnSmsReciver').text('ارسال دوباره');
$('#CodeDiv').addClass("disable");
}
}, 1000);
}
function codeTimer() {
$('#timer').text('');
var timer2 = "2:00";
var interval = setInterval(function () {
var timer = timer2.split(':');
//by parsing integer, I avoid all extra string processing
var minutes = parseInt(timer[0], 10);
var seconds = parseInt(timer[1], 10);
--seconds;
minutes = (seconds < 0) ? --minutes : minutes;
if (minutes < 0) clearInterval(interval);
seconds = (seconds < 0) ? 59 : seconds;
seconds = (seconds < 10) ? '0' + seconds : seconds;
//minutes = (minutes < 10) ? minutes : minutes;
$('.countdown').html(minutes + ':' + seconds);
timer2 = minutes + ':' + seconds;
if (timer2 === "0:00" && !$('#passDiv').hasClass("showPassDiv")) {
$('#next-step').attr('onclick', '');
$('#next-step').addClass('disable');
$('#CodeDiv').addClass("disable");
//اینپوت برای وارد کردن کدها خالی میشود
$('.time-code').val('');
$('#timer').text('00:00');
}
}, 1000);
}
// var form = $("#steps");
// form.steps({
// headerTag: "h6",
// bodyTag: "section",
// transitionEffect: "fade",
// titleTemplate: '<div class="step-progress"><h5 class="d-flex justify-content-center align-items-center not-step"> #index# </h5><p>#title#</p></div>'
// });
});
function confirmCodeToLogin() {
var code = $('#time-code').val();
if (code.length === 6) {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: '@Url.Page("./Plans", "CheckCode")',
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: {
'code': code,
'codeSendTimeStr': dateTimeNow
},
success: function (response) {
if (response.exist === true) {
SaveServiceData();
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
failure: function (response) {
console.log(5, response);
}
});
} else {
$('.alert-msg').show();
$('.alert-msg p').text('کد وارد شده کمتر از 6 رقم است.');
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
}
function SaveServiceData()
{
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: '@Url.Page("./Plans", "SaveService")',
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: $('#create-form').serialize(),
success: function (response) {
if (response.isSuccedded === true) {
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('');
}, 3500);
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
failure: function (response) {
console.log(5, response);
}
});
}
function OpenAccount() {
window.location.href = "#showmodal=@Url.Page("./Index", "SaveCameraAccount")";
}
</script>
var antiForgeryToken = $('@Html.AntiForgeryToken()').val();
var checkCodeAjax = `@Url.Page("./Plans", "CheckCode")'`;
var saveServiceAjax = `@Url.Page("./Plans", "SaveService")`;
var saveCameraAccountUrl = `#showmodal=@Url.Page("./ Index", "SaveCameraAccount")`;
var computeMoneyByMountAjax = `@Url.Page("Plans", "ComputeMoneyByMount")`;
var sendSmsAjax = `@Url.Page("./Plans", "SendSms")`;
</script>
<script src="~/assetsclient/pages/rollcall/js/modalotpaction.js"></script>

View File

@@ -165,175 +165,10 @@
</form>
@section Script
{
}
<script>
$(document).ready(function () {
$('#rule').click(function () {
if ($(this).is(':checked')) {
$('#btnSmsReciver').prop("disabled", false);
$('#btnSmsReciver').removeClass("disable");
} else {
$('#btnSmsReciver').prop("disabled", true);
$('#btnSmsReciver').addClass("disable");
}
});
$("#next-step").on("click", function () {
$('#step-form1').hide();
$('#step-form2').show();
$('#prev-step').text('مرحله قبل')
$('#next-step').text('ثبت')
// $('#next-step').addClass('disable')
$('#step-2').removeClass('not-step')
});
$("#prev-step").on("click", function () {
$('#step-form1').show();
if ($('#step-form2').is(":hidden")) {
$("#MainModal").modal("hide");
}
$('#step-form2').hide();
$('#prev-step').text('انصراف');
$('#next-step').text('مرحله بعد');
$('#step-2').addClass('not-step');
});
$('#btnSmsReciver').on("click", function () {
$('#btnSmsReciver').prop("disabled", true);
$('#btnSmsReciver').addClass("disable");
sendVerifyCode();
});
function sendVerifyCode() {
$.ajax({
dataType: 'json',
type: 'POST',
url: '@Url.Page("./Plans", "SendSms")',
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
success: function (response) {
if (response.isSuccess) {
$('#CodeDiv').removeClass("disable");
$('#next-step').removeClass('disable');
$('#next-step').attr('onclick', 'confirmCodeToLogin()');
codeTimer();
} else {
$('.loading').hide();
$('#btnSmsReciver').show();
}
},
failure: function (response) {
console.log(5, response);
}
});
}
function codeTimer() {
$('#timer').text('');
var timer2 = "2:00";
var interval = setInterval(function () {
var timer = timer2.split(':');
//by parsing integer, I avoid all extra string processing
var minutes = parseInt(timer[0], 10);
var seconds = parseInt(timer[1], 10);
--seconds;
minutes = (seconds < 0) ? --minutes : minutes;
if (minutes < 0) clearInterval(interval);
seconds = (seconds < 0) ? 59 : seconds;
seconds = (seconds < 10) ? '0' + seconds : seconds;
//minutes = (minutes < 10) ? minutes : minutes;
$('.countdown').html(minutes + ':' + seconds);
timer2 = minutes + ':' + seconds;
if (timer2 === "0:00" && !$('#passDiv').hasClass("showPassDiv")) {
$('#next-step').attr('onclick', '');
$('#next-step').addClass('disable');
$('#CodeDiv').addClass("disable");
//اینپوت برای وارد کردن کدها خالی میشود
$('.time-code').val('');
$('#timer').text('00:00');
}
}, 1000);
}
});
function confirmCodeToLogin() {
var code = $('#time-code').val();
if (code.length == 6) {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: '@Url.Page("./Plans", "CheckCode")',
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: {
'code': code
},
success: function (response) {
if (response.exist === true) {
SaveServiceData();
} else {
$('.alert-msg').show();
$('.alert-msg p').text('کد وارد شده صحیح نیست.');
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
failure: function (response) {
console.log(5, response);
}
});
} else {
$('.alert-msg').show();
$('.alert-msg p').text('کد وارد شده کمتر از 6 رقم است.');
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
}
function SaveServiceData()
{
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: '@Url.Page("./Plans", "SaveServiceFree")',
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: $('#create-form').serialize(),
success: function (response) {
if (response.isSuccedded === true) {
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('');
}, 3500);
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
failure: function (response) {
console.log(5, response);
}
});
}
// function
</script>
var antiForgeryToken = $('@Html.AntiForgeryToken()').val();
var checkCodeAjax = `@Url.Page("./Plans", "CheckCode")'`;
var saveServiceFreeAjax = `@Url.Page("./Plans", "SaveServiceFree")`;
var sendSmsAjax = `@Url.Page("./Plans", "SendSms")`;
</script>
<script src="~/assetsclient/pages/rollcall/js/modalotpactionfree.js"></script>

View File

@@ -1,158 +1,7 @@
@model CompanyManagment.App.Contracts.Workshop.TakePictureModel
@{
int index = 1;
<style>
.test {
width: 55px;
height: 10px;
}
.panel-default > .panel-heading {
text-align: center;
}
video {
border-radius: 10px;
}
@@media (max-width: 992px) {
.modal-content {
padding: 0 !important;
}
}
.md-modal {
/* margin: auto;
position: fixed;
top: 100px;
left: 0;
right: 0;
width: 50%;
max-width: 630px;
min-width: 320px;
height: auto;
z-index: 2000;
visibility: hidden;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden; */
margin: auto;
position: fixed;
top: 70px;
left: 0;
right: 0;
width: 100%;
height: auto;
z-index: 2000;
visibility: hidden;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
}
.md-show {
visibility: visible;
}
.md-overlay {
position: fixed;
width: 100%;
height: 100%;
visibility: hidden;
top: 0;
left: 0;
z-index: 1000;
opacity: 0;
background: rgba(228, 240, 227, 0.8);
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
}
.md-show ~ .md-overlay {
opacity: 1;
visibility: visible;
}
.md-effect-12 .md-content {
-webkit-transform: scale(0.8);
-moz-transform: scale(0.8);
-ms-transform: scale(0.8);
transform: scale(0.8);
opacity: 0;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
}
.md-show.md-effect-12 ~ .md-overlay {
background-color: #e4f0e3;
}
.md-effect-12 .md-content h3,
.md-effect-12 .md-content {
background: transparent;
}
.md-show.md-effect-12 .md-content {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
opacity: 1;
}
.image-show {
margin: 0 auto 8px auto;
border: 2px dashed #148b8b;
width: 200px;
height: 200px;
border-radius: 10px;
position: relative;
}
.image-show button {
height: 100%;
width: 100%;
background: #17909040;
font-family: inherit;
position: absolute;
z-index: 3;
color: #fff;
font-weight: 900;
top: 0;
right: 0;
}
.camera_close {
position: fixed;
top: -50px;
right: 10px;
background-color: #fff;
border-radius: 50px;
width: 42px;
height: 42px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}
/* video {
width: 100% !important;
height: 100% !important;
} */
video {
width: 100% !important;
height: 100% !important;
object-fit: cover !important;
}
</style>
<link href="~/assetsclient/pages/rollcall/css/modaltakeimages.css" rel="stylesheet" />
}
<form role="form" method="post" name="create-form" id="create-form" autocomplete="off">
@@ -327,296 +176,7 @@
@* <script src="~/webcamjs/webcam.js"></script> *@
<script src="~/AssetsClient/libs/jslib-html5-camera/jslib-html5-camera-photo.min.js"></script>
<script>
// if ($(window).width() < 992) {
// Webcam.set({
// width: 1800,
// height: 1800,
// // final cropped size
// // crop_width: 296,
// // crop_height: 396,
// dest_width: 1800,
// dest_height: 1800,
// crop_width: 1800,
// crop_height: 1800,
// image_format: 'jpeg',
// jpeg_quality: 90,
// // facingMode: "environment",
// constraints: {
// facingMode: "user" // This sets the camera to front-facing
// }
// });
// Webcam.attach('#my_camera');
// Webcam.attach('#video');
// var demo = $('#video');
// let demoVideo = $('#video').find('video[playsinline="playsinline"]');
// demo.css({
// width: "100%",
// height: "100%",
// });
// demoVideo.css({
// width: "100%",
// height: "100%",
// });
// } else {
// Webcam.set({
// width: 600,
// height: 600,
// image_format: 'jpeg',
// jpeg_quality: 100
// });
// Webcam.attach('#my_camera');
// Webcam.attach('#video');
// var demo = $('#video');
// let demoVideo = $('#video').find('video[playsinline="playsinline"]');
// demo.css({
// width: "100%",
// height: "100%",
// });
// demoVideo.css({
// width: "100%",
// height: "100%",
// });
// }
// function take_snapshot1() {
// Webcam.snap(function (data_uri) {
// // ایجاد یک عنصر تصویر از داده‌های تصویر
// var img = new Image();
// img.src = data_uri;
// img.onload = function() {
// let canvas = document.createElement('canvas');
// let ctx = canvas.getContext('2d');
// // پیدا کردن اندازه مربع برای کراپ
// let sideLength = Math.min(img.width, img.height);
// let startX = (img.width - sideLength) / 2;
// let startY = (img.height - sideLength) / 2;
// let newWidth = 1800;
// let newHeight = 1800;
// // تنظیم اندازه کانواس به اندازه جدید
// canvas.width = newWidth;
// canvas.height = newHeight;
// // رسم تصویر کراپ شده و تغییر اندازه داده شده
// ctx.drawImage(img, startX, startY, sideLength, sideLength, 0, 0, newWidth, newHeight);
// // resolve(canvas.toDataURL('image/jpeg'));
// // // ایجاد یک بوم برای برش دادن تصویر
// // var canvas = document.createElement('canvas');
// // var context = canvas.getContext('2d');
// // var size = Math.min(img.width, img.height);
// // canvas.width = size;
// // canvas.height = size;
// // // محاسبه محل برش تصویر
// // var sx = (img.width - size) / 2;
// // var sy = (img.height - size) / 2;
// // context.drawImage(img, sx, sy, size, size, 0, 0, size, size);
// // تبدیل بوم به داده‌های URI
// var croppedDataUri = canvas.toDataURL('image/jpeg');
// // نمایش تصویر برش داده شده
// document.getElementById('result1').innerHTML = '<img style="display:none; object-fit: cover;" id="pic1" data-uri="' + croppedDataUri + '" src="' + croppedDataUri + '"/>';
// document.getElementById('demoResult1').innerHTML = '<button type="button" class="upload-image1">آپلود عکس اول</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + croppedDataUri + '" src="' + croppedDataUri + '"/>';
// };
// });
// $('.md-modal').removeClass('md-show');
// }
// function take_snapshot1() {
// Webcam.snap(function(data_uri) {
// document.getElementById('result1').innerHTML = '<img style="display:none; object-fit: cover;" id="pic1" data-uri="' + data_uri + '" src="' + data_uri + '"/>';
// document.getElementById('demoResult1').innerHTML = '<button type="button" class="upload-image1">آپلود عکس اول</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + data_uri + '" src="' + data_uri + '"/>';
// });
// $('.md-modal').removeClass('md-show');
// }
// function take_snapshot2() {
// Webcam.snap(function (data_uri) {
// document.getElementById('result2').innerHTML = '<img style="display:none; object-fit: cover;" id="pic2" data-uri="' + data_uri + '" src="' + data_uri + '"/>';
// document.getElementById('demoResult2').innerHTML = '<button type="button" class="upload-image2">آپلود عکس دوم</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + data_uri + '" src="' + data_uri + '"/>';
// });
// $('.md-modal').removeClass('md-show');
// }
var antiForgeryToken = $('@Html.AntiForgeryToken()').val();
var takePictureAjax = `@Url.Page("./EmployeeUploadPicture", "TakePicture")`;
</script>
<script>
$(document).ready(function () {
if ($(window).width() > 992) {
$('#desktopDisplay').show();
$('#mobileDisplay').hide();
$('#mobileDisplay').html('');
}
if ($(window).width() <= 992) {
$('#desktopDisplay').html('');
$('#desktopDisplay').hide();
$('#mobileDisplay').show();
}
$(document).on('click', '.upload-image1', function () {
$('.md-modal').addClass('md-show');
$('.take_snapshot1').show();
$('.take_snapshot2').hide();
startCamera();
});
$(document).on('click', '.upload-image2', function () {
$('.md-modal').addClass('md-show');
$('.take_snapshot1').hide();
$('.take_snapshot2').show();
startCamera();
});
$(document).on('click', '.camera_close', function () {
$('.md-modal').removeClass('md-show');
stopCamera();
});
});
var FACING_MODES = JslibHtml5CameraPhoto.FACING_MODES;
var IMAGE_TYPES = JslibHtml5CameraPhoto.IMAGE_TYPES;
// Check if videoElement is already declared to avoid redeclaration
// if (typeof videoElement === 'undefined') {
var videoElement = document.getElementById('videoElement');
var cameraPhoto = new JslibHtml5CameraPhoto.default(videoElement);
// }
function startCamera() {
// startCameraMaxResolution
cameraPhoto.startCamera(FACING_MODES.USER).then(() => {
console.log('Camera started!');
}).catch((error) => {
console.log(error);
console.error('Camera not started!', error);
});
}
function stopCamera() {
cameraPhoto.stopCamera().then(() => {
console.log('Camera stopped!');
}).catch((error) => {
console.log('No camera to stop!:', error);
});
}
function cropAndResizeImage(base64Str, newWidth, newHeight) {
return new Promise((resolve) => {
let img = new Image();
img.src = base64Str;
img.onload = () => {
let canvas = document.createElement('canvas');
let ctx = canvas.getContext('2d');
let sideLength = Math.min(img.width, img.height);
let startX = (img.width - sideLength) / 2;
let startY = (img.height - sideLength) / 2;
canvas.width = newWidth;
canvas.height = newHeight;
ctx.drawImage(img, startX, startY, sideLength, sideLength, 0, 0, newWidth, newHeight);
resolve(canvas.toDataURL('image/jpeg'));
};
});
}
function take_snapshot1() {
var sizeFactor = 1;
var imageType = IMAGE_TYPES.JPG;
var imageCompression = 1;
var config = {
sizeFactor,
imageType,
imageCompression
};
var dataUri = cameraPhoto.getDataUri(config);
cropAndResizeImage(dataUri, 1800, 1800).then((resizedDataUri) => {
document.getElementById('result1').innerHTML = '<img style="display:none; object-fit: cover;" id="pic1" data-uri="' + resizedDataUri + '" src="' + resizedDataUri + '"/>';
document.getElementById('demoResult1').innerHTML = '<button type="button" class="upload-image1">آپلود عکس اول</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + resizedDataUri + '" src="' + resizedDataUri + '"/>';
}).catch((error) => {
console.error('Error cropping and resizing photo:', error);
});
$('.md-modal').removeClass('md-show');
stopCamera();
}
function take_snapshot2() {
var sizeFactor = 1;
var imageType = IMAGE_TYPES.JPG;
var imageCompression = 1;
var config = {
sizeFactor,
imageType,
imageCompression
};
var dataUri = cameraPhoto.getDataUri(config);
cropAndResizeImage(dataUri, 1800, 1800).then((resizedDataUri) => {
document.getElementById('result2').innerHTML = '<img style="display:none; object-fit: cover;" id="pic2" data-uri="' + resizedDataUri + '" src="' + resizedDataUri + '"/>';
document.getElementById('demoResult2').innerHTML = '<button type="button" class="upload-image2">آپلود عکس دوم</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + resizedDataUri + '" src="' + resizedDataUri + '"/>';
}).catch((error) => {
console.error('Error cropping and resizing photo:', error);
});
$('.md-modal').removeClass('md-show');
stopCamera();
}
function set() {
let pic1 = $("#pic1").attr('src');
let pic2 = $("#pic2").attr('src');
let workshopId = Number($('#workshopId').val());
let employeeId = Number($('#employeeId').val());
if (pic1 != null && pic2 != null) {
$.ajax({
type: 'POST',
url: '@Url.Page("./EmployeeUploadPicture", "TakePicture")',
data: { "base64pic1": pic1, "base64pic2": pic2, "workshopId": workshopId, "employeeId": employeeId },
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
success: function (response) {
if (response.isSuccedded) {
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('ثبت عکس با موفقیت انجام شد');
window.location.reload();
}, 2000);
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('خطایی پیش آمده است');
}, 3500);
}
},
failure: function (response) {
console.log(5, response);
}
});
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('گرفتن دو عکس الزامیست');
}, 3500);
}
}
</script>
<script src="~/assetsclient/pages/rollcall/js/modaltakeimages.js"></script>

View File

@@ -110,25 +110,9 @@
<script src="~/assetsclient/js/site.js?ver=@Version.StyleVersion"></script>
<script>
function choosePlane(maxPersonnelId) {
var maxPersonnelVal = Number(maxPersonnelId);
var parameter = '&maxId=' + maxPersonnelVal;
var url = '#showmodal=@Url.Page("/Company/RollCall/Plans", "OTPAction")';
window.location.href = url + parameter;
}
function choosePlaneFree() {
var employeeCount = @Model.EmployeeCount;
if (employeeCount > 0) {
window.location.href = '#showmodal=@Url.Page("/Company/RollCall/Plans", "OTPActionFree")';
} else {
$('.alert-msg').show();
$('.alert-msg p').text('هیچ پرسنلی در کارگاه وجود ندارد');
setTimeout(function() {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
}
var OTPActionUrl = '#showmodal=@Url.Page("/Company/RollCall/Plans", "OTPAction")';
var employeeCount = @Model.EmployeeCount;
var OTPActionFreeUrl = `#showmodal=@Url.Page("/Company/RollCall/Plans", "OTPActionFree")`;
</script>
<script src="~/assetsclient/pages/rollcall/js/plans.js"></script>
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

View File

@@ -447,6 +447,15 @@
<None Include="wwwroot\AssetsClient\libs\select2\js\select2.full.min.js" />
<None Include="wwwroot\AssetsClient\libs\select2\js\select2.js" />
<None Include="wwwroot\AssetsClient\libs\select2\js\select2.min.js" />
<None Include="wwwroot\AssetsClient\pages\RollCall\js\CaseHistory.js" />
<None Include="wwwroot\AssetsClient\pages\RollCall\js\CurrentDay.js" />
<None Include="wwwroot\AssetsClient\pages\RollCall\js\EmployeeUploadPicture.js" />
<None Include="wwwroot\AssetsClient\pages\RollCall\js\Index.js" />
<None Include="wwwroot\AssetsClient\pages\RollCall\js\ModalCameraAccount.js" />
<None Include="wwwroot\AssetsClient\pages\RollCall\js\ModalOTPAction.js" />
<None Include="wwwroot\AssetsClient\pages\RollCall\js\ModalOTPActionFree.js" />
<None Include="wwwroot\AssetsClient\pages\RollCall\js\ModalTakeImages.js" />
<None Include="wwwroot\AssetsClient\pages\RollCall\js\Plans.js" />
<None Include="wwwroot\AssetsClient\Workshop\js\ContractCheckoutYearlyStatus.js" />
<None Include="wwwroot\AssetsClient\Workshop\js\employees.js" />
<None Include="wwwroot\bootstrap-icons-1.11.2\0-circle-fill.svg" />

View File

@@ -0,0 +1,48 @@
.tooltipfull-container {
cursor: pointer;
position: relative;
}
.tooltipfull {
opacity: 0;
z-index: 99;
color: #fff;
display: grid;
font-size: 12px;
padding: 5px 10px;
border-radius: 8px;
background: #23a8a8;
border: 1px solid #23a8a8;
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
position: absolute;
right: -2px;
bottom: 30px;
white-space: nowrap;
}
.tooltipfull-container:hover .tooltipfull, a:hover .tooltipfull {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.tooltipfull:before, .tooltipfull:after {
content: '';
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #23a8a8;
position: absolute;
bottom: -10px;
right: 20px;
}

View File

@@ -0,0 +1,48 @@
.tooltipfull-container {
cursor: pointer;
position: relative;
}
.tooltipfull {
opacity: 0;
z-index: 99;
color: #fff;
display: grid;
font-size: 12px;
padding: 5px 10px;
border-radius: 8px;
background: #23a8a8;
border: 1px solid #23a8a8;
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
position: absolute;
right: -2px;
bottom: 30px;
white-space: nowrap;
}
.tooltipfull-container:hover .tooltipfull, a:hover .tooltipfull {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.tooltipfull:before, .tooltipfull:after {
content: '';
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #23a8a8;
position: absolute;
bottom: -10px;
right: 20px;
}

View File

@@ -0,0 +1,149 @@
.test {
width: 55px;
height: 10px;
}
.panel-default > .panel-heading {
text-align: center;
}
video {
border-radius: 10px;
}
@media (max-width: 992px) {
.modal-content {
padding: 0 !important;
}
}
.md-modal {
/* margin: auto;
position: fixed;
top: 100px;
left: 0;
right: 0;
width: 50%;
max-width: 630px;
min-width: 320px;
height: auto;
z-index: 2000;
visibility: hidden;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden; */
margin: auto;
position: fixed;
top: 70px;
left: 0;
right: 0;
width: 100%;
height: auto;
z-index: 2000;
visibility: hidden;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
}
.md-show {
visibility: visible;
}
.md-overlay {
position: fixed;
width: 100%;
height: 100%;
visibility: hidden;
top: 0;
left: 0;
z-index: 1000;
opacity: 0;
background: rgba(228, 240, 227, 0.8);
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
}
.md-show ~ .md-overlay {
opacity: 1;
visibility: visible;
}
.md-effect-12 .md-content {
-webkit-transform: scale(0.8);
-moz-transform: scale(0.8);
-ms-transform: scale(0.8);
transform: scale(0.8);
opacity: 0;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
}
.md-show.md-effect-12 ~ .md-overlay {
background-color: #e4f0e3;
}
.md-effect-12 .md-content h3,
.md-effect-12 .md-content {
background: transparent;
}
.md-show.md-effect-12 .md-content {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
opacity: 1;
}
.image-show {
margin: 0 auto 8px auto;
border: 2px dashed #148b8b;
width: 200px;
height: 200px;
border-radius: 10px;
position: relative;
}
.image-show button {
height: 100%;
width: 100%;
background: #17909040;
font-family: inherit;
position: absolute;
z-index: 3;
color: #fff;
font-weight: 900;
top: 0;
right: 0;
}
.camera_close {
position: fixed;
top: -50px;
right: 10px;
background-color: #fff;
border-radius: 50px;
width: 42px;
height: 42px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}
/* video {
width: 100% !important;
height: 100% !important;
} */
video {
width: 100% !important;
height: 100% !important;
object-fit: cover !important;
}

View File

@@ -0,0 +1,114 @@
$(document).ready(function () {
$(".select2Option").select2({
language: "fa",
dir: "rtl"
});
$('.loadingButton').on('click', function () {
var button = $(this);
var loadingDiv = button.find('.loading');
loadingDiv.show();
});
$(document).on('click', ".openAction", function () {
$(this).next().find(".operations-btns").slideToggle(500);
$(".operations-btns").not($(this).next().find(".operations-btns")).slideUp(500);
});
var filterEmployeeId = $('#AccountId').val();
var filterStart = $('#StartDate').val().trim();
var filterEnd = $('#EndDate').val().trim();
if (filterEmployeeId != 0 || filterStart != '' || filterEnd != '') {
$('.btn-clear-filter').removeClass('disable');
} else {
$('.btn-clear-filter').addClass('disable');
}
});
// *************************** مربوط به جستجو در دسکتاپ ********************************
const selectedAll = document.querySelectorAll(".wrapper-dropdown");
var wrapperDropdown = $(".wrapper-dropdown");
$(document).ready(function () {
wrapperDropdown.on("click", function () {
var dropdown = $(this);
var optionsContainer = dropdown.children(".dropdown");
var optionsList = optionsContainer.find(".item");
dropdown.toggleClass("active");
if (dropdown.hasClass("active")) {
wrapperDropdown.not(this).removeClass("active");
}
optionsList.on("click", function () {
var selectedOption = $(this);
var valueData = selectedOption.data("value");
dropdown.removeClass("active");
dropdown.find(".selected-display").text(selectedOption.text());
$("#sendSorting").val(valueData);
optionsList.removeClass("active");
selectedOption.addClass("active");
});
});
var defaultValue = $("#sendSorting").val();
if (defaultValue) {
let defaultItem = $(".dropdown").find(".item[value-data='" + defaultValue + "']");
defaultItem.addClass("active");
var selectedDisplay = wrapperDropdown.find(".selected-display");
selectedDisplay.text(defaultItem.text());
}
});
$('.dropdown-days .item').on("click", function () {
let dataVal = $(this).attr("value-data-normal");
console.log(dataVal);
if (dataVal === "OneDay") {
// $('#endDateRollcall').removeClass('d-flex');
$('#endDateRollcall').addClass('d-none');
} else {
// $('#endDateRollcall').addClass('d-flex');
$('#endDateRollcall').removeClass('d-none');
}
// $('#dropdown-RollcallDate').val(dataVal);
});
var sendDropdownNormal = $("#sendSorting").val();
if (sendDropdownNormal) {
let itemDropdownNormal = $(".dropdown-normal").find(".item[value-data-normal='" + sendDropdownNormal + "']");
itemDropdownNormal.addClass("active");
var selectedNormalDisplay = $(".wrapper-dropdown-normal").find(".selected-display");
selectedNormalDisplay.text(itemDropdownNormal.text());
}
var sendDropdownYear = $("#sendDropdownYear").val();
if (sendDropdownYear) {
let itemDropdownYear = $(".dropdown-year").find(".item[value-data-year='" + sendDropdownYear + "']");
itemDropdownYear.addClass("active");
var selectedYearDisplay = $(".wrapper-dropdown-year").find(".selected-display");
selectedYearDisplay.text(itemDropdownYear.text());
}
var sendDropdownMonth = $("#sendDropdownMonth").val();
if (sendDropdownMonth) {
let itemDropdownMonth = $(".dropdown-month").find(".item[value-data-month='" + sendDropdownMonth + "']");
itemDropdownMonth.addClass("active");
var selectedMonthDisplay = $(".wrapper-dropdown-month").find(".selected-display");
selectedMonthDisplay.text(itemDropdownMonth.text());
}
$(".date").on('input', function () {
var value = $(this).val();
$(this).val(convertPersianNumbersToEnglish(value));
}).mask("0000/00/00");

View File

@@ -0,0 +1,12 @@
$(document).ready(function () {
$('.loadingButton').on('click', function () {
var button = $(this);
var loadingDiv = button.find('.loading');
loadingDiv.show();
});
$(document).on('click', ".openAction", function () {
$(this).next().find(".operations-btns").slideToggle(500);
$(".operations-btns").not($(this).next().find(".operations-btns")).slideUp(500);
});
});

View File

@@ -0,0 +1,106 @@
$(document).ready(function () {
$('.loadingButton').on('click', function () {
var button = $(this);
var loadingDiv = button.find('.loading');
loadingDiv.show();
});
});
function ModalUploadPics(employeeID)
{
$.ajax({
async: false,
dataType: 'json',
url: checkModalTakeImageAjax,
type: 'GET',
success: function (response) {
if (response.isSuccedded) {
window.location.href = `#showmodal=/Client/Company/RollCall/EmployeeUploadPicture?employeeId=${employeeID}&handler=ModalTakeImages`;
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
error: function (err) {
console.log(err);
}
});
}
function deactivePersonnel(id) {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: deActivePersonnelAjax,
headers: { "RequestVerificationToken": antiForgeryToken },
data: { id: Number(id) },
success: function (response) {
if (response.isSuccedded) {
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('');
window.location.reload();
}, 2000);
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
error: function (err) {
console.log(err);
}
});
}
function activePersonnel(id, hasUploadedImage) {
if (hasUploadedImage === "true") {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: activePersonnelAjax,
headers: { "RequestVerificationToken": antiForgeryToken },
data: { id: Number(id) },
success: function (response) {
if (response.isSuccedded) {
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('');
window.location.reload();
}, 2000);
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
error: function (err) {
console.log(err);
}
});
} else {
var errorText = "برای این پرسنل، هنوز هیچ عکسی آپلود نشده است. بعد از آپلود عکس بطور خودکار فعال خواهد شد";
$('.alert-msg').show();
$('.alert-msg p').text(errorText);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
}

View File

@@ -0,0 +1,31 @@
$(".openAction").click(function () {
$(this).next().find(".operations-btns").slideToggle(500);
$(".operations-btns").not($(this).next().find(".operations-btns")).slideUp(500);
});
$(document).ready(function () {
$(this).find(".operations-btns").first().slideToggle(500);
});
$(document).ready(function () {
$('.loadingButton').on('click', function () {
var button = $(this);
var loadingDiv = button.find('.loading');
loadingDiv.show();
});
});
// function AjaxPlans(id) {
// $.ajax({
// url: '@Url.Page("./Plans")',
// type: 'GET',
// headers: {
// 'workshopId': id
// },
// success: function (response) {
// window.location.href = '@Url.Page("./Plans")'
// },
// error: function (e) {
// console.log('error: ' + e)
// }
// });
// }

View File

@@ -0,0 +1,224 @@
$('.loading').hide();
document.getElementById("MainModal").style.visibility = "visible";
$(".toggle").click(function(){
$(".sidebar-navigation").toggleClass("small")
// $(".main-wrapper").toggleClass("small");
$(".sidebar").toggleClass("active-sidebar-navigation");
$(".header-container").toggleClass("main-wrapper ");
$(".header-container").toggleClass("small");
$(".content-container").toggleClass("small");
// $(".content-container").toggleClass("");
$('#overlay').toggleClass("overlay");
});
$("#close-sidemenu-mobile").click(function(){
$(".sidebar-navigation").toggleClass("small")
$(".sidebar").toggleClass("active-sidebar-navigation");
$(".header-container").toggleClass("main-wrapper ");
$(".header-container").toggleClass("small");
$(".content-container").toggleClass("small");
$('#overlay').toggleClass("overlay");
});
$("#overlay").click(function(){
$(".sidebar-navigation").toggleClass("small")
$(".sidebar").toggleClass("active-sidebar-navigation");
$(".header-container").toggleClass("main-wrapper ");
$(".header-container").toggleClass("small");
$(".content-container").toggleClass("small");
$('#overlay').toggleClass("overlay");
});
$(document).ready(function(){
if ($(window).width() < 992) {
$(".sidebar-navigation").toggleClass("small");
// $(".main-wrapper").toggleClass("small");
$(".sidebar").toggleClass("active-sidebar-navigation");
$(".header-container").toggleClass("main-wrapper ");
$(".header-container").toggleClass("small");
$(".content-container").toggleClass("small");
// $(".content-container").toggleClass("");
}
if ($(window).width() > 992){
$('#overlay').toggleClass("overlay");
}
});
var eyeShow = $('.eyeShow');
var eyeClose = $('.eyeClose');
var reEyeShow = $('.reEyeShow');
var reEyeClose = $('.reEyeClose');
eyeShow.show();
eyeClose.hide();
reEyeShow.show();
reEyeClose.hide();
$(document).on('click','#accountModalModal button', function() {
// alert($(this));
// $(this).find('input').type ? 'text' : 'password';
// document.getElementById('hybrid').type = 'password';
$("#accountModalModal button").find('input').attr("type", "text");
// var input=document.getElementById(some-id);
// var input2= input.cloneNode(false);
// input2.type='password';
// input.parentNode.replaceChild(input2,input);
});
function passFunction() {
var x = document.getElementById("signupInputPassword");
if (x.type === "password") {
x.type = "text";
eyeShow.hide();
eyeClose.show();
} else {
x.type = "password";
eyeShow.show();
eyeClose.hide();
}
}
function rePassFunction() {
var x = document.getElementById("repeat_password");
if (x.type === "password") {
x.type = "text";
reEyeShow.hide();
reEyeClose.show();
} else {
x.type = "password";
reEyeShow.show();
reEyeClose.hide();
}
}
function passwordCheck(password) {
if (password.length >= 8)
strength += 1;
if (password.match(/(?=.*[0-9])/))
strength += 1;
if (password.match(/(?=.*[!,%,&,@,#,$,^,*,?,_,~,<,>,])/))
strength += 1;
if (password.match(/(?=.*[A-Z])/))
strength += 1;
displayBar(strength);
}
function displayBar(strength) {
$(".password-strength-group").attr('data-strength', strength);
}
$("#signupInputPassword").keyup(function () {
strength = 0;
var password = $(this).val();
passwordCheck(password);
});
$(document).ready(function() {
$("#username").keyup(function () {
var username = $('#username').val();
if (username.length >= 6) {
$.ajax({
async: false,
dataType: 'json',
type: 'GET',
url: checkAccountAjax,
data: { username: username },
success: function (response) {
if (response.success) {
$('#errorSvg').addClass("d-none");
$('#successSvg').removeClass("d-none");
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('');
}, 2000);
} else {
$('#successSvg').addClass("d-none");
$('#errorSvg').removeClass("d-none");
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 2000);
}
},
error: function (err) {
console.log(err);
}
});
} else {
$('.alert-msg').show();
$('.alert-msg p').text("نام کاربری حداقل باید 6 حرف باشد");
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
$('#successSvg').addClass("d-none");
$('#errorSvg').removeClass("d-none");
}
});
});
function save() {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: saveCameraAccountAjax,
headers: { "RequestVerificationToken": antiForgeryToken },
data: $('#create-form').serialize(),
success: function (response) {
if (response.success) {
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('');
}, 3500);
window.location.reload();
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
error: function (err) {
console.log(err);
}
});
}

View File

@@ -0,0 +1,251 @@
var dateTimeNow = '';
$(document).ready(function () {
$('#rule').click(function () {
if ($(this).is(':checked')) {
$('#btnSmsReciver').prop("disabled", false);
$('#btnSmsReciver').removeClass("disable");
$(this).prop("disabled", true);
} else {
$('#btnSmsReciver').prop("disabled", true);
$('#btnSmsReciver').addClass("disable");
}
});
$("#next-step").on("click", function () {
$('#step-form1').hide();
$('#step-form2').show();
$('#prev-step').text('مرحله قبل');
$('#next-step').text('ثبت');
// $('#next-step').addClass('disable')
$('#step-2').removeClass('not-step');
});
$("#prev-step").on("click", function () {
$('#step-form1').show();
if ($('#step-form2').is(":hidden")) {
$("#MainModal").modal("hide");
}
$('#step-form2').hide();
$('#prev-step').text('انصراف');
$('#next-step').text('مرحله بعد');
$('#step-2').addClass('not-step');
});
$("#time-code").on('input', function () {
var value = $(this).val();
$(this).val(convertPersianNumbersToEnglish(value));
}).mask("000000");
$('#changeDuration').on('change', function () {
if (this.value == "1Mount") {
$('#Duration').val('یک ماهه');
} else if (this.value == "3Mount") {
$('#Duration').val('سه ماهه');
} else if (this.value == "6Mount") {
$('#Duration').val('شش ماهه');
} else if (this.value == "12Mount") {
$('#Duration').val('یک ساله');
}
$.ajax({
async: false,
dataType: 'json',
url: computeMoneyByMountAjax,
type: 'GET',
data: {"mount": this.value, "money": $('#AmountFaReal').val() },
success: function (response) {
console.log(response);
if (response.isSuccedded) {
$('#AmountFaWithout').text(response.cumputeWithout);
$('#AmountFaDiscount').text(response.cumputeDiscount);
$('#AmountFaWith').text(response.cumpute);
$('#AmountFaTotal').text(response.cumpute);
$('#AmountFa').text(response.cumpute);
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
error: function (err) {
console.log(err);
}
});
});
$('#btnSmsReciver').on("click", function () {
$('#btnSmsReciver').prop("disabled", true);
$('#btnSmsReciver').addClass("disable");
sendVerifyCode();
});
function sendVerifyCode() {
$.ajax({
dataType: 'json',
type: 'POST',
url: sendSmsAjax,
headers: { "RequestVerificationToken": antiForgeryToken },
success: function (response) {
if (response.isSuccess) {
$('#CodeDiv').removeClass("disable");
$('#next-step').removeClass('disable');
$('#next-step').attr('onclick', 'confirmCodeToLogin()');
// codeTimer();
dateTimeNow = new Date().toJSON();
startTimer(2);
} else {
$('.loading').hide();
$('#btnSmsReciver').show();
}
},
failure: function (response) {
console.log(5, response);
}
});
}
function startTimer(minutes) {
var timer = minutes * 60, display = $('#timer');
var interval = setInterval(function () {
var minutes = parseInt(timer / 60, 10);
var seconds = parseInt(timer % 60, 10);
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
display.text(minutes + ":" + seconds);
if (--timer < 0) {
clearInterval(interval);
$('#btnSmsReciver').prop("disabled", false);
$('#btnSmsReciver').removeClass("disable");
$('#btnSmsReciver').text('ارسال دوباره');
$('#CodeDiv').addClass("disable");
}
}, 1000);
}
function codeTimer() {
$('#timer').text('');
var timer2 = "2:00";
var interval = setInterval(function () {
var timer = timer2.split(':');
//by parsing integer, I avoid all extra string processing
var minutes = parseInt(timer[0], 10);
var seconds = parseInt(timer[1], 10);
--seconds;
minutes = (seconds < 0) ? --minutes : minutes;
if (minutes < 0) clearInterval(interval);
seconds = (seconds < 0) ? 59 : seconds;
seconds = (seconds < 10) ? '0' + seconds : seconds;
//minutes = (minutes < 10) ? minutes : minutes;
$('.countdown').html(minutes + ':' + seconds);
timer2 = minutes + ':' + seconds;
if (timer2 === "0:00" && !$('#passDiv').hasClass("showPassDiv")) {
$('#next-step').attr('onclick', '');
$('#next-step').addClass('disable');
$('#CodeDiv').addClass("disable");
//اینپوت برای وارد کردن کدها خالی میشود
$('.time-code').val('');
$('#timer').text('00:00');
}
}, 1000);
}
// var form = $("#steps");
// form.steps({
// headerTag: "h6",
// bodyTag: "section",
// transitionEffect: "fade",
// titleTemplate: '<div class="step-progress"><h5 class="d-flex justify-content-center align-items-center not-step"> #index# </h5><p>#title#</p></div>'
// });
});
function confirmCodeToLogin() {
var code = $('#time-code').val();
if (code.length === 6) {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: checkCodeAjax,
headers: { "RequestVerificationToken": antiForgeryToken },
data: {
'code': code,
'codeSendTimeStr': dateTimeNow
},
success: function (response) {
if (response.exist === true) {
SaveServiceData();
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
failure: function (response) {
console.log(5, response);
}
});
} else {
$('.alert-msg').show();
$('.alert-msg p').text('کد وارد شده کمتر از 6 رقم است.');
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
}
function SaveServiceData()
{
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: saveServiceAjax,
headers: { "RequestVerificationToken": antiForgeryToken },
data: $('#create-form').serialize(),
success: function (response) {
if (response.isSuccedded === true) {
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('');
}, 3500);
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
failure: function (response) {
console.log(5, response);
}
});
}
function OpenAccount() {
window.location.href = saveCameraAccountUrl;
}

View File

@@ -0,0 +1,164 @@
$(document).ready(function () {
$('#rule').click(function () {
if ($(this).is(':checked')) {
$('#btnSmsReciver').prop("disabled", false);
$('#btnSmsReciver').removeClass("disable");
} else {
$('#btnSmsReciver').prop("disabled", true);
$('#btnSmsReciver').addClass("disable");
}
});
$("#next-step").on("click", function () {
$('#step-form1').hide();
$('#step-form2').show();
$('#prev-step').text('مرحله قبل');
$('#next-step').text('ثبت');
// $('#next-step').addClass('disable')
$('#step-2').removeClass('not-step');
});
$("#prev-step").on("click", function () {
$('#step-form1').show();
if ($('#step-form2').is(":hidden")) {
$("#MainModal").modal("hide");
}
$('#step-form2').hide();
$('#prev-step').text('انصراف');
$('#next-step').text('مرحله بعد');
$('#step-2').addClass('not-step');
});
$('#btnSmsReciver').on("click", function () {
$('#btnSmsReciver').prop("disabled", true);
$('#btnSmsReciver').addClass("disable");
sendVerifyCode();
});
function sendVerifyCode() {
$.ajax({
dataType: 'json',
type: 'POST',
url: sendSmsAjax,
headers: { "RequestVerificationToken": antiForgeryToken },
success: function (response) {
if (response.isSuccess) {
$('#CodeDiv').removeClass("disable");
$('#next-step').removeClass('disable');
$('#next-step').attr('onclick', 'confirmCodeToLogin()');
codeTimer();
} else {
$('.loading').hide();
$('#btnSmsReciver').show();
}
},
failure: function (response) {
console.log(5, response);
}
});
}
function codeTimer() {
$('#timer').text('');
var timer2 = "2:00";
var interval = setInterval(function () {
var timer = timer2.split(':');
//by parsing integer, I avoid all extra string processing
var minutes = parseInt(timer[0], 10);
var seconds = parseInt(timer[1], 10);
--seconds;
minutes = (seconds < 0) ? --minutes : minutes;
if (minutes < 0) clearInterval(interval);
seconds = (seconds < 0) ? 59 : seconds;
seconds = (seconds < 10) ? '0' + seconds : seconds;
//minutes = (minutes < 10) ? minutes : minutes;
$('.countdown').html(minutes + ':' + seconds);
timer2 = minutes + ':' + seconds;
if (timer2 === "0:00" && !$('#passDiv').hasClass("showPassDiv")) {
$('#next-step').attr('onclick', '');
$('#next-step').addClass('disable');
$('#CodeDiv').addClass("disable");
//اینپوت برای وارد کردن کدها خالی میشود
$('.time-code').val('');
$('#timer').text('00:00');
}
}, 1000);
}
});
function confirmCodeToLogin() {
var code = $('#time-code').val();
if (code.length == 6) {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: checkCodeAjax,
headers: { "RequestVerificationToken": antiForgeryToken },
data: {
'code': code
},
success: function (response) {
if (response.exist === true) {
SaveServiceData();
} else {
$('.alert-msg').show();
$('.alert-msg p').text('کد وارد شده صحیح نیست.');
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
failure: function (response) {
console.log(5, response);
}
});
} else {
$('.alert-msg').show();
$('.alert-msg p').text('کد وارد شده کمتر از 6 رقم است.');
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
}
function SaveServiceData()
{
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: saveServiceFreeAjax,
headers: { "RequestVerificationToken": antiForgeryToken },
data: $('#create-form').serialize(),
success: function (response) {
if (response.isSuccedded === true) {
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('');
}, 3500);
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
},
failure: function (response) {
console.log(5, response);
}
});
}

View File

@@ -0,0 +1,291 @@
// if ($(window).width() < 992) {
// Webcam.set({
// width: 1800,
// height: 1800,
// // final cropped size
// // crop_width: 296,
// // crop_height: 396,
// dest_width: 1800,
// dest_height: 1800,
// crop_width: 1800,
// crop_height: 1800,
// image_format: 'jpeg',
// jpeg_quality: 90,
// // facingMode: "environment",
// constraints: {
// facingMode: "user" // This sets the camera to front-facing
// }
// });
// Webcam.attach('#my_camera');
// Webcam.attach('#video');
// var demo = $('#video');
// let demoVideo = $('#video').find('video[playsinline="playsinline"]');
// demo.css({
// width: "100%",
// height: "100%",
// });
// demoVideo.css({
// width: "100%",
// height: "100%",
// });
// } else {
// Webcam.set({
// width: 600,
// height: 600,
// image_format: 'jpeg',
// jpeg_quality: 100
// });
// Webcam.attach('#my_camera');
// Webcam.attach('#video');
// var demo = $('#video');
// let demoVideo = $('#video').find('video[playsinline="playsinline"]');
// demo.css({
// width: "100%",
// height: "100%",
// });
// demoVideo.css({
// width: "100%",
// height: "100%",
// });
// }
// function take_snapshot1() {
// Webcam.snap(function (data_uri) {
// // ایجاد یک عنصر تصویر از داده‌های تصویر
// var img = new Image();
// img.src = data_uri;
// img.onload = function() {
// let canvas = document.createElement('canvas');
// let ctx = canvas.getContext('2d');
// // پیدا کردن اندازه مربع برای کراپ
// let sideLength = Math.min(img.width, img.height);
// let startX = (img.width - sideLength) / 2;
// let startY = (img.height - sideLength) / 2;
// let newWidth = 1800;
// let newHeight = 1800;
// // تنظیم اندازه کانواس به اندازه جدید
// canvas.width = newWidth;
// canvas.height = newHeight;
// // رسم تصویر کراپ شده و تغییر اندازه داده شده
// ctx.drawImage(img, startX, startY, sideLength, sideLength, 0, 0, newWidth, newHeight);
// // resolve(canvas.toDataURL('image/jpeg'));
// // // ایجاد یک بوم برای برش دادن تصویر
// // var canvas = document.createElement('canvas');
// // var context = canvas.getContext('2d');
// // var size = Math.min(img.width, img.height);
// // canvas.width = size;
// // canvas.height = size;
// // // محاسبه محل برش تصویر
// // var sx = (img.width - size) / 2;
// // var sy = (img.height - size) / 2;
// // context.drawImage(img, sx, sy, size, size, 0, 0, size, size);
// // تبدیل بوم به داده‌های URI
// var croppedDataUri = canvas.toDataURL('image/jpeg');
// // نمایش تصویر برش داده شده
// document.getElementById('result1').innerHTML = '<img style="display:none; object-fit: cover;" id="pic1" data-uri="' + croppedDataUri + '" src="' + croppedDataUri + '"/>';
// document.getElementById('demoResult1').innerHTML = '<button type="button" class="upload-image1">آپلود عکس اول</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + croppedDataUri + '" src="' + croppedDataUri + '"/>';
// };
// });
// $('.md-modal').removeClass('md-show');
// }
// function take_snapshot1() {
// Webcam.snap(function(data_uri) {
// document.getElementById('result1').innerHTML = '<img style="display:none; object-fit: cover;" id="pic1" data-uri="' + data_uri + '" src="' + data_uri + '"/>';
// document.getElementById('demoResult1').innerHTML = '<button type="button" class="upload-image1">آپلود عکس اول</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + data_uri + '" src="' + data_uri + '"/>';
// });
// $('.md-modal').removeClass('md-show');
// }
// function take_snapshot2() {
// Webcam.snap(function (data_uri) {
// document.getElementById('result2').innerHTML = '<img style="display:none; object-fit: cover;" id="pic2" data-uri="' + data_uri + '" src="' + data_uri + '"/>';
// document.getElementById('demoResult2').innerHTML = '<button type="button" class="upload-image2">آپلود عکس دوم</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + data_uri + '" src="' + data_uri + '"/>';
// });
// $('.md-modal').removeClass('md-show');
// }
$(document).ready(function () {
if ($(window).width() > 992) {
$('#desktopDisplay').show();
$('#mobileDisplay').hide();
$('#mobileDisplay').html('');
}
if ($(window).width() <= 992) {
$('#desktopDisplay').html('');
$('#desktopDisplay').hide();
$('#mobileDisplay').show();
}
$(document).on('click', '.upload-image1', function () {
$('.md-modal').addClass('md-show');
$('.take_snapshot1').show();
$('.take_snapshot2').hide();
startCamera();
});
$(document).on('click', '.upload-image2', function () {
$('.md-modal').addClass('md-show');
$('.take_snapshot1').hide();
$('.take_snapshot2').show();
startCamera();
});
$(document).on('click', '.camera_close', function () {
$('.md-modal').removeClass('md-show');
stopCamera();
});
});
var FACING_MODES = JslibHtml5CameraPhoto.FACING_MODES;
var IMAGE_TYPES = JslibHtml5CameraPhoto.IMAGE_TYPES;
// Check if videoElement is already declared to avoid redeclaration
// if (typeof videoElement === 'undefined') {
var videoElement = document.getElementById('videoElement');
var cameraPhoto = new JslibHtml5CameraPhoto.default(videoElement);
// }
function startCamera() {
// startCameraMaxResolution
cameraPhoto.startCamera(FACING_MODES.USER).then(() => {
console.log('Camera started!');
}).catch((error) => {
console.log(error);
console.error('Camera not started!', error);
});
}
function stopCamera() {
cameraPhoto.stopCamera().then(() => {
console.log('Camera stopped!');
}).catch((error) => {
console.log('No camera to stop!:', error);
});
}
function cropAndResizeImage(base64Str, newWidth, newHeight) {
return new Promise((resolve) => {
let img = new Image();
img.src = base64Str;
img.onload = () => {
let canvas = document.createElement('canvas');
let ctx = canvas.getContext('2d');
let sideLength = Math.min(img.width, img.height);
let startX = (img.width - sideLength) / 2;
let startY = (img.height - sideLength) / 2;
canvas.width = newWidth;
canvas.height = newHeight;
ctx.drawImage(img, startX, startY, sideLength, sideLength, 0, 0, newWidth, newHeight);
resolve(canvas.toDataURL('image/jpeg'));
};
});
}
function take_snapshot1() {
var sizeFactor = 1;
var imageType = IMAGE_TYPES.JPG;
var imageCompression = 1;
var config = {
sizeFactor,
imageType,
imageCompression
};
var dataUri = cameraPhoto.getDataUri(config);
cropAndResizeImage(dataUri, 1800, 1800).then((resizedDataUri) => {
document.getElementById('result1').innerHTML = '<img style="display:none; object-fit: cover;" id="pic1" data-uri="' + resizedDataUri + '" src="' + resizedDataUri + '"/>';
document.getElementById('demoResult1').innerHTML = '<button type="button" class="upload-image1">آپلود عکس اول</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + resizedDataUri + '" src="' + resizedDataUri + '"/>';
}).catch((error) => {
console.error('Error cropping and resizing photo:', error);
});
$('.md-modal').removeClass('md-show');
stopCamera();
}
function take_snapshot2() {
var sizeFactor = 1;
var imageType = IMAGE_TYPES.JPG;
var imageCompression = 1;
var config = {
sizeFactor,
imageType,
imageCompression
};
var dataUri = cameraPhoto.getDataUri(config);
cropAndResizeImage(dataUri, 1800, 1800).then((resizedDataUri) => {
document.getElementById('result2').innerHTML = '<img style="display:none; object-fit: cover;" id="pic2" data-uri="' + resizedDataUri + '" src="' + resizedDataUri + '"/>';
document.getElementById('demoResult2').innerHTML = '<button type="button" class="upload-image2">آپلود عکس دوم</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + resizedDataUri + '" src="' + resizedDataUri + '"/>';
}).catch((error) => {
console.error('Error cropping and resizing photo:', error);
});
$('.md-modal').removeClass('md-show');
stopCamera();
}
function set() {
let pic1 = $("#pic1").attr('src');
let pic2 = $("#pic2").attr('src');
let workshopId = Number($('#workshopId').val());
let employeeId = Number($('#employeeId').val());
if (pic1 != null && pic2 != null) {
$.ajax({
type: 'POST',
url: takePictureAjax,
data: { "base64pic1": pic1, "base64pic2": pic2, "workshopId": workshopId, "employeeId": employeeId },
headers: { "RequestVerificationToken": antiForgeryToken },
success: function (response) {
if (response.isSuccedded) {
$('.alert-success-msg').show();
$('.alert-success-msg p').text(response.message);
setTimeout(function () {
$('.alert-success-msg').hide();
$('.alert-success-msg p').text('ثبت عکس با موفقیت انجام شد');
window.location.reload();
}, 2000);
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('خطایی پیش آمده است');
}, 3500);
}
},
failure: function (response) {
console.log(5, response);
}
});
} else {
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('گرفتن دو عکس الزامیست');
}, 3500);
}
}

View File

@@ -0,0 +1,19 @@
function choosePlane(maxPersonnelId) {
var maxPersonnelVal = Number(maxPersonnelId);
var parameter = '&maxId=' + maxPersonnelVal;
var url = OTPActionUrl;
window.location.href = url + parameter;
}
function choosePlaneFree() {
if (employeeCount > 0) {
window.location.href = OTPActionFreeUrl;
} else {
$('.alert-msg').show();
$('.alert-msg p').text('هیچ پرسنلی در کارگاه وجود ندارد');
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text('');
}, 3500);
}
}