ContactPackage.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _react = _interopRequireDefault(require("react"));
  7. var _modularityFront = _interopRequireDefault(require("modularity-front"));
  8. var _reactMaterialize = require("react-materialize");
  9. var _GoogleMap = _interopRequireDefault(require("../../Modules/GoogleMap"));
  10. var _Form = _interopRequireDefault(require("../../Modules/Form"));
  11. var _Toast = _interopRequireDefault(require("../../helpers/Toast"));
  12. var _DictionaryService = _interopRequireDefault(require("../../Services/DictionaryService"));
  13. require("./ContactPackage.css");
  14. var _TonersalesInfo = _interopRequireDefault(require("../../Inputs/TonersalesInfo"));
  15. var _ContactInputs = _interopRequireDefault(require("../../Inputs/ContactInputs"));
  16. var _API = _interopRequireDefault(require("../../Services/API"));
  17. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20. 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); } }
  21. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  22. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  23. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  24. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  25. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  26. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  27. var Module = _modularityFront.default.Module;
  28. var ContactPackage =
  29. /*#__PURE__*/
  30. function (_Modularity$Module) {
  31. _inherits(ContactPackage, _Modularity$Module);
  32. function ContactPackage(props) {
  33. var _this;
  34. _classCallCheck(this, ContactPackage);
  35. _this = _possibleConstructorReturn(this, _getPrototypeOf(ContactPackage).call(this, props));
  36. _this.API = new _API.default();
  37. _this.state = {
  38. formKey: 1
  39. };
  40. console.log("Info", _TonersalesInfo.default);
  41. return _this;
  42. }
  43. _createClass(ContactPackage, [{
  44. key: "contact",
  45. value: function contact(data) {
  46. var _this2 = this;
  47. if (data.email) {
  48. this.API.post('/contact', data).then(function (res) {
  49. _Toast.default.success(_DictionaryService.default.get("Email was sent"));
  50. _this2.setState({
  51. formKey: Math.random()
  52. });
  53. });
  54. }
  55. }
  56. }, {
  57. key: "render",
  58. value: function render() {
  59. var _this3 = this;
  60. var info = Object.keys(_TonersalesInfo.default).map(function (key, index) {
  61. return _react.default.createElement(_reactMaterialize.CollectionItem, null, _react.default.createElement("div", {
  62. className: "title"
  63. }, key), _react.default.createElement("div", {
  64. className: "items"
  65. }, _TonersalesInfo.default[key]));
  66. });
  67. return _react.default.createElement("div", {
  68. className: "contact"
  69. }, _react.default.createElement(_reactMaterialize.Row, null, _react.default.createElement(_reactMaterialize.Col, {
  70. s: 8
  71. }, _react.default.createElement(_reactMaterialize.Collection, {
  72. header: _react.default.createElement("div", {
  73. className: "cont_title"
  74. }, "\u03A4\u03BF\u03C0\u03BF\u03B8\u03B5\u03C3\u03AF\u03B1 \u039A\u03B1\u03C4\u03B1\u03C3\u03C4\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2")
  75. }, _react.default.createElement(_reactMaterialize.CollectionItem, {
  76. className: 'no-padding'
  77. }, _react.default.createElement(_GoogleMap.default, null)))), _react.default.createElement(_reactMaterialize.Col, {
  78. s: 4
  79. }, _react.default.createElement(_reactMaterialize.Collection, {
  80. header: _react.default.createElement("div", {
  81. className: "cont_title"
  82. }, "\u03A3\u03C4\u03BF\u03B9\u03C7\u03B5\u03B9\u03B1 \u039A\u03B1\u03C4\u03B1\u03C3\u03C4\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2")
  83. }, info))), _react.default.createElement(_reactMaterialize.Row, null, _react.default.createElement(_reactMaterialize.Col, {
  84. s: 12
  85. }, _react.default.createElement("div", {
  86. className: "form_container"
  87. }, _react.default.createElement(_reactMaterialize.Row, {
  88. className: "center cont_title"
  89. }, "\u0395\u03C0\u03B9\u03BA\u03BF\u03B9\u03BD\u03C9\u03BD\u03AE\u03C3\u03C4\u03B5 \u039C\u03B1\u03B6\u03AF \u03BC\u03B1\u03C2"), _react.default.createElement(_Form.default, {
  90. key: this.state.formKey,
  91. onSubmit: function onSubmit(data) {
  92. return _this3.contact(data);
  93. },
  94. FormInputs: _ContactInputs.default,
  95. activeButton: true,
  96. button: 'Αποστολή',
  97. withCaptcha: true,
  98. CaptchaKey: '6LcaRqcUAAAAAJRvSwHNtyRDwUiGYcuAfIQVaA1W'
  99. })))));
  100. }
  101. }]);
  102. return ContactPackage;
  103. }(_modularityFront.default.Module);
  104. ContactPackage.Inputs = {};
  105. ContactPackage.Category = "Sxoinas Packages";
  106. var _default = ContactPackage;
  107. exports.default = _default;