diff --git a/client/Helpers.js b/client/Helpers.js
index e2bb5c02c..b28378ba5 100644
--- a/client/Helpers.js
+++ b/client/Helpers.js
@@ -33,6 +33,8 @@ export function NYI() {
export const NONE_CATEGORY_ID = '-1';
+export const NONE_OPERATION_TYPE_ID = '-1';
+
var translator = null;
var alertMissing = null;
export function setTranslator(polyglotInstance) {
@@ -55,3 +57,18 @@ export function translate(format, bindings) {
return ret;
}
+
+export const DEFAULT_TYPE_LABELS = {
+ "type.none": "None",
+ "type.unknown": "Unknown",
+ "type.transfer": "Transfer",
+ "type.order": "Order",
+ "type.check": "Check",
+ "type.deposit": "Deposit",
+ "type.payback": "Payback",
+ "type.withdrawal": "Withdrawal",
+ "type.card": "Card",
+ "type.loan_payment": "Loan payment",
+ "type.bankfee": "Bank fee",
+ "type.cash_deposit": "Cash deposit",
+}
diff --git a/client/Models.js b/client/Models.js
index 8bb5e85b7..15db52ae0 100644
--- a/client/Models.js
+++ b/client/Models.js
@@ -1,4 +1,4 @@
-import {has, assert, maybeHas, NONE_CATEGORY_ID} from './Helpers';
+import {has, assert, maybeHas, NONE_CATEGORY_ID, NONE_OPERATION_TYPE_ID} from './Helpers';
export class Bank {
constructor(arg) {
@@ -47,6 +47,7 @@ export class Operation {
this.dateImport = (maybeHas(arg, 'dateImport') && new Date(arg.dateImport)) || 0;
this.id = has(arg, 'id') && arg.id;
this.categoryId = arg.categoryId || NONE_CATEGORY_ID;
+ this.type = (maybeHas(arg, 'operationTypeID') && arg.operationTypeID) || NONE_OPERATION_TYPE_ID
}
}
@@ -72,3 +73,11 @@ export class Setting {
this.val = has(arg, 'value') && arg.value;
}
}
+
+export class OperationType {
+ constructor(arg) {
+ this.name = has(arg, 'name') && arg.name;
+ this.id = has(arg, 'id') && arg.id;
+ this.weboobvalue = has(arg, 'weboobvalue') && arg.weboobvalue;
+ }
+}
diff --git a/client/components/OperationList.js b/client/components/OperationList.js
index 069482ae0..e2c9fb47d 100644
--- a/client/components/OperationList.js
+++ b/client/components/OperationList.js
@@ -1,7 +1,7 @@
import React from 'react';
// Constants
-import {has, maybeHas, translate as t} from '../Helpers';
+import {has, maybeHas, translate as t, DEFAULT_TYPE_LABELS} from '../Helpers';
import {Category} from '../Models';
@@ -108,6 +108,7 @@ class OperationDetails extends React.Component {
diff --git a/client/components/Similarity.js b/client/components/Similarity.js
index 6ed59214a..cf77aa4a4 100644
--- a/client/components/Similarity.js
+++ b/client/components/Similarity.js
@@ -72,7 +72,8 @@ class SimilarityPairComponent extends React.Component {
Label |
Amount |
Category |
- Imported on |
+ Type |
+ Imported on |
Merge |
@@ -83,6 +84,7 @@ class SimilarityPairComponent extends React.Component {
{this.props.a.title} |
{this.props.a.amount} |
{store.categoryToLabel(this.props.a.categoryId)} |
+ {store.operationTypeToLabel(this.props.a.type)} |
{new Date(this.props.a.dateImport).toLocaleString()} |
|