Остался только 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>"; table += "</thead>";
foreach (var report in result) foreach (var report in result)
{ {
bool IsCost = true;
if (report.RoomPrice.ToString() == "0")
{
IsCost = false;
}
table += "<tbody class=\"u-table-body\">"; table += "<tbody class=\"u-table-body\">";
table += "<tr style=\"height: 75px\">"; 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.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.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.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 += $"<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>"; table += "</tr>";

View File

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

View File

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

View File

@ -4,49 +4,48 @@
ViewData["Title"] = "ListDinnersToPdfFile"; ViewData["Title"] = "ListDinnersToPdfFile";
} }
<div class="text-center"> <div class="container">
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Отчет по участникам за период </h2> <div class="text-center mb-4">
</div> <h2 class="text-custom-color-1">Отчет по обедам за период</h2>
</div>
<div class="text-center"> <form method="post">
@{ <div class="row">
<form method="post"> <div class="col-md-6">
<div class="u-form-email u-form-group u-label-top"> <div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-2" for="dateFrom">Начало периода</label> <label for="dateFrom" class="form-label text-custom-color-1">Начало периода:</label>
<input <input type="datetime-local" id="dateFrom" name="dateFrom" class="form-control" placeholder="Выберите дату начала периода">
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">
</div> </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>
} <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> </div>
@section Scripts { @section Scripts {

View File

@ -7,58 +7,46 @@
<form method="post"> <form method="post">
<div class="container d-flex justify-content-center align-items-center"> <div class="container">
<div class="card-body"> <div class="card-body">
<div class="form-group"> <div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Бронирование: </label> <label for="conferenceBooking">Бронирование:</label>
<select id="conferenceBooking" name="conferenceBooking" class="form-control" asp-items="@(new SelectList(@ViewBag.ConferenceBookings, "Id", "NameHall"))"></select> <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> </div>
</div> <div class="form-group">
</div> <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> </form>
@section Scripts @section Scripts

View File

@ -34,9 +34,15 @@ namespace HotelBusinessLogic.OfficePackage
}); });
foreach (var dinner in info.Dinners) foreach (var dinner in info.Dinners)
{ {
bool IsCost = true;
if (dinner.RoomPrice.ToString() == "0")
{
IsCost = false;
}
CreateRow(new PdfRowParameters 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", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left ParagraphAlignment = PdfParagraphAlignmentType.Left
}); });