// withHooks
// noPage
import { applyStyle } from 'esoftplay';
import { LibStyle } from 'esoftplay/cache/lib/style/import';
import { LibUtils } from 'esoftplay/cache/lib/utils/import';

import React from 'react';
import { Pressable, Text, View } from 'react-native';


export interface EventCounter_history_itemArgs {

}
export interface EventCounter_history_itemProps {
  onPress?: () => void,
  // amount: any,
  // created?: string,
  // event_id?: string,
  // id?: string,
  // is_credit: any,
  // ondate?: string,
  // saldo?: string,
  // title?: string,
  // type?: string,
  // type_id?: string,
  // user_id?: string,

  is_ticket: boolean,
  show_icon?: boolean

  item: any
}
export default function m(props: EventCounter_history_itemProps): any {
  let item = props.item
  return (
    <Pressable onPress={() => { props.onPress && props.onPress() }} style={applyStyle({ padding: 10, flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', borderBottomColor: "#EEF1F8", borderBottomWidth: 1 })}>
      <View style={applyStyle({ flex: 3 })}>
        <Text allowFontScaling={false} style={applyStyle({ fontSize: 14 })}>{item?.title}</Text>
        {
          item?.hasOwnProperty("price_name") && item?.price_name != "" &&
          <Text allowFontScaling={false} style={applyStyle({ fontSize: 10, marginTop: 2, marginBottom: 7, })}>{item?.price_name} {item?.ondate != "0000-00-00" && "- " + LibUtils.moment(item?.ondate).localeFormat("D MMM YYYY")}</Text>
        }
        <Text allowFontScaling={false} style={applyStyle({ fontSize: 10, color: "#797979" })}>{LibUtils.moment(item?.created).serverFormat("DD MMMM YYYY HH:mm:ss")}</Text>
      </View>
      <Text allowFontScaling={false} style={applyStyle({ flex: 1, textAlign: 'right', fontWeight: 'bold', fontSize: 12, color: item?.hasOwnProperty('is_credit') ? (item?.is_credit == 0 ? LibStyle.colorGreen : LibStyle.colorRed) : "#000" })}>{props.show_icon && (item?.hasOwnProperty('is_credit') ? (item?.is_credit == 0 ? "+" : "-") : "")} {props.is_ticket ? LibUtils.number(item?.amount) + " Tiket" : LibUtils.money(item?.amount)}</Text>
    </Pressable>
  )
}