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/Company/Load.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
|
|
9
|
+
var _react2 = _interopRequireDefault(_react);
|
|
10
|
+
|
|
11
|
+
var _reactRouterDom = require("react-router-dom");
|
|
12
|
+
|
|
13
|
+
var _reactRedux = require("react-redux");
|
|
14
|
+
|
|
15
|
+
var _reducer = require("./reducer");
|
|
16
|
+
|
|
17
|
+
var _Account = require("../Account");
|
|
18
|
+
|
|
19
|
+
var _actions = require("./actions");
|
|
20
|
+
|
|
21
|
+
var _Messages = require("../Messages");
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
|
|
25
|
+
// import EstimatePrice from "../Payment/EstimatePrice";
|
|
26
|
+
|
|
27
|
+
var mapStateToProps = function mapStateToProps(state) {
|
|
28
|
+
return {
|
|
29
|
+
isAdministrator: _Account.accountSelectors.getIsCurrentAccountAdministrator(state),
|
|
30
|
+
data: _reducer.selectors.getCurrentCompany(state),
|
|
31
|
+
hasError: _reducer.selectors.getCurrentCompanyHasError(state),
|
|
32
|
+
fetched: _reducer.selectors.getCurrentCompanyIsFetched(state),
|
|
33
|
+
isFetching: _reducer.selectors.getCurrentCompanyIsFetching(state),
|
|
34
|
+
shouldFetch: _reducer.selectors.getCurrentCompanyShouldFetch(state)
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
mapDispatchToProps = function mapDispatchToProps(dispatch, _ref) {
|
|
38
|
+
var company = _ref.match.params.company;
|
|
39
|
+
return {
|
|
40
|
+
fetchCurrentCompany: function fetchCurrentCompany() {
|
|
41
|
+
dispatch((0, _actions.fetchCurrentCompany)(company));
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
// import moment from "moment";
|
|
46
|
+
|
|
47
|
+
/* eslint-disable react/require-optimization */
|
|
48
|
+
|
|
49
|
+
var LoadCompany = function LoadCompany(props) {
|
|
50
|
+
var children = props.children,
|
|
51
|
+
data = props.data,
|
|
52
|
+
isFetching = props.isFetching,
|
|
53
|
+
shouldFetch = props.shouldFetch,
|
|
54
|
+
hasError = props.hasError,
|
|
55
|
+
fetchCurrentCompany = props.fetchCurrentCompany;
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
_react2.default.useEffect(function () {
|
|
59
|
+
if (shouldFetch) {
|
|
60
|
+
fetchCurrentCompany();
|
|
61
|
+
}
|
|
62
|
+
}, [shouldFetch, isFetching, hasError]);
|
|
63
|
+
|
|
64
|
+
if (isFetching) {
|
|
65
|
+
return _react2.default.createElement(_Messages.LoadingMessage, { message: "A\u0219teapt\u0103..." });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (hasError) {
|
|
69
|
+
return _react2.default.createElement(_Messages.LargeErrorMessage, {
|
|
70
|
+
message: "Nu am putut stabili conexiunea cu server-ul",
|
|
71
|
+
onRetry: fetchCurrentCompany
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (data.size === 0) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return children;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
exports.default = (0, _reactRouterDom.withRouter)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(LoadCompany));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.fetchCurrentCompany = undefined;
|
|
7
|
+
|
|
8
|
+
var _request = require("./request");
|
|
9
|
+
|
|
10
|
+
var fetchCurrentCompany = exports.fetchCurrentCompany = function fetchCurrentCompany(rawID) {
|
|
11
|
+
return {
|
|
12
|
+
type: "FETCH_CURRENT_COMPANY_INFO",
|
|
13
|
+
payload: (0, _request.fetchCurrentCompany)(rawID)
|
|
14
|
+
};
|
|
15
|
+
};
|
package/Company/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LoadCompany = exports.companyReducer = exports.companySelectors = undefined;
|
|
7
|
+
|
|
8
|
+
var _reducer = require("./reducer");
|
|
9
|
+
|
|
10
|
+
var _reducer2 = _interopRequireDefault(_reducer);
|
|
11
|
+
|
|
12
|
+
var _Load = require("./Load");
|
|
13
|
+
|
|
14
|
+
var _Load2 = _interopRequireDefault(_Load);
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
exports.companySelectors = _reducer.selectors;
|
|
19
|
+
exports.companyReducer = _reducer2.default;
|
|
20
|
+
exports.LoadCompany = _Load2.default;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.selectors = undefined;
|
|
7
|
+
|
|
8
|
+
var _immutable = require("immutable");
|
|
9
|
+
|
|
10
|
+
var Immutable = _interopRequireWildcard(_immutable);
|
|
11
|
+
|
|
12
|
+
var _reselect = require("reselect");
|
|
13
|
+
|
|
14
|
+
var _utility = require("../utility");
|
|
15
|
+
|
|
16
|
+
var _util = require("./util");
|
|
17
|
+
|
|
18
|
+
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; } }
|
|
19
|
+
|
|
20
|
+
/* eslint-disable global-require */
|
|
21
|
+
|
|
22
|
+
var reducerKey = "companyInfo";
|
|
23
|
+
|
|
24
|
+
var initialState = Immutable.Map({
|
|
25
|
+
error: _utility.noError,
|
|
26
|
+
fetched: false,
|
|
27
|
+
fetching: false,
|
|
28
|
+
|
|
29
|
+
company: Immutable.Map()
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
var fetchCompanyPending = function fetchCompanyPending() {
|
|
33
|
+
return initialState.set("fetching", true);
|
|
34
|
+
},
|
|
35
|
+
fetchCompanyRejected = function fetchCompanyRejected(state, _ref) {
|
|
36
|
+
var error = _ref.payload.error;
|
|
37
|
+
return state.merge({
|
|
38
|
+
error: error,
|
|
39
|
+
fetching: false
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
fetchCompanyFulfilled = function fetchCompanyFulfilled(state, _ref2) {
|
|
43
|
+
var payload = _ref2.payload;
|
|
44
|
+
return state.mergeDeep({
|
|
45
|
+
fetched: true,
|
|
46
|
+
fetching: false,
|
|
47
|
+
company: payload
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
modifyCompany = function modifyCompany(state, _ref3) {
|
|
51
|
+
var payload = _ref3.payload;
|
|
52
|
+
return state.set("company", payload);
|
|
53
|
+
},
|
|
54
|
+
clearInfoIfCurrentCompany = function clearInfoIfCurrentCompany(state, _ref4) {
|
|
55
|
+
var payload = _ref4.payload;
|
|
56
|
+
|
|
57
|
+
var companyID = String(state.getIn(["company", "ID"])),
|
|
58
|
+
fetched = state.get("fetched"),
|
|
59
|
+
dataID = String(payload.get("ID")),
|
|
60
|
+
theCurrentCompanyHasChanged = fetched && dataID === companyID;
|
|
61
|
+
|
|
62
|
+
if (theCurrentCompanyHasChanged) {
|
|
63
|
+
return state.clear();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return state;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var reducer = function reducer() {
|
|
70
|
+
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
71
|
+
var action = arguments[1];
|
|
72
|
+
|
|
73
|
+
switch (action.type) {
|
|
74
|
+
case "FETCH_CURRENT_COMPANY_INFO_PENDING":
|
|
75
|
+
return fetchCompanyPending();
|
|
76
|
+
|
|
77
|
+
case "FETCH_CURRENT_COMPANY_INFO_REJECTED":
|
|
78
|
+
return fetchCompanyRejected(state, action);
|
|
79
|
+
|
|
80
|
+
case "FETCH_CURRENT_COMPANY_INFO_FULFILLED":
|
|
81
|
+
return fetchCompanyFulfilled(state, action);
|
|
82
|
+
|
|
83
|
+
case "MODIFY_CURRENT_COMPANY_INFO":
|
|
84
|
+
return modifyCompany(state, action);
|
|
85
|
+
|
|
86
|
+
case "TOGGLE_COMPANY_STATE":
|
|
87
|
+
case "DELETE_COMPANY":
|
|
88
|
+
return clearInfoIfCurrentCompany(state, action);
|
|
89
|
+
|
|
90
|
+
default:
|
|
91
|
+
return state;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
var getFetching = function getFetching(state) {
|
|
96
|
+
return state.getIn([reducerKey, "fetching"]) || false;
|
|
97
|
+
},
|
|
98
|
+
getFetched = function getFetched(state) {
|
|
99
|
+
return state.getIn([reducerKey, "fetched"]) || false;
|
|
100
|
+
},
|
|
101
|
+
getError = function getError(state) {
|
|
102
|
+
return state.getIn([reducerKey, "error"]) || _utility.noError;
|
|
103
|
+
},
|
|
104
|
+
getCurrentAccountFetched = function getCurrentAccountFetched(state) {
|
|
105
|
+
return state.getIn(["account", "fetched"]) || false;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
var checkForNoErrors = function checkForNoErrors(error) {
|
|
109
|
+
return error !== _utility.noError;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
var getCurrentCompany = function getCurrentCompany(state) {
|
|
113
|
+
return state.getIn([reducerKey, "company"]) || Immutable.Map();
|
|
114
|
+
},
|
|
115
|
+
getCurrentCompanyIsFetched = (0, _reselect.createSelector)(getFetching, getFetched, getError, function (isFetching, isFetched, error) {
|
|
116
|
+
return !isFetching && isFetched && error === _utility.noError;
|
|
117
|
+
}),
|
|
118
|
+
getCurrentCompanyIsFetching = (0, _reselect.createSelector)(getFetching, getError, function (isFetching, error) {
|
|
119
|
+
return isFetching && error === _utility.noError;
|
|
120
|
+
}),
|
|
121
|
+
getCurrentCompanyHasError = (0, _reselect.createSelector)(getError, checkForNoErrors),
|
|
122
|
+
getCurrentCompanyShouldFetch = (0, _reselect.createSelector)(getCurrentAccountFetched, getCurrentCompanyIsFetched, getCurrentCompanyHasError, getFetching, getCurrentCompany, function (accountFetched, isFetched, hasError, isFetching, company) {
|
|
123
|
+
return function (rawID) {
|
|
124
|
+
var hasIDChanged = function hasIDChanged() {
|
|
125
|
+
var id = company.get("ID"),
|
|
126
|
+
newID = Number(rawID);
|
|
127
|
+
|
|
128
|
+
return id === 0 || id !== newID || id === newID && !isFetched;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
return accountFetched && !hasError && !isFetching && hasIDChanged();
|
|
132
|
+
};
|
|
133
|
+
}),
|
|
134
|
+
getCompanyModules = (0, _reselect.createSelector)(getCurrentCompany, function (company) {
|
|
135
|
+
return company.get("Modules") || "";
|
|
136
|
+
}),
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
/*
|
|
140
|
+
This function is special, because it is called also in the
|
|
141
|
+
requests
|
|
142
|
+
In case the state is not ready, we take the id of the current company
|
|
143
|
+
from the URL
|
|
144
|
+
The url must have this pathname:
|
|
145
|
+
something/:companyID/something...
|
|
146
|
+
*/
|
|
147
|
+
getCurrentCompanyID = function getCurrentCompanyID(state) {
|
|
148
|
+
if (typeof state === "undefined" || state === null) {
|
|
149
|
+
return (0, _util.getIDFromURL)();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return state.getIn([reducerKey, "company", "ID"]);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
var selectors = exports.selectors = {
|
|
156
|
+
getCurrentCompany: getCurrentCompany,
|
|
157
|
+
getCurrentCompanyIsFetched: getCurrentCompanyIsFetched,
|
|
158
|
+
getCurrentCompanyIsFetching: getCurrentCompanyIsFetching,
|
|
159
|
+
getCurrentCompanyHasError: getCurrentCompanyHasError,
|
|
160
|
+
getCurrentCompanyShouldFetch: getCurrentCompanyShouldFetch,
|
|
161
|
+
getCompanyModules: getCompanyModules,
|
|
162
|
+
getCurrentCompanyID: getCurrentCompanyID
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
exports.default = reducer;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.modifyCurrentCompany = exports.fetchCurrentCompany = undefined;
|
|
7
|
+
|
|
8
|
+
var _superagent = require("superagent");
|
|
9
|
+
|
|
10
|
+
var _superagent2 = _interopRequireDefault(_superagent);
|
|
11
|
+
|
|
12
|
+
var _immutable = require("immutable");
|
|
13
|
+
|
|
14
|
+
var Immutable = _interopRequireWildcard(_immutable);
|
|
15
|
+
|
|
16
|
+
var _utility = require("../utility");
|
|
17
|
+
|
|
18
|
+
var _reducer = require("./reducer");
|
|
19
|
+
|
|
20
|
+
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; } }
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
var fetchCurrentCompany = exports.fetchCurrentCompany = function fetchCurrentCompany(id) {
|
|
25
|
+
return new Promise(function (resolve, reject) {
|
|
26
|
+
return _superagent2.default.get("/api/company/" + id + "/get-information").set("Accept", "application/json").end((0, _utility.withPromiseCallback)(function (data) {
|
|
27
|
+
return resolve(Immutable.Map(data));
|
|
28
|
+
}, reject));
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var modifyCurrentCompany = exports.modifyCurrentCompany = function modifyCurrentCompany(data) {
|
|
33
|
+
return new Promise(function (resolve, reject) {
|
|
34
|
+
return _superagent2.default.post("/api/company/" + _reducer.selectors.getCurrentCompanyID() + "/modify-info").set("Accept", "application/json").send(data).end((0, _utility.withPromiseCallback)(resolve, reject));
|
|
35
|
+
});
|
|
36
|
+
};
|
package/Company/util.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
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; }; }();
|
|
8
|
+
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
|
|
11
|
+
var _react2 = _interopRequireDefault(_react);
|
|
12
|
+
|
|
13
|
+
var _reactstrap = require("reactstrap");
|
|
14
|
+
|
|
15
|
+
var _reactRedux = require("react-redux");
|
|
16
|
+
|
|
17
|
+
var _LogoutButton = require("./LogoutButton");
|
|
18
|
+
|
|
19
|
+
var _LogoutButton2 = _interopRequireDefault(_LogoutButton);
|
|
20
|
+
|
|
21
|
+
var _actions = require("../actions");
|
|
22
|
+
|
|
23
|
+
var _request = require("./request");
|
|
24
|
+
|
|
25
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
|
+
|
|
27
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
28
|
+
|
|
29
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
30
|
+
|
|
31
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
32
|
+
|
|
33
|
+
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
34
|
+
return {
|
|
35
|
+
showLogoutProblem: function showLogoutProblem() {
|
|
36
|
+
dispatch((0, _actions.notifyError)("Am pierdut conexiunea cu server-ul"));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var OptionsContainer = function (_Component) {
|
|
42
|
+
_inherits(OptionsContainer, _Component);
|
|
43
|
+
|
|
44
|
+
function OptionsContainer() {
|
|
45
|
+
_classCallCheck(this, OptionsContainer);
|
|
46
|
+
|
|
47
|
+
var _this = _possibleConstructorReturn(this, (OptionsContainer.__proto__ || Object.getPrototypeOf(OptionsContainer)).call(this));
|
|
48
|
+
|
|
49
|
+
_this.toggle = function () {
|
|
50
|
+
return _this.setState(function (prevState) {
|
|
51
|
+
return {
|
|
52
|
+
open: !prevState.open
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
_this.logoutAccount = function () {
|
|
58
|
+
var that = _this;
|
|
59
|
+
|
|
60
|
+
_this.setState({
|
|
61
|
+
readyToLogout: false
|
|
62
|
+
}, function () {
|
|
63
|
+
(0, _request.logOut)().then(function () {
|
|
64
|
+
var delay = 800;
|
|
65
|
+
|
|
66
|
+
setTimeout(function () {
|
|
67
|
+
document.location.href = "/";
|
|
68
|
+
}, delay);
|
|
69
|
+
}).catch(function () {
|
|
70
|
+
that.setState({
|
|
71
|
+
readyToLogout: true
|
|
72
|
+
});
|
|
73
|
+
that.props.showLogoutProblem();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
_this.state = {
|
|
79
|
+
open: false,
|
|
80
|
+
readyToLogout: true
|
|
81
|
+
};
|
|
82
|
+
return _this;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
_createClass(OptionsContainer, [{
|
|
86
|
+
key: "shouldComponentUpdate",
|
|
87
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
88
|
+
return this.props.accountName !== nextProps.accountName || this.state.readyToLogout !== nextState.readyToLogout || this.state.open !== nextState.open;
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "render",
|
|
92
|
+
value: function render() {
|
|
93
|
+
var accountName = this.props.accountName;
|
|
94
|
+
var _state = this.state,
|
|
95
|
+
open = _state.open,
|
|
96
|
+
readyToLogout = _state.readyToLogout;
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
return _react2.default.createElement(
|
|
100
|
+
"div",
|
|
101
|
+
{ className: "btn-group" },
|
|
102
|
+
_react2.default.createElement(
|
|
103
|
+
_reactstrap.ButtonDropdown,
|
|
104
|
+
{ isOpen: open, toggle: this.toggle },
|
|
105
|
+
_react2.default.createElement(
|
|
106
|
+
_reactstrap.DropdownToggle,
|
|
107
|
+
{ caret: true },
|
|
108
|
+
"Opțiuni"
|
|
109
|
+
),
|
|
110
|
+
_react2.default.createElement(
|
|
111
|
+
_reactstrap.DropdownMenu,
|
|
112
|
+
{ className: "dropdown-menu-left" },
|
|
113
|
+
_react2.default.createElement(
|
|
114
|
+
"h6",
|
|
115
|
+
{ className: "dropdown-header" },
|
|
116
|
+
accountName
|
|
117
|
+
),
|
|
118
|
+
_react2.default.createElement(
|
|
119
|
+
"a",
|
|
120
|
+
{ className: "dropdown-item", href: "/settings/termeni-si-conditii/all", target: "_blank" },
|
|
121
|
+
"Termeni & condiții"
|
|
122
|
+
),
|
|
123
|
+
_react2.default.createElement(
|
|
124
|
+
"a",
|
|
125
|
+
{
|
|
126
|
+
className: "dropdown-item",
|
|
127
|
+
href: "/settings/politica-de-confidentialitate/all", target: "_blank" },
|
|
128
|
+
"Politica de confidențialitate"
|
|
129
|
+
),
|
|
130
|
+
_react2.default.createElement("div", { className: "dropdown-divider" }),
|
|
131
|
+
_react2.default.createElement(_LogoutButton2.default, {
|
|
132
|
+
logoutAccount: this.logoutAccount,
|
|
133
|
+
readyToLogout: readyToLogout
|
|
134
|
+
})
|
|
135
|
+
)
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}]);
|
|
140
|
+
|
|
141
|
+
return OptionsContainer;
|
|
142
|
+
}(_react.Component);
|
|
143
|
+
|
|
144
|
+
exports.default = (0, _reactRedux.connect)(null, mapDispatchToProps)(OptionsContainer);
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
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; }; }();
|
|
8
|
+
|
|
9
|
+
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; };
|
|
10
|
+
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
|
|
13
|
+
var _react2 = _interopRequireDefault(_react);
|
|
14
|
+
|
|
15
|
+
var _superagent = require("superagent");
|
|
16
|
+
|
|
17
|
+
var _superagent2 = _interopRequireDefault(_superagent);
|
|
18
|
+
|
|
19
|
+
var _reactRouterDom = require("react-router-dom");
|
|
20
|
+
|
|
21
|
+
var _async = require("react-select/async");
|
|
22
|
+
|
|
23
|
+
var _async2 = _interopRequireDefault(_async);
|
|
24
|
+
|
|
25
|
+
var _utility = require("../utility");
|
|
26
|
+
|
|
27
|
+
var _util = require("./util");
|
|
28
|
+
|
|
29
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
+
|
|
31
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
32
|
+
|
|
33
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
34
|
+
|
|
35
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
36
|
+
|
|
37
|
+
var loadOptions = function loadOptions(search, callback) {
|
|
38
|
+
var reject = function reject(_ref) {
|
|
39
|
+
var error = _ref.args.error;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var prepare = function prepare(_ref2) {
|
|
43
|
+
var Suggestions = _ref2.Suggestions;
|
|
44
|
+
return callback(Suggestions.reduce(function (accumulator, currentValue) {
|
|
45
|
+
accumulator.push(_extends({}, currentValue, {
|
|
46
|
+
value: currentValue.ID,
|
|
47
|
+
label: currentValue.Name
|
|
48
|
+
}));
|
|
49
|
+
return accumulator;
|
|
50
|
+
}, []));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
_superagent2.default.get("/api/account/get-companies").type("form").set("Accept", "application/json").query({ search: search }).
|
|
54
|
+
// eslint-disable-next-line
|
|
55
|
+
end((0, _utility.withPromiseCallback)(prepare, reject));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var AdminSelectCompany = function (_Component) {
|
|
59
|
+
_inherits(AdminSelectCompany, _Component);
|
|
60
|
+
|
|
61
|
+
function AdminSelectCompany(props) {
|
|
62
|
+
_classCallCheck(this, AdminSelectCompany);
|
|
63
|
+
|
|
64
|
+
var _this = _possibleConstructorReturn(this, (AdminSelectCompany.__proto__ || Object.getPrototypeOf(AdminSelectCompany)).call(this, props));
|
|
65
|
+
|
|
66
|
+
_this.state = { inputValue: "" };
|
|
67
|
+
|
|
68
|
+
_this.handleChange = function (options) {
|
|
69
|
+
if ((0, _util.isSmall)()) {
|
|
70
|
+
_this.props.toggleNavbar();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_this.props.history.push((0, _util.getDefaultCompanyRoute)(options));
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
_this.handleInputChange = function (newValue) {
|
|
77
|
+
var inputValue = newValue.replace(/(?:[\0-\/:-@\[-\^`\{-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g, "");
|
|
78
|
+
|
|
79
|
+
_this.setState({ inputValue: inputValue });
|
|
80
|
+
return inputValue;
|
|
81
|
+
};
|
|
82
|
+
return _this;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
_createClass(AdminSelectCompany, [{
|
|
86
|
+
key: "render",
|
|
87
|
+
value: function render() {
|
|
88
|
+
return _react2.default.createElement(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
className: _util.wrapperClassname },
|
|
92
|
+
_react2.default.createElement(_async2.default, {
|
|
93
|
+
cacheOptions: true,
|
|
94
|
+
components: { Option: _util.Option },
|
|
95
|
+
loadingMessage: _util.loadingMessage,
|
|
96
|
+
loadOptions: loadOptions,
|
|
97
|
+
noOptionsMessage: _util.noOptionsMessage,
|
|
98
|
+
onChange: this.handleChange,
|
|
99
|
+
onInputChange: this.handleInputChange,
|
|
100
|
+
placeholder: "Selecteaz\u0103 firm\u0103"
|
|
101
|
+
})
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}]);
|
|
105
|
+
|
|
106
|
+
return AdminSelectCompany;
|
|
107
|
+
}(_react.Component);
|
|
108
|
+
|
|
109
|
+
exports.default = (0, _reactRouterDom.withRouter)(AdminSelectCompany);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
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
|
+
|
|
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
|
+
var _react = require("react");
|
|
12
|
+
|
|
13
|
+
var _react2 = _interopRequireDefault(_react);
|
|
14
|
+
|
|
15
|
+
var _reactSelect = require("react-select");
|
|
16
|
+
|
|
17
|
+
var _reactSelect2 = _interopRequireDefault(_reactSelect);
|
|
18
|
+
|
|
19
|
+
var _reactRouterDom = require("react-router-dom");
|
|
20
|
+
|
|
21
|
+
var _util = require("./util");
|
|
22
|
+
|
|
23
|
+
var _reactRedux = require("react-redux");
|
|
24
|
+
|
|
25
|
+
var _reducer = require("../Account/reducer");
|
|
26
|
+
|
|
27
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
|
+
|
|
29
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
30
|
+
|
|
31
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
32
|
+
|
|
33
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
34
|
+
|
|
35
|
+
var mapStateToProps = function mapStateToProps(state) {
|
|
36
|
+
return {
|
|
37
|
+
companies: _reducer.selectors.getCurrentAccountCompanies(state)
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var ClientSelectCompany = function (_Component) {
|
|
42
|
+
_inherits(ClientSelectCompany, _Component);
|
|
43
|
+
|
|
44
|
+
function ClientSelectCompany(props) {
|
|
45
|
+
_classCallCheck(this, ClientSelectCompany);
|
|
46
|
+
|
|
47
|
+
var _this = _possibleConstructorReturn(this, (ClientSelectCompany.__proto__ || Object.getPrototypeOf(ClientSelectCompany)).call(this, props));
|
|
48
|
+
|
|
49
|
+
_this.state = { inputValue: "" };
|
|
50
|
+
|
|
51
|
+
_this.handleChange = function (options) {
|
|
52
|
+
if ((0, _util.isSmall)()) {
|
|
53
|
+
_this.props.toggleNavbar();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
_this.props.history.push((0, _util.getDefaultCompanyRoute)(options));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
_this.handleInputChange = function (newValue) {
|
|
60
|
+
var inputValue = newValue.replace(/(?:[\0-\/:-@\[-\^`\{-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g, "");
|
|
61
|
+
|
|
62
|
+
_this.setState({ inputValue: inputValue });
|
|
63
|
+
return inputValue;
|
|
64
|
+
};
|
|
65
|
+
return _this;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
_createClass(ClientSelectCompany, [{
|
|
69
|
+
key: "render",
|
|
70
|
+
value: function render() {
|
|
71
|
+
var companies = this.props.companies;
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
var options = companies.reduce(function (accumulator, currentValue) {
|
|
75
|
+
accumulator.push(_extends({}, currentValue.toJS(), {
|
|
76
|
+
value: currentValue.get("ID"),
|
|
77
|
+
label: currentValue.get("Name")
|
|
78
|
+
}));
|
|
79
|
+
|
|
80
|
+
return accumulator;
|
|
81
|
+
}, []);
|
|
82
|
+
|
|
83
|
+
if (companies.size > 1) {
|
|
84
|
+
return _react2.default.createElement(
|
|
85
|
+
"div",
|
|
86
|
+
{ className: _util.wrapperClassname },
|
|
87
|
+
_react2.default.createElement(_reactSelect2.default, {
|
|
88
|
+
components: { Option: _util.Option },
|
|
89
|
+
noOptionsMessage: _util.noOptionsMessage,
|
|
90
|
+
onChange: this.handleChange,
|
|
91
|
+
options: options,
|
|
92
|
+
placeholder: "Selecteaz\u0103 firm\u0103"
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}]);
|
|
100
|
+
|
|
101
|
+
return ClientSelectCompany;
|
|
102
|
+
}(_react.Component);
|
|
103
|
+
|
|
104
|
+
exports.default = (0, _reactRouterDom.withRouter)((0, _reactRedux.connect)(mapStateToProps)(ClientSelectCompany));
|