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); }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import React from 'react';
import { locales } from '@pisell/utils';
import { PisellText } from '@pisell/materials';
import { useCart, useSummary } from "../../../../../Sales";
import useEngineContext from "../../../../../../hooks/useEngineContext";
import "./index.less";
import classNames from 'classnames';
var Total = function Total(_ref) {
  var _context$appHelper, _context$appHelper$ge, _cartData$cartItems, _cartData$cartItems2, _context$appHelper2, _context$appHelper2$g;
  var className = _ref.className,
    isFooter = _ref.isFooter;
  var _useCart = useCart(),
    cartData = _useCart.cartData;
  var _useSummary = useSummary(),
    taxTitle = _useSummary.taxTitle,
    totalTaxFee = _useSummary.totalTaxFee,
    isPriceIncludeTax = _useSummary.isPriceIncludeTax,
    total = _useSummary.total,
    deposit = _useSummary.deposit;
  var context = useEngineContext();
  console.log(taxTitle, isPriceIncludeTax, totalTaxFee, total, context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getSymbolic) === null || _context$appHelper$ge === void 0 ? void 0 : _context$appHelper$ge.call(_context$appHelper), deposit, 'wh97978');
  var showDeposit = (cartData === null || cartData === void 0 || (_cartData$cartItems = cartData.cartItems) === null || _cartData$cartItems === void 0 ? void 0 : _cartData$cartItems.length) > 0 && (deposit === null || deposit === void 0 ? void 0 : deposit.hasDeposit);
  return /*#__PURE__*/React.createElement("div", {
    className: "event-total-wrap ".concat(className)
  }, !isPriceIncludeTax && Number(totalTaxFee) > 0 ? /*#__PURE__*/React.createElement("div", {
    className: "gst-wrap"
  }, /*#__PURE__*/React.createElement("span", null, taxTitle, isFooter ? ': ' : ''), /*#__PURE__*/React.createElement(PisellText.Amount, {
    value: totalTaxFee,
    showCurrencySymbol: true
  })) : null, /*#__PURE__*/React.createElement("div", {
    className: classNames('event-total', _defineProperty({}, ['total-gst-wrap'], !isPriceIncludeTax && Number(totalTaxFee) > 0))
  }, /*#__PURE__*/React.createElement("div", {
    className: "left"
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, isFooter && showDeposit ? locales.getText('pisell2.appointment.deposit') : locales.getText('pisell2.event.total'), isFooter ? ': ' : ''), isFooter ? /*#__PURE__*/React.createElement(PisellText.Amount, {
    value: (cartData === null || cartData === void 0 || (_cartData$cartItems2 = cartData.cartItems) === null || _cartData$cartItems2 === void 0 ? void 0 : _cartData$cartItems2.length) > 0 && deposit !== null && deposit !== void 0 && deposit.hasDeposit ? deposit === null || deposit === void 0 ? void 0 : deposit.total : total,
    showCurrencySymbol: true,
    className: "event-amount"
  }) : null), isPriceIncludeTax && Number(totalTaxFee) > 0 ? /*#__PURE__*/React.createElement("span", {
    className: "gst"
  }, locales.getText('pisell2.event.total.gst')("".concat(isFooter ? "".concat(taxTitle, ": ") : taxTitle), "".concat(context === null || context === void 0 || (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 || (_context$appHelper2 = _context$appHelper2.utils) === null || _context$appHelper2 === void 0 || (_context$appHelper2$g = _context$appHelper2.getSymbolic) === null || _context$appHelper2$g === void 0 ? void 0 : _context$appHelper2$g.call(_context$appHelper2)).concat(totalTaxFee))) : null), !isFooter ? /*#__PURE__*/React.createElement(PisellText.Amount, {
    value: total,
    showCurrencySymbol: true,
    className: "event-amount"
  }) : null));
};
export default Total;