add date time picker

This commit is contained in:
Kukks 2019-01-04 12:58:29 +01:00
parent 7768f41849
commit 5341da28d9
7 changed files with 44 additions and 11 deletions

View File

@ -124,8 +124,8 @@
<ItemGroup>
<Folder Include="Build\" />
<Folder Include="Views\AppsPublic\Crowdfund\Templates" />
<Folder Include="wwwroot\vendor\clipboard.js\" />
<Folder Include="wwwroot\vendor\datetimepicker" />
<Folder Include="wwwroot\vendor\highlightjs\" />
</ItemGroup>

View File

@ -39,6 +39,7 @@ namespace BTCPayServer.Controllers
public bool UseInvoiceAmount { get; set; }
public int ResetEveryAmount { get; set; }
public CrowdfundResetEvery ResetEvery { get; set; }
public bool UseAllStoreInvoices { get; set; }
}
@ -73,6 +74,7 @@ namespace BTCPayServer.Controllers
UseInvoiceAmount = settings.UseInvoiceAmount,
ResetEveryAmount = settings.ResetEveryAmount,
ResetEvery = Enum.GetName(typeof(CrowdfundResetEvery), settings.ResetEvery),
UseAllStoreInvoices = settings.UseAllStoreInvoices
};
return View(vm);
}
@ -122,7 +124,8 @@ namespace BTCPayServer.Controllers
AnimationsEnabled = vm.AnimationsEnabled,
ResetEveryAmount = vm.ResetEveryAmount,
ResetEvery = Enum.Parse<CrowdfundResetEvery>(vm.ResetEvery),
UseInvoiceAmount = vm.UseInvoiceAmount
UseInvoiceAmount = vm.UseInvoiceAmount,
UseAllStoreInvoices = vm.UseAllStoreInvoices
});
await UpdateAppSettings(app);
_EventAggregator.Publish(new CrowdfundAppUpdated()

View File

@ -212,7 +212,7 @@ namespace BTCPayServer.Hubs
var invoices = await GetInvoicesForApp(appData, lastResetDate);
var invoices = await GetInvoicesForApp(settings.UseAllStoreInvoices? null : appData.Id, lastResetDate);
var completeInvoices = invoices.Where(entity => entity.Status == InvoiceStatus.Complete).ToArray();
var pendingInvoices = invoices.Where(entity => entity.Status != InvoiceStatus.Complete).ToArray();
@ -268,11 +268,11 @@ namespace BTCPayServer.Hubs
};
}
private async Task<InvoiceEntity[]> GetInvoicesForApp(AppData appData, DateTime? startDate = null)
private async Task<InvoiceEntity[]> GetInvoicesForApp(string appId, DateTime? startDate = null)
{
return await _InvoiceRepository.GetInvoices(new InvoiceQuery()
{
OrderId = $"{CrowdfundInvoiceOrderIdPrefix}{appData.Id}",
OrderId = appId == null? null :$"{CrowdfundInvoiceOrderIdPrefix}{appId}",
Status = new string[]{
InvoiceState.ToString(InvoiceStatus.New),
InvoiceState.ToString(InvoiceStatus.Paid),

View File

@ -12,12 +12,14 @@ namespace BTCPayServer.Models.AppViewModels
[MaxLength(50)] public string Tagline { get; set; }
[Required] public string Description { get; set; }
[Display(Name = "Featured Image")]
public string MainImageUrl { get; set; }
public string NotificationUrl { get; set; }
[Required]
[Display(Name = "Enabled, Allow crowdfund to be publicly visible( still visible to you)")]
[Display(Name = "Allow crowdfund to be publicly visible( still visible to you)")]
public bool Enabled { get; set; } = false;
[Required]
@ -39,7 +41,7 @@ namespace BTCPayServer.Models.AppViewModels
[Required]
[MaxLength(5)]
[Display(Name = "The primary currency used for targets and stats")]
[Display(Name = "The primary currency used for targets and stats. (e.g. BTC, LTC, USD, etc.)")]
public string TargetCurrency { get; set; } = "BTC";
[Display(Name = "Set a Target amount ")]
@ -63,10 +65,13 @@ namespace BTCPayServer.Models.AppViewModels
[Display(Name = "Custom bootstrap CSS file")]
public string CustomCSSLink { get; set; }
[Display(Name = "Custom CSS Code")]
public string EmbeddedCSS { get; set; }
[Display(Name = "Base the contributed goal amount on the invoice amount and not actual payments")]
public bool UseInvoiceAmount { get; set; } = true;
public bool UseInvoiceAmount { get; set; } = true;
[Display(Name = "Count all invoices created on the store as part of the crowdfunding goal")]
public bool UseAllStoreInvoices { get; set; } = false;
}
public enum CrowdfundResetEvery

View File

@ -71,7 +71,7 @@
</div>
<div class="form-group">
<label asp-for="StartDate" class="control-label"></label>*
<input asp-for="StartDate" class="form-control" />
<input asp-for="StartDate" class="form-control datetime " />
<span asp-validation-for="StartDate" class="text-danger"></span>
</div>
<div class="form-group">
@ -90,13 +90,13 @@
<div class="form-group">
<label asp-for="EndDate" class="control-label"></label>*
<input asp-for="EndDate" class="form-control" />
<input asp-for="EndDate" class="form-control datetime" />
<span asp-validation-for="EndDate" class="text-danger"></span>
</div>
<div class="form-group">
<label class="control-label">Contribution Perks</label>
<div class="mb-3">
<a class="js-product-add btn btn-secondary" href="#" data-toggle="modal" data-target="#product-modal"><i class="fa fa-plus fa-fw"></i> Add Product</a>
<a class="js-product-add btn btn-secondary" href="#" data-toggle="modal" data-target="#product-modal"><i class="fa fa-plus fa-fw"></i> Add Perk</a>
</div>
<div class="js-products bg-light row p-3">
</div>
@ -140,6 +140,11 @@
<input asp-for="UseInvoiceAmount" type="checkbox" class="form-check"/>
<span asp-validation-for="UseInvoiceAmount" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="UseAllStoreInvoices"></label>
<input asp-for="UseAllStoreInvoices" type="checkbox" class="form-check"/>
<span asp-validation-for="UseAllStoreInvoices" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="SoundsEnabled"></label>
<input asp-for="SoundsEnabled" type="checkbox" class="form-check"/>
@ -175,10 +180,15 @@
<script src="~/vendor/highlightjs/highlight.min.js"></script>
<script src="~/vendor/richtext/jquery.richtext.min.js"></script>
<link rel="stylesheet" href="~/vendor/richtext/richtext.min.css">
<script src="~/vendor/flatpickr/flatpickr.js"></script>
<link rel="stylesheet" href="~/vendor/flatpickr/flatpickr.min.css">
<script>
hljs.initHighlightingOnLoad();
$(document).ready(function() {
$(".richtext").richText();
$(".datetime").flatpickr({
enableTime: true
});
});
</script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long