From 76feb2c4863245048954437f58eab536116da338 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Mon, 10 Dec 2018 14:53:52 +0100 Subject: [PATCH] First Skippable Item Test --- Site/App_GlobalResources/Global.designer.cs | 27 +++++++++++++++++++ Site/App_GlobalResources/Global.resx | 12 +++++++++ .../Pages.Ledgers.designer.cs | 9 +++++++ Site/App_GlobalResources/Pages.Ledgers.resx | 3 +++ Site/Pages/v5/Ledgers/EndOfMonth.aspx | 17 +++++++++--- Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs | 24 ++++++++++++++--- 6 files changed, 86 insertions(+), 6 deletions(-) diff --git a/Site/App_GlobalResources/Global.designer.cs b/Site/App_GlobalResources/Global.designer.cs index a6526f08..52bf4e72 100644 --- a/Site/App_GlobalResources/Global.designer.cs +++ b/Site/App_GlobalResources/Global.designer.cs @@ -1545,6 +1545,33 @@ namespace Resources { } } + /// + /// Looks up a localized string similar to Don't Skip. + /// + internal static string Global_SkipNo { + get { + return ResourceManager.GetString("Global_SkipNo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to skip this. + /// + internal static string Global_SkipThis { + get { + return ResourceManager.GetString("Global_SkipThis", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Skip. + /// + internal static string Global_SkipYes { + get { + return ResourceManager.GetString("Global_SkipYes", resourceCulture); + } + } + /// /// Looks up a localized string similar to Submit. /// diff --git a/Site/App_GlobalResources/Global.resx b/Site/App_GlobalResources/Global.resx index e6acc786..bb9c0fa0 100644 --- a/Site/App_GlobalResources/Global.resx +++ b/Site/App_GlobalResources/Global.resx @@ -992,4 +992,16 @@ {0} to {1} For example, "January to March". The initial "from" is implied. + + Don't Skip + The "no" option on the "Skip? Yes/no" dialog + + + skip this + Used to skip a list item. If "this" needs a known gender, feel free to just translate "skip". + + + Skip + The "yes" option on the "Skip? Yes/no" dialog + \ No newline at end of file diff --git a/Site/App_GlobalResources/Pages.Ledgers.designer.cs b/Site/App_GlobalResources/Pages.Ledgers.designer.cs index aa51da24..e48a5512 100644 --- a/Site/App_GlobalResources/Pages.Ledgers.designer.cs +++ b/Site/App_GlobalResources/Pages.Ledgers.designer.cs @@ -1149,6 +1149,15 @@ namespace Resources.Pages { } } + /// + /// Looks up a localized string similar to <strong>SKIP BANK STATEMENT?</strong><br/><br/>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.<br/><br/>You won't be asked again to upload this particular statement if you skip it now.. + /// + internal static string EndOfMonth_SkipBankStatementDialog { + get { + return ResourceManager.GetString("EndOfMonth_SkipBankStatementDialog", resourceCulture); + } + } + /// /// Looks up a localized string similar to End-of-Month Routine: {0:MMMM yyyy}. /// diff --git a/Site/App_GlobalResources/Pages.Ledgers.resx b/Site/App_GlobalResources/Pages.Ledgers.resx index 954ee8e2..0343b66f 100644 --- a/Site/App_GlobalResources/Pages.Ledgers.resx +++ b/Site/App_GlobalResources/Pages.Ledgers.resx @@ -1025,4 +1025,7 @@ Upload Transaction Data ({1}) for {0} Parameter zero is the account name, parameter one is the format (e.g. XML or CSV) + + <strong>SKIP BANK STATEMENT?</strong><br/><br/>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.<br/><br/>You won't be asked again to upload this particular statement if you skip it now. + \ No newline at end of file diff --git a/Site/Pages/v5/Ledgers/EndOfMonth.aspx b/Site/Pages/v5/Ledgers/EndOfMonth.aspx index 65d1000d..b0d10922 100644 --- a/Site/Pages/v5/Ledgers/EndOfMonth.aspx +++ b/Site/Pages/v5/Ledgers/EndOfMonth.aspx @@ -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; } diff --git a/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs b/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs index fc58f8cd..142e4979 100644 --- a/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs +++ b/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs @@ -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 += " (" + + Server.HtmlEncode(Resources.Global.Global_SkipThis) + ")"; + } + builder.Append(@" $('#TableEomItems').datagrid('appendRow', { - itemName: """ + item.Name + @""", - action: """" + itemName: """ + itemName + @""", + action: """" }); "); } @@ -184,7 +201,7 @@ namespace Swarmops.Frontend.Pages.Ledgers { builder.Append(@" $('#TableEomItems').datagrid('appendRow', { - itemName: """ + item.Name + @""", + itemName: """ + item.Name + @""", action: """" }); "); @@ -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