From 7276bf59671f347e28d7204ea5eb980395873f02 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Sun, 18 Jun 2017 17:22:39 +0200 Subject: [PATCH] Some work on createtx --- Site/Pages/v5/Ledgers/InspectLedgers.aspx | 31 ++++++++++++++++--- .../Ledgers/InspectLedgers.aspx.designer.cs | 8 ++--- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Site/Pages/v5/Ledgers/InspectLedgers.aspx b/Site/Pages/v5/Ledgers/InspectLedgers.aspx index 849d31a1..5933250c 100644 --- a/Site/Pages/v5/Ledgers/InspectLedgers.aspx +++ b/Site/Pages/v5/Ledgers/InspectLedgers.aspx @@ -17,7 +17,7 @@ if (canWriteRows) { <%=this.DialogCreateTx.ClientID%>_open(); <%=this.TextCreateTxDateTime.ClientID%>_focus(); - <%=this.TextAmountNewTransaction.ClientID%>_initialize('<%=(0.0).ToString("N2")%>'); + <%=this.TextCreateTxAmount.ClientID%>_initialize('<%=(0.0).ToString("N2")%>'); <%=this.TextCreateTxDateTime.ClientID%>_initialize('<%=DateTime.UtcNow.ToShortDateString() + " " + DateTime.UtcNow.ToShortTimeString()%>'); } else { alertify.error("You do not have sufficient authority to create transactions."); @@ -95,6 +95,29 @@ addTransactionRow(); }); + $('#buttonCreateTransaction').click(function() { + var jsonData = {}; + jsonData.dateTimeString = <%=this.TextCreateTxDateTime.ClientID%>_val(); + jsonData.amountString = <%=this.TextCreateTxAmount.ClientID%>_val(); + jsonData.description = <%=this.TextCreateTxDescription.ClientID%>_val(); + jsonData.budgetId = <%=this.DropBudgetsCreateTx.ClientID%>_val(); + + // Disable create button + $("#buttonCreateTransaction").css("visibility", "hidden"); + + SwarmopsJS.ajaxCall("/Pages/v5/Ledgers/InspectLedgers.aspx/CreateTransaction", + jsonData, + function(result) { + $("#buttonCreateTransaction").css("visibility", "visible"); + // Re-enable create button, hide dialog, show edit dialog + }, + function(errorResult) { + $("#buttonCreateTransaction").css("visibility", "visible"); + alertify.error("Error"); + // TODO: Show error message and re-enable create button + }); + }); + currentYear = $('#<%= DropYears.ClientID %>').val(); $('div.datagrid').css('opacity', 0.4); @@ -372,9 +395,9 @@
- - - + + +
Date and Time XYZ
diff --git a/Site/Pages/v5/Ledgers/InspectLedgers.aspx.designer.cs b/Site/Pages/v5/Ledgers/InspectLedgers.aspx.designer.cs index 713b4bf2..ae3f9094 100644 --- a/Site/Pages/v5/Ledgers/InspectLedgers.aspx.designer.cs +++ b/Site/Pages/v5/Ledgers/InspectLedgers.aspx.designer.cs @@ -337,22 +337,22 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers { protected global::Swarmops.Frontend.Controls.Base.AjaxTextBox TextCreateTxDescription; /// - /// DropBudgetsNewTransaction control. + /// DropBudgetsCreateTx control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::Swarmops.Controls.Financial.ComboBudgets DropBudgetsNewTransaction; + protected global::Swarmops.Controls.Financial.ComboBudgets DropBudgetsCreateTx; /// - /// TextAmountNewTransaction control. + /// TextCreateTxAmount control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::Swarmops.Frontend.Controls.Financial.CurrencyTextBox TextAmountNewTransaction; + protected global::Swarmops.Frontend.Controls.Financial.CurrencyTextBox TextCreateTxAmount; /// /// PanelCreateTxVisible control.