x25 5.1.25 → 5.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Header/Header.js +1 -1
- package/Inputs/Business/CifField.js +84 -86
- package/Inputs/Business/CifFieldContainer.js +202 -112
- package/Inputs/Business/request.js +2 -2
- package/package.json +1 -1
package/Header/Header.js
CHANGED
|
@@ -111,7 +111,7 @@ var Header = function Header(_ref) {
|
|
|
111
111
|
typeof company === "undefined" || company.size === 0 ? null : showNoticeToPay ? _react2.default.createElement(
|
|
112
112
|
"div",
|
|
113
113
|
{ className: "alert alert-warning m-2" },
|
|
114
|
-
"
|
|
114
|
+
"Abonamentul t\u0103u va expira " + (0, _moment2.default)(company.get("ValabilityDate")).endOf("day").fromNow() + ".\n Pentru a beneficia de serviciul de facturare, achita\u021Bi online sau transfer bancar. ",
|
|
115
115
|
_react2.default.createElement(
|
|
116
116
|
"button",
|
|
117
117
|
{
|
|
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
|
|
7
7
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
8
8
|
|
|
9
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
10
|
-
|
|
11
9
|
var _react = require("react");
|
|
12
10
|
|
|
13
11
|
var _react2 = _interopRequireDefault(_react);
|
|
@@ -18,95 +16,95 @@ var _classnames2 = _interopRequireDefault(_classnames);
|
|
|
18
16
|
|
|
19
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var name = input.name;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return _react2.default.createElement(
|
|
19
|
+
var CifField = function CifField(props) {
|
|
20
|
+
var input = props.input,
|
|
21
|
+
hasRequested = props.hasRequested,
|
|
22
|
+
isWaiting = props.isWaiting,
|
|
23
|
+
isGood = props.isGood,
|
|
24
|
+
findDetailsByCif = props.findDetailsByCif,
|
|
25
|
+
icon = props.icon,
|
|
26
|
+
handleKeyUp = props.handleKeyUp,
|
|
27
|
+
onRegisterRef = props.onRegisterRef,
|
|
28
|
+
right = props.right,
|
|
29
|
+
left = props.left,
|
|
30
|
+
foundData = props.foundData;
|
|
31
|
+
var name = input.name;
|
|
32
|
+
var _props$meta = props.meta,
|
|
33
|
+
error = _props$meta.error,
|
|
34
|
+
submitting = _props$meta.submitting,
|
|
35
|
+
touched = _props$meta.touched;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
return _react2.default.createElement(
|
|
39
|
+
"div",
|
|
40
|
+
{ className: "form-group row" },
|
|
41
|
+
_react2.default.createElement(
|
|
42
|
+
"label",
|
|
43
|
+
{
|
|
44
|
+
className: "text-md-right\n form-control-label\n form-control-lg " + (left ? left : "col-md-3"), htmlFor: name },
|
|
45
|
+
"C.I.F "
|
|
46
|
+
),
|
|
47
|
+
_react2.default.createElement(
|
|
48
|
+
"div",
|
|
49
|
+
{ className: right ? right : "col-md-9 col-lg-6" },
|
|
50
|
+
_react2.default.createElement(
|
|
57
51
|
"div",
|
|
58
|
-
{ className: "
|
|
59
|
-
_react2.default.createElement(
|
|
60
|
-
"label",
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
{ className: "input-group" },
|
|
53
|
+
_react2.default.createElement("input", _extends({}, input, {
|
|
54
|
+
"aria-label": "Cod de identificare fiscal\u0103",
|
|
55
|
+
className: (0, _classnames2.default)("form-control form-control-lg hide-arrrow", {
|
|
56
|
+
"is-valid": isGood,
|
|
57
|
+
"is-invalid": touched && error
|
|
58
|
+
}),
|
|
59
|
+
disabled: submitting && !(submitting && isWaiting),
|
|
60
|
+
id: name,
|
|
61
|
+
name: name,
|
|
62
|
+
onKeyUp: handleKeyUp,
|
|
63
|
+
placeholder: "ex. 51584214",
|
|
64
|
+
ref: onRegisterRef,
|
|
65
|
+
type: "tel"
|
|
66
|
+
})),
|
|
65
67
|
_react2.default.createElement(
|
|
66
68
|
"div",
|
|
67
|
-
{ className: "
|
|
69
|
+
{ className: "input-group-append" },
|
|
68
70
|
_react2.default.createElement(
|
|
69
|
-
"
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
id: name,
|
|
78
|
-
name: name,
|
|
79
|
-
onKeyPress: handleKeyPressed,
|
|
80
|
-
placeholder: "ex. 51584214",
|
|
81
|
-
ref: onRegisterRef,
|
|
82
|
-
type: "text"
|
|
83
|
-
})),
|
|
84
|
-
_react2.default.createElement(
|
|
85
|
-
"div",
|
|
86
|
-
{ className: "input-group-append" },
|
|
87
|
-
_react2.default.createElement(
|
|
88
|
-
"button",
|
|
89
|
-
{
|
|
90
|
-
className: "btn btn-secondary btn-lg btn-info",
|
|
91
|
-
disabled: submitting,
|
|
92
|
-
onClick: findDetailsByCif(input.value),
|
|
93
|
-
title: "Preia datele de pe Internet",
|
|
94
|
-
type: "button" },
|
|
95
|
-
_react2.default.createElement("i", { className: "fa fa-search" })
|
|
96
|
-
)
|
|
97
|
-
)
|
|
98
|
-
),
|
|
99
|
-
_react2.default.createElement(
|
|
100
|
-
"div",
|
|
101
|
-
{ className: "invalid-feedback is-valid" },
|
|
102
|
-
touched && error ? error : null
|
|
71
|
+
"button",
|
|
72
|
+
{
|
|
73
|
+
className: "btn btn-primary btn-lg",
|
|
74
|
+
disabled: submitting || isWaiting,
|
|
75
|
+
onClick: findDetailsByCif(input.value),
|
|
76
|
+
title: "Preia datele de pe Internet",
|
|
77
|
+
type: "button" },
|
|
78
|
+
_react2.default.createElement("i", { className: "fa " + (icon ? icon : "fa-search") })
|
|
103
79
|
)
|
|
104
80
|
)
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
81
|
+
),
|
|
82
|
+
_react2.default.createElement(
|
|
83
|
+
"div",
|
|
84
|
+
{ className: "col small" },
|
|
85
|
+
isWaiting ? _react2.default.createElement(
|
|
86
|
+
"span",
|
|
87
|
+
null,
|
|
88
|
+
_react2.default.createElement("span", { className: "spinner-border spinner-border-sm text-primary me-2", role: "status" }),
|
|
89
|
+
"Preluare automată date..."
|
|
90
|
+
) : hasRequested ? foundData ? _react2.default.createElement(
|
|
91
|
+
"div",
|
|
92
|
+
{ className: "text-success" },
|
|
93
|
+
_react2.default.createElement("i", { className: "fa fa-check me-2" }),
|
|
94
|
+
"Datele firmei au fost preluate automat"
|
|
95
|
+
) : _react2.default.createElement(
|
|
96
|
+
"div",
|
|
97
|
+
{ className: "text-warning" },
|
|
98
|
+
"Nu se pot prelua automat datele firmei"
|
|
99
|
+
) : " "
|
|
100
|
+
),
|
|
101
|
+
_react2.default.createElement(
|
|
102
|
+
"div",
|
|
103
|
+
{ className: "invalid-feedback is-valid" },
|
|
104
|
+
touched && error ? error : null
|
|
105
|
+
)
|
|
106
|
+
)
|
|
107
|
+
);
|
|
108
|
+
};
|
|
111
109
|
|
|
112
110
|
exports.default = CifField;
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
|
|
7
7
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /* eslint-disable no-magic-numbers */
|
|
10
|
+
|
|
11
|
+
// import { notify, notifyError, notifyWarning } from "Extern/actions";
|
|
10
12
|
|
|
11
13
|
var _react = require("react");
|
|
12
14
|
|
|
@@ -14,144 +16,232 @@ var _react2 = _interopRequireDefault(_react);
|
|
|
14
16
|
|
|
15
17
|
var _immutable = require("redux-form/immutable");
|
|
16
18
|
|
|
17
|
-
var _reactRedux = require("react-redux");
|
|
18
|
-
|
|
19
19
|
var _request = require("./request");
|
|
20
20
|
|
|
21
21
|
var _actions = require("../../actions");
|
|
22
22
|
|
|
23
|
-
var actions = _interopRequireWildcard(_actions);
|
|
24
|
-
|
|
25
23
|
var _utility = require("../../utility");
|
|
26
24
|
|
|
27
25
|
var _CifField = require("./CifField");
|
|
28
26
|
|
|
29
27
|
var _CifField2 = _interopRequireDefault(_CifField);
|
|
30
28
|
|
|
29
|
+
var _reactRedux = require("react-redux");
|
|
30
|
+
|
|
31
|
+
var _immutable2 = require("immutable");
|
|
32
|
+
|
|
33
|
+
var Immutable = _interopRequireWildcard(_immutable2);
|
|
34
|
+
|
|
31
35
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
32
36
|
|
|
33
37
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
38
|
|
|
35
|
-
|
|
39
|
+
var CifContainer = function CifContainer(props) {
|
|
40
|
+
var dispatch = (0, _reactRedux.useDispatch)(),
|
|
41
|
+
isGood = (0, _utility.isValidCIF)(props.input.value),
|
|
42
|
+
_React$useState = _react2.default.useState(Immutable.Map()),
|
|
43
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
44
|
+
theHistory = _React$useState2[0],
|
|
45
|
+
setTheHistory = _React$useState2[1],
|
|
46
|
+
_React$useState3 = _react2.default.useState(false),
|
|
47
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
48
|
+
isWaiting = _React$useState4[0],
|
|
49
|
+
setIsWaiting = _React$useState4[1],
|
|
50
|
+
_React$useState5 = _react2.default.useState(false),
|
|
51
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
52
|
+
foundData = _React$useState6[0],
|
|
53
|
+
setFoundData = _React$useState6[1],
|
|
54
|
+
_React$useState7 = _react2.default.useState(false),
|
|
55
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
56
|
+
hasRequested = _React$useState8[0],
|
|
57
|
+
setHasRequested = _React$useState8[1],
|
|
58
|
+
_React$useState9 = _react2.default.useState(),
|
|
59
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
60
|
+
clearTextTimeout = _React$useState10[0],
|
|
61
|
+
setClearTextTimeout = _React$useState10[1],
|
|
62
|
+
_React$useState11 = _react2.default.useState(),
|
|
63
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
64
|
+
typeDelay = _React$useState12[0],
|
|
65
|
+
setTypeDelay = _React$useState12[1],
|
|
66
|
+
clearText = function clearText() {
|
|
67
|
+
clearTimeout(clearTextTimeout);
|
|
68
|
+
|
|
69
|
+
setIsWaiting(false);
|
|
70
|
+
setHasRequested(false);
|
|
71
|
+
setFoundData(false);
|
|
72
|
+
},
|
|
73
|
+
searchOnWeb = function searchOnWeb(cif) {
|
|
74
|
+
var automatic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
75
|
+
return function () {
|
|
76
|
+
|
|
77
|
+
// const temp = setTimeout(() => {
|
|
78
|
+
|
|
79
|
+
// }, 2000);
|
|
80
|
+
|
|
81
|
+
// setRequestTimeout(temp);
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
var changeFields = function changeFields(data) {
|
|
85
|
+
var _iteratorNormalCompletion = true;
|
|
86
|
+
var _didIteratorError = false;
|
|
87
|
+
var _iteratorError = undefined;
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
91
|
+
var _ref = _step.value;
|
|
92
|
+
|
|
93
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
94
|
+
|
|
95
|
+
var key = _ref2[0];
|
|
96
|
+
var value = _ref2[1];
|
|
97
|
+
|
|
98
|
+
if (value !== "") {
|
|
99
|
+
dispatch((0, _immutable.change)(props.formID, key, value));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
} catch (err) {
|
|
103
|
+
_didIteratorError = true;
|
|
104
|
+
_iteratorError = err;
|
|
105
|
+
} finally {
|
|
106
|
+
try {
|
|
107
|
+
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
108
|
+
_iterator.return();
|
|
109
|
+
}
|
|
110
|
+
} finally {
|
|
111
|
+
if (_didIteratorError) {
|
|
112
|
+
throw _iteratorError;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
endRequest = function endRequest(isOk) {
|
|
118
|
+
setIsWaiting(false);
|
|
119
|
+
setFoundData(isOk);
|
|
36
120
|
|
|
37
|
-
|
|
121
|
+
setTheHistory(theHistory.set(cif, true));
|
|
38
122
|
|
|
39
|
-
|
|
123
|
+
var temp2 = setTimeout(clearText, 3000);
|
|
40
124
|
|
|
41
|
-
|
|
42
|
-
return new Promise(function (resolve) {
|
|
43
|
-
after();
|
|
44
|
-
setTimeout(function () {
|
|
45
|
-
resolve();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
var tryToGetInfo = function tryToGetInfo(_ref) {
|
|
51
|
-
var dispatch = _ref.dispatch,
|
|
52
|
-
cif = _ref.cif,
|
|
53
|
-
focusInput = _ref.focusInput,
|
|
54
|
-
formID = _ref.formID;
|
|
55
|
-
return (0, _request.getCompanyDetails)(cif).then(function (response) {
|
|
56
|
-
var before = [createPromise(function () {
|
|
57
|
-
return dispatch(actions.notify("Am preluat informațiile"));
|
|
58
|
-
})],
|
|
59
|
-
changes = Object.keys(response).map(function (key) {
|
|
60
|
-
return function () {
|
|
61
|
-
return createPromise(function () {
|
|
62
|
-
return dispatch((0, _immutable.change)(formID, key, response[key]));
|
|
63
|
-
});
|
|
125
|
+
setClearTextTimeout(temp2);
|
|
64
126
|
};
|
|
65
|
-
}),
|
|
66
|
-
after = [createPromise(function () {
|
|
67
|
-
return dispatch((0, _immutable.stopSubmit)(formID));
|
|
68
|
-
}), createPromise(function () {
|
|
69
|
-
return focusInput();
|
|
70
|
-
})];
|
|
71
|
-
|
|
72
|
-
var promises = before.concat(changes).concat(after);
|
|
73
|
-
|
|
74
|
-
promises.reduce(function (prev, cur) {
|
|
75
|
-
return prev.then(cur);
|
|
76
|
-
}, Promise.resolve());
|
|
77
|
-
}).catch(function () {
|
|
78
|
-
(0, _utility.delay)().then(function () {
|
|
79
|
-
dispatch(actions.notifyError("Nu am putut prelua informațiile firmei"));
|
|
80
|
-
}).then(function () {
|
|
81
|
-
dispatch((0, _immutable.stopSubmit)(formID));
|
|
82
|
-
}).then(function () {
|
|
83
|
-
focusInput();
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
127
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
128
|
+
// dispatch(startSubmit(props.formID));
|
|
129
|
+
|
|
130
|
+
clearTimeout(clearTextTimeout);
|
|
131
|
+
clearTimeout(typeDelay);
|
|
132
|
+
|
|
133
|
+
if ((0, _utility.isValidCIF)(cif)) {
|
|
134
|
+
|
|
135
|
+
setIsWaiting(true);
|
|
136
|
+
setHasRequested(true);
|
|
137
|
+
setFoundData(false);
|
|
138
|
+
|
|
139
|
+
// clearTimeout(requestTimeout);
|
|
140
|
+
|
|
141
|
+
var mainReason = props.reason ? props.reason : "",
|
|
142
|
+
reason = mainReason + " - " + (automatic ? "automatic" : "click buton");
|
|
143
|
+
|
|
144
|
+
(0, _request.getCompanyDetails)(cif, reason).then(function (response) {
|
|
145
|
+
var map = new Map();
|
|
146
|
+
|
|
147
|
+
Object.keys(response).forEach(function (key) {
|
|
148
|
+
if (key !== "Capital") {
|
|
149
|
+
map.set(key, response[key]);
|
|
150
|
+
}
|
|
102
151
|
});
|
|
103
|
-
|
|
152
|
+
|
|
104
153
|
(0, _utility.delay)().then(function () {
|
|
105
|
-
|
|
154
|
+
changeFields(map);
|
|
155
|
+
}).
|
|
156
|
+
// then(() => {
|
|
157
|
+
// dispatch(notify("Am preluat informațiile"));
|
|
158
|
+
// }).
|
|
159
|
+
then(function () {
|
|
160
|
+
// dispatch(stopSubmit(props.formID));
|
|
106
161
|
}).then(function () {
|
|
107
|
-
|
|
162
|
+
props.focusInput();
|
|
108
163
|
}).then(function () {
|
|
109
|
-
|
|
164
|
+
if (typeof props.onSuccess === "function") {
|
|
165
|
+
props.onSuccess(response);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
endRequest(true);
|
|
110
169
|
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
170
|
+
}).catch(function () {
|
|
171
|
+
if (typeof onError === "function") {
|
|
172
|
+
(0, _utility.delay)().then(function () {
|
|
173
|
+
// dispatch(stopSubmit(props.formID));
|
|
174
|
+
}).then(function () {
|
|
175
|
+
props.onError();
|
|
176
|
+
});
|
|
177
|
+
} else {
|
|
178
|
+
(0, _utility.delay)().
|
|
179
|
+
// then(() => {
|
|
180
|
+
// dispatch(notifyError("Nu am putut prelua informațiile firmei"));
|
|
181
|
+
// }).
|
|
182
|
+
then(function () {
|
|
183
|
+
dispatch((0, _immutable.stopSubmit)(props.formID));
|
|
184
|
+
}).then(function () {
|
|
185
|
+
props.focusInput();
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
endRequest(false);
|
|
190
|
+
});
|
|
191
|
+
} else {
|
|
192
|
+
(0, _utility.delay)().then(function () {
|
|
193
|
+
dispatch((0, _actions.notifyWarning)("Trebuie furnizat un CIF valid"));
|
|
194
|
+
}).then(function () {
|
|
195
|
+
// dispatch(stopSubmit(props.formID));
|
|
196
|
+
}).then(function () {
|
|
197
|
+
props.focusInput();
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
},
|
|
202
|
+
checkIfNeedsToRequest = function checkIfNeedsToRequest(current) {
|
|
203
|
+
clearText();
|
|
204
|
+
clearTimeout(typeDelay);
|
|
116
205
|
|
|
117
|
-
var
|
|
118
|
-
|
|
206
|
+
var typeTimeout = setTimeout(function () {
|
|
207
|
+
var isValid = (0, _utility.isValidCIF)(current),
|
|
208
|
+
hasNotRequestedThis = !theHistory.has(current);
|
|
119
209
|
|
|
120
|
-
|
|
121
|
-
|
|
210
|
+
if (isValid && hasNotRequestedThis) {
|
|
211
|
+
searchOnWeb(current, true)();
|
|
212
|
+
}
|
|
213
|
+
}, 2000);
|
|
122
214
|
|
|
123
|
-
|
|
215
|
+
setTypeDelay(typeTimeout);
|
|
216
|
+
},
|
|
217
|
+
handleKeyUp = function handleKeyUp() {
|
|
218
|
+
setHasRequested(false);
|
|
219
|
+
var current = props.input.value;
|
|
124
220
|
|
|
125
|
-
|
|
126
|
-
var _this$props = _this.props,
|
|
127
|
-
findDetailsByCif = _this$props.findDetailsByCif,
|
|
128
|
-
value = _this$props.input.value;
|
|
221
|
+
checkIfNeedsToRequest(current);
|
|
129
222
|
|
|
223
|
+
// const { justEnter, input: { value } } = props;
|
|
130
224
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return CifFieldContainer;
|
|
155
|
-
}(_react2.default.Component);
|
|
156
|
-
|
|
157
|
-
exports.default = (0, _reactRedux.connect)(null, mapDispatchToProps)(CifFieldContainer);
|
|
225
|
+
// const fired = (
|
|
226
|
+
// (justEnter && event.key === "Enter") ||
|
|
227
|
+
// (!justEnter && (event.key === "Enter" && event.shiftKey))
|
|
228
|
+
// );
|
|
229
|
+
|
|
230
|
+
// if (fired) {
|
|
231
|
+
// event.preventDefault();
|
|
232
|
+
// event.stopPropagation();
|
|
233
|
+
// findDetailsByCif(value)();
|
|
234
|
+
// }
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
return _react2.default.createElement(_CifField2.default, _extends({}, props, {
|
|
238
|
+
findDetailsByCif: searchOnWeb,
|
|
239
|
+
foundData: foundData,
|
|
240
|
+
handleKeyUp: handleKeyUp,
|
|
241
|
+
hasRequested: hasRequested,
|
|
242
|
+
isGood: isGood,
|
|
243
|
+
isWaiting: isWaiting
|
|
244
|
+
}));
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
exports.default = CifContainer;
|
|
@@ -32,8 +32,8 @@ var normalizeCompanyDetails = function normalizeCompanyDetails(resolve, reject)
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
var getCompanyDetails = exports.getCompanyDetails = function getCompanyDetails(cif) {
|
|
35
|
+
var getCompanyDetails = exports.getCompanyDetails = function getCompanyDetails(cif, reason) {
|
|
36
36
|
return new Promise(function (resolve, reject) {
|
|
37
|
-
return _superagent2.default.post("/api/extern/get-company-information/" + cif).type("json").end(normalizeCompanyDetails(resolve, reject));
|
|
37
|
+
return _superagent2.default.post("/api/extern/get-company-information/" + cif + "/" + reason).type("json").end(normalizeCompanyDetails(resolve, reject));
|
|
38
38
|
});
|
|
39
39
|
};
|
package/package.json
CHANGED