// withHooks

import { applyStyle } from 'esoftplay';
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
import { LibStyle } from 'esoftplay/cache/lib/style/import';
import { EventOrder_itemProperty } from 'esoftplay/cache/event/order_item/import';
import esp from 'esoftplay/esp';
import React from 'react';
import { Text, TouchableOpacity, View } from 'react-native';


export interface EventTms_in_warningArgs {

}
export interface EventTms_in_warningProps {

}
export default function m(props: EventTms_in_warningProps): any {
  const {
    url_ticket_update,
    url_ticket_detail,
    price_type,
    selectedTicket,
    gate_type,
    qr_code,
    event_id,
    selectGate,
    typeScanner,
    event_title,
    qty,
    configPriority,
    scan_type,
    is_from_list } = LibNavigation.getArgsAll<any>(props)


  let args = {
    price_type: price_type,
    gate_type: gate_type,
    qr_code: qr_code,
    event_id: event_id,
    event_title: event_title,
    selectGate: selectGate,
    typeScanner: typeScanner,
    url_ticket_detail: url_ticket_detail,
    url_ticket_update: url_ticket_update,
    qty: qty,
    configPriority: configPriority,
    scan_type: scan_type
  }

  return (
    <View style={{ flex: 1, backgroundColor: selectedTicket?.color }}>
      <View style={{ padding: 15, flex: 4, alignContent: 'center', alignItems: 'center', justifyContent: 'center' }}>
        <Text allowFontScaling={false} style={{ color: EventOrder_itemProperty.textColor(selectedTicket?.color), letterSpacing: 1, fontSize: 20, textAlign: 'center', fontWeight: 'normal' }}>{esp.lang("event/tms_in_warning", "your_ticket")}</Text>
        <Text allowFontScaling={false} numberOfLines={5} ellipsizeMode="tail" style={{ marginVertical: 15, letterSpacing: 2, color: EventOrder_itemProperty.textColor(selectedTicket?.color), fontSize: 32, textAlign: 'center', fontWeight: 'bold' }}>{selectedTicket?.title}</Text>
        <Text allowFontScaling={false} style={{ paddingHorizontal: 20, color: EventOrder_itemProperty.textColor(selectedTicket?.color), letterSpacing: 1, fontSize: 20, textAlign: 'center', fontWeight: 'normal' }}>{esp.lang("event/tms_in_warning", "confirm")}</Text>
      </View>
      <View style={{ flex: 1, padding: 15, justifyContent: 'flex-end' }}>
        <TouchableOpacity onPress={() => {
          if (is_from_list == 1) {
            LibNavigation.replace('event/tms_in_success', {
              selectedTicket: selectedTicket,
              ...args
            })
          } else {
            if (selectedTicket?.qty > 1) {
              let tikets = [selectedTicket]
              LibNavigation.replace('event/tms_in_list', {
                tickets: tikets,
                ...args
              })
            } else {
              LibNavigation.replace('event/tms_in_success', {
                selectedTicket: selectedTicket,
                ...args
              })
            }
          }
        }} style={applyStyle({ marginBottom: 20, width: LibStyle.width - 30, height: 40, borderRadius: 16, backgroundColor: EventOrder_itemProperty.textColor(selectedTicket?.color), flexDirection: 'row', alignItems: 'center', alignContent: 'center', justifyContent: 'center', paddingHorizontal: 9 })} >
          <Text allowFontScaling={false} style={applyStyle({ fontFamily: "ArialBold", fontSize: 14, textAlign: "center", textAlignVertical: 'center', color: selectedTicket?.color, marginRight: 15 })} >{esp.lang("event/tms_in_warning", "process")}</Text>
        </TouchableOpacity>
        <TouchableOpacity onPress={() => {
          LibNavigation.back()
        }} style={applyStyle({ width: LibStyle.width - 30, borderWidth: 1, borderColor: EventOrder_itemProperty.textColor(selectedTicket?.color), height: 40, borderRadius: 16, backgroundColor: selectedTicket?.color, flexDirection: 'row', alignItems: 'center', alignContent: 'center', justifyContent: 'center', paddingHorizontal: 9 })} >
          <Text allowFontScaling={false} style={applyStyle({ fontFamily: "ArialBold", fontSize: 14, textAlign: "center", textAlignVertical: 'center', color: EventOrder_itemProperty.textColor(selectedTicket?.color), marginRight: 15 })} >{esp.lang("event/tms_in_warning", "cancel")}</Text>
        </TouchableOpacity>
      </View>

    </View>
  )
}