Work on Payment OCR data

This commit is contained in:
Rick Falkvinge
2019-03-01 14:21:37 +01:00
parent 715e2e37b3
commit 71296c0cf1
4 changed files with 75 additions and 21 deletions
+18
View File
@@ -1257,6 +1257,24 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to ...and this.
/// </summary>
internal static string PayOutMoney_AutomationFieldNext {
get {
return ResourceManager.GetString("PayOutMoney_AutomationFieldNext", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Scan this.
/// </summary>
internal static string PayOutMoney_AutomationFieldStart {
get {
return ResourceManager.GetString("PayOutMoney_AutomationFieldStart", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Amount.
/// </summary>
+12 -4
View File
@@ -429,10 +429,6 @@
<value>Recipient</value>
<comment>Can be org (for invoice) or person (for salary, expense, advance)</comment>
</data>
<data name="PayOutMoney_GridHeader_Reference" xml:space="preserve">
<value>Reference</value>
<comment>Depends on cost type - can be an OCR number for an invoice, a cash advance number, a salary spec, etc.</comment>
</data>
<data name="PayOutMoney_Header" xml:space="preserve">
<value>Costs Ready For Payout</value>
</data>
@@ -741,6 +737,18 @@
<value>Transfer Method</value>
<comment>As in "money transfer method"; this can be a domestic bank transfer, mailing a check, et cetera.</comment>
</data>
<data name="PayOutMoney_AutomationFieldNext" xml:space="preserve">
<value>...and this</value>
<comment>AutomationStartFirst and AutomationStartNext are shown as labels to machine-readable data fields, that the user can scan with an app in their smartphone.</comment>
</data>
<data name="PayOutMoney_AutomationFieldStart" xml:space="preserve">
<value>Scan this</value>
<comment>AutomationStartFirst and AutomationStartNext are shown as labels to machine-readable data fields, that the user can scan with an app in their smartphone.</comment>
</data>
<data name="PayOutMoney_GridHeader_Reference" xml:space="preserve">
<value>Reference</value>
<comment>Depends on cost type - can be an OCR number for an invoice, a cash advance number, a salary spec, etc.</comment>
</data>
<data name="PayOutMoney_PaymentLate" xml:space="preserve">
<value>Payment is late</value>
<comment>"Late" in this context means "after its due date".</comment>
+37 -15
View File
@@ -96,6 +96,20 @@
}
}
// Show or hide the automation toggle
var automationAvailable = $(this).attr("data-ocr");
if (automationAvailable == "yes") {
$(".modal-automation-toggle").show();
} else {
$(".modal-automation-toggle").hide();
}
$(".input-field-needs-init").each(function() {
$(this).val(loadingBreadcrumb);
});
<%=this.ModalConfirmPayment.ClientID%>_open();
modalPrototypeId = $(this).attr("protoid");
@@ -128,6 +142,14 @@
$('#idModalExtraField' + index).val(result.TransferMethodData[index]);
}
// Add OCR fields if available
if (result.OcrData != null && result.OcrData.Length > 0) {
$('#idModalAutomationField1').val(result.OcrData[0]);
$('#idModalAutomationField2').val(result.OcrData[1]);
$('#idModalAutomationField3').val(result.OcrData[2]);
}
} else {
// TODO: Handle server-level concurrency lock
}
@@ -359,23 +381,23 @@
<DialogCode>
<h2><asp:Label ID="LabelModalHeader" runat="server" Text="Execute this payout manually now XYZ"/> (<asp:Label runat="server" ID="LabelModalHeaderDue"/> <span id="idModalDueDate"></span></h2>
<div class="data-entry-fields modal wide">
<input type="text" id="idModalInputRecipient" readonly="readonly" value="Recipient"/>&#8203;<br/>
<input type="text" id="idModalInputRecipient" class="input-field-needs-init" readonly="readonly" value="Recipient"/>&#8203;<br/>
<span class="modal-input-regular">
<input type="text" id="idModalInputCurrencyAmount" readonly="readonly" class="align-for-numbers" value="Amount"/>&#8203;<br/>
<input type="text" id="idModalReference" readonly="readonly" value="Reference"/>&#8203;<br/>
<input type="text" id="idModalTransferMethod" readonly="readonly" value="Transfer Method"/>&#8203;<br/>
<input type="text" id="idModalInputCurrencyAmount" readonly="readonly" class="input-field-needs-init align-for-numbers" value="Amount"/>&#8203;<br/>
<input type="text" id="idModalReference" readonly="readonly" class="input-field-needs-init" value="Reference"/>&#8203;<br/>
<input type="text" id="idModalTransferMethod" readonly="readonly" class="input-field-needs-init" value="Transfer Method"/>&#8203;<br/>
</span>
<span class="modal-input-automated ocr-font">
<input type="text" id="idModalAutomationField1" readonly="readonly" class="ocr-font" value="Field1"/>&#8203;<br/>
<input type="text" id="idModalAutomationField2" readonly="readonly" class="ocr-font" value="Field2"/>&#8203;<br/>
<input type="text" id="idModalAutomationField3" readonly="readonly" class="ocr-font" value="Field3"/>&#8203;<br/>
<input type="text" id="idModalAutomationField1" class="input-field-needs-init ocr-font" readonly="readonly" value="Field1"/>&#8203;<br/>
<input type="text" id="idModalAutomationField2" class="input-field-needs-init ocr-font" readonly="readonly" value="Field2"/>&#8203;<br/>
<input type="text" id="idModalAutomationField3" class="input-field-needs-init ocr-font" readonly="readonly" value="Field3"/>&#8203;<br/>
</span>
<div class="modal-extra-data-fields">
<span id="idModalSpanExtraField0"><input type="text" id="idModalExtraField0" readonly="readonly" value="Extra Field 0"/>&#8203;<br/></span>
<span id="idModalSpanExtraField1"><input type="text" id="idModalExtraField1" readonly="readonly" value="Extra Field 1"/>&#8203;<br/></span>
<span id="idModalSpanExtraField2"><input type="text" id="idModalExtraField2" readonly="readonly" value="Extra Field 2"/>&#8203;<br/></span>
<span id="idModalSpanExtraField3"><input type="text" id="idModalExtraField3" readonly="readonly" value="Extra Field 3"/>&#8203;<br/></span>
<span id="idModalSpanExtraField4"><input type="text" id="idModalExtraField4" readonly="readonly" value="Extra Field 4"/>&#8203;<br/></span>
<span id="idModalSpanExtraField0"><input type="text" id="idModalExtraField0" class="input-field-needs-init" readonly="readonly" value="Extra Field 0"/>&#8203;<br/></span>
<span id="idModalSpanExtraField1"><input type="text" id="idModalExtraField1" class="input-field-needs-init" readonly="readonly" value="Extra Field 1"/>&#8203;<br/></span>
<span id="idModalSpanExtraField2"><input type="text" id="idModalExtraField2" class="input-field-needs-init" readonly="readonly" value="Extra Field 2"/>&#8203;<br/></span>
<span id="idModalSpanExtraField3"><input type="text" id="idModalExtraField3" class="input-field-needs-init" readonly="readonly" value="Extra Field 3"/>&#8203;<br/></span>
<span id="idModalSpanExtraField4"><input type="text" id="idModalExtraField4" class="input-field-needs-init" readonly="readonly" value="Extra Field 4"/>&#8203;<br/></span>
</div>
<span class="modal-automation-toggle"><Swarmops5:AjaxToggleSlider ID="ToggleModalMachineReadable" runat="server" Label="Show in machine-readable format XYZ" Cookie="MachineReadable" AjaxCallbackUrl="" OnChange="modalToggleMachineReadable"/></span>
<input type="button" id="idModalButtonConfirm" value="Confirm XYZ" class="button-accent-color suppress-input-focus action-icon-button icon-yes" onclick="onConfirmModal();"/>
@@ -388,9 +410,9 @@
<asp:Label ID="LabelModalTransferMethod" runat="server" Text="Transfer Method XYZ"/><br/>
</span>
<span class="modal-input-automated">
<asp:Label runat="server" ID="LabelModalAutomation1" />
<asp:Label runat="server" ID="LabelModalAutomation2" />
<asp:Label runat="server" ID="LabelModalAutomation3" />
<asp:Label runat="server" ID="LabelModalAutomation1" /><br/>
<asp:Label runat="server" ID="LabelModalAutomation2" /><br/>
<asp:Label runat="server" ID="LabelModalAutomation3" /><br/>
</span>
<div class="modal-extra-data-fields">
<span id="idModalSpanExtraLabel0">Label 0<br/></span>
+8 -2
View File
@@ -44,7 +44,7 @@ namespace Swarmops.Frontend.Pages.Financial
InfoBoxLiteral = Resources.Pages.Financial.PayOutMoney_Info;
this.LabelPayOutMoneyHeader.Text = Resources.Pages.Financial.PayOutMoney_Header;
this.LabelGridHeaderAmount.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_Amount;
this.LabelGridHeaderDue.Text = Resources.Global.Financial_DueDate;
this.LabelGridHeaderDue.Text = Resources.Global.Financial_DueDateShort;
this.LabelGridHeaderPay.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_PayThis;
this.LabelGridHeaderRecipient.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_Recipient;
this.LabelGridHeaderCurrencyMethod.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_CurrencyMethod;
@@ -58,6 +58,10 @@ namespace Swarmops.Frontend.Pages.Financial
this.LabelModalTransferMethod.Text = Resources.Pages.Financial.PayOutMoney_Modal_TransferMethod;
this.LabelModalHeaderDue.Text = Resources.Global.Financial_DueDateShort;
this.LabelModalAutomation1.Text = Resources.Pages.Financial.PayOutMoney_AutomationFieldStart;
this.LabelModalAutomation2.Text = Resources.Pages.Financial.PayOutMoney_AutomationFieldNext;
this.LabelModalAutomation3.Text = Resources.Pages.Financial.PayOutMoney_AutomationFieldNext;
this.LabelSidebarOptions.Text = Resources.Global.Sidebar_Options;
this.LabelOptionsShowOcr.Text = Resources.Pages.Financial.PayoutMoney_OptionShowOcr;
}
@@ -102,7 +106,7 @@ namespace Swarmops.Frontend.Pages.Financial
if (!payout.Open)
{
// this payout has already been settled, or picked up for settling. This is a concurrency error, only detected earlier than the database layer.
// this payout has already been settled, or picked up for settling. This is a concurrency error, detected before actually trying to change it.
return new AjaxCallResult
{
@@ -218,6 +222,7 @@ namespace Swarmops.Frontend.Pages.Financial
result.TransferMethodLabels = listTransferMethodLabels.ToArray();
result.TransferMethodData = listTransferMethodData.ToArray();
result.OcrData = info.OcrData; // can be null and that's ok
return result;
}
@@ -264,6 +269,7 @@ namespace Swarmops.Frontend.Pages.Financial
public string TransferMethod { get; set; }
public string[] TransferMethodLabels { get; set; }
public string[] TransferMethodData { get; set; }
public string[] OcrData { get; set; }
}