/
UpdateCrowdfund.cshtml
369 lines (354 loc) · 22.3 KB
/
UpdateCrowdfund.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
@using System.Globalization
@using BTCPayServer.Abstractions.Extensions
@using BTCPayServer.Abstractions.Models
@using BTCPayServer.TagHelpers
@using BTCPayServer.Views.Apps
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model BTCPayServer.Plugins.Crowdfund.Models.UpdateCrowdfundViewModel
@{
ViewData.SetActivePage(AppsNavPages.Update, "Update Crowdfund", Model.AppId);
}
@section PageHeadContent {
<link href="~/vendor/summernote/summernote-bs5.css" rel="stylesheet" asp-append-version="true" />
<link href="~/main/template-editor.css" rel="stylesheet" asp-append-version="true" />
<style>
.flatpickr-wrapper { flex-grow: 1; }
</style>
}
@section PageFootContent {
<partial name="_ValidationScriptsPartial" />
<script src="~/vendor/vuejs/vue.min.js" asp-append-version="true"></script>
<script src="~/vendor/summernote/summernote-bs5.js" asp-append-version="true"></script>
}
<form method="post">
<div class="sticky-header-setup"></div>
<div class="sticky-header d-sm-flex align-items-center justify-content-between">
<h2 class="mb-0">@ViewData["Title"]</h2>
<div class="d-flex gap-3 mt-3 mt-sm-0">
<button type="submit" class="btn btn-primary order-sm-1" id="SaveSettings">Save</button>
@if (Model.ModelWithMinimumData)
{
<a class="btn btn-secondary" asp-action="ViewCrowdfund" asp-route-appId="@Model.AppId" id="ViewApp" target="_blank">View</a>
}
</div>
</div>
<partial name="_StatusMessage" />
<input type="hidden" asp-for="StoreId" />
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="row">
<div class="col-xl-8 col-xxl-constrain">
<div class="form-group">
<label asp-for="AppName" class="form-label" data-required></label>
<input asp-for="AppName" class="form-control" required />
<span asp-validation-for="AppName" class="text-danger"></span>
</div>
<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>
<div class="form-group">
<label asp-for="Tagline" class="form-label"></label>
<input asp-for="Tagline" class="form-control" />
<span asp-validation-for="Tagline" class="text-danger"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-10 col-xxl-constrain">
<div class="form-group">
<label asp-for="Description" class="form-label" data-required></label>
<textarea asp-for="Description" rows="20" cols="40" class="form-control richtext"></textarea>
<span asp-validation-for="Description" class="text-danger"></span>
</div>
<div class="form-group">
<div class="d-flex align-items-center">
<input asp-for="Enabled" type="checkbox" class="btcpay-toggle me-3"/>
<div>
<label asp-for="Enabled" class="form-label mb-0"></label>
<span asp-validation-for="Enabled" class="text-danger"></span>
<div class="text-muted" hidden="@Model.Enabled">The crowdfund is only visible to you. To make it visible to anyone else, enable this.</div>
<div class="text-muted" hidden="@(!Model.Enabled)">The crowdfund is visible to anyone. To make it only visible to you, disable this.</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-10 col-xxl-constrain">
<h3 class="mt-5 mb-4">Goal</h3>
<div class="d-flex flex-wrap gap-3 mb-3">
<div class="form-group w-250px mb-0">
<label asp-for="TargetAmount" class="form-label"></label>
<input inputmode="decimal" asp-for="TargetAmount" class="form-control" />
<span asp-validation-for="TargetAmount" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="TargetCurrency" class="form-label"></label>
<input asp-for="TargetCurrency" class="form-control w-auto" currency-selection />
<div class="form-text">Uses the store's default currency (@Model.StoreDefaultCurrency) if empty.</div>
<span asp-validation-for="TargetCurrency" class="text-danger"></span>
</div>
</div>
<div class="d-flex flex-wrap gap-3 align-items-center mb-4">
<div class="form-group mb-0 w-250px">
<label asp-for="StartDate" class="form-label"></label>
<div class="input-group flex-nowrap">
<input type="datetime-local" asp-for="StartDate"
value="@(Model.StartDate?.ToString("u", CultureInfo.InvariantCulture))"
class="form-control flatdtpicker"
placeholder="No start date has been set" />
<button class="btn btn-secondary input-group-clear px-3" type="button" title="Clear">
<vc:icon symbol="close"/>
</button>
</div>
</div>
<div class="form-group mb-0 w-250px">
<label asp-for="EndDate" class="form-label"></label>
<div class="input-group flex-nowrap">
<input type="datetime-local" asp-for="EndDate"
value="@(Model.EndDate?.ToString("u", CultureInfo.InvariantCulture))"
class="form-control flatdtpicker"
placeholder="No end date has been set" />
<button class="btn btn-secondary input-group-clear px-3" type="button" title="Clear">
<vc:icon symbol="close"/>
</button>
</div>
</div>
<span asp-validation-for="StartDate" class="text-danger"></span>
<span asp-validation-for="EndDate" class="text-danger"></span>
</div>
<div class="form-group mt-4" id="ResetRow" hidden="@(Model.StartDate == null)">
<div class="d-flex align-items-center mb-3">
<input asp-for="IsRecurring" type="checkbox" class="btcpay-toggle me-3" data-bs-toggle="collapse" data-bs-target="#ResetEverySettings" aria-expanded="@(Model.IsRecurring)" aria-controls="ResetEverySettings" />
<div>
<label asp-for="IsRecurring" class="form-label mb-0">Recurring Goal</label>
<span asp-validation-for="IsRecurring" class="text-danger"></span>
<div class="text-muted">Reset goal after a specific period of time, based on your crowdfund's start date.</div>
</div>
</div>
<div class="collapse @(Model.IsRecurring ? "show" : "")" id="ResetEverySettings">
<div class="form-group mb-0 pt-2 w-250px">
<label asp-for="ResetEveryAmount" class="form-label"></label>
<div class="d-flex align-items-center">
<input type="number" inputmode="numeric" asp-for="ResetEveryAmount" placeholder="Amount" class="form-control me-3" min="0">
<select class="form-select w-auto" asp-for="ResetEvery">
@foreach (var opt in Model.ResetEveryValues)
{
<option value="@opt">@opt</option>
}
</select>
</div>
<span asp-validation-for="ResetEveryAmount" class="text-danger"></span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-10 col-xxl-constrain">
<partial name="TemplateEditor" model="@(nameof(Model.PerksTemplate), "Perks", Model.TargetCurrency ?? Model.StoreDefaultCurrency)" />
</div>
</div>
<div class="row collapse" id="RawEditor">
<div class="col-xl-10 col-xxl-constrain">
<div class="form-group pt-3">
<label asp-for="PerksTemplate" class="form-label"></label>
<textarea asp-for="PerksTemplate" rows="10" cols="40" class="form-control"></textarea>
<span asp-validation-for="PerksTemplate" class="text-danger"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-8 col-xxl-constrain">
<h3 class="mt-5 mb-4">Contributions</h3>
<div class="form-check mb-3">
<input asp-for="SortPerksByPopularity" type="checkbox" class="form-check-input" />
<label asp-for="SortPerksByPopularity" class="form-check-label"></label>
<span asp-validation-for="SortPerksByPopularity" class="text-danger"></span>
</div>
<div class="form-check mb-3">
<input asp-for="DisplayPerksRanking" type="checkbox" class="form-check-input" />
<label asp-for="DisplayPerksRanking" class="form-check-label"></label>
<span asp-validation-for="DisplayPerksRanking" class="text-danger"></span>
</div>
<div class="form-check mb-3">
<input asp-for="DisplayPerksValue" type="checkbox" class="form-check-input" />
<label asp-for="DisplayPerksValue" class="form-check-label"></label>
<span asp-validation-for="DisplayPerksValue" class="text-danger"></span>
</div>
<div class="form-check mb-3">
<input asp-for="EnforceTargetAmount" type="checkbox" class="form-check-input" />
<label asp-for="EnforceTargetAmount" class="form-check-label"></label>
<span asp-validation-for="EnforceTargetAmount" class="text-danger"></span>
</div>
<h3 class="mt-5 mb-4">Crowdfund Behavior</h3>
<div class="form-check">
<input asp-for="UseAllStoreInvoices" type="checkbox" class="form-check-input" />
<label asp-for="UseAllStoreInvoices" class="form-check-label"></label>
<span asp-validation-for="UseAllStoreInvoices" class="text-danger"></span>
</div>
<h3 class="mt-5 mb-2">Additional Options</h3>
<div class="form-group">
<div class="accordion" id="additional">
<div class="accordion-item">
<h2 class="accordion-header" id="additional-sound-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#additional-sound" aria-expanded="false" aria-controls="additional-sound">
Sound
<vc:icon symbol="caret-down" />
</button>
</h2>
<div id="additional-sound" class="accordion-collapse collapse" aria-labelledby="additional-sound-header">
<div class="accordion-body">
<div class="form-group mb-0">
<div class="d-flex align-items-center">
<input asp-for="SoundsEnabled" type="checkbox" class="btcpay-toggle me-3" data-bs-toggle="collapse" data-bs-target="#SoundsEnabledSettings" aria-expanded="@Model.SoundsEnabled" aria-controls="SoundsEnabledSettings"/>
<label asp-for="SoundsEnabled" class="form-label mb-0"></label>
<span asp-validation-for="SoundsEnabled" class="text-danger"></span>
</div>
</div>
<div class="collapse @(Model.SoundsEnabled ? "show" : "")" id="SoundsEnabledSettings">
<div class="form-group mb-0 pt-3">
<label asp-for="Sounds" class="form-label"></label>
<textarea asp-for="Sounds" class="form-control" rows="5"></textarea>
<span asp-validation-for="Sounds" class="text-danger"></span>
</div>
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="additional-animation-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#additional-animation" aria-expanded="false" aria-controls="additional-animation">
Animation
<vc:icon symbol="caret-down" />
</button>
</h2>
<div id="additional-animation" class="accordion-collapse collapse" aria-labelledby="additional-animation-header">
<div class="accordion-body">
<div class="form-group mb-0">
<div class="d-flex align-items-center">
<input asp-for="AnimationsEnabled" type="checkbox" class="btcpay-toggle me-3" data-bs-toggle="collapse" data-bs-target="#AnimationsEnabledSettings" aria-expanded="@Model.AnimationsEnabled" aria-controls="AnimationsEnabledSettings"/>
<label asp-for="AnimationsEnabled" class="form-label mb-0"></label>
<span asp-validation-for="AnimationsEnabled" class="text-danger"></span>
</div>
</div>
<div class="collapse @(Model.AnimationsEnabled ? "show" : "")" id="AnimationsEnabledSettings">
<div class="form-group mb-0 pt-3">
<label asp-for="AnimationColors" class="form-label"></label>
<textarea asp-for="AnimationColors" class="form-control" rows="5"></textarea>
<span asp-validation-for="AnimationColors" class="text-danger"></span>
</div>
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="additional-discussion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#additional-discussion" aria-expanded="false" aria-controls="additional-discussion">
Discussion
<vc:icon symbol="caret-down" />
</button>
</h2>
<div id="additional-discussion" class="accordion-collapse collapse" aria-labelledby="additional-discussion-header">
<div class="accordion-body">
<div class="form-group mb-0">
<div class="d-flex align-items-center">
<input asp-for="DisqusEnabled" type="checkbox" class="btcpay-toggle me-3" data-bs-toggle="collapse" data-bs-target="#DisqusEnabledSettings" aria-expanded="@Model.DisqusEnabled" aria-controls="DisqusEnabledSettings"/>
<label asp-for="DisqusEnabled" class="form-label mb-0"></label>
<span asp-validation-for="DisqusEnabled" class="text-danger"></span>
</div>
</div>
<div class="collapse @(Model.DisqusEnabled ? "show" : "")" id="DisqusEnabledSettings">
<div class="form-group mb-0 pt-3">
<label asp-for="DisqusShortname" class="form-label"></label>
<input asp-for="DisqusShortname" class="form-control" />
<span asp-validation-for="DisqusShortname" class="text-danger"></span>
</div>
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="additional-custom-css-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#additional-custom-css" aria-expanded="false" aria-controls="additional-custom-css">
Custom CSS
<vc:icon symbol="caret-down" />
</button>
</h2>
<div id="additional-custom-css" class="accordion-collapse collapse" aria-labelledby="additional-custom-css-header">
<div class="accordion-body">
<div class="form-group">
<label asp-for="MainImageUrl" class="form-label"></label>
<input asp-for="MainImageUrl" class="form-control" />
<span asp-validation-for="MainImageUrl" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="CustomCSSLink" class="form-label"></label>
<a href="https://docs.btcpayserver.org/Development/Theme/#2-bootstrap-themes" target="_blank" rel="noreferrer noopener">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<input asp-for="CustomCSSLink" class="form-control" />
<span asp-validation-for="CustomCSSLink" class="text-danger"></span>
</div>
<div class="form-group mb-4">
<label asp-for="EmbeddedCSS" class="form-label"></label>
<textarea asp-for="EmbeddedCSS" rows="10" cols="40" class="form-control"></textarea>
<span asp-validation-for="EmbeddedCSS" class="text-danger"></span>
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="additional-notification-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#additional-notification" aria-expanded="false" aria-controls="additional-notification">
Notification URL Callbacks
<vc:icon symbol="caret-down" />
</button>
</h2>
<div id="additional-notification" class="accordion-collapse collapse" aria-labelledby="additional-notification-header">
<div class="accordion-body">
<div class="form-group">
<label asp-for="NotificationUrl" class="form-label"></label>
<input asp-for="NotificationUrl" class="form-control" />
<span asp-validation-for="NotificationUrl" class="text-danger"></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<div class="d-flex gap-3 mt-3">
<a class="btn btn-secondary" asp-action="ListInvoices" asp-controller="UIInvoice" asp-route-storeId="@Model.StoreId" asp-route-searchterm="@Model.SearchTerm">Invoices</a>
<a id="DeleteApp" class="btn btn-outline-danger" asp-controller="UIApps" asp-action="DeleteApp" asp-route-appId="@Model.AppId" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-description="The app <strong>@Html.Encode(Model.AppName)</strong> and its settings will be permanently deleted." data-confirm-input="DELETE">Delete this app</a>
</div>
<partial name="_Confirm" model="@(new ConfirmModel("Delete app", "This app will be removed from this store.", "Delete"))" />
<script>
const resetRow = document.getElementById('ResetRow');
const startDateInputId = "StartDate";
document.addEventListener("DOMContentLoaded", () => {
setTimeout(() => {
flatpickrInstances.forEach((instance) => {
if (instance.element.id === startDateInputId) {
instance.config.onChange.push((selectedDates) => {
if (selectedDates.length) {
// Show the reset row if start date is selected.
// Since start date must be selected in order for the reset options to be set
// we don't need to show it by default and can show it only when start date is selected
resetRow.removeAttribute('hidden');
}
});
}
});
}, 0);
document.addEventListener('input-group-clear-input-value-cleared', ({ detail }) => {
const input = detail[0];
if (input.id === startDateInputId) {
resetRow.setAttribute('hidden', 'hidden');
}
});
});
</script>