refactor roll call case history controller and add total working hours endpoint
This commit is contained in:
@@ -6,12 +6,12 @@ using ServiceHost.BaseControllers;
|
|||||||
|
|
||||||
namespace ServiceHost.Areas.Client.Controllers.RollCall;
|
namespace ServiceHost.Areas.Client.Controllers.RollCall;
|
||||||
|
|
||||||
public class CaseHistoryController : ClientBaseController
|
public class RollCallCaseHistoryController : ClientBaseController
|
||||||
{
|
{
|
||||||
private readonly IRollCallApplication _rollCallApplication;
|
private readonly IRollCallApplication _rollCallApplication;
|
||||||
private readonly long _workshopId;
|
private readonly long _workshopId;
|
||||||
|
|
||||||
public CaseHistoryController(IRollCallApplication rollCallApplication,
|
public RollCallCaseHistoryController(IRollCallApplication rollCallApplication,
|
||||||
IAuthHelper authHelper)
|
IAuthHelper authHelper)
|
||||||
{
|
{
|
||||||
_rollCallApplication = rollCallApplication;
|
_rollCallApplication = rollCallApplication;
|
||||||
@@ -50,6 +50,48 @@ public class CaseHistoryController : ClientBaseController
|
|||||||
{
|
{
|
||||||
return await _rollCallApplication.GetCaseHistoryDetails(_workshopId, titleId, searchModel);
|
return await _rollCallApplication.GetCaseHistoryDetails(_workshopId, titleId, searchModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("total-working")]
|
||||||
|
public ActionResult<OperationResult<string>> OnGetTotalWorking(
|
||||||
|
string startDate,
|
||||||
|
string startTime,
|
||||||
|
string endDate,
|
||||||
|
string endTime)
|
||||||
|
{
|
||||||
|
var op = new OperationResult<string>();
|
||||||
|
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")]
|
// [HttpGet("excel")]
|
||||||
// public async Task<IActionResult> GetDownload(string titleId,RollCallCaseHistorySearchModel searchModel)
|
// public async Task<IActionResult> GetDownload(string titleId,RollCallCaseHistorySearchModel searchModel)
|
||||||
@@ -61,7 +103,7 @@ public class CaseHistoryController : ClientBaseController
|
|||||||
// $"{workshopFullName} - {caseHistoryRollCallExcelForOneDay.DayOfWeekFa}،{caseHistoryRollCallExcelForOneDay.DateFa}.xlsx");
|
// $"{workshopFullName} - {caseHistoryRollCallExcelForOneDay.DayOfWeekFa}،{caseHistoryRollCallExcelForOneDay.DateFa}.xlsx");
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// [HttpGet("edit")]
|
// [HttpGet("edit")]
|
||||||
// public ActionResult<> GetEditDetails(string date,long employeeId)
|
// public ActionResult<> GetEditDetails(string date,long employeeId)
|
||||||
// {
|
// {
|
||||||
@@ -82,5 +124,4 @@ public class CaseHistoryController : ClientBaseController
|
|||||||
// TotalRollCallsDuration = total.ToFarsiHoursAndMinutes("-")
|
// TotalRollCallsDuration = total.ToFarsiHoursAndMinutes("-")
|
||||||
// };
|
// };
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -250,9 +250,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
|||||||
var span = end - start;
|
var span = end - start;
|
||||||
var hours = (int)span.TotalHours;
|
var hours = (int)span.TotalHours;
|
||||||
var minutes = span.Minutes;
|
var minutes = span.Minutes;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (hours > 0 && minutes > 0)
|
if (hours > 0 && minutes > 0)
|
||||||
{
|
{
|
||||||
return new JsonResult(new
|
return new JsonResult(new
|
||||||
|
|||||||
@@ -42,6 +42,15 @@ public class GeneralController : GeneralBaseController
|
|||||||
currentDate
|
currentDate
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
[HttpGet("persian-day-of-week")]
|
||||||
|
public ActionResult<OperationResult<string>> OnGetDayOfWeek(string dateFa)
|
||||||
|
{
|
||||||
|
var op = new OperationResult<string>();
|
||||||
|
if (!dateFa.TryToGeorgianDateTime(out DateTime date))
|
||||||
|
return op.Failed("تاریخ وارد شده نامعتبر است");
|
||||||
|
|
||||||
|
return op.Succcedded(date.DayOfWeek.DayOfWeeKToPersian());
|
||||||
|
}
|
||||||
|
|
||||||
// [HttpGet("pm-permissions")]
|
// [HttpGet("pm-permissions")]
|
||||||
// public IActionResult GetPMPermissions()
|
// public IActionResult GetPMPermissions()
|
||||||
@@ -96,44 +105,8 @@ public class GeneralController : GeneralBaseController
|
|||||||
var statusCode = isSuccess ? "1" : "0";
|
var statusCode = isSuccess ? "1" : "0";
|
||||||
return $"{baseUrl}/callback?Status={statusCode}&transactionId={transactionId}";
|
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
|
public class SepehrGatewayPayResponse
|
||||||
@@ -169,10 +142,4 @@ public class SepehrGatewayPayResponse
|
|||||||
public string issuerbank { get; set; }
|
public string issuerbank { get; set; }
|
||||||
|
|
||||||
[Display(Name = " شماره کارت ")] public string cardnumber { get; set; }
|
[Display(Name = " شماره کارت ")] public string cardnumber { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
public class AdviceReq
|
|
||||||
{
|
|
||||||
[Display(Name = " رسید دیجیتال ")] public string digitalreceipt { get; set; }
|
|
||||||
public long Tid { get; set; }
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user