This commit is contained in:
Вячеслав Иванов 2024-05-11 20:28:57 +04:00
parent a824aad0b1
commit e0bd220db8
2 changed files with 23 additions and 1 deletions

View File

@ -630,18 +630,28 @@ namespace HotelHeadwaiterApp.Controllers
}
[HttpPost]
public void ListLunchesToPdfFile(DateTime dateFrom, DateTime dateTo)
public void ListLunchesToPdfFile(DateTime dateFrom, DateTime dateTo, string headwaiterEmail)
{
if (APIClient.Headwaiter == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
if (string.IsNullOrEmpty(headwaiterEmail))
{
throw new Exception("Email пуст");
}
APIClient.PostRequest("api/report/CreateHeadwaiterReportToPdfFile", new ReportHeadwaiterBindingModel
{
DateFrom = dateFrom,
DateTo = dateTo,
HeadwaiterId = APIClient.Headwaiter.Id
});
APIClient.PostRequest("api/report/SendPdfToMail", new MailSendInfoBindingModel
{
MailAddress = headwaiterEmail,
Subject = "Отчет по обедам (pdf)",
Text = "Отчет по обедам с " + dateFrom.ToShortDateString() + " до " + dateTo.ToShortDateString()
});
Response.Redirect("ListLunchesToPdfFile");
}

View File

@ -25,6 +25,18 @@
</div>
</div>
<div class="form-group mb-4">
<label for="headwaiterEmail" class="form-label text-custom-color-1">Почта:</label>
<input type="email" id="headwaiterEmail" name="headwaiterEmail" class="form-control" placeholder="Введите вашу почту">
</div>
<div class="row mb-4">
<div class="col-md-8"></div>
<div class="col-md-4">
<button type="submit" class="btn btn-outline-dark w-100 text-center d-flex justify-content-md-center">Отправить на почту</button>
</div>
</div>
<div class="row mb-4">
<div class="col-md-8"></div>
<div class="col-md-4">