diff --git a/ServiceHost/Areas/Admin/Pages/Index.cshtml b/ServiceHost/Areas/Admin/Pages/Index.cshtml
index b6a40be7..a36a3d4b 100644
--- a/ServiceHost/Areas/Admin/Pages/Index.cshtml
+++ b/ServiceHost/Areas/Admin/Pages/Index.cshtml
@@ -240,35 +240,38 @@
@@ -793,10 +796,11 @@
{
-@* *@
+ var smsRemainingUrl = `@Url.Page("./Index", "SmsRemaining")`;
+ // var ajaxDataReport = `@Url.Page("./Index", "ReportDataAjax")`;
+ // var boolPermissionForReports = @(authHelper.GetPermissions().Any(x => x == 306) ? "true" : "false");
+
}
\ No newline at end of file
diff --git a/ServiceHost/Areas/Admin/Pages/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Index.cshtml.cs
index 8ea4df36..005eb483 100644
--- a/ServiceHost/Areas/Admin/Pages/Index.cshtml.cs
+++ b/ServiceHost/Areas/Admin/Pages/Index.cshtml.cs
@@ -48,7 +48,6 @@ namespace ServiceHost.Areas.Admin.Pages
public string FolderPath;
public int TaskCount;
public int TicketCount;
- public int SmsRemaining;
public IndexModel(IWebHostEnvironment webHostEnvironment, IConfiguration configuration, IAuthHelper authHelper, IReportApplication reportApplication, IYearlySalaryApplication yearlySalaryApplication, IWorkshopApplication workshopApplication, IAccountApplication accountApplication, ITaskApplication taskApplication, ITicketApplication ticketApplication, ISmsService smsService)
{
@@ -89,6 +88,14 @@ namespace ServiceHost.Areas.Admin.Pages
// Console.WriteLine(Path.GetFileName(fileEntry));
//}
}
+ public async Task OnGetSmsRemaining()
+ {
+ var result = (int)await _smsService.GetCreditAmount();
+ return new JsonResult(new
+ {
+ data = result
+ });
+ }
public async Task OnGetReportDataAjax()
{
diff --git a/ServiceHost/wwwroot/AssetsAdmin/page/Index/js/Index.js b/ServiceHost/wwwroot/AssetsAdmin/page/Index/js/Index.js
index 2e3e24f0..6f299c25 100644
--- a/ServiceHost/wwwroot/AssetsAdmin/page/Index/js/Index.js
+++ b/ServiceHost/wwwroot/AssetsAdmin/page/Index/js/Index.js
@@ -5,12 +5,31 @@
loadingDiv.show();
});
- updateAmountColor();
+ loadSmsRemaining();
//if (boolPermissionForReports) {
// ReportAjaxData();
//}
});
+function loadSmsRemaining() {
+ $.ajax({
+ async: true,
+ contentType: 'charset=utf-8',
+ dataType: 'json',
+ type: 'GET',
+ url: smsRemainingUrl,
+ headers: { "RequestVerificationToken": antiForgeryToken },
+ success: function (response) {
+ $('#amountSms').text(response.data);
+ $('#loadingSmsRemaining').hide();
+ updateAmountColor();
+ },
+ error: function (xhr, status, error) {
+ console.error(xhr.responseText);
+ }
+ });
+}
+
function updateAmountColor() {
const amountDiv = document.querySelector("#amountSms");
const smsDiv = document.getElementById('smsDiv');