update fix
This commit is contained in:
parent
555afefd32
commit
36233b487a
@ -344,7 +344,7 @@ namespace CanteenManagerApp.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DishCreate(string name)
|
||||
public void DishCreate(string name, int price)
|
||||
{
|
||||
if (APIClient.Manager == null)
|
||||
{
|
||||
@ -356,10 +356,16 @@ namespace CanteenManagerApp.Controllers
|
||||
throw new Exception("Наименование блюда не должно быть пустым");
|
||||
}
|
||||
|
||||
if (price <= 0)
|
||||
{
|
||||
throw new Exception("Цена блюда должна быть больше нуля");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/main/dishcreate", new DishBindingModel
|
||||
{
|
||||
ManagerId = APIClient.Manager.Id,
|
||||
DishName = name
|
||||
DishName = name,
|
||||
Price = price
|
||||
});
|
||||
|
||||
Response.Redirect("DishList");
|
||||
@ -484,7 +490,7 @@ namespace CanteenManagerApp.Controllers
|
||||
public void ReportPdf(ReportBindingModel model)
|
||||
{
|
||||
model.UserId = APIClient.Manager.Id;
|
||||
APIClient.PostRequest("api/main/SaveOrdersToPDF", model);
|
||||
APIClient.PostRequest("api/main/SaveCooksToPDF", model);
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
@ -492,7 +498,7 @@ namespace CanteenManagerApp.Controllers
|
||||
public void ReportXsl(ReportBindingModel model)
|
||||
{
|
||||
model.UserId = APIClient.Manager.Id;
|
||||
APIClient.PostRequest("api/main/SavevToXSL", model);
|
||||
APIClient.PostRequest("api/main/SaveOrdersToXSL", model);
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,9 @@
|
||||
@{
|
||||
ViewData["Title"] = "CookUpdate";
|
||||
}
|
||||
<header>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
</header>
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Данные повара</h2>
|
||||
</div>
|
||||
@ -12,11 +15,11 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">ФИО:</div>
|
||||
<div class="col-8"><input type="text" name="FIO" value="" /></div>
|
||||
<div class="col-8"><input type="text" name="FIO" id="FIO" value="" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Должность:</div>
|
||||
<div class="col-8"><input type="text" name="position" value="" /></div>
|
||||
<div class="col-8"><input type="text" name="position" id="position" value="" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
@ -24,21 +27,22 @@
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
const cooks = [];
|
||||
|
||||
function populateFields() {
|
||||
ViewBag.CookList.forEach(value => {
|
||||
cooks.push(value);
|
||||
$(document).ready(function () {
|
||||
$('#Id').change(function () {
|
||||
var selectedCookId = $(this).val();
|
||||
var cooks = @Html.Raw(JsonConvert.SerializeObject(ViewBag.CookList));
|
||||
var selectedCook;
|
||||
for (var i = 0; i < cooks.length; i++) {
|
||||
if (cooks[i].Id == selectedCookId) {
|
||||
selectedCook = cooks[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selectedCook) {
|
||||
$('#FIO').val(selectedCook.FIO);
|
||||
$('#position').val(selectedCook.Position);
|
||||
}
|
||||
});
|
||||
var selectedCookId = document.getElementById("Id").value;
|
||||
var selectedCook = cooks.find(function (cook) {
|
||||
return cook.Id === selectedCookId;
|
||||
});
|
||||
//console.log(selectedCook.FIO);
|
||||
if (selectedCook) {
|
||||
document.getElementsByName("FIO")[0].value = selectedCook.FIO;
|
||||
document.getElementsByName("position")[0].value = selectedCook.Position;
|
||||
}
|
||||
console.log(document.getElementsByName("FIO")[0].value);
|
||||
}
|
||||
$('#Id').val($('#Id option:first').val()).change();
|
||||
});
|
||||
</script>
|
@ -17,6 +17,12 @@
|
||||
<input type="text" name="name" id="name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена блюда:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="price" id="price" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
|
@ -1,21 +1,25 @@
|
||||
@{
|
||||
@using Newtonsoft.Json;
|
||||
@{
|
||||
ViewData["Title"] = "DishUpdate";
|
||||
}
|
||||
<header>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
</header>
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Данные блюда</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Блюдо:</div>
|
||||
<div class="col-8"><select id="Id" name="Id" class="form-control" onchange="populateFields()" asp-items="@(new SelectList(@ViewBag.DishList, "Id", "DishName"))"></select></div>
|
||||
<div class="col-8"><select id="Id" name="Id" class="form-control" asp-items="@(new SelectList(@ViewBag.DishList, "Id", "DishName"))"></select></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Название:</div>
|
||||
<div class="col-8"><input type="text" name="name" value="" /></div>
|
||||
<div class="col-8"><input type="text" name="name" id="name" value="" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="price" value="" /></div>
|
||||
<div class="col-8"><input type="text" name="price" id="price" value="" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
@ -23,16 +27,22 @@
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
function populateFields() {
|
||||
var selectedDishId = document.getElementById("dish").value;
|
||||
var dishes = @Json.Serialize(ViewBag.CookList);
|
||||
var selectedDish = dishes.find(function (dish) {
|
||||
return dish.Id === selectedDishId;
|
||||
$(document).ready(function () {
|
||||
$('#Id').change(function () {
|
||||
var selectedDishId = $(this).val();
|
||||
var dishes = @Html.Raw(JsonConvert.SerializeObject(ViewBag.DishList));
|
||||
var selectedDish;
|
||||
for (var i = 0; i < dishes.length; i++) {
|
||||
if (dishes[i].Id == selectedDishId) {
|
||||
selectedDish = dishes[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selectedDish) {
|
||||
$('#name').val(selectedDish.DishName);
|
||||
$('#price').val(selectedDish.Price);
|
||||
}
|
||||
});
|
||||
|
||||
if (selectedDish) {
|
||||
document.getElementsByName("name")[0].value = selectedDish.DishName;
|
||||
document.getElementsByName("price")[0].value = selectedDish.Price;
|
||||
}
|
||||
}
|
||||
$('#Id').val($('#Id option:first').val()).change();
|
||||
});
|
||||
</script>
|
@ -1,6 +1,10 @@
|
||||
@{
|
||||
@using Newtonsoft.Json;
|
||||
@{
|
||||
ViewData["Title"] = "ProductUpdate";
|
||||
}
|
||||
<header>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
</header>
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Данные продукта</h2>
|
||||
</div>
|
||||
@ -11,11 +15,11 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">ФИО:</div>
|
||||
<div class="col-8"><input type="text" name="name" value="" /></div>
|
||||
<div class="col-8"><input type="text" name="name" id="name" value="" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="price" value="" /></div>
|
||||
<div class="col-8"><input type="text" name="price" id="price" value="" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
@ -23,16 +27,22 @@
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
function populateFields() {
|
||||
var selectedCookId = document.getElementById("product").value;
|
||||
var cooks = @Json.Serialize(ViewBag.CookList);
|
||||
var selectedCook = cooks.find(function (cook) {
|
||||
return cook.Id === selectedCookId;
|
||||
$(document).ready(function () {
|
||||
$('#Id').change(function () {
|
||||
var selectedProductId = $(this).val();
|
||||
var products = @Html.Raw(JsonConvert.SerializeObject(ViewBag.ProductList));
|
||||
var selectedProduct;
|
||||
for (var i = 0; i < products.length; i++) {
|
||||
if (products[i].Id == selectedProductId) {
|
||||
selectedProduct = products[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selectedProduct) {
|
||||
$('#name').val(selectedProduct.ProductName);
|
||||
$('#price').val(selectedProduct.Price);
|
||||
}
|
||||
});
|
||||
|
||||
if (selectedCook) {
|
||||
document.getElementsByName("name")[0].value = selectedCook.ProductName;
|
||||
document.getElementsByName("price")[0].value = selectedCook.Price;
|
||||
}
|
||||
}
|
||||
$('#Id').val($('#Id option:first').val()).change();
|
||||
});
|
||||
</script>
|
@ -55,7 +55,7 @@ namespace CanteenRestApi.Controllers
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void SaveOrdersToPDF(ReportBindingModel model)
|
||||
public void SaveCooksToPDF(ReportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -619,6 +619,19 @@ namespace CanteenRestApi.Controllers
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public LunchViewModel GetLunch(int lunchId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _lunch.ReadElement(new LunchSearchModel { Id = lunchId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error during loading list of bouquets");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public GraphicViewModel[] GetGraphic()
|
||||
{
|
||||
return new GraphicViewModel[]
|
||||
|
@ -530,6 +530,7 @@ namespace CanteenVisitorApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult Report()
|
||||
{
|
||||
ViewBag.LunchList = APIClient.GetRequest<List<LunchViewModel>>($"api/main/getlunchlist?visitorId={APIClient.Visitor.Id}");
|
||||
return View(new ReportBindingModel());
|
||||
}
|
||||
[HttpPost]
|
||||
@ -559,6 +560,13 @@ namespace CanteenVisitorApp.Controllers
|
||||
[HttpPost]
|
||||
public void ReportEmail(ReportBindingModel model)
|
||||
{
|
||||
model.UserId = APIClient.Visitor.Id;
|
||||
APIClient.PostRequest($"api/visitor/SendEmail", new MailSendInfoBindingModel
|
||||
{
|
||||
MailAddress = APIClient.Visitor.Login,
|
||||
Subject = "Отчет",
|
||||
report = model
|
||||
});
|
||||
APIClient.PostRequest("api/main/SaveCooksToEMAIL", model);
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
@ -5,27 +5,38 @@
|
||||
ViewBag.Title = "Report";
|
||||
}
|
||||
|
||||
<h2>Generate Report</h2>
|
||||
<h2>Отчеты</h2>
|
||||
|
||||
@using (Html.BeginForm("Report", "Home", FormMethod.Post))
|
||||
{
|
||||
<div>
|
||||
@Html.LabelFor(m => m.FileName)
|
||||
@Html.TextBoxFor(m => m.FileName)
|
||||
<div class="row">
|
||||
<h4>Pdf</h4>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.DateBefore, "От")
|
||||
@Html.TextBoxFor(m => m.DateBefore, new { type = "date", @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.DateAfter, "До")
|
||||
@Html.TextBoxFor(m => m.DateAfter, new { type = "date", @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mt-2">
|
||||
<button type="submit" class="btn btn-primary" formaction="@Url.Action("ReportPdf", "Home")">Сохранить в pdf</button>
|
||||
<button type="submit" class="btn btn-primary" formaction="@Url.Action("ReportEmail", "Home")">Отправить pdf по почте</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@Html.LabelFor(m => m.DateAfter)
|
||||
@Html.TextBoxFor(m => m.DateAfter, new { type = "date" })
|
||||
<div class="mt-3">
|
||||
<h4>Word, Excel</h4>
|
||||
<div class="form-group mb-2">
|
||||
@Html.LabelFor(m => m.LunchId, "Выбранные обеды")
|
||||
@Html.DropDownListFor(m => m.LunchId, new SelectList(ViewBag.LunchList, "Id", "LunchName"), new { @class = "form-control", multiple = "multiple" })
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" formaction="@Url.Action("ReportXsl", "Home")">Сохранить в excel</button>
|
||||
<button type="submit" class="btn btn-primary" formaction="@Url.Action("ReportWord", "Home")">Сохранить в word</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@Html.LabelFor(m => m.DateBefore)
|
||||
@Html.TextBoxFor(m => m.DateBefore, new { type = "date" })
|
||||
</div>
|
||||
|
||||
<button type="submit" formaction="@Url.Action("ReportPdf", "Home")">Сохранить в pfd</button>
|
||||
<button type="submit" formaction="@Url.Action("ReportEmail", "Home")">Отправить по почте</button>
|
||||
<button type="submit" formaction="@Url.Action("ReportXsl", "Home")">Сохранить в excel</button>
|
||||
<button type="submit" formaction="@Url.Action("ReportWord", "Home")">Сохранить в word</button>
|
||||
}
|
@ -2,6 +2,9 @@
|
||||
@{
|
||||
ViewData["Title"] = "UpdateLunch";
|
||||
}
|
||||
<header>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
</header>
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Данные обеда</h2>
|
||||
</div>
|
||||
@ -20,4 +23,23 @@
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#Id').change(function () {
|
||||
var selectedLunchId = $(this).val();
|
||||
var lunches = @Html.Raw(JsonConvert.SerializeObject(ViewBag.Lunches));
|
||||
var selectedLunch;
|
||||
for (var i = 0; i < lunches.length; i++) {
|
||||
if (lunches[i].Id == selectedLunchId) {
|
||||
selectedLunch = lunches[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selectedLunch) {
|
||||
$('#name').val(selectedLunch.LunchName);
|
||||
}
|
||||
});
|
||||
$('#Id').val($('#Id option:first').val()).change();
|
||||
});
|
||||
</script>
|
@ -2,13 +2,16 @@
|
||||
@{
|
||||
ViewData["Title"] = "UpdateOrder";
|
||||
}
|
||||
<header>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
</header>
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Данные заказа</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Заказ:</div>
|
||||
<div class="col-8"><select id="Id" name="Id" class="form-control" onchange="populateFields()" asp-items="@(new SelectList(@ViewBag.Orders, "Id", "Id"))"></select></div>
|
||||
<div class="col-8"><select id="Id" name="Id" class="form-control" asp-items="@(new SelectList(@ViewBag.Orders, "Id", "Id"))"></select></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Пожелания:</div>
|
||||
@ -20,4 +23,23 @@
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#Id').change(function () {
|
||||
var selectedOrderId = $(this).val();
|
||||
var orders = @Html.Raw(JsonConvert.SerializeObject(ViewBag.Orders));
|
||||
var selectedOrder;
|
||||
for (var i = 0; i < orders.length; i++) {
|
||||
if (orders[i].Id == selectedOrderId) {
|
||||
selectedOrder = orders[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selectedOrder) {
|
||||
$('#description').val(selectedOrder.Description);
|
||||
}
|
||||
});
|
||||
$('#Id').val($('#Id option:first').val()).change();
|
||||
});
|
||||
</script>
|
@ -2,13 +2,16 @@
|
||||
@{
|
||||
ViewData["Title"] = "UpdateTableware";
|
||||
}
|
||||
<header>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
</header>
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Данные прибора</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Прибор:</div>
|
||||
<div class="col-8"><select id="Id" name="Id" class="form-control" onchange="populateFields()" asp-items="@(new SelectList(@ViewBag.Tablewares, "Id", "TablewareName"))"></select></div>
|
||||
<div class="col-8"><select id="Id" name="Id" class="form-control" asp-items="@(new SelectList(@ViewBag.Tablewares, "Id", "TablewareName"))"></select></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Название прибора:</div>
|
||||
@ -20,23 +23,24 @@
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>@*
|
||||
</form>
|
||||
<script>
|
||||
const tablewars = [];
|
||||
|
||||
function populateFields() {
|
||||
ViewBag.Tablewares.forEach(value => {
|
||||
tablewars.push(value);
|
||||
$(document).ready(function () {
|
||||
$('#Id').change(function () {
|
||||
var selectedTablewareId = $(this).val();
|
||||
var tablewares = @Html.Raw(JsonConvert.SerializeObject(ViewBag.Tablewares));
|
||||
var selectedTableware;
|
||||
for (var i = 0; i < tablewares.length; i++) {
|
||||
if (tablewares[i].Id == selectedTablewareId) {
|
||||
selectedTableware = tablewares[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
console.log(selectedTableware);
|
||||
if (selectedTableware) {
|
||||
$('#TablewareName').val(selectedTableware.TablewareName);
|
||||
}
|
||||
});
|
||||
var selectedTablewareId = document.getElementById("Id").value;
|
||||
var selectedTableware = tablewares.find(function (tableware) {
|
||||
return tableware.Id === selectedTablewareId;
|
||||
});
|
||||
//console.log(selectedCook.FIO);
|
||||
if (selectedTableware) {
|
||||
document.getElementsByName("TablewareName")[0].value = selectedTableware.TablewareName;
|
||||
document.getElementsByName("TablewareCount")[0].value = selectedTableware.TablewareCount;
|
||||
}
|
||||
console.log(document.getElementsByName("TablewareName")[0].value);
|
||||
}
|
||||
</script>*@
|
||||
$('#Id').val($('#Id option:first').val()).change();
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user