removed md templates

cleanup
This commit is contained in:
EugeneTes
2026-02-03 11:20:01 +01:00
parent dca0f259ac
commit 46b648d753
195 changed files with 128 additions and 82694 deletions

225
CLAUDE.md
View File

@@ -4,19 +4,15 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Project Overview
This is a C# .NET 8.0 solution for Epson TM-m30III thermal receipt printer integration. The solution consists of a core SDK library (Inspectron.Epson) and multiple applications for production printing, configuration, testing, and discovery.
This is a C# .NET 8.0 solution for Epson thermal receipt printer integration. The solution consists of a core SDK library (Inspectron.Epson) and a production print service application.
## Solution Structure
### Core Projects
### Projects
- **Inspectron.Epson** - Core SDK library providing printer communication, status monitoring, and ESC/POS commands
- **EpsonPrintService** - Production console application with SignalR-based remote job source and systemd service support
- **ConfigurationPannel** - ASP.NET Razor Pages web application for printer configuration with embedded print server
- **Discovery** - Printer network discovery utilities (SLP, ENPC, mDNS)
- **EpsonTest** - Test project for SDK functionality
- **TestClient** - SDK usage examples and testing
- **SendPrintJob** - Direct print job submission utility
- **Inspectron.Epson** - Core SDK library providing printer communication, status monitoring, ESC/POS commands, print queue management, and receipt conversion
- **EpsonPrintService** - Production console application with SignalR-based remote job source, printer discovery, and systemd service support
- **EpsonTest** - Test/example project for SDK functionality and receipt conversion
## Common Build Commands
@@ -27,14 +23,12 @@ dotnet build Inspectron.Epson.slnx
# Build specific project
dotnet build Inspectron.Epson/Inspectron.Epson.csproj
dotnet build EpsonPrintService/EpsonPrintService.csproj
dotnet build ConfigurationPannel/ConfigurationPannel.csproj
# Run projects
# Run print service
dotnet run --project EpsonPrintService/EpsonPrintService.csproj
dotnet run --project ConfigurationPannel/ConfigurationPannel.csproj
# Run tests
dotnet test EpsonTest/EpsonTest.csproj
# Run tests/examples
dotnet run --project EpsonTest/EpsonTest.csproj
# Clean build artifacts
dotnet clean
@@ -45,95 +39,127 @@ dotnet clean
### Three-Layer Architecture
1. **SDK Layer (Inspectron.Epson)**
- `EpsonPrinter`: Main facade for printer operations (TCP/IP, async/await)
- `IEpsonPrinter` / `EpsonPrinter`: Main interface and TCP/IP implementation for printer operations (async/await)
- `EpsonCommands`: Static ESC/POS command definitions
- `EpsonImageConverter`: Image processing with Floyd-Steinberg dithering
- `EpsonPrinterDiscovery`: Network printer discovery (SLP, ENPC)
- `IDiscoveryService` / `DiscoveryService`: Network printer discovery (SLP, ENPC)
- `PreconfiguredDiscoveryService`: Preconfigured printer list (no network scan)
- `BonjourDiscovery`: mDNS-based printer discovery
- `HtmlPrinter`: HTML output implementation for testing without hardware
- Status classes: PrinterStatus, OfflineStatus, ErrorStatus, PaperSensorStatus, OverallStatus
- Exception hierarchy: EpsonPrinterException EpsonConnectionException, EpsonCommandException
- Exception hierarchy: EpsonPrinterException -> EpsonConnectionException, EpsonCommandException
2. **Print Server Layer (PrintServer/ namespace in Inspectron.Epson)**
- `PrintServer`: Manager for printer queues, coordinates multiple printers by IP
2. **Queue Layer (Inspectron.Epson.Queue namespace)**
- `PrintServer`: Manager for per-printer queues with read/write lock coordination between printing and discovery
- `PrinterQueue`: Per-printer queue with retry logic (ConcurrentQueue + priority ConcurrentStack)
- `IPrintService`: Print workflow interface (PrintAsync returns `PrintResult`)
- `PrintJob`: Job model with IP, Document, QueuedAt, RetryCount
- `PrintResult`: Success/Failure result with `PrintErrorType`
- `IJobStatusReporter`: Interface for reporting job status updates
3. **PrintServer Layer (Inspectron.Epson.PrintServer namespace)**
- `PrintLoop`: Orchestrator connecting job sources to print server
- `IPrintJobSource`: Strategy pattern for job sources (SignalRPrintJobSource, SingleJobSource, NoOpPrintJobSource)
- `IPrintService`: Print workflow orchestration (EpsonPrintService implementation)
- `IPrinter`: Printer model abstraction (TM-T30III, TM-U220II)
- `PrinterFactory`: Factory pattern for creating printer instances by model ID
- **JobSources/**: `IPrintJobSource` strategy pattern (SignalRPrintJobSource, SingleJobSource)
- **PrintServices/**: `IPrintService` implementation (`EpsonPrintService`), `IAssignedPrinterRepository`, `IPrinterConfigurationSource`
- **ConfigurationSources/**: `EpsonPrintServiceConfiguration`, `FixedConfigurationSource`
- **Printers/**: `IPrinterFactory` (creates `IEpsonPrinter`), `IWrapperPrinterFactory` / `PrinterWrapperFactory` (creates `IPrinter` adapter by model ID)
- **Printers/Utils/**: `PrintCommand` model, `IReceiptConverter` / `IReceiptConverterFactory` with receipt type implementations
- **WorkAreaSources/**: `IWorkAreasSource`, `JamesWorkAreaSource`
- **DiscoveredPrintersReceiver/**: `IDiscoveredPrintersReceiver`, `JamesDiscoveredPrintersReceiver`
3. **Application Layer**
- EpsonPrintService: Production deployment with Ninject DI, SignalR remote jobs, systemd service
- ConfigurationPannel: ASP.NET Core with Microsoft.Extensions.DI, cookie authentication, hosted service pattern
4. **Application Layer (EpsonPrintService)**
- Production deployment with Ninject DI, SignalR remote jobs, printer discovery, heartbeat, systemd service
### Dependency Injection Patterns
### Receipt Conversion System
The codebase uses TWO different DI containers:
Receipt content is converted from JSON to `PrintCommand` lists via `IReceiptConverterFactory`:
- **KitchenReceipt** - Kitchen order tickets
- **FinalReceipt** - Final customer receipts
- **InvoiceReceipt** - Invoice receipts
- **BarReceipt** - Bar order tickets
- **OrderItems** - Order item lists
`PrintCommand` properties: Text, IsBig, IsTall, IsBold, IsRed, SetLineSpacing, IsCut
### Printer Model Adapters
`IPrinter` implementations wrap `IEpsonPrinter` with model-specific behavior:
- `TM-T30III` / `TM-T30IIITranslated` - Thermal receipt printer (384px image width)
- `TM-U220II` / `TM-U220IITranslated` - Dot matrix receipt printer (narrower image width)
Created via `IWrapperPrinterFactory.CreatePrinterFromId(modelIdByte, epsonPrinter)`.
### Dependency Injection (Ninject)
**Ninject (EpsonPrintService console app):**
```csharp
StandardKernel kernel = new();
kernel.Bind<IPrinterFactory>().To<EpsonPrinterFactory>();
kernel.Bind<IWrapperPrinterFactory>().To<PrinterWrapperFactory>().InSingletonScope();
kernel.Bind<IPrintJobSource, SignalRPrintJobSource>().To<SignalRPrintJobSource>().InSingletonScope();
kernel.Bind<IPrintService>().To<EpsonPrintService>();
kernel.Bind<IAssignedPrinterRepository>().ToConstant(config);
kernel.Bind<IPrinterFactory>().To<PrinterFactory>().InSingletonScope();
kernel.Bind<IPrinterConfigurationSource>().To<FixedConfigurationSource>();
kernel.Bind<IReceiptConverterFactory>().To<ReceiptConverterFactory>().InSingletonScope();
kernel.Bind<IJobStatusReporter>().To<NullJobStatusReporter>();
kernel.Bind<IDiscoveryService>().ToConstant(discovery);
kernel.Bind<IDiscoveredPrintersReceiver>().To<JamesDiscoveredPrintersReceiver>().InSingletonScope();
kernel.Bind<PrintServer>().ToSelf().InSingletonScope();
```
**Microsoft.Extensions.DependencyInjection (ConfigurationPannel ASP.NET):**
```csharp
builder.Services.AddSingleton<UserService>();
builder.Services.AddSingleton<ConfigurationManager>();
builder.Services.AddHostedService<PrintServerHostedService>();
```
When adding new services, match the DI pattern of the project you're working in.
### Key Interfaces and Abstractions
- `IEpsonPrinter`: Low-level printer operations (connect, status, ESC/POS commands, image printing)
- `IPrinter`: Printer model adapter (InitAsync, PrintImageAsync, SetFontSizeAsync, PrintAsync, Cut)
- `IPrintJobSource`: Pluggable job sources (async via Channel<PrintJob>)
- `IPrintService`: Print workflow execution (PrintAsync returns bool for success/failure)
- `IAssignedPrinterRepository`: Maps work area IDs to printer IPs (GetAssignedPrinter)
- `IPrinterConfigurationSource`: Provides printer configuration (address, font size, logo)
- `IPrinter`: Printer model-specific operations (InitAsync, PrintImageAsync, SetFontSizeAsync, PrintTextAsync, Cut)
- `IPrinterFactory`: Creates IPrinter from model ID byte (0x01 = TM-T30III, 0x13 = TM-U220II)
- `IPrintService`: Print workflow execution (PrintAsync returns `PrintResult`)
- `IPrinterFactory`: Creates `IEpsonPrinter` instances (EpsonPrinterFactory, HtmlPrinterFactory)
- `IWrapperPrinterFactory`: Creates `IPrinter` adapter from model ID byte
- `IPrinterConfigurationSource`: Provides printer configuration
- `IReceiptConverter` / `IReceiptConverterFactory`: Converts JSON receipt content to `PrintCommand` list
- `IDiscoveryService`: Printer network discovery
- `IDiscoveredPrintersReceiver`: Receives and processes discovered printers
- `IJobStatusReporter`: Reports job status updates
### Print Job Flow
```
PrintLoop.StartAsync()
IPrintJobSource.GetNextJobAsync() [blocks until job available]
→ IAssignedPrinterRepository.GetAssignedPrinter(job.AreaId) [returns printer IP]
PrintServer.SubmitJob(printerIp, job)
→ PrinterQueue.Enqueue(job) [per-printer queue]
→ ProcessQueueAsync() [background loop]
IPrintService.PrintAsync(printerIp, job)
→ Get configuration, connect to printer, detect model
→ IPrinterFactory.CreatePrinterFromId()
Initialize printer, print logo (if configured), set font size
→ Print text content, cut paper
→ Return true/false for success
→ On failure: retry up to 3 times via priority queue
-> IPrintJobSource.GetNextJobAsync() [blocks until job available]
-> PrintServer.SubmitJob(job.IP, job)
-> PrinterQueue.Enqueue(job) [per-printer queue]
-> ProcessQueueAsync() [background loop]
-> IPrintService.PrintAsync(printerIp, job)
-> IPrinterFactory.CreatePrinter() [creates IEpsonPrinter]
-> Connect, get printer ID, check status
-> IWrapperPrinterFactory.CreatePrinterFromId() [creates IPrinter adapter]
-> Initialize printer, download & cache logo (if URL provided)
-> IReceiptConverterFactory.Create(receiptType, printerId)
-> Convert JSON content to PrintCommand list
-> printerAdapter.PrintAsync(commands), cut paper
-> Return PrintResult.Ok() or PrintResult.Fail(errorType)
-> On failure: retry up to 3 times via priority queue
```
### Configuration System
**EpsonPrintServiceConfiguration** (config.json):
```json
{
"GroupId": "67e534f8e86e816689323023",
"RestaurantId": "63e37295bd6f26dbd36164c0",
"PrinterConfigurations": {
"192.168.1.100": {
"Address": "192.168.1.100:9100",
"FontSize": 2,
"LogoFilename": "logo.png",
"AreaId": "kitchen"
}
}
}
Configuration is loaded from a base64-encoded `config.txt` file containing `apiUrl;restaurantId;apiKey`:
```
# config.txt contains a single base64-encoded line
# Decoded format: apiUrl;restaurantId;apiKey
# Example decoded: https://api.gastrojames.ch;63e37295bd6f26dbd36164c0;yourApiKeyHere
```
This class implements BOTH `IPrinterConfigurationSource` and `IAssignedPrinterRepository` for dual roles.
`ConfigurationPaths` resolves the config path:
- **Windows**: local `config.txt`
- **Linux**: `/root/epsonprintservice/config.txt`
Printers are registered via `PreconfiguredDiscoveryService` with hardcoded IPs in `Program.cs`, or dynamically via `PrinterDiscoveryBackgroundTask`.
### PrintServer Read/Write Lock
`PrintServer` uses a readers-writer lock pattern to coordinate printing with discovery:
- **Print operations** acquire a read lock (`EnterPrintLock` / `ExitPrintLock`) - multiple prints run concurrently
- **Discovery operations** acquire a write lock (`EnterDiscoveryLockAsync` / `ExitDiscoveryLock`) - blocks until all prints complete, prevents new prints during discovery
### Printer Communication
@@ -149,9 +175,17 @@ This class implements BOTH `IPrinterConfigurationSource` and `IAssignedPrinterRe
1. Get printer ID byte via `EpsonPrinter.GetPrinterIdAsync()` (GS I 1 command)
2. Create new class implementing `IPrinter` in `Inspectron.Epson/PrintServer/Printers/`
3. Implement required methods: InitAsync, PrintImageAsync, SetFontSizeAsync, PrintTextAsync, Cut
4. Add case to `PrinterFactory.CreatePrinterFromId()` with the printer ID byte
5. Test with actual hardware - different models have different image widths and positioning
3. Implement required methods: InitAsync, PrintImageAsync, SetFontSizeAsync, PrintAsync, Cut
4. Add case to `PrinterWrapperFactory.CreatePrinterFromId()` with the printer ID byte
5. Add receipt converter support in `ReceiptConverterFactory` if needed
6. Test with actual hardware - different models have different image widths and positioning
## Adding New Receipt Types
1. Create a new folder under `Inspectron.Epson/PrintServer/Printers/Utils/`
2. Add Models.cs with the receipt data model
3. Create a converter implementing `IReceiptConverter` (returns `List<PrintCommand>`)
4. Register the new receipt type in `ReceiptConverterFactory`
## Testing Printer Connectivity
@@ -172,7 +206,7 @@ Console.WriteLine(report);
### Systemd Service (Linux)
EpsonPrintService includes systemd service file (`epson.service`):
EpsonPrintService includes systemd service files (`epson.service`, `print_server.service`):
```bash
# Copy files to deployment directory
cp -r EpsonPrintService/bin/Debug/net8.0/* /home/pi/epson_service/
@@ -187,13 +221,7 @@ sudo systemctl start epson.service
sudo systemctl status epson.service
```
### ASP.NET Hosted Service
ConfigurationPannel runs print server as `IHostedService`:
```bash
dotnet run --project ConfigurationPannel/ConfigurationPannel.csproj
```
Access web UI at http://localhost:5000 (default login credentials in users.json).
Deployment scripts included: `start.sh`, `postinst`, `prem`, `uninstall.sh`.
## Important Implementation Notes
@@ -215,12 +243,20 @@ When printing images via `EpsonPrinter.LoadImageAsync()`:
5. Pack pixels to byte-aligned format
6. Generate column format for bit-image mode (ESC * 33)
### Logo Caching
`EpsonPrintService` downloads logos from URLs provided in print jobs:
- Logos are cached locally in a `logos/` directory under the app base directory
- Filename is base64-encoded to avoid path issues
- Subsequent prints skip the download if the cached file exists
### SignalR Job Source
`SignalRPrintJobSource` connects to `https://api.gastrojames.ch/hubs/internal`:
- Authentication: Bearer token from configuration
- Group: Joins via GroupId from configuration
- Message: "PrintJob" with { WorkingAreaId, Content }
`SignalRPrintJobSource` connects to `{ApiUrl}/hubs/printer-servers`:
- Uses `InfiniteRetryPolicy` with exponential backoff (capped at 30s) for automatic reconnection
- Retries initial connection in a loop on failure
- Joins group by RestaurantId from configuration
- Message: "PrintJob" with { PrinterIp, LogoUrl, ReceiptType, Content }
- Uses Channel<PrintJob> for async producer-consumer pattern
### Font Sizing
@@ -236,7 +272,7 @@ Font magnification is 1-8x for both width and height:
- Verify IP address with `ping <printer-ip>`
- Check printer is on same network/VLAN
- Ensure port 9100 is not blocked by firewall
- Try printer discovery: run Discovery project
- Check `PreconfiguredDiscoveryService` entries in `Program.cs`
### "Cover open" or "Paper end" errors
- Check `OverallStatus.Recommendations` for specific issues
@@ -244,15 +280,10 @@ Font magnification is 1-8x for both width and height:
### Image not printing or garbled
- Verify image width matches printer specification (384px for TM-T30III)
- Check image file path is accessible
- Check image file path or URL is accessible
- Ensure printer model supports raster graphics (TM-T30III does, older models may not)
### SignalR connection failures
- Check GroupId and RestaurantId in config.json
- Verify network connectivity to api.gastrojames.ch
- Check bearer token expiration
### ConfigurationPannel login issues
- Default credentials in users.json (BCrypt hashed)
- Cookie expiration: 8 hours with sliding expiration
- Authentication uses CookieAuthenticationDefaults scheme
- Check RestaurantId and ApiKey in config.txt (base64-encoded)
- Verify network connectivity to the API URL
- SignalR auto-reconnects with infinite retry; check logs for reconnection attempts

View File

@@ -1,46 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Inspectron.Epson\Inspectron.Epson.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.3.0" />
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="Ninject" Version="3.3.6" />
</ItemGroup>
<ItemGroup>
<None Update="config.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ConfigurationPannel.service">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="install.sh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="postinst">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="prem">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="start.sh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="uninstall.sh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="users.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -1,12 +0,0 @@
[Unit]
Description=ConfigurationPannel service
[Service]
Restart=always
RestartSec=1
WorkingDirectory=/home/pi/print_server
Type=simple
ExecStart=/bin/bash /home/pi/print_server/start.sh
[Install]
WantedBy=multi-user.target

View File

@@ -1,263 +0,0 @@
@page
@model ConfigurationPannel.Pages.ConfigureModel
@{
ViewData["Title"] = "Printer Configuration";
}
<div class="container mt-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2>Printer Configuration</h2>
<div>
<button type="button" class="btn btn-secondary" onclick="discoverPrinters()">
<span id="discover-spinner" class="spinner-border spinner-border-sm d-none"></span>
Discover Printers
</button>
<a asp-page="/Logout" class="btn btn-outline-secondary">Logout</a>
</div>
</div>
<div id="discovery-status" class="alert alert-info d-none">
Discovering printers...
</div>
<div id="discovered-printers" class="mb-4">
<h5>Discovered Printers: <span id="printer-count">@Model.DiscoveredPrinters.Count</span></h5>
<ul id="printer-list" class="list-group">
@foreach (var printer in Model.DiscoveredPrinters)
{
<li class="list-group-item">@printer.IPAddress </li>
}
</ul>
</div>
<div class="card mb-4">
<div class="card-header d-flex justify-content-between align-items-center">
<h4>Logo Management</h4>
<button type="button" class="btn btn-sm btn-warning" onclick="document.getElementById('cleanLogosForm').submit()">
Clean Unused Logos
</button>
</div>
<div class="card-body">
<form method="post" asp-page-handler="UploadLogo" enctype="multipart/form-data" class="d-flex gap-2 align-items-center">
<input type="file" name="UploadedLogo" accept=".png,.jpg,.jpeg,.gif,.bmp" class="form-control" style="max-width: 400px;" />
<button type="submit" class="btn btn-primary">Upload Logo</button>
</form>
<small class="text-muted">Supported formats: PNG, JPG, JPEG, GIF, BMP</small>
@if (Model.AvailableLogos.Any())
{
<div class="mt-3">
<strong>Available logos (@Model.AvailableLogos.Count):</strong>
<div class="d-flex flex-wrap gap-2 mt-2">
@foreach (var logo in Model.AvailableLogos)
{
<div class="border p-2 text-center" style="width: 120px;">
<a href="/logos/@logo" target="_blank">
<img src="/logos/@logo" alt="@logo" style="max-width: 100px; max-height: 80px;" class="d-block mx-auto" />
</a>
<small class="text-muted d-block mt-1" style="font-size: 10px; word-break: break-all;">@logo</small>
</div>
}
</div>
</div>
}
</div>
</div>
<!-- Hidden form for cleaning logos -->
<form id="cleanLogosForm" method="post" asp-page-handler="CleanLogos" style="display: none;"></form>
<form method="post" asp-page-handler="Save">
<div class="card">
<div class="card-header">
<h4>Work Area Assignments</h4>
</div>
<div class="card-body">
@if (Model.WorkAreas == null || !Model.WorkAreas.Any())
{
<div class="alert alert-warning">No work areas found. Check configuration.</div>
}
else
{
<table class="table table-hover">
<thead>
<tr>
<th>Work Area</th>
<th>Assigned Printer</th>
<th>Font Size</th>
<th>Logo</th>
</tr>
</thead>
<tbody>
@for (int i = 0; i < Model.WorkAreas.Count; i++)
{
var workArea = Model.WorkAreas[i];
var currentPrinter = Model.CurrentAssignments.TryGetValue(workArea.Id, out var assigned) ? assigned.Address : "";
var currentFontSize = Model.CurrentAssignments.TryGetValue(workArea.Id, out var cfg) ? cfg.FontSize : 1;
<tr>
<td>
<strong>@workArea.Name</strong>
<input type="hidden" name="WorkAreaAssignments[@i].WorkAreaId" value="@workArea.Id" />
<input type="hidden" name="WorkAreaAssignments[@i].WorkAreaName" value="@workArea.Name" />
</td>
<td>
<select name="WorkAreaAssignments[@i].PrinterAddress"
class="form-select printer-select"
data-workarea="@workArea.Id">
<option value="">None</option>
@foreach (var printer in Model.DiscoveredPrinters)
{
var selected = currentPrinter == printer.IPAddress;
<option value="@printer.IPAddress" selected="@selected">
@printer.IPAddress @(!string.IsNullOrEmpty(printer.ModelName) ? $"({printer.ModelName})" : "")
</option>
}
</select>
</td>
<td>
<input type="number"
name="WorkAreaAssignments[@i].FontSize"
class="form-control"
min="1"
max="4"
value="@currentFontSize"
style="width: 80px;" />
</td>
<td>
@{
var currentLogo = Model.CurrentAssignments.TryGetValue(workArea.Id, out var cfgLogo) ? cfgLogo.LogoFilename : "";
}
<select name="WorkAreaAssignments[@i].LogoFilename"
id="logo-select-@i"
class="form-select logo-select"
onchange="updateLogoPreview(@i)"
style="max-width: 200px;">
<option value="">None</option>
@foreach (var logo in Model.AvailableLogos)
{
var selected = currentLogo == logo;
<option value="@logo" selected="@selected">@logo</option>
}
</select>
<div id="logo-preview-@i" class="mt-2" style="display: none;">
<a href="#" target="_blank" id="logo-link-@i">
<img id="logo-img-@i" src="" alt="Logo preview" style="max-height: 100px; cursor: pointer;" />
</a>
</div>
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
<div class="mt-3">
<button type="submit" class="btn btn-primary btn-lg">Save Configuration</button>
</div>
@if (!string.IsNullOrEmpty(Model.SuccessMessage))
{
<div class="alert alert-success mt-3">@Model.SuccessMessage</div>
}
@if (!string.IsNullOrEmpty(Model.ErrorMessage))
{
<div class="alert alert-danger mt-3">@Model.ErrorMessage</div>
}
</form>
</div>
@section Scripts {
<script>
async function discoverPrinters() {
const button = document.querySelector('button[onclick="discoverPrinters()"]');
const spinner = document.getElementById('discover-spinner');
const status = document.getElementById('discovery-status');
const printerList = document.getElementById('printer-list');
const printerCount = document.getElementById('printer-count');
button.disabled = true;
spinner.classList.remove('d-none');
status.classList.remove('d-none');
printerList.innerHTML = '';
printerCount.textContent = '0';
try {
const response = await fetch('/Configure?handler=Discover', {
method: 'POST',
headers: {
'RequestVerificationToken': document.querySelector('input[name="__RequestVerificationToken"]').value
}
});
const printers = await response.json();
printerCount.textContent = printers.length;
if (printers.length === 0) {
printerList.innerHTML = '<li class="list-group-item">No printers found</li>';
} else {
// Update all select dropdowns with discovered printers
document.querySelectorAll('.printer-select').forEach(select => {
const currentValue = select.value;
// Keep "None" option
select.innerHTML = '<option value="">None</option>';
printers.forEach(printer => {
const option = document.createElement('option');
option.value = printer.ipAddress;
option.textContent = `${printer.ipAddress} ${printer.modelName ? '(' + printer.modelName + ')' : ''}`;
if (printer.ipAddress === currentValue) {
option.selected = true;
}
select.appendChild(option);
});
});
// Show discovered printers list
printers.forEach(printer => {
const li = document.createElement('li');
li.className = 'list-group-item';
li.textContent = `${printer.ipAddress}`;
printerList.appendChild(li);
});
}
} catch (error) {
printerList.innerHTML = `<li class="list-group-item text-danger">Error: ${error.message}</li>`;
} finally {
button.disabled = false;
spinner.classList.add('d-none');
status.classList.add('d-none');
}
}
function updateLogoPreview(index) {
const select = document.getElementById(`logo-select-${index}`);
const preview = document.getElementById(`logo-preview-${index}`);
const img = document.getElementById(`logo-img-${index}`);
const link = document.getElementById(`logo-link-${index}`);
if (select.value) {
const logoUrl = `/logos/${select.value}`;
img.src = logoUrl;
link.href = logoUrl;
preview.style.display = 'block';
} else {
preview.style.display = 'none';
}
}
// Initialize previews on page load
document.addEventListener('DOMContentLoaded', function() {
const selects = document.querySelectorAll('.logo-select');
selects.forEach((select, index) => {
if (select.value) {
updateLogoPreview(index);
}
});
});
</script>
}

View File

@@ -1,225 +0,0 @@
using ConfigurationPannel.Services;
using Inspectron.Epson;
using Inspectron.Epson.PrintServer.ConfigurationSources;
using Inspectron.Epson.PrintServer.PrintServices;
using Inspectron.Epson.PrintServer.WorkAreaSources;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Reflection;
using ConfigurationManager = ConfigurationPannel.Services.ConfigurationManager;
namespace ConfigurationPannel.Pages;
[Authorize]
public class ConfigureModel : PageModel
{
private readonly ConfigurationManager _configManager;
private readonly PrintServerHostedService _printServerService;
private readonly LogoService _logoService;
private readonly IWebHostEnvironment _env;
private readonly DiscoveryService _discoveryService;
private readonly ILogger<ConfigureModel> _logger;
public ConfigureModel(
ConfigurationManager configManager,
PrintServerHostedService printServerService,
LogoService logoService,
IWebHostEnvironment env,
ILogger<ConfigureModel> logger)
{
_configManager = configManager;
_printServerService = printServerService;
_logoService = logoService;
_env = env;
_discoveryService = new DiscoveryService();
_logger = logger;
}
public List<WorkArea> WorkAreas { get; set; } = new();
public List<DiscoveredPrinter> DiscoveredPrinters { get; set; } = new();
public Dictionary<string, PrinterConfiguration> CurrentAssignments { get; set; } = new();
public List<string> AvailableLogos { get; set; } = new();
[BindProperty]
public List<WorkAreaAssignment> WorkAreaAssignments { get; set; } = new();
[BindProperty]
public IFormFile? UploadedLogo { get; set; }
public string SuccessMessage { get; set; } = string.Empty;
public string ErrorMessage { get; set; } = string.Empty;
public async Task<IActionResult> OnGetAsync()
{
try
{
// Load current configuration
var config = await _configManager.LoadConfigurationAsync();
// Get work areas from API
var workAreaSource = new JamesWorkAreaSource(config);
WorkAreas = await workAreaSource.GetWorkAreasAsync();
// Map current assignments
CurrentAssignments = config.PrinterConfigurations
.GroupBy(kv => kv.Value.AreaId)
.ToDictionary(g => g.Key, g => g.First().Value);
// Initial discovery (quick timeout for page load)
DiscoveredPrinters = await _discoveryService.DiscoverPrintersAsync(TimeSpan.FromSeconds(3));
// Load available logos
AvailableLogos = _logoService.GetAllLogos();
}
catch (Exception ex)
{
_logger.LogError(ex, "Error loading configuration page");
ErrorMessage = "Error loading configuration: " + ex.Message;
}
return Page();
}
public async Task<IActionResult> OnPostDiscoverAsync()
{
try
{
var printers = await _discoveryService.DiscoverPrintersAsync(TimeSpan.FromSeconds(5));
return new JsonResult(printers.Select(p => new
{
ipAddress = p.IPAddress,
modelName = p.ModelName,
macAddress = p.MACAddress
}));
}
catch (Exception ex)
{
_logger.LogError(ex, "Error discovering printers");
return new JsonResult(new { error = ex.Message }) { StatusCode = 500 };
}
}
public async Task<IActionResult> OnPostUploadLogoAsync()
{
try
{
if (UploadedLogo != null)
{
var filename = await _logoService.SaveLogoAsync(UploadedLogo);
SuccessMessage = $"Logo uploaded successfully: {filename}";
}
else
{
ErrorMessage = "No file selected";
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Error uploading logo");
ErrorMessage = "Error uploading logo: " + ex.Message;
}
return await OnGetAsync();
}
public async Task<IActionResult> OnPostCleanLogosAsync()
{
try
{
var config = await _configManager.LoadConfigurationAsync();
var usedLogos = config.PrinterConfigurations.Values
.Select(p => p.LogoFilename)
.Where(f => !string.IsNullOrEmpty(f))
.ToList();
var cleanedLogos = _logoService.CleanUnusedLogos(usedLogos!);
if (cleanedLogos.Any())
{
SuccessMessage = $"Cleaned {cleanedLogos.Count} unused logo(s): {string.Join(", ", cleanedLogos)}";
}
else
{
SuccessMessage = "No unused logos found";
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Error cleaning logos");
ErrorMessage = "Error cleaning logos: " + ex.Message;
}
return await OnGetAsync();
}
public async Task<IActionResult> OnPostSaveAsync()
{
try
{
// Load current config
var config = await _configManager.LoadConfigurationAsync();
// Clear existing printer configurations
var newPrinterConfigurations = new Dictionary<string, PrinterConfiguration>();
// Build new configurations from assignments
foreach (var assignment in WorkAreaAssignments)
{
if (!string.IsNullOrEmpty(assignment.PrinterAddress))
{
var printerKey = assignment.PrinterAddress;
if (!newPrinterConfigurations.ContainsKey(printerKey))
{
newPrinterConfigurations[printerKey] = new PrinterConfiguration
{
Address = assignment.PrinterAddress,
AreaId = assignment.WorkAreaId,
FontSize = assignment.FontSize,
LogoFilename = assignment.LogoFilename
};
// Copy logo to printer service directory
if (!string.IsNullOrEmpty(assignment.LogoFilename))
{
var printerServicePath = Path.Combine("logos");
_logoService.CopyLogoToDirectory(assignment.LogoFilename, printerServicePath);
}
}
}
}
// Update configuration
config.PrinterConfigurations = newPrinterConfigurations;
// Save configuration
await _configManager.SaveConfigurationAsync(config);
// Restart PrintLoop with new configuration
await _printServerService.RestartAsync();
SuccessMessage = "Configuration saved and print server restarted successfully!";
_logger.LogInformation("Configuration saved successfully");
// Reload page data
return await OnGetAsync();
}
catch (Exception ex)
{
_logger.LogError(ex, "Error saving configuration");
ErrorMessage = "Error saving configuration: " + ex.Message;
return await OnGetAsync();
}
}
}
public class WorkAreaAssignment
{
public string WorkAreaId { get; set; } = string.Empty;
public string WorkAreaName { get; set; } = string.Empty;
public string PrinterAddress { get; set; } = string.Empty;
public int FontSize { get; set; } = 1;
public string? LogoFilename { get; set; }
}

View File

@@ -1,26 +0,0 @@
@page
@model ErrorModel
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>

View File

@@ -1,28 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;
namespace ConfigurationPannel.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}

View File

@@ -1,10 +0,0 @@
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>

View File

@@ -1,24 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace ConfigurationPannel.Pages
{
public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
public IndexModel(ILogger<IndexModel> logger)
{
_logger = logger;
}
public IActionResult OnGet()
{
if (User.Identity?.IsAuthenticated == true)
{
return RedirectToPage("/Configure");
}
return RedirectToPage("/Login");
}
}
}

View File

@@ -1,33 +0,0 @@
@page
@model ConfigurationPannel.Pages.LoginModel
@{
ViewData["Title"] = "Login";
Layout = "_Layout";
}
<div class="container">
<div class="row justify-content-center mt-5">
<div class="col-md-4">
<div class="card">
<div class="card-body">
<h3 class="card-title text-center mb-4">Printer Configuration</h3>
<form method="post">
<div class="mb-3">
<label asp-for="Username" class="form-label">Username</label>
<input asp-for="Username" class="form-control" placeholder="Enter username" required />
</div>
<div class="mb-3">
<label asp-for="Password" class="form-label">Password</label>
<input asp-for="Password" type="password" class="form-control" placeholder="Enter password" required />
</div>
@if (!string.IsNullOrEmpty(Model.ErrorMessage))
{
<div class="alert alert-danger">@Model.ErrorMessage</div>
}
<button type="submit" class="btn btn-primary w-100">Login</button>
</form>
</div>
</div>
</div>
</div>
</div>

View File

@@ -1,53 +0,0 @@
using System.Security.Claims;
using ConfigurationPannel.Services;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace ConfigurationPannel.Pages;
public class LoginModel : PageModel
{
private readonly UserService _userService;
public LoginModel(UserService userService)
{
_userService = userService;
}
[BindProperty]
public string Username { get; set; } = string.Empty;
[BindProperty]
public string Password { get; set; } = string.Empty;
public string ErrorMessage { get; set; } = string.Empty;
public void OnGet()
{
}
public async Task<IActionResult> OnPostAsync()
{
if (await _userService.ValidateCredentialsAsync(Username, Password))
{
var claims = new List<Claim>
{
new Claim(ClaimTypes.Name, Username)
};
var identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
var principal = new ClaimsPrincipal(identity);
await HttpContext.SignInAsync(
CookieAuthenticationDefaults.AuthenticationScheme,
principal);
return RedirectToPage("/Configure");
}
ErrorMessage = "Invalid username or password";
return Page();
}
}

View File

@@ -1,2 +0,0 @@
@page
@model ConfigurationPannel.Pages.LogoutModel

View File

@@ -1,15 +0,0 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace ConfigurationPannel.Pages;
public class LogoutModel : PageModel
{
public async Task<IActionResult> OnGetAsync()
{
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
return RedirectToPage("/Login");
}
}

View File

@@ -1,8 +0,0 @@
@page
@model PrivacyModel
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>

View File

@@ -1,20 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace ConfigurationPannel.Pages
{
public class PrivacyModel : PageModel
{
private readonly ILogger<PrivacyModel> _logger;
public PrivacyModel(ILogger<PrivacyModel> logger)
{
_logger = logger;
}
public void OnGet()
{
}
}
}

View File

@@ -1,62 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - ConfigurationPannel</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/ConfigurationPannel.styles.css" asp-append-version="true" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" asp-area="" asp-page="/Index">ConfigurationPannel</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
@if (User.Identity?.IsAuthenticated == true)
{
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Configure">Configuration</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/TestPrint">Test Print</a>
</li>
}
</ul>
<ul class="navbar-nav">
@if (User.Identity?.IsAuthenticated == true)
{
<li class="nav-item">
<span class="navbar-text me-3">Welcome, @User.Identity.Name</span>
</li>
}
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2025 - ConfigurationPannel - <a asp-area="" asp-page="/Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>

View File

@@ -1,48 +0,0 @@
/* Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
for details on configuring this project to bundle and minify static web assets. */
a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
}
a {
color: #0077cc;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.border-top {
border-top: 1px solid #e5e5e5;
}
.border-bottom {
border-bottom: 1px solid #e5e5e5;
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
button.accept-policy {
font-size: 1rem;
line-height: inherit;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px;
}

View File

@@ -1,2 +0,0 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

View File

@@ -1,62 +0,0 @@
@page
@model ConfigurationPannel.Pages.TestPrintModel
@{
ViewData["Title"] = "Test Print";
}
<div class="container mt-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2>Test Print</h2>
<a asp-page="/Logout" class="btn btn-outline-secondary">Logout</a>
</div>
<form method="post">
<div class="card">
<div class="card-header">
<h4>Submit Test Print Job</h4>
</div>
<div class="card-body">
@if (Model.WorkAreas == null || !Model.WorkAreas.Any())
{
<div class="alert alert-warning">
No work areas found. Please check configuration.
</div>
}
else
{
<div class="mb-3">
<label asp-for="SelectedWorkAreaId" class="form-label">Work Area</label>
<select asp-for="SelectedWorkAreaId" class="form-select" required>
<option value="">Select a work area...</option>
@foreach (var workArea in Model.WorkAreas)
{
<option value="@workArea.Id">@workArea.Name</option>
}
</select>
</div>
<div class="mb-3">
<label asp-for="PrintContent" class="form-label">Content to Print</label>
<textarea asp-for="PrintContent"
class="form-control"
rows="6"
placeholder="Enter text to print..."
required></textarea>
<small class="text-muted">Text will be printed on the assigned printer for the selected work area</small>
</div>
<button type="submit" class="btn btn-primary">Submit Print Job</button>
}
</div>
</div>
@if (!string.IsNullOrEmpty(Model.SuccessMessage))
{
<div class="alert alert-success mt-3">@Model.SuccessMessage</div>
}
@if (!string.IsNullOrEmpty(Model.ErrorMessage))
{
<div class="alert alert-danger mt-3">@Model.ErrorMessage</div>
}
</form>
</div>

View File

@@ -1,92 +0,0 @@
using ConfigurationPannel.Services;
using Inspectron.Epson.PrintServer.WorkAreaSources;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using ConfigurationManager = ConfigurationPannel.Services.ConfigurationManager;
namespace ConfigurationPannel.Pages;
[Authorize]
public class TestPrintModel : PageModel
{
private readonly ConfigurationManager _configManager;
private readonly PrintServerHostedService _printServerService;
private readonly ILogger<TestPrintModel> _logger;
public TestPrintModel(
ConfigurationManager configManager,
PrintServerHostedService printServerService,
ILogger<TestPrintModel> logger)
{
_configManager = configManager;
_printServerService = printServerService;
_logger = logger;
}
public List<WorkArea> WorkAreas { get; set; } = new();
[BindProperty]
public string SelectedWorkAreaId { get; set; } = string.Empty;
[BindProperty]
public string PrintContent { get; set; } = string.Empty;
public string SuccessMessage { get; set; } = string.Empty;
public string ErrorMessage { get; set; } = string.Empty;
public async Task<IActionResult> OnGetAsync()
{
try
{
var config = await _configManager.LoadConfigurationAsync();
var workAreaSource = new JamesWorkAreaSource(config);
WorkAreas = await workAreaSource.GetWorkAreasAsync();
}
catch (Exception ex)
{
_logger.LogError(ex, "Error loading test print page");
ErrorMessage = "Error loading work areas: " + ex.Message;
}
return Page();
}
public async Task<IActionResult> OnPostAsync()
{
try
{
if (string.IsNullOrWhiteSpace(SelectedWorkAreaId))
{
ErrorMessage = "Please select a work area";
return await OnGetAsync();
}
if (string.IsNullOrWhiteSpace(PrintContent))
{
ErrorMessage = "Please enter content to print";
return await OnGetAsync();
}
var (success, message) = await _printServerService.SubmitPrintJobAsync(
SelectedWorkAreaId,
PrintContent);
if (success)
{
SuccessMessage = message;
PrintContent = string.Empty;
}
else
{
ErrorMessage = message;
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Error submitting test print job");
ErrorMessage = "Error submitting print job: " + ex.Message;
}
return await OnGetAsync();
}
}

View File

@@ -1,3 +0,0 @@
@using ConfigurationPannel
@namespace ConfigurationPannel.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@@ -1,3 +0,0 @@
@{
Layout = "_Layout";
}

View File

@@ -1,55 +0,0 @@
using ConfigurationPannel.Services;
using Microsoft.AspNetCore.Authentication.Cookies;
using ConfigurationManager = ConfigurationPannel.Services.ConfigurationManager;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
// Authentication
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(options =>
{
options.LoginPath = "/Login";
options.LogoutPath = "/Logout";
options.ExpireTimeSpan = TimeSpan.FromHours(8);
options.SlidingExpiration = true;
});
builder.Services.AddAuthorization();
// Application services
builder.Services.AddSingleton<UserService>();
builder.Services.AddSingleton<ConfigurationManager>();
builder.Services.AddSingleton<LogoService>();
// PrintServer as hosted service
builder.Services.AddHostedService<PrintServerHostedService>();
// Make PrintServerHostedService available for injection (for restart capability)
builder.Services.AddSingleton(sp =>
sp.GetServices<IHostedService>()
.OfType<PrintServerHostedService>()
.FirstOrDefault()!);
var app = builder.Build();
// set port
app.Urls.Add($"http://*:80");
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseRouting();
// Authentication & Authorization
app.UseAuthentication();
app.UseAuthorization();
app.MapRazorPages();
app.Run();

View File

@@ -1,29 +0,0 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:43656",
"sslPort": 0
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:80",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -1,61 +0,0 @@
using System.Text.Json;
using Inspectron.Epson.PrintServer.ConfigurationSources;
using Inspectron.Epson.PrintServer.PrintServices;
namespace ConfigurationPannel.Services;
public class ConfigurationManager
{
private readonly string _configPath;
private readonly SemaphoreSlim _configLock = new SemaphoreSlim(1, 1);
private EpsonPrintServiceConfiguration? _currentConfig;
public ConfigurationManager(IWebHostEnvironment env)
{
_configPath = Path.Combine(env.ContentRootPath, "config.json");
}
public async Task<EpsonPrintServiceConfiguration> LoadConfigurationAsync()
{
await _configLock.WaitAsync();
try
{
if (File.Exists(_configPath))
{
var json = await File.ReadAllTextAsync(_configPath);
_currentConfig = JsonSerializer.Deserialize<EpsonPrintServiceConfiguration>(json);
}
else
{
_currentConfig = new EpsonPrintServiceConfiguration
{
GroupId = "default-group",
RestaurantId = "default-restaurant",
PrinterConfigurations = new Dictionary<string, PrinterConfiguration>()
};
}
return _currentConfig!;
}
finally
{
_configLock.Release();
}
}
public async Task SaveConfigurationAsync(EpsonPrintServiceConfiguration config)
{
await _configLock.WaitAsync();
try
{
var json = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
await File.WriteAllTextAsync(_configPath, json);
_currentConfig = config;
}
finally
{
_configLock.Release();
}
}
public EpsonPrintServiceConfiguration? GetCurrentConfiguration() => _currentConfig;
}

View File

@@ -1,119 +0,0 @@
namespace ConfigurationPannel.Services;
public class LogoService
{
private readonly IWebHostEnvironment _env;
private readonly string _logosPath;
private readonly ILogger<LogoService> _logger;
public LogoService(IWebHostEnvironment env, ILogger<LogoService> logger)
{
_env = env;
_logger = logger;
_logosPath = Path.Combine(_env.WebRootPath, "logos");
// Ensure logos directory exists
if (!Directory.Exists(_logosPath))
{
Directory.CreateDirectory(_logosPath);
}
}
public async Task<string> SaveLogoAsync(IFormFile file)
{
if (file == null || file.Length == 0)
throw new ArgumentException("No file provided");
// Validate file type
var allowedExtensions = new[] { ".png", ".jpg", ".jpeg", ".gif", ".bmp" };
var extension = Path.GetExtension(file.FileName).ToLowerInvariant();
if (!allowedExtensions.Contains(extension))
throw new ArgumentException($"Invalid file type. Allowed: {string.Join(", ", allowedExtensions)}");
// Generate unique filename to avoid collisions
var fileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}_{Guid.NewGuid().ToString("N").Substring(0, 8)}{extension}";
var filePath = Path.Combine(_logosPath, fileName);
using (var stream = new FileStream(filePath, FileMode.Create))
{
await file.CopyToAsync(stream);
}
_logger.LogInformation("Logo uploaded: {FileName}", fileName);
return fileName;
}
public List<string> GetAllLogos()
{
if (!Directory.Exists(_logosPath))
return new List<string>();
return Directory.GetFiles(_logosPath)
.Select(Path.GetFileName)
.Where(f => f != null)
.Select(f => f!)
.OrderBy(f => f)
.ToList();
}
public string GetLogoUrl(string? filename)
{
if (string.IsNullOrEmpty(filename))
return string.Empty;
return $"/logos/{filename}";
}
public bool LogoExists(string filename)
{
return File.Exists(Path.Combine(_logosPath, filename));
}
public void DeleteLogo(string filename)
{
var filePath = Path.Combine(_logosPath, filename);
if (File.Exists(filePath))
{
File.Delete(filePath);
_logger.LogInformation("Logo deleted: {FileName}", filename);
}
}
public List<string> CleanUnusedLogos(IEnumerable<string> usedLogoFilenames)
{
var allLogos = GetAllLogos();
var usedSet = new HashSet<string>(usedLogoFilenames.Where(f => !string.IsNullOrEmpty(f))!);
var unusedLogos = allLogos.Where(logo => !usedSet.Contains(logo)).ToList();
foreach (var logo in unusedLogos)
{
DeleteLogo(logo);
}
_logger.LogInformation("Cleaned {Count} unused logos", unusedLogos.Count);
return unusedLogos;
}
public void CopyLogoToDirectory(string filename, string targetDirectory)
{
if (string.IsNullOrEmpty(filename))
return;
var sourcePath = Path.Combine(_logosPath, filename);
if (!File.Exists(sourcePath))
{
_logger.LogWarning("Logo file not found for copy: {FileName}", filename);
return;
}
if (!Directory.Exists(targetDirectory))
{
Directory.CreateDirectory(targetDirectory);
}
var targetPath = Path.Combine(targetDirectory, filename);
File.Copy(sourcePath, targetPath, overwrite: true);
_logger.LogInformation("Logo copied to: {TargetPath}", targetPath);
}
}

View File

@@ -1,16 +0,0 @@
using System.Threading.Channels;
using Inspectron.Epson.PrintServer;
namespace ConfigurationPannel.Services;
public class NoOpPrintJobSource : IPrintJobSource
{
private readonly Channel<PrintJob> _channel = Channel.CreateUnbounded<PrintJob>();
public Task<PrintJob> GetNextJobAsync(CancellationToken cancellationToken)
{
// Blocks indefinitely, keeping PrintLoop alive without processing jobs
// This stub implementation keeps the loop running but never provides actual jobs
return _channel.Reader.ReadAsync(cancellationToken).AsTask();
}
}

View File

@@ -1,131 +0,0 @@
using Ninject;
using Inspectron.Epson.PrintServer;
using Inspectron.Epson.PrintServer.ConfigurationSources;
using Inspectron.Epson.PrintServer.JobSources;
using Inspectron.Epson.PrintServer.Printers;
using Inspectron.Epson.PrintServer.PrintServices;
using Microsoft.Extensions.Logging;
namespace ConfigurationPannel.Services;
public class PrintServerHostedService : IHostedService
{
private readonly ILogger<PrintServerHostedService> _logger;
private readonly ConfigurationManager _configManager;
private PrintServer? _printServer;
private PrintLoop? _printLoop;
private StandardKernel? _kernel;
public PrintServerHostedService(
ILogger<PrintServerHostedService> logger,
ConfigurationManager configManager)
{
_logger = logger;
_configManager = configManager;
}
public async Task StartAsync(CancellationToken cancellationToken)
{
_logger.LogInformation("Starting PrintServer background service");
await InitializePrintServerAsync();
}
private async Task InitializePrintServerAsync()
{
// Load configuration
var config = await _configManager.LoadConfigurationAsync();
// Setup Ninject kernel (matching EpsonPrintService pattern)
_kernel = new StandardKernel();
_kernel.Bind<EpsonPrintServiceConfiguration>().ToConstant(config);
_kernel.Bind<IPrintJobSource>().To<SignalRPrintJobSource>().InSingletonScope();
_kernel.Bind<IPrintService>().To<Inspectron.Epson.PrintServer.PrintServices.EpsonPrintService>();
_kernel.Bind<Microsoft.Extensions.Logging.ILogger>().ToConstant(_logger);
_kernel.Bind<IAssignedPrinterRepository>().ToConstant(config);
_kernel.Bind<IWrapperPrinterFactory>().To<PrinterWrapperFactory>().InSingletonScope();
_kernel.Bind<IPrinterConfigurationSource>().ToConstant(config);
_kernel.Bind<IJobStatusReporter>().To<NullJobStatusReporter>();
_kernel.Bind<PrintServer>().ToSelf().InSingletonScope();
// Get instances
_printServer = _kernel.Get<PrintServer>();
_printLoop = _kernel.Get<PrintLoop>();
// Register printers from configuration
foreach (var printerConfig in config.PrinterConfigurations.Values)
{
_printServer.RegisterPrinter(printerConfig.Address);
}
// Start print loop
await _printLoop.StartAsync();
_logger.LogInformation("PrintServer background service started successfully");
}
public async Task RestartAsync()
{
_logger.LogInformation("Restarting PrintServer with new configuration");
// Stop current print loop
if (_printLoop != null)
{
await _printLoop.StopAsync();
}
// Shutdown print server
if (_printServer != null)
{
await _printServer.ShutdownAsync();
}
// Dispose kernel
_kernel?.Dispose();
// Reinitialize with new config
await InitializePrintServerAsync();
_logger.LogInformation("PrintServer background service restarted successfully");
}
public async Task StopAsync(CancellationToken cancellationToken)
{
_logger.LogInformation("Stopping PrintServer background service");
if (_printLoop != null)
{
await _printLoop.StopAsync();
}
if (_printServer != null)
{
await _printServer.ShutdownAsync();
}
_kernel?.Dispose();
_logger.LogInformation("PrintServer background service stopped");
}
public async Task<(bool Success, string Message)> SubmitPrintJobAsync(string workAreaId, string content)
{
if (_printServer == null)
return (false, "Print server not initialized");
var config = await _configManager.LoadConfigurationAsync();
var printerIp = config.GetAssignedPrinter(workAreaId);
if (string.IsNullOrEmpty(printerIp))
return (false, "No printer assigned to this work area");
var job = new PrintJob
{
AreaId = workAreaId,
Document = content
};
_printServer.SubmitJob(printerIp, job);
_logger.LogInformation($"Test print job submitted to {printerIp} for work area {workAreaId}");
return (true, $"Print job submitted successfully to {printerIp}");
}
}

View File

@@ -1,39 +0,0 @@
using System.Text.Json;
namespace ConfigurationPannel.Services;
public class UserService
{
private readonly string _usersFilePath;
public UserService(IWebHostEnvironment env)
{
_usersFilePath = Path.Combine(env.ContentRootPath, "users.json");
}
public async Task<bool> ValidateCredentialsAsync(string username, string password)
{
if (!File.Exists(_usersFilePath))
return false;
var json = await File.ReadAllTextAsync(_usersFilePath);
var userStore = JsonSerializer.Deserialize<UserStore>(json, new JsonSerializerOptions(){PropertyNameCaseInsensitive = true});
var user = userStore?.Users.FirstOrDefault(u => u.Username == username);
if (user == null)
return false;
return user.Password==password;
}
}
public class UserStore
{
public List<User> Users { get; set; } = new();
}
public class User
{
public string Username { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}

View File

@@ -1,9 +0,0 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@@ -1,11 +0,0 @@
*** KOPIE ***
BAR
---------------------------------
17-Dec-25 11:15 Nr.:5
Roger Deuber
TISCH: BISTRO 1
---------------------------------
1x Espresso
1x Kaffee Crème
---------------------------------

View File

@@ -1,12 +0,0 @@
{
"GroupId": "62905517684789afbce4de79",
"RestaurantId": "62905517684789afbce4de79",
"PrinterConfigurations": {
"127.0.0.1:8888": {
"LogoFilename": "ristorante-klinglers.ch-logo_white_bg_73bed37f.png",
"FontSize": 1,
"Address": "127.0.0.1:8888",
"AreaId": "62921263d8157895a0826f07"
}
}
}

View File

@@ -1,6 +0,0 @@
#!/bin/bash
chmod +x start.sh
cp -rf ConfigurationPannel.service /etc/systemd/system/ConfigurationPannel.service
systemctl daemon-reload
systemctl enable ConfigurationPannel.service
systemctl start ConfigurationPannel.service

View File

@@ -1,16 +0,0 @@
*** KOPIE ***
WARME KÜCHE
---------------------------------
18-Dec-25 09:51 Nr.:6
Roger Deuber
TISCH: BISTRO 1
---------------------------------
1. Gang
1x Apéroplatten
für 1 Person
2. Gang
1x Pinsa (mit Crudo Parma)
3. Gang
1x Schoggichueche
---------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -1,5 +0,0 @@
chmod +x start.sh
cp -rf ConfigurationPannel.service /etc/systemd/system/ConfigurationPannel.service
systemctl enable ConfigurationPannel.service
systemctl start ConfigurationPannel.service
systemctl daemon-reload

View File

@@ -1,2 +0,0 @@
systemctl stop ConfigurationPannel.service
systemctl disable ConfigurationPannel.service

View File

@@ -1,19 +0,0 @@
Gaumenfreuden
+41438104848
https://gaumen-freuden.ch
------------------------------------------
Datum: 01.07.2025 15:41:34
------------------------------------------
Der Glücklichmacher 1 * 16,50 16,50
(klein)
Gartenfreunde 1 * 16,50 16,50
S' Zähni 1 * 10,00 10,00
Apéroplatten 1 * 15,50 15,50
Summe CHF : 58,50
------------------------------------------
TOTAL MWST
58,50 0
Nicht mehrwertsteuerpflichtig
------------------------------------------
Thank you for your order!

View File

@@ -1,2 +0,0 @@
#!/bin/bash
/root/.dotnet/dotnet /home/pi/print_server/ConfigurationPannel.dll

View File

@@ -1,5 +0,0 @@
#!/bin/bash
systemctl stop ConfigurationPannel.service
systemctl disable ConfigurationPannel.service
rm -f /etc/systemd/system/ConfigurationPannel.service
systemctl daemon-reload

View File

@@ -1,8 +0,0 @@
{
"users": [
{
"username": "admin",
"password": "admin"
}
]
}

View File

@@ -1,22 +0,0 @@
html {
font-size: 14px;
}
@media (min-width: 768px) {
html {
font-size: 16px;
}
}
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -1,4 +0,0 @@
// Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
// for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code.

View File

@@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2011-2021 Twitter, Inc.
Copyright (c) 2011-2021 The Bootstrap Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,427 +0,0 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-left: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr /* rtl:ignore */;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: left;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: left;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: left;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
/* rtl:raw:
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +0,0 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */

File diff suppressed because one or more lines are too long

View File

@@ -1,424 +0,0 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-right: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-right: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr ;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: right;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: right;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: right;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.rtl.css.map */

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +0,0 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-right:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:right;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:right}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[type=email],[type=number],[type=tel],[type=url]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.rtl.min.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) .NET Foundation and Contributors
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,435 +0,0 @@
/**
* @license
* Unobtrusive validation support library for jQuery and jQuery Validate
* Copyright (c) .NET Foundation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
* @version v4.0.0
*/
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
/*global document: false, jQuery: false */
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define("jquery.validate.unobtrusive", ['jquery-validation'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports
module.exports = factory(require('jquery-validation'));
} else {
// Browser global
jQuery.validator.unobtrusive = factory(jQuery);
}
}(function ($) {
var $jQval = $.validator,
adapters,
data_validation = "unobtrusiveValidation";
function setValidationValues(options, ruleName, value) {
options.rules[ruleName] = value;
if (options.message) {
options.messages[ruleName] = options.message;
}
}
function splitAndTrim(value) {
return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g);
}
function escapeAttributeValue(value) {
// As mentioned on http://api.jquery.com/category/selectors/
return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1");
}
function getModelPrefix(fieldName) {
return fieldName.substr(0, fieldName.lastIndexOf(".") + 1);
}
function appendModelPrefix(value, prefix) {
if (value.indexOf("*.") === 0) {
value = value.replace("*.", prefix);
}
return value;
}
function onError(error, inputElement) { // 'this' is the form element
var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
replaceAttrValue = container.attr("data-valmsg-replace"),
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
container.removeClass("field-validation-valid").addClass("field-validation-error");
error.data("unobtrusiveContainer", container);
if (replace) {
container.empty();
error.removeClass("input-validation-error").appendTo(container);
}
else {
error.hide();
}
}
function onErrors(event, validator) { // 'this' is the form element
var container = $(this).find("[data-valmsg-summary=true]"),
list = container.find("ul");
if (list && list.length && validator.errorList.length) {
list.empty();
container.addClass("validation-summary-errors").removeClass("validation-summary-valid");
$.each(validator.errorList, function () {
$("<li />").html(this.message).appendTo(list);
});
}
}
function onSuccess(error) { // 'this' is the form element
var container = error.data("unobtrusiveContainer");
if (container) {
var replaceAttrValue = container.attr("data-valmsg-replace"),
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
container.addClass("field-validation-valid").removeClass("field-validation-error");
error.removeData("unobtrusiveContainer");
if (replace) {
container.empty();
}
}
}
function onReset(event) { // 'this' is the form element
var $form = $(this),
key = '__jquery_unobtrusive_validation_form_reset';
if ($form.data(key)) {
return;
}
// Set a flag that indicates we're currently resetting the form.
$form.data(key, true);
try {
$form.data("validator").resetForm();
} finally {
$form.removeData(key);
}
$form.find(".validation-summary-errors")
.addClass("validation-summary-valid")
.removeClass("validation-summary-errors");
$form.find(".field-validation-error")
.addClass("field-validation-valid")
.removeClass("field-validation-error")
.removeData("unobtrusiveContainer")
.find(">*") // If we were using valmsg-replace, get the underlying error
.removeData("unobtrusiveContainer");
}
function validationInfo(form) {
var $form = $(form),
result = $form.data(data_validation),
onResetProxy = $.proxy(onReset, form),
defaultOptions = $jQval.unobtrusive.options || {},
execInContext = function (name, args) {
var func = defaultOptions[name];
func && $.isFunction(func) && func.apply(form, args);
};
if (!result) {
result = {
options: { // options structure passed to jQuery Validate's validate() method
errorClass: defaultOptions.errorClass || "input-validation-error",
errorElement: defaultOptions.errorElement || "span",
errorPlacement: function () {
onError.apply(form, arguments);
execInContext("errorPlacement", arguments);
},
invalidHandler: function () {
onErrors.apply(form, arguments);
execInContext("invalidHandler", arguments);
},
messages: {},
rules: {},
success: function () {
onSuccess.apply(form, arguments);
execInContext("success", arguments);
}
},
attachValidation: function () {
$form
.off("reset." + data_validation, onResetProxy)
.on("reset." + data_validation, onResetProxy)
.validate(this.options);
},
validate: function () { // a validation function that is called by unobtrusive Ajax
$form.validate();
return $form.valid();
}
};
$form.data(data_validation, result);
}
return result;
}
$jQval.unobtrusive = {
adapters: [],
parseElement: function (element, skipAttach) {
/// <summary>
/// Parses a single HTML element for unobtrusive validation attributes.
/// </summary>
/// <param name="element" domElement="true">The HTML element to be parsed.</param>
/// <param name="skipAttach" type="Boolean">[Optional] true to skip attaching the
/// validation to the form. If parsing just this single element, you should specify true.
/// If parsing several elements, you should specify false, and manually attach the validation
/// to the form when you are finished. The default is false.</param>
var $element = $(element),
form = $element.parents("form")[0],
valInfo, rules, messages;
if (!form) { // Cannot do client-side validation without a form
return;
}
valInfo = validationInfo(form);
valInfo.options.rules[element.name] = rules = {};
valInfo.options.messages[element.name] = messages = {};
$.each(this.adapters, function () {
var prefix = "data-val-" + this.name,
message = $element.attr(prefix),
paramValues = {};
if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy)
prefix += "-";
$.each(this.params, function () {
paramValues[this] = $element.attr(prefix + this);
});
this.adapt({
element: element,
form: form,
message: message,
params: paramValues,
rules: rules,
messages: messages
});
}
});
$.extend(rules, { "__dummy__": true });
if (!skipAttach) {
valInfo.attachValidation();
}
},
parse: function (selector) {
/// <summary>
/// Parses all the HTML elements in the specified selector. It looks for input elements decorated
/// with the [data-val=true] attribute value and enables validation according to the data-val-*
/// attribute values.
/// </summary>
/// <param name="selector" type="String">Any valid jQuery selector.</param>
// $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one
// element with data-val=true
var $selector = $(selector),
$forms = $selector.parents()
.addBack()
.filter("form")
.add($selector.find("form"))
.has("[data-val=true]");
$selector.find("[data-val=true]").each(function () {
$jQval.unobtrusive.parseElement(this, true);
});
$forms.each(function () {
var info = validationInfo(this);
if (info) {
info.attachValidation();
}
});
}
};
adapters = $jQval.unobtrusive.adapters;
adapters.add = function (adapterName, params, fn) {
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.</summary>
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
/// <param name="params" type="Array" optional="true">[Optional] An array of parameter names (strings) that will
/// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and
/// mmmm is the parameter name).</param>
/// <param name="fn" type="Function">The function to call, which adapts the values from the HTML
/// attributes into jQuery Validate rules and/or messages.</param>
/// <returns type="jQuery.validator.unobtrusive.adapters" />
if (!fn) { // Called with no params, just a function
fn = params;
params = [];
}
this.push({ name: adapterName, params: params, adapt: fn });
return this;
};
adapters.addBool = function (adapterName, ruleName) {
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
/// the jQuery Validate validation rule has no parameter values.</summary>
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
/// of adapterName will be used instead.</param>
/// <returns type="jQuery.validator.unobtrusive.adapters" />
return this.add(adapterName, function (options) {
setValidationValues(options, ruleName || adapterName, true);
});
};
adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) {
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
/// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and
/// one for min-and-max). The HTML parameters are expected to be named -min and -max.</summary>
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
/// <param name="minRuleName" type="String">The name of the jQuery Validate rule to be used when you only
/// have a minimum value.</param>
/// <param name="maxRuleName" type="String">The name of the jQuery Validate rule to be used when you only
/// have a maximum value.</param>
/// <param name="minMaxRuleName" type="String">The name of the jQuery Validate rule to be used when you
/// have both a minimum and maximum value.</param>
/// <param name="minAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
/// contains the minimum value. The default is "min".</param>
/// <param name="maxAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
/// contains the maximum value. The default is "max".</param>
/// <returns type="jQuery.validator.unobtrusive.adapters" />
return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) {
var min = options.params.min,
max = options.params.max;
if (min && max) {
setValidationValues(options, minMaxRuleName, [min, max]);
}
else if (min) {
setValidationValues(options, minRuleName, min);
}
else if (max) {
setValidationValues(options, maxRuleName, max);
}
});
};
adapters.addSingleVal = function (adapterName, attribute, ruleName) {
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
/// the jQuery Validate validation rule has a single value.</summary>
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
/// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).</param>
/// <param name="attribute" type="String">[Optional] The name of the HTML attribute that contains the value.
/// The default is "val".</param>
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
/// of adapterName will be used instead.</param>
/// <returns type="jQuery.validator.unobtrusive.adapters" />
return this.add(adapterName, [attribute || "val"], function (options) {
setValidationValues(options, ruleName || adapterName, options.params[attribute]);
});
};
$jQval.addMethod("__dummy__", function (value, element, params) {
return true;
});
$jQval.addMethod("regex", function (value, element, params) {
var match;
if (this.optional(element)) {
return true;
}
match = new RegExp(params).exec(value);
return (match && (match.index === 0) && (match[0].length === value.length));
});
$jQval.addMethod("nonalphamin", function (value, element, nonalphamin) {
var match;
if (nonalphamin) {
match = value.match(/\W/g);
match = match && match.length >= nonalphamin;
}
return match;
});
if ($jQval.methods.extension) {
adapters.addSingleVal("accept", "mimtype");
adapters.addSingleVal("extension", "extension");
} else {
// for backward compatibility, when the 'extension' validation method does not exist, such as with versions
// of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for
// validating the extension, and ignore mime-type validations as they are not supported.
adapters.addSingleVal("extension", "extension", "accept");
}
adapters.addSingleVal("regex", "pattern");
adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");
adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range");
adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength");
adapters.add("equalto", ["other"], function (options) {
var prefix = getModelPrefix(options.element.name),
other = options.params.other,
fullOtherName = appendModelPrefix(other, prefix),
element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
setValidationValues(options, "equalTo", element);
});
adapters.add("required", function (options) {
// jQuery Validate equates "required" with "mandatory" for checkbox elements
if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") {
setValidationValues(options, "required", true);
}
});
adapters.add("remote", ["url", "type", "additionalfields"], function (options) {
var value = {
url: options.params.url,
type: options.params.type || "GET",
data: {}
},
prefix = getModelPrefix(options.element.name);
$.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
var paramName = appendModelPrefix(fieldName, prefix);
value.data[paramName] = function () {
var field = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']");
// For checkboxes and radio buttons, only pick up values from checked fields.
if (field.is(":checkbox")) {
return field.filter(":checked").val() || field.filter(":hidden").val() || '';
}
else if (field.is(":radio")) {
return field.filter(":checked").val() || '';
}
return field.val();
};
});
setValidationValues(options, "remote", value);
});
adapters.add("password", ["min", "nonalphamin", "regex"], function (options) {
if (options.params.min) {
setValidationValues(options, "minlength", options.params.min);
}
if (options.params.nonalphamin) {
setValidationValues(options, "nonalphamin", options.params.nonalphamin);
}
if (options.params.regex) {
setValidationValues(options, "regex", options.params.regex);
}
});
adapters.add("fileextensions", ["extensions"], function (options) {
setValidationValues(options, "extension", options.params.extensions);
});
$(function () {
$jQval.unobtrusive.parse(document);
});
return $jQval.unobtrusive;
}));

File diff suppressed because one or more lines are too long

View File

@@ -1,22 +0,0 @@
The MIT License (MIT)
=====================
Copyright Jörn Zaefferer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,21 +0,0 @@
Copyright OpenJS Foundation and other contributors, https://openjsf.org/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Some files were not shown because too many files have changed in this diff Show More