First Skippable Item Test

This commit is contained in:
Rick Falkvinge
2018-12-10 14:53:52 +01:00
parent a06e03bbc8
commit 76feb2c486
6 changed files with 86 additions and 6 deletions
+27
View File
@@ -1545,6 +1545,33 @@ namespace Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Don&apos;t Skip.
/// </summary>
internal static string Global_SkipNo {
get {
return ResourceManager.GetString("Global_SkipNo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to skip this.
/// </summary>
internal static string Global_SkipThis {
get {
return ResourceManager.GetString("Global_SkipThis", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Skip.
/// </summary>
internal static string Global_SkipYes {
get {
return ResourceManager.GetString("Global_SkipYes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Submit.
/// </summary>
+12
View File
@@ -992,4 +992,16 @@
<value>{0} to {1}</value>
<comment>For example, "January to March". The initial "from" is implied.</comment>
</data>
<data name="Global_SkipNo" xml:space="preserve">
<value>Don't Skip</value>
<comment>The "no" option on the "Skip? Yes/no" dialog</comment>
</data>
<data name="Global_SkipThis" xml:space="preserve">
<value>skip this</value>
<comment>Used to skip a list item. If "this" needs a known gender, feel free to just translate "skip".</comment>
</data>
<data name="Global_SkipYes" xml:space="preserve">
<value>Skip</value>
<comment>The "yes" option on the "Skip? Yes/no" dialog</comment>
</data>
</root>
+9
View File
@@ -1149,6 +1149,15 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to &lt;strong&gt;SKIP BANK STATEMENT?&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Bank statements are typically needed for audit verification of the internal records. The only valid reason to skip a month&apos;s statement is that the account wasn&apos;t opened yet, in which case you skip the months before the account was opened and no statements therefore exist.&lt;br/&gt;&lt;br/&gt;You won&apos;t be asked again to upload this particular statement if you skip it now..
/// </summary>
internal static string EndOfMonth_SkipBankStatementDialog {
get {
return ResourceManager.GetString("EndOfMonth_SkipBankStatementDialog", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to End-of-Month Routine: {0:MMMM yyyy}.
/// </summary>
@@ -1025,4 +1025,7 @@
<value>Upload Transaction Data ({1}) for {0}</value>
<comment>Parameter zero is the account name, parameter one is the format (e.g. XML or CSV)</comment>
</data>
<data name="EndOfMonth_SkipBankStatementDialog" xml:space="preserve">
<value>&lt;strong&gt;SKIP BANK STATEMENT?&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Bank statements are typically needed for audit verification of the internal records. The only valid reason to skip a month's statement is that the account wasn't opened yet, in which case you skip the months before the account was opened and no statements therefore exist.&lt;br/&gt;&lt;br/&gt;You won't be asked again to upload this particular statement if you skip it now.</value>
</data>
</root>
+14 -3
View File
@@ -144,8 +144,7 @@
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').hide();
$('img.status-icon-completed[data-item="' + itemId + '"]').fadeIn();
$(this).attr('data-item');
var selector = ".action-list-item:not(.action-list-item-disabled)[data-group='" + groupId + "']";
var selector = ".action-list-item:not(.action-list-item-completed):not(.action-list-item-disabled)[data-group='" + groupId + "']";
if ($(selector).length == 0) // no further actions in this group enabled
{
// mark the group as completed
@@ -207,13 +206,25 @@
transition: all 0.50s;*/
}
.action-list-item-disabled {
.action-list-item-disabled .action-skip, .action-list-item-completed .action-skip {
-webkit-transition: all 0.50s;
transition: all 0.50s;
display: none;
}
.action-list-item-completed {
-webkit-transition: all 0.50s;
transition: all 0.50s;
color: #ccc;
text-decoration: line-through;
}
.action-list-item-disabled {
-webkit-transition: all 0.50s;
transition: all 0.50s;
color: #aaa;
}
.datagrid-row-selected, .datagrid-row-over, .datagrid-row-checked {
background:transparent !important;
}
+21 -3
View File
@@ -46,6 +46,7 @@ namespace Swarmops.Frontend.Pages.Ledgers
DateTime lastMonthEndDate = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, 1).AddDays(-1);
int lastMonth = lastMonthEndDate.Year*100 + lastMonthEndDate.Month;
bool skippable = true;
foreach (FinancialAccount assetAccount in assetAccounts)
{
@@ -61,6 +62,7 @@ namespace Swarmops.Frontend.Pages.Ledgers
{
lastStatementMonth = lastBankStatement.ConcernsPeriodStart.Year*100 +
lastBankStatement.ConcernsPeriodStart.Month;
skippable = false;
}
string lastId = string.Empty;
@@ -81,6 +83,7 @@ namespace Swarmops.Frontend.Pages.Ledgers
bankStatement.Name = string.Format(Resources.Pages.Ledgers.EndOfMonth_UploadBankStatementFor,
assetAccount.Name, "PDF", new DateTime(monthIterator / 100, monthIterator % 100, 15).ToString("MMMM yyyy"));
bankStatement.Completed = false; // TODO
bankStatement.Skippable = skippable;
group1.Items.Add(bankStatement);
}
@@ -173,10 +176,24 @@ namespace Swarmops.Frontend.Pages.Ledgers
{
if (!item.Completed)
{
string itemName = Server.HtmlEncode(item.Name);
string itemDisabledClass = string.Empty;
if (item.DependsOn.Length > 0)
{
// add as disabled
itemDisabledClass = " action-list-item-disabled";
}
if (item.Skippable)
{
itemName += " (<span class='action-item-skip'>" +
Server.HtmlEncode(Resources.Global.Global_SkipThis) + "</span>)";
}
builder.Append(@"
$('#TableEomItems').datagrid('appendRow', {
itemName: ""<span class='action-list-item' data-item='" + item.Id + @"' data-group='" + group.Id + @"'>" + item.Name + @"</span>"",
action: ""<img src='/Images/Icons/transparency-16px.png' data-item='" + item.Id + @"' data-group='" + group.Id + @"' class='action action-icon eomitem-" + item.Icon + @"' data-callback='" + item.Callback + @"' style='display:inline' /><img src='/Images/Abstract/ajaxloader-48x36px.gif' data-group='" + group.Id + @"' class='status-icon status-icon-pleasewait' data-item='" + item.Id + @"' style='display:none' /><img src='/Images/Icons/iconshock-green-tick-128x96px.png' data-group='" + group.Id + @"' class='status-icon status-icon-completed' data-item='" + item.Id + @"' style='display:none' />""
itemName: ""<span class='action-list-item" + itemDisabledClass + @"' data-item='" + item.Id + @"' data-dependson='" + item.DependsOn + @"' data-group='" + group.Id + @"'>" + itemName + @"</span>"",
action: ""<img src='/Images/Icons/transparency-16px.png' data-item='" + item.Id + @"' data-group='" + group.Id + @"' class='action action-icon eomitem-" + item.Icon + @"' data-callback='" + item.Callback + @"' data-dependson='" + item.DependsOn + @"' style='display:inline' /><img src='/Images/Abstract/ajaxloader-48x36px.gif' data-group='" + group.Id + @"' class='status-icon status-icon-pleasewait' data-item='" + item.Id + @"' style='display:none' /><img src='/Images/Icons/iconshock-green-tick-128x96px.png' data-group='" + group.Id + @"' class='status-icon status-icon-completed' data-item='" + item.Id + @"' style='display:none' />""
});
");
}
@@ -184,7 +201,7 @@ namespace Swarmops.Frontend.Pages.Ledgers
{
builder.Append(@"
$('#TableEomItems').datagrid('appendRow', {
itemName: ""<span class='action-list-item action-list-item-disabled' data-item='" + item.Id + @"' data-group='" + group.Id + @"'>" + item.Name + @"</span>"",
itemName: ""<span class='action-list-item action-list-item-completed' data-item='" + item.Id + @"' data-group='" + group.Id + @"'>" + item.Name + @"</span>"",
action: ""<img src='/Images/Icons/iconshock-green-tick-128x96px.png' data-group='" + group.Id + @"' class='status-icon status-icon-completed' data-item='" + item.Id + @"' style='display:inline' />""
});
");
@@ -224,6 +241,7 @@ namespace Swarmops.Frontend.Pages.Ledgers
public string Callback { get; set; }
public bool Completed { get; set; }
public string DependsOn { get; set; }
public bool Skippable { get; set; }
}
private class EomItemGroup