Expensify ready up until submit button
This commit is contained in:
+9
@@ -1518,6 +1518,15 @@ namespace Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Submit.
|
||||
/// </summary>
|
||||
internal static string Global_Submit {
|
||||
get {
|
||||
return ResourceManager.GetString("Global_Submit", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to System.
|
||||
/// </summary>
|
||||
|
||||
@@ -978,4 +978,8 @@
|
||||
<value>MMM d, yyyy</value>
|
||||
<comment>Convert the formatting only - this is machine interpreted. Example: "Dec 23, 1921".</comment>
|
||||
</data>
|
||||
<data name="Global_Submit" xml:space="preserve">
|
||||
<value>Submit</value>
|
||||
<comment>As in "Submit this data for processing"</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -942,6 +942,24 @@ namespace Resources.Pages {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to All expense claims need a budget before submitting..
|
||||
/// </summary>
|
||||
internal static string FileExpenseClaim_Expensify_NeedBudgetsForAll {
|
||||
get {
|
||||
return ResourceManager.GetString("FileExpenseClaim_Expensify_NeedBudgetsForAll", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No Expensify records to submit.
|
||||
/// </summary>
|
||||
internal static string FileExpenseClaim_Expensify_NoRecordsLeft {
|
||||
get {
|
||||
return ResourceManager.GetString("FileExpenseClaim_Expensify_NoRecordsLeft", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Expensify report's currency is.
|
||||
/// </summary>
|
||||
@@ -951,6 +969,24 @@ namespace Resources.Pages {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Ready to submit one claim.
|
||||
/// </summary>
|
||||
internal static string FileExpenseClaim_Expensify_SubmitRecordSingle {
|
||||
get {
|
||||
return ResourceManager.GetString("FileExpenseClaim_Expensify_SubmitRecordSingle", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Ready to submit {0} claims.
|
||||
/// </summary>
|
||||
internal static string FileExpenseClaim_Expensify_SubmitRecordsSeveral {
|
||||
get {
|
||||
return ResourceManager.GetString("FileExpenseClaim_Expensify_SubmitRecordsSeveral", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Upload Another Expensify CSV File?.
|
||||
/// </summary>
|
||||
|
||||
@@ -710,4 +710,19 @@
|
||||
<value>(The amount must exclude any VAT specified!)</value>
|
||||
<comment>This refers to when a budget owner is asked to correct an amount to charge their budget, based on seeing an invoice or receipt for that charge, and is instructed that they should not enter the TOTAL as shown on the invoice or receipt, but the TOTAL EXCEPT VAT.</comment>
|
||||
</data>
|
||||
<data name="FileExpenseClaim_Expensify_NeedBudgetsForAll" xml:space="preserve">
|
||||
<value>All expense claims need a budget before submitting.</value>
|
||||
<comment>This is displayed after the user has uploaded an Expensify report with lots of expense claims, but hasn't yet set a budget for all of them</comment>
|
||||
</data>
|
||||
<data name="FileExpenseClaim_Expensify_NoRecordsLeft" xml:space="preserve">
|
||||
<value>No Expensify records to submit</value>
|
||||
<comment>This appears after an empty file is uploaded, or the last record deleted</comment>
|
||||
</data>
|
||||
<data name="FileExpenseClaim_Expensify_SubmitRecordSingle" xml:space="preserve">
|
||||
<value>Ready to submit one claim</value>
|
||||
</data>
|
||||
<data name="FileExpenseClaim_Expensify_SubmitRecordsSeveral" xml:space="preserve">
|
||||
<value>Ready to submit {0} claims</value>
|
||||
<comment>The {0} is replaced by a number, 2 or higher</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -204,6 +204,12 @@ namespace Swarmops.Frontend
|
||||
get { return JavascriptEscape(Resources.Global.Global_Cancel); }
|
||||
}
|
||||
|
||||
|
||||
public string Localized_ConfirmDialog_Submit
|
||||
{
|
||||
get { return JavascriptEscape(Resources.Global.Global_Submit); }
|
||||
}
|
||||
|
||||
public bool SuppressStatisticHeaders { get; set; } // defaults to false
|
||||
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@
|
||||
displayExpensifyRecord(result);
|
||||
}
|
||||
|
||||
displaySubmitPrompt(result.SubmitPrompt);
|
||||
|
||||
} else {
|
||||
<%=this.DialogEditExpenseClaim.ClientID%>_open(); // re-open same dialog
|
||||
alertify.error("There was an error submitting the data. Please fix.");
|
||||
@@ -86,7 +88,21 @@
|
||||
currentlyEditedRecordGuid = result.Guid;
|
||||
displayExpensifyRecord(result);
|
||||
}
|
||||
else if (result.DataUpdate.length == 0) {
|
||||
// There are no more records
|
||||
|
||||
// No data, so prepare for another upload
|
||||
|
||||
$('#spanLabelExpensifySomethingMissing').text(SwarmopsJS.unescape('<%=this.Localized_Expensify_NoRecords%>'));
|
||||
$('#divExpensifySomethingMissing').show();
|
||||
$('#divExpensifyReadySubmit').hide();
|
||||
$('#divExpensifyUploadAnotherHeader').show();
|
||||
$('#divExpensifyUploadFile').show();
|
||||
$('#divExpensifyInstructions').hide();
|
||||
$('#divUploadExpensify').slideDown();
|
||||
} else {
|
||||
displaySubmitPrompt(result.SubmitPrompt);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -229,6 +245,15 @@
|
||||
});
|
||||
}
|
||||
|
||||
function displaySubmitPrompt(prompt) {
|
||||
if (prompt.length > 1) {
|
||||
$('#buttonExpensifySubmit').val(SwarmopsJS.unescape('<%=this.Localized_ConfirmDialog_Submit%>'));
|
||||
$('#spanLabelExpensifySubmit').text(prompt);
|
||||
$('#divExpensifySomethingMissing').slideUp();
|
||||
$('#divExpensifyReadySubmit').slideDown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var expensifyProcessingHalfway = false;
|
||||
var currentlyEditedRecordGuid = '';
|
||||
@@ -278,28 +303,50 @@
|
||||
<%=this.ProgressExpensifyFake.ClientID%>_fadeOut();
|
||||
});
|
||||
|
||||
// Display processed data
|
||||
// If there's no data at all, sort of abort and ask for a new file
|
||||
|
||||
$('#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');
|
||||
}
|
||||
});
|
||||
if (result.Data.length == 0)
|
||||
{
|
||||
// No data, so prepare for another upload
|
||||
|
||||
// Fill in documents (hidden)
|
||||
$('#spanLabelExpensifySomethingMissing').text(SwarmopsJS.unescape('<%=this.Localized_Expensify_NoRecords%>'));
|
||||
$('#divExpensifySomethingMissing').show();
|
||||
$('#divExpensifyReadySubmit').hide();
|
||||
$('#divExpensifyUploadAnotherHeader').show();
|
||||
$('#divExpensifyUploadFile').show();
|
||||
$('#divExpensifyInstructions').hide();
|
||||
$('#divUploadExpensify').slideDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$('#divDocumentsHidden').html(result.Documents);
|
||||
// Else, display processed data
|
||||
|
||||
displayExpensifyDataGrid(result.Data, result.Footer);
|
||||
$('#divExpensifySomethingMissing').hide();
|
||||
$('#divExpensifyReadySubmit').show();
|
||||
|
||||
$('#spanLabelExpensifySomethingMissing').text(SwarmopsJS.unescape('<%=this.Localized_Expensify_NeedBudgetsForAll%>'));
|
||||
|
||||
$('#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');
|
||||
}
|
||||
});
|
||||
|
||||
// Fill in documents (hidden)
|
||||
|
||||
$('#divDocumentsHidden').html(result.Documents);
|
||||
|
||||
displayExpensifyDataGrid(result.Data, result.Footer);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -399,6 +446,18 @@
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<div id="divExpensifySomethingMissing">
|
||||
<span id="spanLabelExpensifySomethingMissing">Need budgets for all</span>
|
||||
</div>
|
||||
|
||||
<div id="divExpensifyReadySubmit" style="display:none">
|
||||
<div class="entryFields">
|
||||
<input type="button" class="buttonAccentColor NoInputFocus" id="buttonExpensifySubmit" value="Submit"/>
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
<span id="spanLabelExpensifySubmit">Ready to submit</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -513,8 +513,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
|
||||
// TODO: Suggest initial budgets
|
||||
|
||||
// TODO: Once user has confirmed budgets, save expenses
|
||||
|
||||
List<ExpensifyOutputRecord> outputRecords = new List<ExpensifyOutputRecord>();
|
||||
|
||||
string docString =
|
||||
@@ -622,6 +620,26 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
}
|
||||
|
||||
|
||||
private static string FormatExpensifySubmitPrompt(List<ExpensifyRecord> recordList)
|
||||
{
|
||||
foreach (ExpensifyRecord record in recordList)
|
||||
{
|
||||
if (record.BudgetId == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
if (recordList.Count == 1)
|
||||
{
|
||||
return Resources.Pages.Financial.FileExpenseClaim_Expensify_SubmitRecordSingle;
|
||||
}
|
||||
|
||||
return String.Format(Resources.Pages.Financial.FileExpenseClaim_Expensify_SubmitRecordsSeveral,
|
||||
recordList.Count);
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public static AjaxCallExpensifyRecordResult ExpensifyRecordProceed(string masterGuid, string recordGuid,
|
||||
string amountString, string amountVatString, int budgetId, string description)
|
||||
@@ -676,7 +694,8 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
ExistNext = (index < recordList.Count - 1 ? true : false),
|
||||
Success = true,
|
||||
DataUpdate = FormatExpensifyOutputRecords(recordList),
|
||||
FooterUpdate = FormatExpensifyFooter (recordList)
|
||||
FooterUpdate = FormatExpensifyFooter (recordList),
|
||||
SubmitPrompt = FormatExpensifySubmitPrompt(recordList)
|
||||
};
|
||||
|
||||
}
|
||||
@@ -715,7 +734,8 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
ExistNext = (index < recordList.Count - 1 ? true : false),
|
||||
Success = true,
|
||||
DataUpdate = FormatExpensifyOutputRecords(recordList),
|
||||
FooterUpdate = FormatExpensifyFooter(recordList)
|
||||
FooterUpdate = FormatExpensifyFooter(recordList),
|
||||
SubmitPrompt = FormatExpensifySubmitPrompt (recordList)
|
||||
};
|
||||
|
||||
}
|
||||
@@ -943,6 +963,16 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
{
|
||||
get { return JavascriptEscape(Resources.Pages.Financial.FileExpenseClaim_ValidationError_Documents); }
|
||||
}
|
||||
|
||||
public string Localized_Expensify_NeedBudgetsForAll
|
||||
{
|
||||
get { return JavascriptEscape(Resources.Pages.Financial.FileExpenseClaim_Expensify_NeedBudgetsForAll); }
|
||||
}
|
||||
|
||||
public string Localized_Expensify_NoRecords
|
||||
{
|
||||
get { return JavascriptEscape(Resources.Pages.Financial.FileExpenseClaim_Expensify_NoRecordsLeft); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -967,6 +997,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
public ExpensifyOutputRecord[] Data { get; set; }
|
||||
public ExpensifyOutputRecord[] Footer { get; set; }
|
||||
public string Documents { get; set; }
|
||||
public string SubmitPrompt { get; set; }
|
||||
}
|
||||
|
||||
public class AjaxCallExpensifyRecordResult : AjaxCallResult
|
||||
@@ -981,7 +1012,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
|
||||
public ExpensifyOutputRecord[] DataUpdate { get; set; }
|
||||
public ExpensifyOutputRecord[] FooterUpdate { get; set; }
|
||||
public bool CanCommit { get; set; }
|
||||
public string SubmitPrompt { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user