Skip to content

Instantly share code, notes, and snippets.

@osnipezzini
Created November 7, 2021 20:00
Show Gist options
  • Save osnipezzini/b07a342c3c76eb8c1bf40bf62eecc861 to your computer and use it in GitHub Desktop.
Save osnipezzini/b07a342c3c76eb8c1bf40bf62eecc861 to your computer and use it in GitHub Desktop.
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@using SOTicket.Common
@using SOTicket.Common.Models
@model Produto
@{
Layout = "~/Views/Shared/_Layout.cshtml";
var htmlClass = "btn btn-lg ";
var ignoredStatus = new StatusEnvio[] { StatusEnvio.Enviado };
var htmlAtt = "";
if (ignoredStatus.Contains(Model.StatusEnvio))
{
htmlClass += "btn-secondary ";
htmlAtt += " disabled ";
}
else
htmlClass += "btn-primary ";
}
<div class="container mt-3">
@using (Html.BeginForm(FormMethod.Post))
{
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-floating">
@Html.EditorFor(model => model.StatusEnvio, new { htmlAttributes = new { @class = "form-control", @readonly = true } })
@Html.ValidationMessageFor(model => model.StatusEnvio, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.StatusEnvio)
</div>
<div class="form-floating">
@Html.EditorFor(model => model.Id, new { htmlAttributes = new { @class = "form-control", @readonly = true } })
@Html.ValidationMessageFor(model => model.Id, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Id)
</div>
<div class="form-floating">
@Html.EditorFor(model => model.ProdutoId, new { htmlAttributes = new { @class = "form-control", @readonly = true } })
@Html.ValidationMessageFor(model => model.ProdutoId, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.ProdutoId)
</div>
<div class="form-floating">
@Html.EditorFor(model => model.EmpresaId, new { htmlAttributes = new { @class = "form-control", @readonly = true } })
@Html.ValidationMessageFor(model => model.EmpresaId, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.EmpresaId)
</div>
<div class="form-floating">
@Html.EditorFor(model => model.Hora, new { htmlAttributes = new { @class = "form-control", @readonly = true } })
@Html.ValidationMessageFor(model => model.Hora, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Hora)
</div>
<div class="form-floating">
@Html.EditorFor(model => model.Valor, new { htmlAttributes = new { @class = "form-control", @readonly = true } })
@Html.ValidationMessageFor(model => model.Valor, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Valor)
</div>
<div class="form-floating">
@Html.EditorFor(model => model.ErrorCode, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.ErrorCode, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.ErrorCode)
</div>
<div class="form-floating">
@Html.EditorFor(model => model.ErrorMessage, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.ErrorMessage, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.ErrorMessage)
</div>
<button class="@htmlClass" @htmlAtt type="submit">Reprocessar</button>
}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment