Some work on createtx

This commit is contained in:
Falkvinge
2017-06-18 17:22:39 +02:00
parent 425cdffe5d
commit 7276bf5967
2 changed files with 31 additions and 8 deletions
+27 -4
View File
@@ -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 @@
<div class="entryFields">
<Swarmops5:AjaxTextBox ID="TextCreateTxDateTime" runat="server"/>
<Swarmops5:AjaxTextBox ID="TextCreateTxDescription" runat="server"/>
<Swarmops5:ComboBudgets ID="DropBudgetsNewTransaction" ListType="All" runat="server"/>
<Swarmops5:CurrencyTextBox ID="TextAmountNewTransaction" runat="server"/>
<input type="button" class="NoInputFocus buttonAccentColor" value="Create XYZ"/>
<Swarmops5:ComboBudgets ID="DropBudgetsCreateTx" ListType="All" runat="server"/>
<Swarmops5:CurrencyTextBox ID="TextCreateTxAmount" runat="server"/>
<input type="button" id="buttonCreateTransaction" class="NoInputFocus buttonAccentColor" value="Create XYZ"/>
</div>
<div class="entryLabels">
Date and Time XYZ<br/>
+4 -4
View File
@@ -337,22 +337,22 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers {
protected global::Swarmops.Frontend.Controls.Base.AjaxTextBox TextCreateTxDescription;
/// <summary>
/// DropBudgetsNewTransaction control.
/// DropBudgetsCreateTx control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Swarmops.Controls.Financial.ComboBudgets DropBudgetsNewTransaction;
protected global::Swarmops.Controls.Financial.ComboBudgets DropBudgetsCreateTx;
/// <summary>
/// TextAmountNewTransaction control.
/// TextCreateTxAmount control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Swarmops.Frontend.Controls.Financial.CurrencyTextBox TextAmountNewTransaction;
protected global::Swarmops.Frontend.Controls.Financial.CurrencyTextBox TextCreateTxAmount;
/// <summary>
/// PanelCreateTxVisible control.