Compare commits
5 Commits
7d5c48565c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ef09b334c | ||
|
|
075283f884 | ||
|
|
57946e64d5 | ||
|
|
8cb745063d | ||
|
|
57146a02f1 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -3,6 +3,9 @@
|
|||||||
##
|
##
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
Caddy/*
|
||||||
|
!Caddyfile
|
||||||
|
|
||||||
# User-specific files
|
# User-specific files
|
||||||
*.rsuser
|
*.rsuser
|
||||||
*.suo
|
*.suo
|
||||||
|
|||||||
16
Caddy/Caddyfile
Normal file
16
Caddy/Caddyfile
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
log {
|
||||||
|
output stderr
|
||||||
|
format json {
|
||||||
|
time_local
|
||||||
|
time_format wall_milli
|
||||||
|
duration_format string
|
||||||
|
}
|
||||||
|
level debug
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
http://*:9000 {
|
||||||
|
reverse_proxy localhost:5000
|
||||||
|
log
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WebPostPartialJsonObject.Extensions;
|
||||||
using WebPostPartialJsonObject.Models;
|
using WebPostPartialJsonObject.Models;
|
||||||
|
|
||||||
namespace WebPostPartialJsonObject.Controllers
|
namespace WebPostPartialJsonObject.Controllers
|
||||||
@@ -22,12 +23,12 @@ namespace WebPostPartialJsonObject.Controllers
|
|||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost, Consumes("application/json")]
|
||||||
public IActionResult Index(ExpectedViewModel data)
|
public IActionResult Index([FromBody] ExpectedViewModel data)
|
||||||
{
|
{
|
||||||
return View();
|
HttpContext.Session.SetObject("KioskSettings", data);
|
||||||
|
return RedirectToAction("Index", "Settings");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Privacy()
|
public IActionResult Privacy()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
|
|||||||
23
WebPostPartialJsonObject/Controllers/SettingsController.cs
Normal file
23
WebPostPartialJsonObject/Controllers/SettingsController.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WebPostPartialJsonObject.Extensions;
|
||||||
|
using WebPostPartialJsonObject.Models;
|
||||||
|
|
||||||
|
namespace WebPostPartialJsonObject.Controllers
|
||||||
|
{
|
||||||
|
public class SettingsController : Controller
|
||||||
|
{
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
ExpectedViewModel data = HttpContext.Session.GetObject<ExpectedViewModel>("KioskSettings");
|
||||||
|
return View(data);
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Reprint([FromForm] int ckinid)
|
||||||
|
{
|
||||||
|
ReprintInfo model = new ReprintInfo();
|
||||||
|
model.CkInId = ckinid;
|
||||||
|
model.PrinterName = "printer";
|
||||||
|
return PartialView("ReprintView", model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
WebPostPartialJsonObject/Extensions/SessionExtensions.cs
Normal file
19
WebPostPartialJsonObject/Extensions/SessionExtensions.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WebPostPartialJsonObject.Extensions
|
||||||
|
{
|
||||||
|
public static class SessionExtensions
|
||||||
|
{
|
||||||
|
public static void SetObject(this ISession session, string key, object value)
|
||||||
|
{
|
||||||
|
session.SetString(key, JsonConvert.SerializeObject(value));
|
||||||
|
}
|
||||||
|
public static T GetObject<T>(this ISession session, string key)
|
||||||
|
{
|
||||||
|
var value = session.GetString(key);
|
||||||
|
return value == null ? default : JsonConvert.DeserializeObject<T>(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
WebPostPartialJsonObject/Models/ReprintInfo.cs
Normal file
14
WebPostPartialJsonObject/Models/ReprintInfo.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
namespace WebPostPartialJsonObject.Models
|
||||||
|
{
|
||||||
|
|
||||||
|
public class ReprintInfo
|
||||||
|
{
|
||||||
|
public IEnumerable<string> LabelSets { get; set; }
|
||||||
|
public IEnumerable<string> LabelNames { get; set; }
|
||||||
|
public int PrinterType { get; set; }
|
||||||
|
public string PrinterName { get; set; }
|
||||||
|
public int CkInId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
7
WebPostPartialJsonObject/Models/ReprintRequest.cs
Normal file
7
WebPostPartialJsonObject/Models/ReprintRequest.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace WebPostPartialJsonObject.Models
|
||||||
|
{
|
||||||
|
public class ReprintRequest
|
||||||
|
{
|
||||||
|
public int CkInId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"WebPostPartialJsonObject": {
|
"WebPostPartialJsonObject": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"applicationUrl": "http://localhost:5000",
|
"applicationUrl": "http://+:5000",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,11 @@ namespace WebPostPartialJsonObject
|
|||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddControllersWithViews();
|
services.AddSession(options =>
|
||||||
|
{
|
||||||
|
options.IdleTimeout = TimeSpan.FromHours(2.0);
|
||||||
|
});
|
||||||
|
services.AddControllersWithViews().AddSessionStateTempDataProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
@@ -37,6 +41,7 @@ namespace WebPostPartialJsonObject
|
|||||||
app.UseExceptionHandler("/Home/Error");
|
app.UseExceptionHandler("/Home/Error");
|
||||||
}
|
}
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
app.UseSession();
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|
||||||
|
|||||||
69
WebPostPartialJsonObject/Views/Settings/Index.cshtml
Normal file
69
WebPostPartialJsonObject/Views/Settings/Index.cshtml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
@model WebPostPartialJsonObject.Models.ExpectedViewModel
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Index";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1>Index</h1>
|
||||||
|
|
||||||
|
<h4>ExpectedViewModel</h4>
|
||||||
|
<hr />
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<form asp-action="Index">
|
||||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="KioskName" class="control-label"></label>
|
||||||
|
<input asp-for="KioskName" class="form-control" />
|
||||||
|
<span asp-validation-for="KioskName" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="StartUp" class="control-label"></label>
|
||||||
|
<input asp-for="StartUp" class="form-control" />
|
||||||
|
<span asp-validation-for="StartUp" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="submit" value="Save" class="btn btn-primary" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div id="reprintLabels" class="modal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Select the labels you want to reprint</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">x</span></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" id="reprintLabelsForm"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-outline-secondary" id="btnReprintLabels" data-toggle="modal" data-target="#reprintLabels" data-ckinid="123">
|
||||||
|
Reprint Label(s)
|
||||||
|
</button>
|
||||||
|
<div>
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@section Scripts {
|
||||||
|
@{
|
||||||
|
await Html.RenderPartialAsync("_ValidationScriptsPartial");
|
||||||
|
}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('#btnReprintLabels').click(function (e) { pickLabels(e, $(this)); });
|
||||||
|
|
||||||
|
function pickLabels(e, element) {
|
||||||
|
var id = element.data('ckinid');
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: '/Settings/Reprint',
|
||||||
|
data: { 'ckinid': id },
|
||||||
|
success: function (response) {
|
||||||
|
$('#reprintLabelsForm').html(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
}
|
||||||
10
WebPostPartialJsonObject/Views/Settings/ReprintView.cshtml
Normal file
10
WebPostPartialJsonObject/Views/Settings/ReprintView.cshtml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
@*
|
||||||
|
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||||
|
*@
|
||||||
|
@model WebPostPartialJsonObject.Models.ReprintInfo
|
||||||
|
@{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
<h5>Partial View @Model.CkInId</h5>
|
||||||
|
<div>Printer: @Model.PrinterName</div>
|
||||||
@@ -4,4 +4,9 @@
|
|||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.5" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user