You've already forked onecmonitor
mirror of
https://github.com/akpaevj/onecmonitor.git
synced 2026-06-17 22:34:48 +02:00
39 lines
1.4 KiB
Plaintext
39 lines
1.4 KiB
Plaintext
@page "/techlog/templates/{id:guid}"
|
|
@page "/techlog/templates/create"
|
|
@using OneSwiss.Server.Attributes
|
|
@using OneSwiss.Server.Components.Shared
|
|
@using OneSwiss.Server.Models
|
|
@inject IJSRuntime JS
|
|
|
|
@attribute [ExtAuthorize(Roles.WriteTechLogSeances)]
|
|
|
|
<EditDatabaseForm @ref="_editor" T="LogTemplate" Id="Id"
|
|
NameSelector="template => template.Name"
|
|
Route="techlog/templates"
|
|
Title="Новый шаблон сбора технологического журнала"
|
|
BeforeValidation="BeforeValidation">
|
|
<MudStack>
|
|
<MudTextField Class="mb-3" Label="Наименование" @bind-Value="@_editor.Model!.Name"
|
|
Required="true" RequiredError="Не заполнено наименование"/>
|
|
<div id="container" class="w-100" style="height: 500px"></div>
|
|
</MudStack>
|
|
</EditDatabaseForm>
|
|
|
|
@code
|
|
{
|
|
private EditDatabaseForm<LogTemplate> _editor = null!;
|
|
|
|
[Parameter] public Guid Id { get; set; }
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
if (firstRender)
|
|
await JS.InvokeVoidAsync("OM.initTechLogTemplateEditor", _editor.Model!.Content);
|
|
}
|
|
|
|
private async Task BeforeValidation(LogTemplate obj)
|
|
{
|
|
obj.Content = await JS.InvokeAsync<string>("OM.getTechLogTemplateEditorContent");
|
|
}
|
|
}
|