Work on Expensify uploads

This commit is contained in:
Rick Falkvinge
2018-02-24 16:41:20 +01:00
parent c04224aa54
commit 2a4e0563bc
4 changed files with 73 additions and 13 deletions
+45 -5
View File
@@ -91,6 +91,20 @@
return true;
}
function editExpenseClaim(expenseClaimGuid) {
SwarmopsJS.ajaxCall("/Pages/v5/Financial/FileExpenseClaim.aspx/GetExpenseClaimData",
{
masterGuid: '<%=this.UploadExpensify.GuidString%>',
expenseGuid: expenseClaimGuid
},
function(result) {
if (result.Success) {
<%=this.DialogEditExpenseClaim.ClientID%>_show();
}
});
}
var vatEnable = <%= this.CurrentOrganization.VatEnabled? "true" : "false" %>;
var expensifyProcessingHalfway = false;
@@ -133,27 +147,45 @@
<%=this.ProgressExpensifyFake.ClientID%>_show();
$('#divUploadExpensify').hide();
$('#divExpensifyUploadAnotherHeader').show();
$('#divExpensifyResults').slideDown();
$('#divExpensifyResults').slideDown("slow", function() {
<%=this.ProgressExpensifyFake.ClientID%>_fadeOut();
});
// Display processed data
$('#expensifyDataGrid').datagrid({});
$('#expensifyDataGrid').datagrid({
onBeginEdit: function(index,row){
var ed = $(this).datagrid('getEditor',{index:index,field:'productid'});
$(ed.target).combotree({
url: '...',
value: row.productid
});
},
onEndEdit: function(index,row){
var ed = $(this).datagrid('getEditor',{index:index,field:'productid'});
row.productname = $(ed.target).combotree('getText');
}
});
$('#expensifyDataGrid').datagrid('loadData', result.Data);
// Fill in documents (hidden)
$('#divDocumentsHidden').html(result.Documents);
// Enable document viewing
$('#divDocumentsHidden').html(result.Documents);
SwarmopsJS.fancyBoxInit('.FancyBox_Gallery');
$(".LocalIconViewDoc").click(function () {
$("a.FancyBox_Gallery[data-fancybox='" + $(this).attr("firstDocId") + "']").first().click();
});
// Hook in edit-expense popup
$(".LocalEditExpenseClaim").click(function() {
editExpenseClaim($(this).attr("data-guid"));
});
} else {
@@ -293,6 +325,14 @@
</div>
</div>
<Swarmops5:ModalDialog ID="DialogEditExpenseClaim" runat="server">
<DialogCode>
<h2>Editing Expense Claim</h2>
<div class="divEntryFields">FOOOO!</div>
<div class="divEntryLabels">BAAAAR!</div>
</DialogCode>
</Swarmops5:ModalDialog>
</asp:Content>
@@ -507,12 +507,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
// so the user can review all of it.
// TODO: Get all receipts
// TODO: Present report to user
// TODO: Let user confirm budgets
// TODO: Suggest initial budgets
// TODO: Once user has confirmed budgets, save expenses
@@ -522,7 +517,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
"<img src='/Images/Icons/iconshock-search-256px.png' onmouseover=\"this.src='/Images/Icons/iconshock-search-hot-256px.png';\" onmouseout=\"this.src='/Images/Icons/iconshock-search-256px.png';\" firstDocId='{0}' class='LocalIconViewDoc' style='cursor:pointer' height='20' width='20' />";
string editString =
"<img src='/Images/Icons/iconshock-wrench-128x96px-centered.png' height='18' width='24' class='LocalIconEdit' guid='{0}' />";
"<img src='/Images/Icons/iconshock-wrench-128x96px-centered.png' height='18' width='24' class='LocalEditExpenseClaim' data-guid='{0}' />";
string docString =
"<a href='/Pages/v5/Support/StreamUpload.aspx?DocId={0}&hq=1' data-caption=\"{1}\" class='FancyBox_Gallery' data-fancybox='{2}'>";
@@ -533,6 +528,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
{
outputRecords.Add(new ExpensifyOutputRecord
{
Budget = "<span class='LocalEditExpenseClaim' data-guid='" + record.Guid + "'>" + Resources.Global.Global_DropInits_SelectFinancialAccount + "</span>",
Description = record.CategoryCustom + " / " + record.Description,
CreatedDateTime = record.Timestamp.ToString("MMM dd"),
Amount = (record.AmountCents / 100.0).ToString("N2"),
@@ -571,6 +567,16 @@ namespace Swarmops.Frontend.Pages.v5.Financial
}
[WebMethod]
public static AjaxCallExpensifyRecordResult GetExpensifyRecord(string masterGuid, string recordGuid)
{
return new AjaxCallExpensifyRecordResult
{
Success = true,
};
}
public class BarfException: Exception {}
@@ -767,5 +773,10 @@ namespace Swarmops.Frontend.Pages.v5.Financial
public string Documents { get; set; }
}
public class AjaxCallExpensifyRecordResult : AjaxCallResult
{
public string Amount { get; set; }
public string AmountVat { get; set; }
}
}
@@ -362,5 +362,14 @@ namespace Swarmops.Frontend.Pages.v5.Financial {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Swarmops.Frontend.Controls.v5.Base.ProgressBar ProgressExpensify;
/// <summary>
/// DialogEditExpenseClaim control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Swarmops.Frontend.Controls.Base.ModalDialog DialogEditExpenseClaim;
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
Some of these scripts are not in the public domain.
jQuery is licensed as MIT License (free to use for any purpose). So is FancyBox, Alertify, Superfish, HoverIntent, jQuery JSON, BCHAddr, Elevate Zoom, and jQuery SwitchButton.
jQuery is licensed as MIT License (free to use for any purpose). So is FancyBox (1.x), Alertify, Superfish, HoverIntent, jQuery JSON, BCHAddr, Elevate Zoom, and jQuery SwitchButton.
SmartWizard is licensed under Creative Commons Attribution-ShareAlike.