Остался только PDF

This commit is contained in:
Кашин Максим 2023-05-19 21:49:45 +04:00
parent e0dd8ad335
commit 8b8ffbcb32
6 changed files with 182 additions and 225 deletions

View File

@ -720,11 +720,17 @@ namespace HostrelHeadwaiterApp.Controllers
table += "</thead>";
foreach (var report in result)
{
bool IsCost = true;
if (report.RoomPrice.ToString() == "0")
{
IsCost = false;
}
table += "<tbody class=\"u-table-body\">";
table += "<tr style=\"height: 75px\">";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.DinnerName}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.RoomName}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.RoomPrice}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{(IsCost is true ? report.RoomPrice.ToString() : string.Empty)}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.NameHall}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.BookingDate}</td>";
table += "</tr>";

View File

@ -6,71 +6,47 @@
}
@model Tuple<List<ConferenceBookingViewModel>, List<DinnerViewModel>>
<form method="post">
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">План питания: </label>
<div class="u-input u-input-rectangle">
<select id="conferenceBooking" name="conferenceBooking" class="form-control">
<div class="container">
<h2>Добавление обедов в бронирование конференции</h2>
<form method="post">
<div class="form-group">
<label for="conferenceBooking">План питания:</label>
<select id="conferenceBooking" name="conferenceBooking" class="form-control">
@foreach (var conferenceBooking in Model.Item1)
{
<option value="@conferenceBooking.Id">
@Html.DisplayFor(modelItem => conferenceBooking.NameHall)
</option>
<option value="@conferenceBooking.Id">@Html.DisplayFor(modelItem => conferenceBooking.NameHall)</option>
}
</select>
</div>
</div>
<label class="u-label u-text-custom-color-1 u-label-1">Участники: </label>
<div class="u-container-style u-layout-cell u-size-48 u-layout-cell-1">
<div class="u-container-layout u-container-layout-1">
<div class="u-table u-table-responsive u-table-1">
<table class="u-table-entity">
<colgroup>
<col width="9.8%" />
<col width="62.9%" />
<col width="27.3%" />
</colgroup>
<thead
class="u-custom-color-1 u-table-header u-table-header-1">
<tr style="height: 31px">
<th class="u-border-1 u-border-grey-50 u-table-cell">
</th>
<th class="u-border-1 u-border-grey-50 u-table-cell">
ФИО участника
</th>
<th class="u-border-1 u-border-grey-50 u-table-cell">
Гражданство
</th>
</tr>
</thead>
<tbody class="u-table-body">
@foreach (var item in Model.Item2)
{
<tr style="height: 75px">
<td
class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell">
<input type="checkbox" class="form-check-input" name="dinner[]" value="@item.Id" id="@item.Id">
</td>
<td
class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell"
>
@Html.DisplayFor(modelItem => item.DinnerName)
</td>
<td
class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell"
>
@Html.DisplayFor(modelItem => item.DinnerPrice)
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Добавить участников" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
</div>
</form>
</div>
<div class="form-group">
<label>Обеды для бронирования:</label>
<div class="table-responsive">
<table class="table">
<thead class="thead-dark">
<tr>
<th>Обед</th>
<th>Цена</th>
</
<tbody>
@foreach (var item in Model.Item2)
{
<tr>
<td>
<div class="form-check">
<input type="checkbox" class="form-check-input" name="dinner[]" value="@item.Id">
</div>
</td>
<td>@Html.DisplayFor(modelItem => item.DinnerName)</td>
<td>@Html.DisplayFor(modelItem => item.DinnerPrice)</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<br>
<div class="u-container-layout u-container-layout-2">
<input type="submit" value="Добавить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
</div>
</form>
</div>

View File

@ -1,77 +1,59 @@
@using HotelContracts.ViewModels;
@using HotelContracts.ViewModels;
@using HotelDataModels.Models;
@{
ViewData["Title"] = "AddDinnerToRoom";
ViewData["Title"] = "AddDinnerToRoom";
}
@model Tuple<List<RoomViewModel>, List<DinnerViewModel>>
<form method="post">
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Конференции: </label>
<div class="u-input u-input-rectangle">
<select id="room" name="room" class="form-control">
@foreach (var room in Model.Item1)
{
<option value="@room.Id">
@Html.DisplayFor(modelItem => room.RoomName)
</option>
}
</select>
</div>
</div>
<label class="u-label u-text-custom-color-1 u-label-1">Участники: </label>
<div class="u-container-style u-layout-cell u-size-48 u-layout-cell-1">
<div class="u-container-layout u-container-layout-1">
<div class="u-table u-table-responsive u-table-1">
<table class="u-table-entity">
<colgroup>
<col width="9.8%" />
<col width="62.9%" />
<col width="27.3%" />
</colgroup>
<thead
class="u-custom-color-1 u-table-header u-table-header-1">
<tr style="height: 31px">
<th class="u-border-1 u-border-grey-50 u-table-cell">
</th>
<th class="u-border-1 u-border-grey-50 u-table-cell">
ФИО участника
</th>
<th class="u-border-1 u-border-grey-50 u-table-cell">
Гражданство
</th>
</tr>
</thead>
<tbody class="u-table-body">
@foreach (var item in Model.Item2)
{
<tr style="height: 75px">
<td
class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell">
<input type="checkbox" class="form-check-input" name="dinner[]" value="@item.Id" id="@item.Id">
</td>
<td
class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell"
>
@Html.DisplayFor(modelItem => item.DinnerName)
</td>
<td
class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell"
>
@Html.DisplayFor(modelItem => item.DinnerPrice)
</td>
<div class="container">
<h2>Добавление обедов в номер</h2>
<form method="post">
<div class="form-group">
<label for="room">Выберите номер</label>
<select id="room" name="room" class="form-control">
@foreach (var room in Model.Item1)
{
<option value="@room.Id">@Html.DisplayFor(modelItem => room.RoomName)</option>
}
</select>
</div>
<div class="form-group">
<label for="dinner">Выберите обеды</label>
<div class="card">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">Наименование</th>
<th scope="col">Цена</th>
</tr>
}
</tbody>
</table>
</div>
</thead>
<tbody>
@foreach (var item in Model.Item2)
{
<tr>
<td class="align-middle">
<div class="form-check">
<input type="checkbox" class="form-check-input" name="dinner[]" value="@item.Id" id="@item.Id">
</div>
</td>
<td class="align-middle">@Html.DisplayFor(modelItem => item.DinnerName)</td>
<td class="align-middle">@Html.DisplayFor(modelItem => item.DinnerPrice)</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Добавить участников" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
</div>
</form>
</div>
</div>
<br>
<div class="u-container-layout u-container-layout-2">
<input type="submit" value="Добавить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
</div>
</form>
</div>

View File

@ -4,49 +4,48 @@
ViewData["Title"] = "ListDinnersToPdfFile";
}
<div class="text-center">
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Отчет по участникам за период </h2>
</div>
<div class="container">
<div class="text-center mb-4">
<h2 class="text-custom-color-1">Отчет по обедам за период</h2>
</div>
<div class="text-center">
@{
<form method="post">
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2" for="dateFrom">Начало периода</label>
<input
type="datetime-local"
placeholder="Выберите дату начала периода"
id="dateFrom" name="dateFrom"
class="u-input u-input-rectangle"/>
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2" for="dateTo">Окончание периода</label>
<input
type="datetime-local"
placeholder="Выберите дату окончания периода"
id="dateTo" name="dateTo"
class="u-input u-input-rectangle"/>
</div>
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Введите почту</label>
<input
type="email"
placeholder="Введите вашу почту"
name="headwaiterEmail"
class="u-input u-input-rectangle"/>
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Отправить на почту" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
</div>
<div class="mt-3" id="report">
<form method="post">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="dateFrom" class="form-label text-custom-color-1">Начало периода:</label>
<input type="datetime-local" id="dateFrom" name="dateFrom" class="form-control" placeholder="Выберите дату начала периода">
</div>
</form>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<div class="col-8"></div>
<div class="col-4"><button type="button" id="demonstrate" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1">Продемонстрировать</button></div>
</div>
}
<div class="col-md-6">
<div class="form-group">
<label for="dateTo" class="form-label text-custom-color-1">Окончание периода:</label>
<input type="datetime-local" id="dateTo" name="dateTo" class="form-control" placeholder="Выберите дату окончания периода">
</div>
</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">
<button type="button" id="demonstrate" class="btn btn-outline-dark w-100 text-center d-flex justify-content-md-center">Продемонстрировать</button>
</div>
</div>
<div id="report"></div>
</form>
</div>
@section Scripts {

View File

@ -7,58 +7,46 @@
<form method="post">
<div class="container d-flex justify-content-center align-items-center">
<div class="card-body">
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Бронирование: </label>
<select id="conferenceBooking" name="conferenceBooking" class="form-control" asp-items="@(new SelectList(@ViewBag.ConferenceBookings, "Id", "NameHall"))"></select>
</div>
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Конференция: </label>
<div class="u-input u-input-rectangle">
<select id="conference" name="conference" class="form-control" asp-items="@(new SelectList(@ViewBag.Conferences, "Id", "ConferenceName"))"></select>
</div>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Название зала</label>
<input
type="text"
id="nameHall"
placeholder="Введите название зала"
name="nameHall"
class="form-control"/>
<label class="u-label u-text-custom-color-1 u-label-1">Название зала</label>
<input
type="datetime-local"
id="bookingDate"
placeholder="Выберите начало конференции"
name="bookingDate"
class="u-input u-input-rectangle"/>
</div>
<div class="u-table u-table-responsive u-table-1">
<label class="u-label u-text-custom-color-1 u-label-1">Обеды для бронирования</label>
<table class="table">
<thead class="thead-dark">
<tr style="height: 44px">
<th class="u-border-1 u-border-black u-table-cell">
Обед
</th>
<th class="u-border-1 u-border-black u-table-cell">
Цена
</th>
</tr>
</thead>
<tbody class="u-table-body" id="table-elements">
</tbody>
</table>
</div>
<br>
<div class="u-container-layout u-container-layout-2">
<input type="submit" value="Сохранить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
<div class="container">
<div class="card-body">
<div class="form-group">
<label for="conferenceBooking">Бронирование:</label>
<select id="conferenceBooking" name="conferenceBooking" class="form-control" asp-items="@(new SelectList(@ViewBag.ConferenceBookings, "Id", "NameHall"))"></select>
</div>
</div>
</div>
<div class="form-group">
<label for="conference">Конференция:</label>
<select id="conference" name="conference" class="form-control" asp-items="@(new SelectList(@ViewBag.Conferences, "Id", "ConferenceName"))"></select>
</div>
<div class="form-group">
<label for="nameHall">Название зала:</label>
<input type="text" id="nameHall" name="nameHall" class="form-control" placeholder="Введите название зала">
</div>
<div class="form-group">
<label for="bookingDate">Дата:</label>
<input type="datetime-local" id="bookingDate" name="bookingDate" class="form-control" placeholder="Выберите начало конференции">
</div>
<div class="form-group">
<label>Обеды для бронирования:</label>
<div class="table-responsive">
<table class="table">
<thead class="thead-dark">
<tr>
<th>Обед</th>
<th>Цена</th>
</tr>
</thead>
<tbody id="table-elements" class="u-table-body">
</tbody>
</table>
</div>
</div>
<br>
<div class="u-container-layout u-container-layout-2">
<input type="submit" value="Добавить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
</div>
</div>
</div>
</form>
@section Scripts

View File

@ -34,9 +34,15 @@ namespace HotelBusinessLogic.OfficePackage
});
foreach (var dinner in info.Dinners)
{
bool IsCost = true;
if (dinner.RoomPrice.ToString() == "0")
{
IsCost = false;
}
CreateRow(new PdfRowParameters
{
Texts = new List<string> { dinner.DinnerName.ToString(), dinner.RoomName, dinner.RoomPrice.ToString(), dinner.NameHall, dinner.BookingDate?.ToShortDateString() ?? string.Empty },
Texts = new List<string> { dinner.DinnerName.ToString(), dinner.RoomName, IsCost is true ? dinner.RoomPrice.ToString() : string.Empty, dinner.NameHall, dinner.BookingDate?.ToShortDateString() ?? string.Empty },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});