"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _react = _interopRequireWildcard(require("react"));

var _reactNative = require("react-native");

var _reactNativePaper = require("react-native-paper");

var _Colors = _interopRequireDefault(require("./Colors"));

var _Constants = require("../common/Constants");

var _DocumentLast = require("./Services/DocumentLast");

var _Constants2 = require("./Constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

const car = require('./Image/car.png');

const thumbs_up = require('./Image/thumbs_up.png');

const checkmark = require('./Image/checkmark.png');

const support = require('./Image/support.png');

class Success extends _react.Component {
  constructor(props) {
    super(props);
    this.state = {
      documentLastData: "",
      thankYou: "",
      message: ""
    };
  }

  componentDidMount() {
    this.documentLast();
    this.renderDataToScreen();
  }

  renderDataToScreen() {
    const {
      details: approved,
      agentCode: agentCode
    } = this.state.documentLastData;
    console.log("    *********************          ", approved, agentCode);

    if (approved != null) {
      if (approved.toUpperCase() == "UPDATE") {
        if (agentCode != undefined) {
          if (agentCode == _Constants2.DIRECT_PORTAL_AGENTCODE) {
            this.setState({
              thankYou: _Constants2.super_thank_you,
              message: _Constants2.your_preins_apprvd
            });
          }
        } else {
          this.setState({
            thankYou: _Constants2.super_thank_you,
            message: _Constants2.your_preins_apprvd
          });
        }
      } else {
        this.setState({
          thankYou: _Constants2.thank_you,
          message: _Constants2.preinsp_com_will_update
        });
      }
    } else {
      this.setState({
        thankYou: _Constants2.thank_you,
        message: _Constants2.preinsp_com_will_update
      });
    }
  }

  async documentLast() {
    (0, _DocumentLast.getDocumentLast)({
      body: {
        "activityId": this.props.screenProps.activityId,
        "isLast": true,
        "source": "DIGITEDGE"
      }
    }).then(data => {
      this.setState({
        documentLastData: data
      });
    });
    console.log(':>>>>>>>>>>>>>>>>>>>>             >>>>>>>>>>>> ', this.state.documentLastData);
  }

  thankYouScreens() {
    return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
      style: {
        flex: 1
      }
    }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
      style: styles.SuccessTextView
    }, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
      style: styles.superTextStyle
    }, thankYou), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
      style: {
        marginLeft: 16,
        fontFamily: 'Muli-Regular',
        fontSize: 16
      }
    }, message), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
      style: styles.inspectTextView
    }, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
      onPress: () => this.props.navigation.navigate("PI")
    }, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
      style: {
        fontSize: 20,
        fontFamily: 'Muli-Regular',
        color: _Colors.default.digitYellow
      }
    }, "Inspect Another Vechicle")))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
      style: styles.SuccessImageView
    }, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
      source: car,
      style: {
        alignSelf: 'center',
        width: _Constants.SCREEN_WIDTH,
        resizeMode: 'contain',
        height: _Constants.SCREEN_HEIGHT / 3
      }
    })));
  }

  render() {
    const {
      thankYou,
      message
    } = this.state;
    return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
      style: styles.main
    }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
      style: {
        flex: 0.45
      }
    }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
      style: {
        flexDirection: "row",
        flex: 1,
        marginLeft: 16
      }
    }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
      style: {
        alignSelf: "flex-end"
      }
    }, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
      source: thumbs_up,
      style: {
        width: 90,
        height: 90
      }
    }), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
      style: styles.superTextStyle
    }, thankYou)))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
      style: {
        flex: 0.15
      }
    }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
      style: {
        flexDirection: "row",
        flex: 1,
        marginLeft: 16,
        marginRight: 16
      }
    }, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
      source: checkmark,
      style: {
        width: 50,
        height: 50,
        alignSelf: 'center'
      }
    }), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
      style: styles.subTextStyle
    }, message))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
      style: {
        flex: 0.4,
        flexDirection: 'row'
      }
    }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
      style: {
        alignSelf: 'flex-end',
        flex: 1,
        marginBottom: 8,
        minHeight: 40,
        maxHeight: 50,
        flexDirection: 'row'
      }
    }, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
      source: support,
      style: {
        width: 40,
        height: 40,
        alignSelf: 'center',
        marginLeft: 16
      }
    }), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
      style: styles.subTextStyle
    }, "1800-258-5956"))));
  }

}

exports.default = Success;

const styles = _reactNative.StyleSheet.create({
  main: {
    flex: 1 // backgroundColor: Colors.white,

  },
  SuccessTextView: {
    flex: 0.7,
    justifyContent: 'center'
  },
  SuccessImageView: {
    flex: 0.3
  },
  superTextStyle: {
    marginLeft: 16,
    fontSize: 20,
    fontFamily: 'Muli-Bold',
    alignSelf: 'center',
    marginRight: 16
  },
  subTextStyle: {
    marginLeft: 16,
    fontSize: 18,
    fontFamily: 'Muli-Regular',
    alignSelf: 'center'
  },
  inspectTextView: {
    marginTop: 22,
    alignSelf: 'center'
  },
  SuccessImageView: {
    flex: 0.5,
    justifyContent: 'flex-end'
  }
});
//# sourceMappingURL=Success.js.map