PrinterPresentPackage.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 _Pagination = _interopRequireDefault(require("../../Modules/Pagination"));
  10. var _Card = _interopRequireDefault(require("../../Modules/Card"));
  11. var _Repository = _interopRequireDefault(require("../../Services/Repository"));
  12. var _FilterModule = _interopRequireDefault(require("../../Modules/FilterModule"));
  13. var _Present = _interopRequireDefault(require("../../Modules/Product/Present"));
  14. var _Done = _interopRequireDefault(require("@material-ui/icons/Done"));
  15. var _searchbar = _interopRequireDefault(require("../../Modules/searchbar"));
  16. var _Chip = _interopRequireDefault(require("../../Modules/Chip"));
  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 _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  25. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  26. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  27. 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); }
  28. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  29. var Module = _modularityFront.default.Module;
  30. var PrinterPresentPackage =
  31. /*#__PURE__*/
  32. function (_Modularity$Module) {
  33. _inherits(PrinterPresentPackage, _Modularity$Module);
  34. function PrinterPresentPackage(props) {
  35. var _this;
  36. _classCallCheck(this, PrinterPresentPackage);
  37. _this = _possibleConstructorReturn(this, _getPrototypeOf(PrinterPresentPackage).call(this, props));
  38. _this.state = {
  39. product: {}
  40. };
  41. _this.repo = new _Repository.default('printers');
  42. _this.productId = _this.RoutingSystem.getRoute().params.printerId;
  43. _this.repo.get(_this.productId).then(function (product) {
  44. return _this.setState({
  45. product: product
  46. });
  47. }).catch(function (e) {
  48. return alert("NOT FOUND");
  49. });
  50. return _this;
  51. }
  52. _createClass(PrinterPresentPackage, [{
  53. key: "render",
  54. value: function render() {
  55. var _this2 = this;
  56. return _react.default.createElement("div", {
  57. className: "PrinterPresentPackage"
  58. }, _react.default.createElement("div", null, _react.default.createElement(_Present.default, {
  59. noBuy: true,
  60. Product: this.state.product,
  61. addToCart: function addToCart(q) {
  62. return _this2.AddToCart.set({
  63. id: _this2.state.product.id,
  64. name: _this2.state.product.name,
  65. price: _this2.state.product.price,
  66. quantity: q
  67. });
  68. }
  69. })), _get(_getPrototypeOf(PrinterPresentPackage.prototype), "render", this).call(this));
  70. }
  71. }]);
  72. return PrinterPresentPackage;
  73. }(_modularityFront.default.Module);
  74. PrinterPresentPackage.EditPosition = "center";
  75. PrinterPresentPackage.Inputs = {};
  76. PrinterPresentPackage.Outputs = {
  77. AddToCart: {}
  78. };
  79. PrinterPresentPackage.Category = "NikatlasPackages";
  80. var _default = PrinterPresentPackage;
  81. exports.default = _default;