x25 3.0.0 → 17.0.0
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/Account/Load.js +75 -0
- package/Account/actions.js +15 -0
- package/Account/index.js +20 -0
- package/Account/reducer.js +122 -0
- package/Account/request.js +44 -0
- package/Async/InitModule.js +190 -0
- package/Async/RouteLoading.js +64 -0
- package/Async/SimulatedException.js +44 -0
- package/Async/index.js +95 -0
- package/Async/types.js +1 -0
- package/Company/Load.js +82 -0
- package/Company/actions.js +15 -0
- package/Company/index.js +20 -0
- package/Company/reducer.js +165 -0
- package/Company/request.js +36 -0
- package/Company/util.js +10 -0
- package/Header/AccountOptionsContainer.js +144 -0
- package/Header/AdminSelectCompany.js +109 -0
- package/Header/ClientSelectCompany.js +104 -0
- package/Header/Header.js +127 -0
- package/Header/HeaderContainer.js +39 -0
- package/Header/Logo.js +30 -0
- package/Header/LogoutButton.js +39 -0
- package/Header/index.js +19 -0
- package/Header/request.js +26 -0
- package/Header/types.js +1 -0
- package/Header/util.js +58 -0
- package/Inputs/Business/BankAccount.js +48 -0
- package/Inputs/Business/BankName.js +49 -0
- package/Inputs/Business/CifField.js +112 -0
- package/Inputs/Business/CifFieldContainer.js +157 -0
- package/Inputs/Business/Email.js +37 -0
- package/Inputs/Business/NidField.js +91 -0
- package/Inputs/Business/Phone.js +37 -0
- package/Inputs/Business/index.js +34 -0
- package/Inputs/Business/request.js +39 -0
- package/Inputs/CaptchaBox.js +151 -0
- package/Inputs/DateInput.js +172 -0
- package/Inputs/DateTemplate.js +200 -0
- package/Inputs/DelayInputChange.js +135 -0
- package/Inputs/FocusTemplate.js +47 -0
- package/Inputs/InputTemplate.js +78 -0
- package/Inputs/LabelTemplate.js +59 -0
- package/Inputs/NumericInput.js +139 -0
- package/Inputs/NumericTemplate.js +148 -0
- package/Inputs/Selects/County.js +29 -0
- package/Inputs/Selects/Custom.js +56 -0
- package/Inputs/Selects/Simple.js +75 -0
- package/Inputs/Selects/index.js +52 -0
- package/Inputs/SimpleInput.js +42 -0
- package/Inputs/SimpleTextarea.js +47 -0
- package/Inputs/TextareaTemplate.js +55 -0
- package/Inputs/Tooltip.js +82 -0
- package/Inputs/index.js +185 -0
- package/Messages/Error.js +106 -0
- package/Messages/Loading.js +68 -0
- package/Messages/index.js +29 -0
- package/Modal/Delete.js +240 -0
- package/Modal/Root.js +81 -0
- package/Modal/SimpleModal.js +57 -0
- package/Modal/actions.js +10 -0
- package/Modal/getComponent.js +42 -0
- package/Modal/index.js +22 -0
- package/Modal/reducer.js +53 -0
- package/Modal/types.js +7 -0
- package/Modal/util.js +17 -0
- package/Payment/EstimatePrice/Description.js +92 -0
- package/Payment/EstimatePrice/PayBox.js +220 -0
- package/Payment/EstimatePrice/index.js +92 -0
- package/Payment/EstimatePrice/util.js +21 -0
- package/Payment/MobilpayForm.js +86 -0
- package/Payment/Modal/BankTransfer.js +233 -0
- package/Payment/Modal/CompanyValability.js +28 -0
- package/Payment/Modal/DoneForm.js +222 -0
- package/Payment/Modal/PaymentDone.js +53 -0
- package/Payment/Modal/index.js +27 -0
- package/Payment/actions.js +23 -0
- package/{src/Payment → Payment}/codes.js +19 -16
- package/Payment/index.js +141 -0
- package/Payment/request.js +49 -0
- package/Payment/types.js +1 -0
- package/Payment/util.js +50 -0
- package/Payment/validate.js +23 -0
- package/Sidebar.js +156 -0
- package/Things.js +53 -0
- package/actions.js +73 -0
- package/config.js +10 -0
- package/dev/ErrorBoundary.js +109 -0
- package/dev/TheError.js +113 -0
- package/dev/index.js +132 -0
- package/dev/types.js +1 -0
- package/package.json +13 -13
- package/prod/SentryErrorBoundary.js +150 -0
- package/reducer/captchas.js +51 -0
- package/reducer/counties.js +57 -0
- package/reducer/index.js +38 -0
- package/reducer/module.js +48 -0
- package/style/index.css +1 -0
- package/style/sidebar.css +1 -0
- package/types.js +1 -0
- package/utility/calendar.js +45 -0
- package/utility/date.js +111 -0
- package/utility/index.js +125 -0
- package/utility/language.js +20 -0
- package/utility/mql.js +6 -0
- package/utility/normalize-test.js +54 -0
- package/utility/normalize.js +108 -0
- package/utility/numbers.js +93 -0
- package/utility/numeric.js +103 -0
- package/utility/others.js +142 -0
- package/utility/strings-test.js +216 -0
- package/utility/strings.js +85 -0
- package/utility/validation/common.js +278 -0
- package/utility/validation/index.js +110 -0
- package/utility/validation/specific.js +14 -0
- package/utility/validation/validate/bank-test.js +41 -0
- package/utility/validation/validate/bank.js +176 -0
- package/utility/validation/validate/cif-test.js +37 -0
- package/utility/validation/validate/cif.js +44 -0
- package/utility/validation/validate/cnp-test.js +68 -0
- package/utility/validation/validate/cnp.js +193 -0
- package/{src/utility → utility}/validation/validate/date.js +61 -73
- package/utility/validation/validate/email-test.js +30 -0
- package/utility/validation/validate/email.js +11 -0
- package/utility/validation/validate/index.js +65 -0
- package/.eslintignore +0 -2
- package/.eslintrc.json +0 -275
- package/.flowconfig +0 -23
- package/conf/dev.js +0 -19
- package/conf/dist.js +0 -19
- package/conf/polyfills/tempPolyfills.js +0 -7
- package/src/Account/Load.jsx +0 -79
- package/src/Account/actions.js +0 -10
- package/src/Account/index.js +0 -11
- package/src/Account/reducer.js +0 -139
- package/src/Account/request.js +0 -36
- package/src/Async/InitModule.jsx +0 -114
- package/src/Async/RouteLoading.jsx +0 -52
- package/src/Async/SimulatedException.jsx +0 -19
- package/src/Async/index.jsx +0 -75
- package/src/Async/types.js +0 -39
- package/src/Company/Load.jsx +0 -84
- package/src/Company/actions.js +0 -10
- package/src/Company/index.js +0 -11
- package/src/Company/reducer.js +0 -201
- package/src/Company/request.js +0 -30
- package/src/Company/util.js +0 -7
- package/src/Header/AccountOptionsContainer.jsx +0 -124
- package/src/Header/AdminSelectCompany.jsx +0 -101
- package/src/Header/ClientSelectCompany.jsx +0 -90
- package/src/Header/Header.jsx +0 -120
- package/src/Header/HeaderContainer.jsx +0 -30
- package/src/Header/Logo.jsx +0 -16
- package/src/Header/LogoutButton.jsx +0 -34
- package/src/Header/index.jsx +0 -9
- package/src/Header/request.js +0 -28
- package/src/Header/types.js +0 -6
- package/src/Header/util.jsx +0 -61
- package/src/Inputs/Business/BankAccount.jsx +0 -39
- package/src/Inputs/Business/BankName.jsx +0 -40
- package/src/Inputs/Business/CifField.jsx +0 -93
- package/src/Inputs/Business/CifFieldContainer.jsx +0 -142
- package/src/Inputs/Business/Email.jsx +0 -23
- package/src/Inputs/Business/NidField.jsx +0 -77
- package/src/Inputs/Business/Phone.jsx +0 -23
- package/src/Inputs/Business/index.js +0 -16
- package/src/Inputs/Business/request.js +0 -39
- package/src/Inputs/CaptchaBox.jsx +0 -131
- package/src/Inputs/DateInput.jsx +0 -188
- package/src/Inputs/DateTemplate.jsx +0 -213
- package/src/Inputs/DelayInputChange.jsx +0 -130
- package/src/Inputs/FocusTemplate.jsx +0 -41
- package/src/Inputs/InputTemplate.jsx +0 -79
- package/src/Inputs/LabelTemplate.jsx +0 -47
- package/src/Inputs/NumericInput.jsx +0 -142
- package/src/Inputs/NumericTemplate.jsx +0 -155
- package/src/Inputs/Selects/County.jsx +0 -19
- package/src/Inputs/Selects/Custom.jsx +0 -55
- package/src/Inputs/Selects/Simple.jsx +0 -73
- package/src/Inputs/Selects/index.jsx +0 -37
- package/src/Inputs/SimpleInput.jsx +0 -40
- package/src/Inputs/SimpleTextarea.jsx +0 -55
- package/src/Inputs/TextareaTemplate.jsx +0 -57
- package/src/Inputs/Tooltip.jsx +0 -61
- package/src/Inputs/index.js +0 -22
- package/src/Messages/Error.jsx +0 -83
- package/src/Messages/Loading.jsx +0 -43
- package/src/Messages/index.jsx +0 -4
- package/src/Modal/Delete.jsx +0 -237
- package/src/Modal/Root.jsx +0 -57
- package/src/Modal/SimpleModal.jsx +0 -47
- package/src/Modal/actions.js +0 -7
- package/src/Modal/getComponent.jsx +0 -32
- package/src/Modal/index.jsx +0 -12
- package/src/Modal/reducer.js +0 -40
- package/src/Modal/types.js +0 -6
- package/src/Modal/util.js +0 -15
- package/src/Payment/EstimatePrice/Description.jsx +0 -101
- package/src/Payment/EstimatePrice/PayBox.jsx +0 -173
- package/src/Payment/EstimatePrice/index.jsx +0 -63
- package/src/Payment/EstimatePrice/util.js +0 -15
- package/src/Payment/MobilpayForm.jsx +0 -77
- package/src/Payment/Modal/BankTransfer.jsx +0 -129
- package/src/Payment/Modal/CompanyValability.jsx +0 -14
- package/src/Payment/Modal/DoneForm.jsx +0 -209
- package/src/Payment/Modal/PaymentDone.jsx +0 -27
- package/src/Payment/Modal/index.js +0 -13
- package/src/Payment/actions.jsx +0 -22
- package/src/Payment/index.jsx +0 -124
- package/src/Payment/request.js +0 -50
- package/src/Payment/types.js +0 -14
- package/src/Payment/util.jsx +0 -52
- package/src/Payment/validate.js +0 -25
- package/src/Sidebar.jsx +0 -158
- package/src/Things.jsx +0 -35
- package/src/actions.js +0 -36
- package/src/config.js +0 -7
- package/src/dev/ErrorBoundary.jsx +0 -98
- package/src/dev/TheError.jsx +0 -87
- package/src/dev/index.js +0 -127
- package/src/dev/types.js +0 -10
- package/src/prod/SentryErrorBoundary.jsx +0 -98
- package/src/reducer/captchas.js +0 -44
- package/src/reducer/counties.js +0 -46
- package/src/reducer/index.js +0 -25
- package/src/reducer/module.jsx +0 -43
- package/src/style/.sass-lint.yml +0 -84
- package/src/style/.stylelintrc.json +0 -161
- package/src/style/_fancy-text.scss +0 -37
- package/src/style/_fix_bootstrap_placeholder_color.scss +0 -14
- package/src/style/_header-company.scss +0 -69
- package/src/style/_inputs.scss +0 -12
- package/src/style/_minimal.scss +0 -31
- package/src/style/_navigation.scss +0 -24
- package/src/style/_others.scss +0 -79
- package/src/style/index.scss +0 -7
- package/src/style/sidebar/_animations.scss +0 -21
- package/src/style/sidebar/_dark-theme.scss +0 -77
- package/src/style/sidebar/_scroll.scss +0 -37
- package/src/style/sidebar/_structure.scss +0 -299
- package/src/style/sidebar.scss +0 -4
- package/src/types.js +0 -31
- package/src/utility/calendar.js +0 -39
- package/src/utility/date.js +0 -100
- package/src/utility/index.js +0 -12
- package/src/utility/language.js +0 -17
- package/src/utility/mql.js +0 -3
- package/src/utility/normalize-test.js +0 -58
- package/src/utility/normalize.js +0 -119
- package/src/utility/numbers.js +0 -87
- package/src/utility/numeric.js +0 -114
- package/src/utility/others.jsx +0 -160
- package/src/utility/strings-test.js +0 -136
- package/src/utility/strings.js +0 -80
- package/src/utility/validation/common.js +0 -360
- package/src/utility/validation/index.js +0 -70
- package/src/utility/validation/specific.js +0 -9
- package/src/utility/validation/validate/bank-test.js +0 -129
- package/src/utility/validation/validate/bank.js +0 -176
- package/src/utility/validation/validate/cif-test.js +0 -105
- package/src/utility/validation/validate/cif.js +0 -44
- package/src/utility/validation/validate/cnp-test.js +0 -216
- package/src/utility/validation/validate/cnp.js +0 -261
- package/src/utility/validation/validate/email-test.js +0 -36
- package/src/utility/validation/validate/email.js +0 -6
- package/src/utility/validation/validate/index.js +0 -7
- package/webpack.config.js +0 -90
- package/x25.wiki/Account.md +0 -41
- package/x25.wiki/Company.md +0 -39
- package/x25.wiki/Header.md +0 -21
- package/x25.wiki/Home.md +0 -1
- package/x25.wiki/Inputs.md +0 -33
- package/x25.wiki/Messages.md +0 -27
- package/x25.wiki/Payment.md +0 -42
package/src/Header/Logo.jsx
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
const SideworkLogo = () => (
|
|
6
|
-
<div className="sidework-logo">
|
|
7
|
-
<span className="first-char">
|
|
8
|
-
{"S"}
|
|
9
|
-
</span>
|
|
10
|
-
<span className="color">
|
|
11
|
-
{"idework"}
|
|
12
|
-
</span>
|
|
13
|
-
</div>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
export default SideworkLogo;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type LogoutButtonPropTypes = {
|
|
4
|
-
+readyToLogout: boolean;
|
|
5
|
-
+logoutAccount: () => void;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
import React from "react";
|
|
9
|
-
|
|
10
|
-
import { LoadingMessage } from "../Messages";
|
|
11
|
-
|
|
12
|
-
const LogoutButton = ({ readyToLogout, logoutAccount } : LogoutButtonPropTypes) => (
|
|
13
|
-
<button
|
|
14
|
-
className="dropdown-item"
|
|
15
|
-
disabled={!readyToLogout}
|
|
16
|
-
id="login-button"
|
|
17
|
-
onClick={logoutAccount}
|
|
18
|
-
type="button">
|
|
19
|
-
{
|
|
20
|
-
readyToLogout ? (
|
|
21
|
-
<span>
|
|
22
|
-
<i className="fa fa-sign-out" />
|
|
23
|
-
{" Deconectează-mă"}
|
|
24
|
-
</span>
|
|
25
|
-
) : (
|
|
26
|
-
<span>
|
|
27
|
-
<LoadingMessage message="Așteaptă..." sm />
|
|
28
|
-
</span>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
</button>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export default LogoutButton;
|
package/src/Header/index.jsx
DELETED
package/src/Header/request.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import agent from "superagent";
|
|
4
|
-
|
|
5
|
-
import { withPromiseCallback } from "../utility";
|
|
6
|
-
|
|
7
|
-
export const fetchSuggestions = (search : string) => (
|
|
8
|
-
new Promise((resolve, reject) => (
|
|
9
|
-
agent.
|
|
10
|
-
get("/api/account/get-companies").
|
|
11
|
-
type("form").
|
|
12
|
-
set("Accept",
|
|
13
|
-
"application/json").
|
|
14
|
-
query({ search }).
|
|
15
|
-
end(withPromiseCallback(resolve,
|
|
16
|
-
reject))
|
|
17
|
-
)) : Promise<any>
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
export const logOut = () => (
|
|
21
|
-
new Promise((resolve, reject) => (
|
|
22
|
-
agent.
|
|
23
|
-
post("/api/account/logout").
|
|
24
|
-
type("form").
|
|
25
|
-
end(withPromiseCallback(resolve,
|
|
26
|
-
reject))
|
|
27
|
-
)) : Promise<any>
|
|
28
|
-
);
|
package/src/Header/types.js
DELETED
package/src/Header/util.jsx
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import type { CompanyRoutePropTypes } from "./types";
|
|
4
|
-
|
|
5
|
-
type OptionsPropTypes = {
|
|
6
|
-
+label: string;
|
|
7
|
-
|
|
8
|
-
+options: any;
|
|
9
|
-
+clearValue: any;
|
|
10
|
-
+innerProps: any;
|
|
11
|
-
+hasValue: any;
|
|
12
|
-
+isDisabled: any;
|
|
13
|
-
+selectOption: any;
|
|
14
|
-
+cx: any;
|
|
15
|
-
+isFocused: any;
|
|
16
|
-
+isMulti: any;
|
|
17
|
-
+isSelected: any;
|
|
18
|
-
+selectProps: any;
|
|
19
|
-
+getValue: any;
|
|
20
|
-
+innerRef: any;
|
|
21
|
-
+data: any;
|
|
22
|
-
+children: any;
|
|
23
|
-
+getStyles: any;
|
|
24
|
-
+theme: any;
|
|
25
|
-
+type: any;
|
|
26
|
-
+setValue: any;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
import React from "react";
|
|
30
|
-
import { components } from "react-select";
|
|
31
|
-
|
|
32
|
-
export const noOptionsMessage = () => "Nu există opțiuni";
|
|
33
|
-
export const loadingMessage = () => "Se încarcă...";
|
|
34
|
-
|
|
35
|
-
export const Option = (props : OptionsPropTypes) => (
|
|
36
|
-
<div className="text-truncate small" title={props.label}>
|
|
37
|
-
<components.Option {...props} />
|
|
38
|
-
</div>
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
export const isSmall = () => window.matchMedia("(max-width: 780px)").matches;
|
|
42
|
-
|
|
43
|
-
export const wrapperClassname = "search-bar mr-md-1 mb-2 md-mb-0 d-block d-md-inline-block";
|
|
44
|
-
|
|
45
|
-
export const getDefaultCompanyRoute = ({ Modules, ID } : CompanyRoutePropTypes) => {
|
|
46
|
-
const getModule = () => {
|
|
47
|
-
const
|
|
48
|
-
modules = String(Modules),
|
|
49
|
-
parts = modules.split(",");
|
|
50
|
-
|
|
51
|
-
if (modules === "") {
|
|
52
|
-
return "info";
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const [first] = parts;
|
|
56
|
-
|
|
57
|
-
return `${first}/list`;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return `/company/${ID}/${getModule()}`;
|
|
61
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type BankNamePropTypes = {
|
|
4
|
-
+input: any;
|
|
5
|
-
+meta: {
|
|
6
|
-
submitting: boolean;
|
|
7
|
-
touched: boolean;
|
|
8
|
-
error: ?string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
import React from "react";
|
|
13
|
-
import classnames from "classnames";
|
|
14
|
-
|
|
15
|
-
const BankAccount = ({
|
|
16
|
-
input,
|
|
17
|
-
meta: {
|
|
18
|
-
error,
|
|
19
|
-
submitting,
|
|
20
|
-
touched,
|
|
21
|
-
},
|
|
22
|
-
} : BankNamePropTypes) => (
|
|
23
|
-
<div className={classnames("input-group", { "is-invalid": touched && error })}>
|
|
24
|
-
<div className="input-group-prepend">
|
|
25
|
-
<span className="input-group-text">{"Contul"}</span>
|
|
26
|
-
</div>
|
|
27
|
-
<input
|
|
28
|
-
{...input}
|
|
29
|
-
aria-label="Contul bancar"
|
|
30
|
-
className={classnames("form-control", { "is-invalid": touched && error })}
|
|
31
|
-
disabled={submitting}
|
|
32
|
-
id={input.name}
|
|
33
|
-
name={input.name}
|
|
34
|
-
placeholder="ex. RO14 CECE GR02 01RO N026 9171"
|
|
35
|
-
/>
|
|
36
|
-
</div>
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
export default BankAccount;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type BankNamePropTypes = {
|
|
4
|
-
+input: any;
|
|
5
|
-
+meta: {
|
|
6
|
-
submitting: boolean;
|
|
7
|
-
touched: boolean;
|
|
8
|
-
error: ?string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
import React from "react";
|
|
13
|
-
import classnames from "classnames";
|
|
14
|
-
|
|
15
|
-
const BankNameField = ({
|
|
16
|
-
input,
|
|
17
|
-
meta: {
|
|
18
|
-
error,
|
|
19
|
-
submitting,
|
|
20
|
-
touched,
|
|
21
|
-
},
|
|
22
|
-
} : BankNamePropTypes) => (
|
|
23
|
-
<div className={classnames("input-group", { "is-invalid": touched && error })}>
|
|
24
|
-
<div className="input-group-prepend">
|
|
25
|
-
<span className="input-group-text">{"Denumire sau BIC"}</span>
|
|
26
|
-
</div>
|
|
27
|
-
<input
|
|
28
|
-
{...input}
|
|
29
|
-
aria-label="Denumire bancă"
|
|
30
|
-
className={classnames("form-control", { "is-invalid": touched && error })}
|
|
31
|
-
disabled={submitting}
|
|
32
|
-
id={input.name}
|
|
33
|
-
name={input.name}
|
|
34
|
-
placeholder="ex. Banca Transilvania"
|
|
35
|
-
type="text"
|
|
36
|
-
/>
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
export default BankNameField;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type CifFieldPropTypes = {
|
|
4
|
-
+input: any;
|
|
5
|
-
+meta: {
|
|
6
|
-
submitting: boolean;
|
|
7
|
-
touched: boolean;
|
|
8
|
-
error?: string;
|
|
9
|
-
};
|
|
10
|
-
+formID: string;
|
|
11
|
-
+findDetailsByCif: (cif: ?string) => () => void;
|
|
12
|
-
+handleKeyPressed: (event : any) => void;
|
|
13
|
-
+onRegisterRef?: (callback : (node : any) => void) => void;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import React from "react";
|
|
18
|
-
import classnames from "classnames";
|
|
19
|
-
|
|
20
|
-
class CifField extends React.Component<CifFieldPropTypes> {
|
|
21
|
-
props: CifFieldPropTypes;
|
|
22
|
-
|
|
23
|
-
shouldComponentUpdate (nextProps : CifFieldPropTypes) {
|
|
24
|
-
return (
|
|
25
|
-
this.props.input !== nextProps.input ||
|
|
26
|
-
this.props.meta.submitting !== nextProps.meta.submitting ||
|
|
27
|
-
this.props.meta.touched !== nextProps.meta.touched ||
|
|
28
|
-
this.props.meta.error !== nextProps.meta.error
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
render () {
|
|
33
|
-
const {
|
|
34
|
-
input,
|
|
35
|
-
findDetailsByCif,
|
|
36
|
-
meta: {
|
|
37
|
-
error,
|
|
38
|
-
submitting,
|
|
39
|
-
touched,
|
|
40
|
-
},
|
|
41
|
-
handleKeyPressed,
|
|
42
|
-
onRegisterRef,
|
|
43
|
-
} = this.props;
|
|
44
|
-
|
|
45
|
-
const { name } = input;
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<div className="form-group row">
|
|
49
|
-
<label
|
|
50
|
-
className="
|
|
51
|
-
col-md-3
|
|
52
|
-
text-md-right
|
|
53
|
-
form-control-label
|
|
54
|
-
form-control-lg" htmlFor={name}>
|
|
55
|
-
{"C.I.F "}
|
|
56
|
-
</label>
|
|
57
|
-
<div className="col-md-9 col-lg-6">
|
|
58
|
-
<div className="input-group">
|
|
59
|
-
<input
|
|
60
|
-
{...input}
|
|
61
|
-
aria-label="Cod de identificare fiscală"
|
|
62
|
-
className={classnames("form-control form-control-lg", {
|
|
63
|
-
"is-invalid": touched && error,
|
|
64
|
-
})}
|
|
65
|
-
disabled={submitting}
|
|
66
|
-
id={name}
|
|
67
|
-
name={name}
|
|
68
|
-
onKeyPress={handleKeyPressed}
|
|
69
|
-
placeholder="ex. 51584214"
|
|
70
|
-
ref={onRegisterRef}
|
|
71
|
-
type="text"
|
|
72
|
-
/>
|
|
73
|
-
<div className="input-group-append">
|
|
74
|
-
<button
|
|
75
|
-
className="btn btn-secondary btn-lg btn-info"
|
|
76
|
-
disabled={submitting}
|
|
77
|
-
onClick={findDetailsByCif(input.value)}
|
|
78
|
-
title="Preia datele de pe Internet"
|
|
79
|
-
type="button">
|
|
80
|
-
<i className="fa fa-search" />
|
|
81
|
-
</button>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
<div className="invalid-feedback is-valid">
|
|
85
|
-
{ touched && error ? error : null }
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export default CifField;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import type { Dispatch } from "src\\types";
|
|
4
|
-
|
|
5
|
-
type CifFieldContainerPropTypes = {
|
|
6
|
-
+input: any;
|
|
7
|
-
+meta: {
|
|
8
|
-
submitting: boolean;
|
|
9
|
-
touched: boolean;
|
|
10
|
-
error?: string;
|
|
11
|
-
};
|
|
12
|
-
+formID: string;
|
|
13
|
-
+findDetailsByCif: (cif: ?string) => () => void;
|
|
14
|
-
+onRegisterRef?: (callback : (node : any) => void) => void;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type OwnProps = {
|
|
18
|
-
formID: string;
|
|
19
|
-
focusInput: () => void;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
import React from "react";
|
|
23
|
-
import { change, startSubmit, stopSubmit } from "redux-form/immutable";
|
|
24
|
-
|
|
25
|
-
import { connect } from "react-redux";
|
|
26
|
-
|
|
27
|
-
import { getCompanyDetails } from "./request";
|
|
28
|
-
|
|
29
|
-
import * as actions from "../../actions";
|
|
30
|
-
|
|
31
|
-
import { delay, isValidCIF } from "../../utility";
|
|
32
|
-
|
|
33
|
-
import CifField from "./CifField";
|
|
34
|
-
|
|
35
|
-
const createPromise = (after) => (
|
|
36
|
-
new Promise((resolve) => {
|
|
37
|
-
after();
|
|
38
|
-
setTimeout(() => {
|
|
39
|
-
resolve();
|
|
40
|
-
});
|
|
41
|
-
})
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
const tryToGetInfo = ({ dispatch, cif, focusInput, formID }) => (
|
|
45
|
-
getCompanyDetails(cif).then((response) => {
|
|
46
|
-
const
|
|
47
|
-
before = [createPromise(() => dispatch(actions.notify("Am preluat informațiile")))],
|
|
48
|
-
changes = Object.keys(response).map((key) => () : Promise<any> => (
|
|
49
|
-
createPromise(() => dispatch(change(formID, key, response[key])))
|
|
50
|
-
)),
|
|
51
|
-
after = [
|
|
52
|
-
createPromise(() => dispatch(stopSubmit(formID))),
|
|
53
|
-
createPromise(() => focusInput()),
|
|
54
|
-
];
|
|
55
|
-
|
|
56
|
-
const promises = before.concat(changes).concat(after);
|
|
57
|
-
|
|
58
|
-
promises.reduce((prev, cur : any) => prev.then(cur), Promise.resolve());
|
|
59
|
-
}).
|
|
60
|
-
catch(() => {
|
|
61
|
-
delay().
|
|
62
|
-
then(() => {
|
|
63
|
-
dispatch(actions.notifyError("Nu am putut prelua informațiile firmei"));
|
|
64
|
-
}).
|
|
65
|
-
then(() => {
|
|
66
|
-
dispatch(stopSubmit(formID));
|
|
67
|
-
}).
|
|
68
|
-
then(() => {
|
|
69
|
-
focusInput();
|
|
70
|
-
});
|
|
71
|
-
})
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
mapDispatchToProps = (dispatch : Dispatch, { formID, focusInput } : OwnProps) => ({
|
|
76
|
-
findDetailsByCif: (cif : string) => () => {
|
|
77
|
-
dispatch(startSubmit(formID));
|
|
78
|
-
|
|
79
|
-
if (isValidCIF(cif)) {
|
|
80
|
-
tryToGetInfo({
|
|
81
|
-
dispatch,
|
|
82
|
-
cif,
|
|
83
|
-
focusInput,
|
|
84
|
-
formID,
|
|
85
|
-
});
|
|
86
|
-
} else {
|
|
87
|
-
delay().
|
|
88
|
-
then(() => {
|
|
89
|
-
dispatch(actions.notifyError("Trebuie furnizat un CIF valid"));
|
|
90
|
-
}).
|
|
91
|
-
then(() => {
|
|
92
|
-
dispatch(stopSubmit(formID));
|
|
93
|
-
}).
|
|
94
|
-
then(() => {
|
|
95
|
-
focusInput();
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
class CifFieldContainer extends React.Component<CifFieldContainerPropTypes> {
|
|
102
|
-
props: CifFieldContainerPropTypes;
|
|
103
|
-
|
|
104
|
-
handleKeyPressed: (event : any) => void;
|
|
105
|
-
|
|
106
|
-
constructor (props: CifFieldContainerPropTypes) {
|
|
107
|
-
super(props);
|
|
108
|
-
|
|
109
|
-
this.handleKeyPressed = (event : any) => {
|
|
110
|
-
const {
|
|
111
|
-
findDetailsByCif,
|
|
112
|
-
input: { value },
|
|
113
|
-
} = this.props;
|
|
114
|
-
|
|
115
|
-
if (event.key === "Enter" && event.shiftKey) {
|
|
116
|
-
event.preventDefault();
|
|
117
|
-
event.stopPropagation();
|
|
118
|
-
findDetailsByCif(value)();
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
shouldComponentUpdate (nextProps : CifFieldContainerPropTypes) {
|
|
124
|
-
return (
|
|
125
|
-
this.props.input !== nextProps.input ||
|
|
126
|
-
this.props.meta.submitting !== nextProps.meta.submitting ||
|
|
127
|
-
this.props.meta.touched !== nextProps.meta.touched ||
|
|
128
|
-
this.props.meta.error !== nextProps.meta.error
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
render () {
|
|
133
|
-
return (
|
|
134
|
-
<CifField
|
|
135
|
-
{...this.props}
|
|
136
|
-
handleKeyPressed={this.handleKeyPressed}
|
|
137
|
-
/>
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export default connect(null, mapDispatchToProps)(CifFieldContainer);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
/* eslint-disable no-duplicate-imports */
|
|
3
|
-
|
|
4
|
-
import type { SimpleInputPropTypes } from "../SimpleInput";
|
|
5
|
-
|
|
6
|
-
import React from "react";
|
|
7
|
-
import { SimpleInput } from "../SimpleInput";
|
|
8
|
-
|
|
9
|
-
const EmailInput = (props : SimpleInputPropTypes) => (
|
|
10
|
-
<div className="input-group">
|
|
11
|
-
<div className="input-group-prepend">
|
|
12
|
-
<span className="input-group-text">
|
|
13
|
-
<i className="fa fa-envelope-o" />
|
|
14
|
-
</span>
|
|
15
|
-
</div>
|
|
16
|
-
<SimpleInput
|
|
17
|
-
{...props}
|
|
18
|
-
placeholder="ex. design@gmail.ro"
|
|
19
|
-
/>
|
|
20
|
-
</div>
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
export default EmailInput;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type NidFieldPropTypes = {
|
|
4
|
-
+input: any;
|
|
5
|
-
+meta: {
|
|
6
|
-
submitting: boolean;
|
|
7
|
-
touched: boolean;
|
|
8
|
-
error?: string;
|
|
9
|
-
};
|
|
10
|
-
+formID: string;
|
|
11
|
-
+findDetailsByNid: (Nid: ?string) => () => void;
|
|
12
|
-
+onRegisterRef: ?(callback : (node : any) => void) => void;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
import React from "react";
|
|
16
|
-
import classnames from "classnames";
|
|
17
|
-
|
|
18
|
-
class NidField extends React.Component<NidFieldPropTypes> {
|
|
19
|
-
props: NidFieldPropTypes;
|
|
20
|
-
|
|
21
|
-
shouldComponentUpdate (nextProps : NidFieldPropTypes) {
|
|
22
|
-
return (
|
|
23
|
-
this.props.input !== nextProps.input ||
|
|
24
|
-
this.props.meta.submitting !== nextProps.meta.submitting ||
|
|
25
|
-
this.props.meta.touched !== nextProps.meta.touched ||
|
|
26
|
-
this.props.meta.error !== nextProps.meta.error
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
render () {
|
|
31
|
-
|
|
32
|
-
const {
|
|
33
|
-
input,
|
|
34
|
-
meta: {
|
|
35
|
-
error,
|
|
36
|
-
submitting,
|
|
37
|
-
touched,
|
|
38
|
-
},
|
|
39
|
-
onRegisterRef,
|
|
40
|
-
} = this.props;
|
|
41
|
-
|
|
42
|
-
const { name } = input;
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<div className={classnames("form-group row", { "is-invalid": touched && error })}>
|
|
46
|
-
<label
|
|
47
|
-
className="
|
|
48
|
-
col-md-3
|
|
49
|
-
text-md-right
|
|
50
|
-
form-control-label
|
|
51
|
-
form-control-lg" htmlFor={name}>
|
|
52
|
-
{"C.N.P "}
|
|
53
|
-
</label>
|
|
54
|
-
<div className="col-md-9 col-lg-6">
|
|
55
|
-
<input
|
|
56
|
-
{...input}
|
|
57
|
-
aria-label="Cod numeric personal"
|
|
58
|
-
className={classnames("form-control form-control-lg", {
|
|
59
|
-
"is-invalid": touched && error,
|
|
60
|
-
})}
|
|
61
|
-
disabled={submitting}
|
|
62
|
-
id={name}
|
|
63
|
-
name={name}
|
|
64
|
-
placeholder="ex. 1750826256625"
|
|
65
|
-
ref={onRegisterRef}
|
|
66
|
-
type="text"
|
|
67
|
-
/>
|
|
68
|
-
<div className="invalid-feedback">
|
|
69
|
-
{ touched && error ? error : null }
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export default NidField;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
/* eslint-disable no-duplicate-imports */
|
|
3
|
-
|
|
4
|
-
import type { SimpleInputPropTypes } from "../SimpleInput";
|
|
5
|
-
|
|
6
|
-
import React from "react";
|
|
7
|
-
import { SimpleInput } from "../SimpleInput";
|
|
8
|
-
|
|
9
|
-
const PhoneInput = (props : SimpleInputPropTypes) => (
|
|
10
|
-
<div className="input-group">
|
|
11
|
-
<div className="input-group-prepend">
|
|
12
|
-
<span className="input-group-text">
|
|
13
|
-
<i className="fa fa-phone" />
|
|
14
|
-
</span>
|
|
15
|
-
</div>
|
|
16
|
-
<SimpleInput
|
|
17
|
-
{...props}
|
|
18
|
-
placeholder="ex. 0755326517"
|
|
19
|
-
/>
|
|
20
|
-
</div>
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
export default PhoneInput;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import EmailInput from "./Email";
|
|
5
|
-
import PhoneInput from "./Phone";
|
|
6
|
-
import BankAccountInput from "./BankAccount";
|
|
7
|
-
import BankNameField from "./BankName";
|
|
8
|
-
import CifFieldContainer from "./CifFieldContainer";
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
EmailInput,
|
|
12
|
-
PhoneInput,
|
|
13
|
-
BankAccountInput,
|
|
14
|
-
BankNameField,
|
|
15
|
-
CifFieldContainer,
|
|
16
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import agent from "superagent";
|
|
4
|
-
|
|
5
|
-
const fields = [
|
|
6
|
-
"Address",
|
|
7
|
-
"IsVatPayer",
|
|
8
|
-
"Name",
|
|
9
|
-
"Phone",
|
|
10
|
-
"Registration",
|
|
11
|
-
"Email",
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
const normalizeCompanyDetails = (resolve, reject) => (
|
|
15
|
-
(error, response) => {
|
|
16
|
-
if (error) {
|
|
17
|
-
reject({ error });
|
|
18
|
-
} else {
|
|
19
|
-
const { body } = response;
|
|
20
|
-
|
|
21
|
-
resolve(fields.reduce((accumulator, currentValue) => ({
|
|
22
|
-
// $FlowFixMe
|
|
23
|
-
...accumulator,
|
|
24
|
-
// $FlowFixMe
|
|
25
|
-
[currentValue]: body[currentValue],
|
|
26
|
-
}), {}));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
export const getCompanyDetails = (cif: string) => (
|
|
32
|
-
new Promise((resolve, reject) => (
|
|
33
|
-
agent.
|
|
34
|
-
post(`/api/extern/get-company-information/${cif}`).
|
|
35
|
-
type("json").
|
|
36
|
-
end(normalizeCompanyDetails(resolve,
|
|
37
|
-
reject))
|
|
38
|
-
)) : Promise<any>
|
|
39
|
-
);
|