"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireWildcard(require("react"));
var _index = require("../../index");
var _api = require("../../api");
require("./index.less");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var SummaryItem = function SummaryItem(_ref) {
  var prefix = _ref.prefix,
    url = _ref.url,
    name = _ref.name,
    num = _ref.num,
    unit = _ref.unit;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefix, "-summary-item")
  }, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("img", {
    src: url
  })), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefix, "-summary-item-name")
  }, name), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefix, "-summary-item-num")
  }, num, /*#__PURE__*/_react["default"].createElement("span", null, unit))));
};
var Summary = function Summary(_ref2) {
  var startDay = _ref2.startDay,
    endDay = _ref2.endDay;
  var _useContext = (0, _react.useContext)(_index.RestaurantContext),
    prefix = _useContext.prefix,
    id = _useContext.id,
    garbageType = _useContext.garbageType;
  var data = _api.BasicService.summary({
    id: id,
    startDay: startDay,
    endDay: endDay,
    garbageType: garbageType
  });
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefix, "-summary")
  }, /*#__PURE__*/_react["default"].createElement(SummaryItem, {
    prefix: prefix,
    name: "\u4EA7\u751F\u91CF",
    url: require('../../imgs/weigh.png'),
    num: (data === null || data === void 0 ? void 0 : data.collectWeight) || 0,
    unit: "kg"
  }), /*#__PURE__*/_react["default"].createElement(SummaryItem, {
    prefix: prefix,
    name: "\u5783\u573E\u6876\u6570",
    url: require('../../imgs/bucket.png'),
    num: (data === null || data === void 0 ? void 0 : data.actCollectNum) || 0,
    unit: "\u6876"
  }), /*#__PURE__*/_react["default"].createElement(SummaryItem, {
    prefix: prefix,
    name: "\u6536\u8FD0\u6B21\u6570",
    url: require('../../imgs/carNum.png'),
    num: (data === null || data === void 0 ? void 0 : data.collectTimes) || 0,
    unit: "\u6B21"
  }));
};
var _default = exports["default"] = Summary;
//# sourceMappingURL=Summary.js.map
