Compare commits

...

3 Commits

Author SHA1 Message Date
Tracy Pearson
0ef09b334c Functioning partial view usings ajax 2022-12-10 17:01:11 -05:00
Tracy Pearson
075283f884 Functional partialview via ajax 2022-12-10 02:51:51 -05:00
Tracy Pearson
57946e64d5 Attempt to use PartialView 2022-12-10 01:16:37 -05:00
9 changed files with 92 additions and 4 deletions

3
.gitignore vendored
View File

@@ -3,6 +3,9 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
Caddy/*
!Caddyfile
# User-specific files
*.rsuser
*.suo

16
Caddy/Caddyfile Normal file
View 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
}

View File

@@ -29,7 +29,6 @@ namespace WebPostPartialJsonObject.Controllers
HttpContext.Session.SetObject("KioskSettings", data);
return RedirectToAction("Index", "Settings");
}
public IActionResult Privacy()
{
return View();

View File

@@ -11,5 +11,13 @@ namespace WebPostPartialJsonObject.Controllers
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);
}
}
}

View 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; }
}
}

View File

@@ -0,0 +1,7 @@
namespace WebPostPartialJsonObject.Models
{
public class ReprintRequest
{
public int CkInId { get; set; }
}
}

View File

@@ -18,7 +18,7 @@
"WebPostPartialJsonObject": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "http://localhost:5000",
"applicationUrl": "http://+:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}

View File

@@ -26,13 +26,44 @@
<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");}
@{
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>
}

View 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>