From 9b1f141dec418c743ce67f9e3f42c189c8a16a6a Mon Sep 17 00:00:00 2001 From: SamSys Date: Tue, 7 Jan 2025 17:49:46 +0330 Subject: [PATCH] rollcall admin report --- .../GetWorkshopWithRollCallHandler.cs | 151 +++++++++--------- .../WorkshopWithRollCallServiceQueryModel.cs | 48 +++--- ...kshopWithRollCallServiceQueryParameters.cs | 16 +- Query/Query.csproj | 1 + .../Pages/Company/RollCall/Index.cshtml | 75 +++++++-- .../Pages/Company/RollCall/Index.cshtml.cs | 35 +++- ServiceHost/ServiceHost.csproj | 17 ++ .../AssetsAdminNew/RollCall/css/Index.css | 86 +++++++--- .../wwwroot/AssetsClient/css/table-style.css | 2 +- ServiceHost/wwwroot/AssetsClient/js/site.js | 11 +- 10 files changed, 297 insertions(+), 145 deletions(-) diff --git a/Query/AdminReports/Handlers/GetWorkshopWithRollCallHandler.cs b/Query/AdminReports/Handlers/GetWorkshopWithRollCallHandler.cs index 19c9ff3c..2da1ea4c 100644 --- a/Query/AdminReports/Handlers/GetWorkshopWithRollCallHandler.cs +++ b/Query/AdminReports/Handlers/GetWorkshopWithRollCallHandler.cs @@ -4,6 +4,8 @@ using Microsoft.EntityFrameworkCore; using Query.AdminReports.Models; using System.Data; using _0_Framework.Application; +using WorkFlow.Application.Contracts.WorkFlow; + namespace Query.AdminReports.Handlers { @@ -12,97 +14,102 @@ namespace Query.AdminReports.Handlers List Handle(WorkshopWithRollCallServiceQueryParameters parameters); } - public class GetWorkshopWithRollCallHandler : IGetWorkshopWithRollCallHandler + public class GetWorkshopWithRollCallHandler: IGetWorkshopWithRollCallHandler { - private readonly CompanyContext _companyContext; + private readonly CompanyContext _companyContext; + private readonly IWorkFlowApplication workFlowApplication; - public GetWorkshopWithRollCallHandler(CompanyContext companyContext) - { - _companyContext = companyContext; - } + public GetWorkshopWithRollCallHandler(CompanyContext companyContext, IWorkFlowApplication workFlowApplication) + { + _companyContext = companyContext; + this.workFlowApplication = workFlowApplication; + } - public List Handle(WorkshopWithRollCallServiceQueryParameters parameters) - { - var now = DateTime.Now.Date; - var lastWeek = now.AddDays(-7); + public List Handle(WorkshopWithRollCallServiceQueryParameters parameters) + { + var now = DateTime.Now.Date; + var lastWeek = now.AddDays(-7); - //workshop filter by parameters - var rollCallServiceQuery = _companyContext.RollCallServices.AsQueryable(); - var allWorkshops = _companyContext.Workshops.Select(x => new { x.id, x.WorkshopFullName }); + //workshop filter by parameters + var rollCallServiceQuery = _companyContext.RollCallServices.AsQueryable(); - if (!string.IsNullOrWhiteSpace(parameters.WorkshopName)) - allWorkshops = allWorkshops.Where(x => x.WorkshopFullName.Contains(parameters.WorkshopName)); + var allWorkshops = _companyContext.Workshops.Select(x => new { x.id, x.WorkshopFullName }); - if (!string.IsNullOrWhiteSpace(parameters.RollCallServiceType)) - rollCallServiceQuery = rollCallServiceQuery.Where(x => x.ServiceType == parameters.RollCallServiceType); - if (!string.IsNullOrWhiteSpace(parameters.IsActive)) - { - if (parameters.IsActive.ToLower() == "active") - rollCallServiceQuery = rollCallServiceQuery.Where(x => x.StartService.Date <= now && x.EndService.Date >= now); - else if (parameters.IsActive.ToLower() == "deactive") - rollCallServiceQuery = rollCallServiceQuery.Where(x => x.EndService.Date < now || x.StartService.Date > now); + if (parameters.WorkshopId != 0) + allWorkshops = allWorkshops.Where(x => x.id == parameters.WorkshopId); - } - - var workshopsWithService = rollCallServiceQuery.Join(allWorkshops, x => x.WorkshopId, y => y.id, (rcs, workshop) => - new WorkshopWithRollCallServiceQueryModel() - { - WorkshopId = workshop.id, - RollCallServiceType = rcs.ServiceType, - WorkshopName = workshop.WorkshopFullName, - MaxPersonValid = rcs.MaxPersonValid, - IsActive = rcs.StartService <= DateTime.Now && rcs.EndService >= DateTime.Now, - ServiceStart = rcs.StartService, - ServiceEnd = rcs.EndService + if (!string.IsNullOrWhiteSpace(parameters.WorkshopName)) + allWorkshops = allWorkshops.Where(x => x.WorkshopFullName.Contains(parameters.WorkshopName)); + + if (!string.IsNullOrWhiteSpace(parameters.RollCallServiceType)) + rollCallServiceQuery = rollCallServiceQuery.Where(x => x.ServiceType == parameters.RollCallServiceType); + + if (parameters.FilterMode == FilterMode.Active) + rollCallServiceQuery = rollCallServiceQuery.Where(x => x.StartService.Date <= now && x.EndService.Date >= now); + else if(parameters.FilterMode == FilterMode.DeActive) + rollCallServiceQuery = rollCallServiceQuery.Where(x => x.EndService.Date < now || x.StartService.Date > now); + + var workshopsWithService = rollCallServiceQuery.Join(allWorkshops, x => x.WorkshopId, y => y.id, (rcs, workshop) => + new WorkshopWithRollCallServiceQueryModel() + { + WorkshopId = workshop.id, + RollCallServiceType = rcs.ServiceType, + WorkshopName = workshop.WorkshopFullName, + MaxPersonValid = rcs.MaxPersonValid, + IsActive = rcs.StartService <= DateTime.Now && rcs.EndService >= DateTime.Now, + ServiceStart = rcs.StartService, + ServiceEnd = rcs.EndService }); - //workshop population - var workshopLeftWorks = _companyContext.Workshops.Where(x => workshopsWithService.Any(y => y.WorkshopId == x.id)).Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances) - .Select(x => new - { - WorkshopId = x.id, - LeftWorks = x.LeftWorks.Where(y => y.StartWorkDate <= lastWeek && y.LeftWorkDate > now).Select(y => y.EmployeeId), - LeftWorkInsurances = x.LeftWorkInsurances.Where(y => y.StartWorkDate <= lastWeek && (y.LeftWorkDate > now || y.LeftWorkDate == null)).Select(y => y.EmployeeId) - }).ToList(); + //workshop population + var workshopLeftWorks = _companyContext.Workshops.Where(x => workshopsWithService.Any(y => y.WorkshopId == x.id)).Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances) + .Select(x => new + { + WorkshopId = x.id, + LeftWorks = x.LeftWorks.Where(y => y.StartWorkDate <= lastWeek && y.LeftWorkDate > now).Select(y => y.EmployeeId), + LeftWorkInsurances = x.LeftWorkInsurances.Where(y => y.StartWorkDate <= lastWeek && (y.LeftWorkDate > now || y.LeftWorkDate == null)).Select(y => y.EmployeeId) + }).ToList(); - var workshopsWorkingEmployeesList = workshopLeftWorks - .Select(x => new { x.WorkshopId, TotalWorkingEmployeesCount = x.LeftWorks.Concat(x.LeftWorkInsurances).Distinct().Count() }).ToList(); + var workshopsWorkingEmployeesList = workshopLeftWorks + .Select(x => new { x.WorkshopId, TotalWorkingEmployeesCount = x.LeftWorks.Concat(x.LeftWorkInsurances).Distinct().Count() }).ToList(); - var activeEmployees = _companyContext.RollCallEmployees.Include(x => x.EmployeesStatus).Where(x => x.EmployeesStatus.Any(y => - y.EndDate.Date >= now) && workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).Select(x => new { x.WorkshopId, x.EmployeeId }); + var activeEmployees = _companyContext.RollCallEmployees.Include(x => x.EmployeesStatus).Where(x => x.EmployeesStatus.Any(y => + y.EndDate.Date >= now) && workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).Select(x => new { x.WorkshopId, x.EmployeeId }); - var lastWeekRollCalls = _companyContext.RollCalls.Where(x => x.StartDate.HasValue && x.StartDate.Value >= lastWeek - && workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).GroupBy(x => x.EmployeeId).Select(x => x.Key); + var lastWeekRollCalls = _companyContext.RollCalls.Where(x => x.StartDate.HasValue && x.StartDate.Value >= lastWeek + && workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).GroupBy(x => x.EmployeeId).Select(x => x.Key); - var leaves = _companyContext.LeaveList.Where(x => x.StartLeave <= lastWeek && x.EndLeave >= now && (x.LeaveType == "استعلاجی" || x.PaidLeaveType == "روزانه") - && workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).Select(x => x.EmployeeId); + var leaves = _companyContext.LeaveList.Where(x => x.StartLeave <= lastWeek && x.EndLeave >= now && (x.LeaveType == "استعلاجی" || x.PaidLeaveType == "روزانه") + && workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).Select(x => x.EmployeeId); - var activeEmployeesList = activeEmployees.ToList(); - var lastWeekRollCallsList = lastWeekRollCalls.ToList(); - var leavesList = leaves.ToList(); - var workshopsWithServiceList = workshopsWithService.ToList(); - return workshopsWithServiceList.GroupBy(x => x.WorkshopId).Select(x => - x.OrderByDescending(y => y.ServiceStart).First()).Select(x => new WorkshopWithRollCallServiceQueryModel() - { - IsActive = x.IsActive, - ServiceStartFa = x.ServiceStart.ToFarsi(), - ServiceEndFa = x.ServiceEnd.ToFarsi(), - WorkshopId = x.WorkshopId, - RollCallServiceType = x.RollCallServiceType, - MaxPersonValid = x.MaxPersonValid, - WorkshopName = x.WorkshopName, - ActiveEmployeesCount = activeEmployeesList.Count(y => y.WorkshopId == x.WorkshopId), - ActiveEmployeesWithRollCallInLastWeekCount = activeEmployeesList.Count(y => y.WorkshopId == x.WorkshopId && - lastWeekRollCallsList.Contains(y.EmployeeId) && !leavesList.Contains(y.EmployeeId)), - TotalEmployeesCount = workshopsWorkingEmployeesList.FirstOrDefault(y => y.WorkshopId == x.WorkshopId)?.TotalWorkingEmployeesCount ?? 0 - }).OrderByDescending(x => x.IsActive).ToList(); + var activeEmployeesList = activeEmployees.ToList(); + var lastWeekRollCallsList = lastWeekRollCalls.ToList(); + var leavesList = leaves.ToList(); + var workshopsWithServiceList = workshopsWithService.ToList(); + return workshopsWithServiceList.GroupBy(x=>x.WorkshopId) + .Select(x=>x.OrderByDescending(y=>y.ServiceStartFa).First()) + .Select(x => new WorkshopWithRollCallServiceQueryModel() + { + IsActive = x.IsActive, + ServiceStartFa = x.ServiceStart.ToFarsi(), + ServiceEndFa = x.ServiceEnd.ToFarsi(), + WorkshopId = x.WorkshopId, + RollCallServiceType = x.RollCallServiceType, + MaxPersonValid = x.MaxPersonValid, + WorkshopName = x.WorkshopName, + ActiveEmployeesCount = activeEmployeesList.Count(y => y.WorkshopId == x.WorkshopId), + ActiveEmployeesWithRollCallInLastWeekCount = activeEmployeesList.Count(y => y.WorkshopId == x.WorkshopId && + lastWeekRollCallsList.Contains(y.EmployeeId) && !leavesList.Contains(y.EmployeeId)), + TotalEmployeesCount = workshopsWorkingEmployeesList.FirstOrDefault(y => y.WorkshopId == x.WorkshopId)?.TotalWorkingEmployeesCount ?? 0, + UndoneWorkFlowsCount = workFlowApplication.GetAllWorkFlowCount(x.WorkshopId).Result + }).OrderByDescending(x=>x.IsActive).ToList(); - } - } + } + } } diff --git a/Query/AdminReports/Models/WorkshopWithRollCallServiceQueryModel.cs b/Query/AdminReports/Models/WorkshopWithRollCallServiceQueryModel.cs index 62f5db2e..90bdeb2d 100644 --- a/Query/AdminReports/Models/WorkshopWithRollCallServiceQueryModel.cs +++ b/Query/AdminReports/Models/WorkshopWithRollCallServiceQueryModel.cs @@ -1,32 +1,34 @@ namespace Query.AdminReports.Models { - public class WorkshopWithRollCallServiceQueryModel - { - public string WorkshopName { get; set; } - public long WorkshopId { get; set; } - public string RollCallServiceType { get; set; } + public class WorkshopWithRollCallServiceQueryModel + { + public string WorkshopName { get; set; } + public long WorkshopId { get; set; } + public string RollCallServiceType { get; set; } - public int TotalEmployeesCount { get; set; } + public int TotalEmployeesCount { get; set; } - public int ActiveEmployeesCount { get; set; } + public int ActiveEmployeesCount { get; set; } - public int ActiveEmployeesWithRollCallInLastWeekCount { get; set; } + public int ActiveEmployeesWithRollCallInLastWeekCount { get; set; } + + public int UndoneWorkFlowsCount { get; set; } - public float ActiveEmployeesWithRollCallPercentage - { - get - { - return ((float)ActiveEmployeesWithRollCallInLastWeekCount / ActiveEmployeesCount) * 100; - } - } + public float ActiveEmployeesWithRollCallPercentage + { + get + { + return ((float)ActiveEmployeesWithRollCallInLastWeekCount / ActiveEmployeesCount) * 100; + } + } - public int MaxPersonValid { get; set; } - public bool IsActive { get; set; } - public DateTime ServiceStart { get; set; } - public DateTime ServiceEnd { get; set; } + public int MaxPersonValid { get; set; } + public bool IsActive { get; set; } + public DateTime ServiceStart { get; set; } + public DateTime ServiceEnd { get; set; } - public string ServiceStartFa { get; set; } - public string ServiceEndFa { get; set; } - } -} \ No newline at end of file + public string ServiceStartFa { get; set; } + public string ServiceEndFa { get; set; } + } +} diff --git a/Query/AdminReports/Models/WorkshopWithRollCallServiceQueryParameters.cs b/Query/AdminReports/Models/WorkshopWithRollCallServiceQueryParameters.cs index b20d39c1..e220b740 100644 --- a/Query/AdminReports/Models/WorkshopWithRollCallServiceQueryParameters.cs +++ b/Query/AdminReports/Models/WorkshopWithRollCallServiceQueryParameters.cs @@ -2,7 +2,15 @@ public class WorkshopWithRollCallServiceQueryParameters { - public string WorkshopName { get; set; } - public string RollCallServiceType { get; set; } - public string IsActive { get; set; } -} \ No newline at end of file + public string WorkshopName { get; set; } + public long WorkshopId { get; set; } + public string RollCallServiceType { get; set; } + public FilterMode FilterMode { get; set; } = FilterMode.All; +} + +public enum FilterMode +{ + All, + Active, + DeActive +} diff --git a/Query/Query.csproj b/Query/Query.csproj index 18a1ea10..38ac1440 100644 --- a/Query/Query.csproj +++ b/Query/Query.csproj @@ -8,6 +8,7 @@ + diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/RollCall/Index.cshtml b/ServiceHost/Areas/AdminNew/Pages/Company/RollCall/Index.cshtml index fa4370af..8c346497 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/RollCall/Index.cshtml +++ b/ServiceHost/Areas/AdminNew/Pages/Company/RollCall/Index.cshtml @@ -45,11 +45,11 @@ var index = 1;
لیست کارگاه های حضور و غیاب
-
- - بازگشت - -
+
+ + بازگشت + +
@@ -60,8 +60,59 @@ var index = 1;
-
-
+
+ @*Search Box *@ + +
+ +
+
+ +
+
+
@@ -79,7 +130,8 @@ var index = 1;
نام کارگاه
-
نوع سرویس
+
نوع سرویس
+
کارپوشه
تعداد پرسنل
تعداد پرسنل فعال
تعداد پرسنل در حال حضور و غیاب
@@ -103,9 +155,12 @@ var index = 1;
@item.WorkshopName
-
@item.RollCallServiceType
+
@item.MaxPersonValid نفره
-
+
+
@item.UndoneWorkFlowsCount
+
+
@item.TotalEmployeesCount
diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/RollCall/Index.cshtml.cs b/ServiceHost/Areas/AdminNew/Pages/Company/RollCall/Index.cshtml.cs index 65867f6b..a93aabee 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/RollCall/Index.cshtml.cs +++ b/ServiceHost/Areas/AdminNew/Pages/Company/RollCall/Index.cshtml.cs @@ -1,3 +1,4 @@ +using CompanyManagment.App.Contracts.Workshop; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Query.AdminReports.Handlers; @@ -8,16 +9,42 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall public class IndexModel : PageModel { private readonly IGetWorkshopWithRollCallHandler _workshopWithRollCallHandler; + private readonly IWorkshopApplication _workshopApplication; public List Items { get; set; } + public List WorkshopSearchItems { get; set; } + public WorkshopWithRollCallServiceQueryParameters SearchModel; - public IndexModel(IGetWorkshopWithRollCallHandler workshopWithRollCallHandler) + public FilterMode FilterMode { get; set; } + public IndexModel(IGetWorkshopWithRollCallHandler workshopWithRollCallHandler, IWorkshopApplication workshopApplication) + { + _workshopWithRollCallHandler = workshopWithRollCallHandler; + _workshopApplication = workshopApplication; + } + + public void OnGet(WorkshopWithRollCallServiceQueryParameters searchModel) { - _workshopWithRollCallHandler = workshopWithRollCallHandler; + SearchModel = new WorkshopWithRollCallServiceQueryParameters() + { + WorkshopId = searchModel.WorkshopId, + FilterMode = searchModel.FilterMode + }; + + Items = _workshopWithRollCallHandler.Handle(searchModel); + + OnGetLoadWorkshops(); + + } - public void OnGet() + public void OnGetLoadWorkshops() { - Items = _workshopWithRollCallHandler.Handle(new WorkshopWithRollCallServiceQueryParameters()); + var search = new WorkshopWithRollCallServiceQueryParameters() + { + }; + + WorkshopSearchItems = _workshopWithRollCallHandler.Handle(search); + + } } } diff --git a/ServiceHost/ServiceHost.csproj b/ServiceHost/ServiceHost.csproj index c5a5985f..210f292a 100644 --- a/ServiceHost/ServiceHost.csproj +++ b/ServiceHost/ServiceHost.csproj @@ -102,7 +102,24 @@ + + + + + + + + + + + + + + + + + diff --git a/ServiceHost/wwwroot/AssetsAdminNew/RollCall/css/Index.css b/ServiceHost/wwwroot/AssetsAdminNew/RollCall/css/Index.css index 58c7e827..00700bf0 100644 --- a/ServiceHost/wwwroot/AssetsAdminNew/RollCall/css/Index.css +++ b/ServiceHost/wwwroot/AssetsAdminNew/RollCall/css/Index.css @@ -5,12 +5,16 @@ .table-rollcall .width2, .table-rollcall .rollcall-list .width2 { - width: 20% !important; + width: 18% !important; } .table-rollcall .width3, .table-rollcall .rollcall-list .width3 { - width: 15% !important; + width: 9% !important; +} +.table-rollcall .width3new, +.table-rollcall .rollcall-list .width3new { + width: 7% !important; } .table-rollcall .width4, @@ -31,7 +35,7 @@ .table-rollcall .width7, .table-rollcall .rollcall-list .width7 { - width: 14% !important; + width: 5% !important; text-align: center !important; } @@ -247,17 +251,25 @@ font-size: 12px !important; } - .table-rollcall .width1, + /*.table-rollcall .width1, .table-rollcall .ticket-list .width1 { width: 5% !important; - } + }*/ + .table-rollcall .Rtable-cell.column-heading.width2 { + width: 18% !important; + } .table-rollcall .width2, .table-rollcall .ticket-list .width2 { - width: 8% !important; + width: 12% !important; } - .table-rollcall .width3, +/* .table-rollcall .width3, + .table-rollcall .ticket-list .width3 { + width: 5% !important; + }*/ + + /*/*.table-rollcall .width3, .table-rollcall .ticket-list .width3 { width: 17% !important; text-align: center !important; @@ -270,9 +282,9 @@ .table-rollcall .width5, .table-rollcall .ticket-list .width5 { - width: 15% !important; + width: 15% !important;*/ /*text-align: center !important;*/ - } + /*}*/ .table-rollcall .ticket-list .width3 .Rtable-cell--content { text-align: center; @@ -285,20 +297,33 @@ .table-rollcall .width6, .table-rollcall .ticket-list .width6 { - width: 10% !important; + width: 16% !important; } .table-rollcall .width7, .table-rollcall .ticket-list .width7 { - width: 15% !important; + width: 8% !important; + text-align: center !important; } .table-rollcall .width8, .table-rollcall .ticket-list .width8 { - width: 10% !important; + width: 5% !important; } } + + +@media (max-width: 992px) { + .table-rollcall .width1 { + width: 4% !important; + } + + .table-rollcall .width7, .table-rollcall .ticket-list .width7 { + width:4% !important; + text-align: end !important; + } +} @media (max-width: 767px) { .Rtable--collapse .Rtable-row { outline: 0; @@ -306,23 +331,32 @@ padding: 0; } - .Rtable--collapse .Rtable-row .Rtable-cell.width3 .Rtable-cell--content { - justify-content: right; - display: flex; - } + .Rtable--collapse .Rtable-row .Rtable-cell.width3 .Rtable-cell--content { + justify-content: right; + display: flex; + } - .Rtable--collapse .Rtable-row .Rtable-cell.width8 { - justify-content: end; - } + .Rtable--collapse .Rtable-row .Rtable-cell.width8 { + justify-content: end; + } + .Rtable--collapse .Rtable-row .Rtable-cell.width8 { + justify-content: end; + } + .Rtable--collapse .Rtable-row .Rtable-cell.width5 { + justify-content: center; + } + .Rtable--collapse .Rtable-row .Rtable-cell.width4 { + justify-content: center; + } - .Rtable--collapse .Rtable-row .Rtable-cell.width8 .Rtable-cell--content { - justify-content: end; - display: flex; - } + .Rtable--collapse .Rtable-row .Rtable-cell.width8 .Rtable-cell--content { + justify-content: end; + display: flex; + } - .Rtable--collapse .Rtable-row .Rtable-cell { - border-bottom: 0; - } + .Rtable--collapse .Rtable-row .Rtable-cell { + border-bottom: 0; + } .badget-inprogress, .badget-answer, diff --git a/ServiceHost/wwwroot/AssetsClient/css/table-style.css b/ServiceHost/wwwroot/AssetsClient/css/table-style.css index e5a0c363..3413cab0 100644 --- a/ServiceHost/wwwroot/AssetsClient/css/table-style.css +++ b/ServiceHost/wwwroot/AssetsClient/css/table-style.css @@ -77,7 +77,7 @@ /* overflow: hidden; */ list-style: none; text-align: right; - font-size: 14px; + font-size: 12px; /* این قسمت برای همتراز کردن ستون های جدول است */ width: 100%; } diff --git a/ServiceHost/wwwroot/AssetsClient/js/site.js b/ServiceHost/wwwroot/AssetsClient/js/site.js index 5ee7d6f3..141feec8 100644 --- a/ServiceHost/wwwroot/AssetsClient/js/site.js +++ b/ServiceHost/wwwroot/AssetsClient/js/site.js @@ -16,7 +16,8 @@ SinglePage.LoadModal = function () { /* $.validator.unobtrusive.parse(newForm);*/ showModal(); }).fail(function (error) { - alert("خطایی رخ داده، لطفا با مدیر سیستم تماس بگیرید."); + window.location.hash = "##"; + //alert("خطایی رخ داده، لطفا با مدیر سیستم تماس بگیرید."); }); }; @@ -29,6 +30,7 @@ function AjaxUrlContentModal(url) { showModal(); }); } + function showModal() { $("#MainModal").modal("show"); } @@ -41,10 +43,9 @@ $(document).ready(function () { window.onhashchange = function () { SinglePage.LoadModal(); }; - $("#MainModal").on("shown.bs.modal", - function () { - window.location.hash = "##"; - }); + $("#MainModal").on("shown.bs.modal", function () { + window.location.hash = ""; + }); $(document).on("submit", 'form[data-ajax="true"]',