diff --git a/ServiceHost/Areas/Client/Controllers/RollCall/CaseHistoryController.cs b/ServiceHost/Areas/Client/Controllers/RollCall/RollCallCaseHistoryController.cs similarity index 71% rename from ServiceHost/Areas/Client/Controllers/RollCall/CaseHistoryController.cs rename to ServiceHost/Areas/Client/Controllers/RollCall/RollCallCaseHistoryController.cs index 5f8b8b77..5bbf6c70 100644 --- a/ServiceHost/Areas/Client/Controllers/RollCall/CaseHistoryController.cs +++ b/ServiceHost/Areas/Client/Controllers/RollCall/RollCallCaseHistoryController.cs @@ -6,12 +6,12 @@ using ServiceHost.BaseControllers; namespace ServiceHost.Areas.Client.Controllers.RollCall; -public class CaseHistoryController : ClientBaseController +public class RollCallCaseHistoryController : ClientBaseController { private readonly IRollCallApplication _rollCallApplication; private readonly long _workshopId; - public CaseHistoryController(IRollCallApplication rollCallApplication, + public RollCallCaseHistoryController(IRollCallApplication rollCallApplication, IAuthHelper authHelper) { _rollCallApplication = rollCallApplication; @@ -50,6 +50,48 @@ public class CaseHistoryController : ClientBaseController { return await _rollCallApplication.GetCaseHistoryDetails(_workshopId, titleId, searchModel); } + + [HttpGet("total-working")] + public ActionResult> OnGetTotalWorking( + string startDate, + string startTime, + string endDate, + string endTime) + { + var op = new OperationResult(); + const string emptyValue = "-"; + + if (!TryParseDateTime(startDate, startTime, out var start) || + !TryParseDateTime(endDate, endTime, out var end)) + { + return op.Succcedded(emptyValue); + } + + if (start >= end) + { + return op.Succcedded(emptyValue); + } + + var duration = (end - start).ToFarsiHoursAndMinutes(emptyValue); + return op.Succcedded(duration); + } + + private static bool TryParseDateTime(string date, string time, out DateTime result) + { + result = default; + + try + { + var dateTime = date.ToGeorgianDateTime(); + var timeOnly = TimeOnly.Parse(time); + result = dateTime.AddTicks(timeOnly.Ticks); + return true; + } + catch + { + return false; + } + } // [HttpGet("excel")] // public async Task GetDownload(string titleId,RollCallCaseHistorySearchModel searchModel) @@ -61,7 +103,7 @@ public class CaseHistoryController : ClientBaseController // $"{workshopFullName} - {caseHistoryRollCallExcelForOneDay.DayOfWeekFa}،{caseHistoryRollCallExcelForOneDay.DateFa}.xlsx"); // // } - + // [HttpGet("edit")] // public ActionResult<> GetEditDetails(string date,long employeeId) // { @@ -82,5 +124,4 @@ public class CaseHistoryController : ClientBaseController // TotalRollCallsDuration = total.ToFarsiHoursAndMinutes("-") // }; // } - } \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml.cs index 04e0d1b0..7b4f8966 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml.cs @@ -250,9 +250,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall var span = end - start; var hours = (int)span.TotalHours; var minutes = span.Minutes; - - - + if (hours > 0 && minutes > 0) { return new JsonResult(new diff --git a/ServiceHost/Controllers/GeneralController.cs b/ServiceHost/Controllers/GeneralController.cs index 7871eef9..01ed3d64 100644 --- a/ServiceHost/Controllers/GeneralController.cs +++ b/ServiceHost/Controllers/GeneralController.cs @@ -42,6 +42,15 @@ public class GeneralController : GeneralBaseController currentDate }); } + [HttpGet("persian-day-of-week")] + public ActionResult> OnGetDayOfWeek(string dateFa) + { + var op = new OperationResult(); + if (!dateFa.TryToGeorgianDateTime(out DateTime date)) + return op.Failed("تاریخ وارد شده نامعتبر است"); + + return op.Succcedded(date.DayOfWeek.DayOfWeeKToPersian()); + } // [HttpGet("pm-permissions")] // public IActionResult GetPMPermissions() @@ -96,44 +105,8 @@ public class GeneralController : GeneralBaseController var statusCode = isSuccess ? "1" : "0"; return $"{baseUrl}/callback?Status={statusCode}&transactionId={transactionId}"; } -} - -public class TokenReq -{ - public long Amount { get; set; } - - public string CallbackUrl { get; set; } - - [Display(Name = "شماره فاکتور")] - [MaxLength(100)] - [Required] - [Key] - // be ezaye har pazirande bayad yekta bashad - public string invoiceID { get; set; } - - [Required] public long terminalID { get; set; } - - /* - * JSON Bashad - * etelaate takmili site harchi - * nabayad char khas dashte bashe (*'"xp_%!+- ...) - */ - public string Payload { get; set; } = ""; - public string email { get; set; } -} - -public class TokenResp -{ - // if 0 = success - public int Status { get; set; } - public string AccessToken { get; set; } -} - -public class PayRequest -{ - [Required] [MaxLength(3000)] public string token { get; set; } - [Required] public long terminalID { get; set; } - public string nationalCode { get; set; } + + } public class SepehrGatewayPayResponse @@ -169,10 +142,4 @@ public class SepehrGatewayPayResponse public string issuerbank { get; set; } [Display(Name = " شماره کارت ")] public string cardnumber { get; set; } -} - -public class AdviceReq -{ - [Display(Name = " رسید دیجیتال ")] public string digitalreceipt { get; set; } - public long Tid { get; set; } } \ No newline at end of file