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 "./index.less";
import classNames from 'classnames';
import { useAppointmentBookingContext } from "../../../context";
var Total = function Total(_ref) {
  var className = _ref.className,
    isFooter = _ref.isFooter;
  var _useAppointmentBookin = useAppointmentBookingContext(),
    summary = _useAppointmentBookin.summary,
    symbolic = _useAppointmentBookin.symbolic;
  var taxTitle = summary.taxTitle,
    totalTaxFee = summary.totalTaxFee,
    isPriceIncludeTax = summary.isPriceIncludeTax,
    total = summary.total,
    deposit = summary.deposit;
  return /*#__PURE__*/React.createElement("div", {
    className: "appointment-total-wrap ".concat(className, " ").concat(deposit !== null && deposit !== void 0 && deposit.hasDeposit ? 'appointment-total-deposit-wrap' : '')
  }, !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, deposit !== null && deposit !== void 0 && deposit.hasDeposit && isFooter ? locales.getText('pisell2.appointment.deposit') : locales.getText('pisell2.event.total'), isFooter ? ': ' : ''), isFooter ? /*#__PURE__*/React.createElement(PisellText.Amount, {
    value: 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(symbolic).concat(totalTaxFee))) : null), !isFooter ? /*#__PURE__*/React.createElement(PisellText.Amount, {
    value: total,
    showCurrencySymbol: true,
    className: "event-amount"
  }) : null));
};
export default Total;