btcpayserver/BTCPayServer/Views/Shared/PointOfSale/Public/_Layout.cshtml
Nicolas Dorier 8cde8c01df
Add category feature to the PoS with Cart (#5078)
* Add grouping feature to the PoS with Cart

* Improve UI

* Rename groups to categories

* Make it easier to select categories of the items

* Refactor TemplateEditor, use TomSelect for categories

* Prevent Vue code insertion

* Prevent empty categories

* Add label ids

* Add test case

---------

Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
2023-06-30 09:13:15 +09:00

61 lines
2.2 KiB
Text

@using BTCPayServer.Abstractions.Extensions
@using Microsoft.AspNetCore.Hosting
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using Newtonsoft.Json.Linq
@using System.IO
@inject IWebHostEnvironment WebHostEnvironment
@inject BTCPayServer.Services.BTCPayServerEnvironment Env
@model BTCPayServer.Plugins.PointOfSale.Models.ViewPointOfSaleViewModel
@{
ViewData["Title"] = string.IsNullOrEmpty(Model.Title) ? Model.StoreName : Model.Title;
Layout = null;
async Task<string> GetDynamicManifest(string title)
{
var manifest = WebHostEnvironment.WebRootFileProvider.GetFileInfo("manifest.json");
if (!manifest.Exists)
{
return null;
}
using var reader = new StreamReader(manifest.CreateReadStream());
var jObject = JObject.Parse(await reader.ReadToEndAsync());
jObject["short_name"] = title;
jObject["name"] = $"BTCPay Server: {title}";
foreach (var jToken in jObject["icons"]!)
{
var icon = (JObject)jToken;
icon["src"] = $"{Context.Request.GetAbsoluteRoot()}/{icon["src"]}";
}
return $"data:application/manifest+json,{Safe.Json(jObject)}";
}
}
<!DOCTYPE html>
<html class="h-100" lang="en" @(Env.IsDeveloping ? " data-devenv" : "")>
<head>
<partial name="LayoutHead"/>
<partial name="LayoutHeadStoreBranding" model="@(Model.BrandColor, Model.CssFileId, Model.CustomCSSLink, Model.EmbeddedCSS)" />
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="apple-touch-icon" href="~/img/icons/icon-512x512.png">
<link rel="apple-touch-startup-image" href="~/img/splash.png">
<link rel="manifest" href="@(await GetDynamicManifest(ViewData["Title"]!.ToString()))">
<style>
.lead :last-child {
margin-bottom: 0;
}
.card-deck {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
grid-gap: 1.5rem;
}
.card {
page-break-inside: avoid;
}
</style>
@await RenderSectionAsync("PageHeadContent", false)
</head>
<body class="min-vh-100">
@RenderBody()
<partial name="LayoutFoot"/>
@await RenderSectionAsync("PageFootContent", false)
</body>
</html>