2019-02-24 09:26:37 +01:00
@using BTCPayServer.Services.PaymentRequests
2019-05-07 08:01:37 +00:00
@using System.Globalization
2023-12-01 09:12:02 +01:00
@using BTCPayServer.Client
2023-02-20 11:35:54 +01:00
@using BTCPayServer.Forms
2022-11-25 02:42:55 +01:00
@using BTCPayServer.TagHelpers
@using Microsoft.AspNetCore.Mvc.TagHelpers
2023-02-20 11:35:54 +01:00
@inject FormDataService FormDataService
2019-01-14 22:43:29 +01:00
@model BTCPayServer.Models.PaymentRequestViewModels.UpdatePaymentRequestViewModel
2019-11-15 14:43:36 +01:00
@{
2023-02-20 11:35:54 +01:00
var checkoutFormOptions = await FormDataService.GetSelect(Model.StoreId, Model.FormId);
2022-11-25 02:42:55 +01:00
2024-10-25 15:48:53 +02:00
ViewData.SetActivePage(PaymentRequestsNavPages.Create, string.IsNullOrEmpty(Model.Id) ? StringLocalizer["Create Payment Request"] : StringLocalizer["Edit Payment Request"], Model.Id);
2019-11-15 14:43:36 +01:00
}
2021-05-19 04:39:27 +02:00
@section PageHeadContent {
2022-03-11 08:41:48 +01:00
<link href="~/vendor/summernote/summernote-bs5.css" rel="stylesheet" asp-append-version="true" />
2021-05-19 04:39:27 +02:00
}
@section PageFootContent {
<partial name="_ValidationScriptsPartial" />
2022-03-11 08:41:48 +01:00
<script src="~/vendor/summernote/summernote-bs5.js" asp-append-version="true"></script>
2021-05-19 04:39:27 +02:00
}
2022-01-24 18:07:52 -08:00
2022-01-07 12:32:00 +09:00
<form method="post" action="@Url.Action("EditPaymentRequest", "UIPaymentRequest", new { storeId = Model.StoreId, payReqId = Model.Id }, Context.Request.Scheme)">
2024-06-19 15:23:10 +02:00
<div class="sticky-header">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
2024-10-17 15:51:40 +02:00
<a asp-action="GetPaymentRequests" asp-route-storeId="@Model.StoreId" text-translate="true">Requests</a>
2024-06-19 15:23:10 +02:00
</li>
<li class="breadcrumb-item active" aria-current="page">@ViewData["Title"]</li>
</ol>
2024-07-25 22:46:02 +09:00
<h2 text-translate="true">@ViewData["Title"]</h2>
2024-06-19 15:23:10 +02:00
</nav>
<div>
2022-02-21 03:05:42 +01:00
@if (string.IsNullOrEmpty(Model.Id))
{
2024-10-17 15:51:40 +02:00
<button id="page-primary" type="submit" class="btn btn-primary" permission="@Policies.CanModifyPaymentRequests" text-translate="true">Create</button>
2022-02-21 03:05:42 +01:00
}
else
{
2024-10-17 15:51:40 +02:00
<button id="page-primary" type="submit" class="btn btn-primary order-sm-1" permission="@Policies.CanModifyPaymentRequests" text-translate="true">Save</button>
<a class="btn btn-secondary" asp-action="ViewPaymentRequest" asp-route-payReqId="@Model.Id" id="ViewPaymentRequest" target="_blank" text-translate="true">View</a>
2022-02-21 03:05:42 +01:00
}
</div>
</div>
2024-06-19 15:23:10 +02:00
2022-02-21 03:05:42 +01:00
<partial name="_StatusMessage" />
2022-11-25 02:42:55 +01:00
2021-12-11 04:32:23 +01:00
<div class="row">
2022-01-27 03:56:46 +01:00
<div class="col-xl-8 col-xxl-constrain">
2024-06-19 15:23:10 +02:00
@if (!ViewContext.ModelState.IsValid)
{
<div asp-validation-summary="ModelOnly"></div>
}
2021-12-11 04:32:23 +01:00
<div class="form-group">
<label asp-for="Title" class="form-label" data-required></label>
<input asp-for="Title" class="form-control" required />
<span asp-validation-for="Title" class="text-danger"></span>
</div>
2022-01-11 05:16:16 -08:00
<div class="d-flex justify-content-between">
<div class="form-group flex-fill me-4">
<label asp-for="Amount" class="form-label" data-required></label>
2022-12-13 21:01:48 -08:00
<input type="number" inputmode="decimal" step="any" asp-for="Amount" class="form-control" required disabled="@(!Model.AmountAndCurrencyEditable)" />
2022-01-11 05:16:16 -08:00
<span asp-validation-for="Amount" class="text-danger"></span>
2022-12-13 21:01:48 -08:00
@if (!Model.AmountAndCurrencyEditable)
{
2023-12-13 10:53:37 +01:00
<p class="info-note text-warning mb-0 mt-2">
<vc:icon symbol="warning"/>
2024-10-17 15:51:40 +02:00
<span text-translate="true">Amount and currency are not editable once payment request has invoices</span>
2023-12-13 10:53:37 +01:00
</p>
2022-12-13 21:01:48 -08:00
}
2022-01-11 05:16:16 -08:00
</div>
<div class="form-group">
<label asp-for="Currency" class="form-label"></label>
2022-12-13 21:01:48 -08:00
<input asp-for="Currency" class="form-control w-auto" currency-selection disabled="@(!Model.AmountAndCurrencyEditable)" />
2022-01-11 05:16:16 -08:00
<span asp-validation-for="Currency" class="text-danger"></span>
</div>
2021-12-11 04:32:23 +01:00
</div>
2024-03-14 15:16:48 +01:00
<div class="form-group d-flex">
<input asp-for="AllowCustomPaymentAmounts" type="checkbox" class="btcpay-toggle me-3" />
2021-12-11 04:32:23 +01:00
<label asp-for="AllowCustomPaymentAmounts" class="form-check-label"></label>
<span asp-validation-for="AllowCustomPaymentAmounts" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="ExpiryDate" class="form-label"></label>
<div class="input-group ">
<input asp-for="ExpiryDate"
value="@(Model.ExpiryDate?.ToString("u", CultureInfo.InvariantCulture))"
2024-10-25 15:48:53 +02:00
class="form-control flatdtpicker" min="today" placeholder="@StringLocalizer["No expiry date has been set for this payment request"]" />
<button id="ClearExpiryDate" class="btn btn-secondary input-group-clear" type="button" title="@StringLocalizer["Clear"]">
2024-05-20 01:57:46 +02:00
<vc:icon symbol="close" />
2021-12-11 04:32:23 +01:00
</button>
2021-06-30 00:56:28 -07:00
</div>
2021-12-11 04:32:23 +01:00
<span asp-validation-for="ExpiryDate" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Email" class="form-label"></label>
2024-10-25 15:48:53 +02:00
<input type="email" asp-for="Email" placeholder="@StringLocalizer["Firstname Lastname <email@example.com>"]" class="form-control" />
2021-12-11 04:32:23 +01:00
<span asp-validation-for="Email" class="text-danger"></span>
2023-12-01 10:50:05 +01:00
<div id="PaymentRequestEmailHelpBlock" class="form-text">
2024-10-25 15:48:53 +02:00
@ViewLocalizer["This will send notification mails to the recipient, as configured by the {0}.", Html.ActionLink(StringLocalizer["email rules"], "StoreEmails", "UIStores", new { storeId = Model.StoreId })]
2023-12-01 10:50:05 +01:00
@if (Model.HasEmailRules is not true)
{
2023-12-13 10:53:37 +01:00
<div class="info-note mt-1 text-warning" role="alert">
<vc:icon symbol="warning"/>
2024-10-17 15:51:40 +02:00
<span text-translate="true">No payment request related email rules have been configured for this store.</span>
2023-12-13 10:53:37 +01:00
</div>
2023-12-01 10:50:05 +01:00
}
</div>
2021-12-11 04:32:23 +01:00
</div>
2022-11-25 02:42:55 +01:00
<div class="form-group">
<label asp-for="FormId" class="form-label"></label>
<select asp-for="FormId" class="form-select w-auto" asp-items="@checkoutFormOptions"></select>
<span asp-validation-for="FormId" class="text-danger"></span>
</div>
@if (Model.FormResponse is not null)
{
<div class="bg-tile rounded py-2 px-3 mb-5">
<partial name="PosData" model="(Model.FormResponse, 1)"/>
</div>
}
2021-12-11 04:32:23 +01:00
</div>
2022-01-27 23:56:00 -08:00
</div>
<div class="row">
2022-01-27 03:56:46 +01:00
<div class="col-xl-10 col-xxl-constrain">
2021-12-11 04:32:23 +01:00
<div class="form-group">
<label asp-for="Description" class="form-label"></label>
<textarea asp-for="Description" class="form-control richtext"></textarea>
<span asp-validation-for="Description" class="text-danger"></span>
</div>
2022-01-27 03:56:46 +01:00
</div>
2022-01-27 23:56:00 -08:00
</div>
2021-12-11 04:32:23 +01:00
</form>
2022-02-21 03:05:42 +01:00
2022-06-19 19:52:12 -07:00
@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="d-flex gap-3 mt-3">
2022-11-25 02:42:55 +01:00
<a class="btn btn-secondary"
2023-12-01 09:12:02 +01:00
permission="@Policies.CanViewInvoices"
2022-11-25 02:42:55 +01:00
asp-action="ListInvoices"
asp-controller="UIInvoice"
asp-route-storeId="@Model.StoreId"
2024-10-17 15:51:40 +02:00
asp-route-searchterm="@($"orderid:{PaymentRequestRepository.GetOrderIdForPaymentRequest(Model.Id)}")" text-translate="true">Invoices</a>
<a class="btn btn-secondary" asp-route-payReqId="@Model.Id" asp-action="ClonePaymentRequest" id="ClonePaymentRequest" permission="@Policies.CanModifyPaymentRequests" text-translate="true">Clone</a>
2022-11-25 02:42:55 +01:00
@if (!Model.Archived)
{
2024-10-25 15:48:53 +02:00
<a class="btn btn-secondary" data-bs-toggle="tooltip" title="@StringLocalizer["Archive this payment request so that it does not appear in the payment request list by default"]" asp-controller="UIPaymentRequest" asp-action="TogglePaymentRequestArchival" asp-route-payReqId="@Model.Id" id="ArchivePaymentRequest" permission="@Policies.CanModifyPaymentRequests" text-translate="true">Archive</a>
2022-11-25 02:42:55 +01:00
}
else
{
2024-10-25 15:48:53 +02:00
<a class="btn btn-secondary" data-bs-toggle="tooltip" title="@StringLocalizer["Unarchive this payment request"]" asp-controller="UIPaymentRequest" asp-action="TogglePaymentRequestArchival" asp-route-payReqId="@Model.Id" id="UnarchivePaymentRequest" permission="@Policies.CanModifyPaymentRequests" text-translate="true">Unarchive</a>
2022-11-25 02:42:55 +01:00
}
</div>
2022-06-19 19:52:12 -07:00
}