import {Order, OrderProduct} from "../../types/order";
import {ScrollView, StyleSheet, View} from "react-native";
import DTitle from "../../components/DTitle/DTitle";
import DText from "../../components/DText/DText";
import {OrderStatus, OrderStatusDictionary} from "../../features/ordersFilter/ordersFilterSlice";
import React from "react";
import {RFPercentage} from "react-native-responsive-fontsize";
import {responsiveWidth} from "react-native-responsive-dimensions";

type Props = {
    order: Order;
    selectedProduct?: OrderProduct
}
const OrderInfoView = (props: Props) => {
    const {order, selectedProduct} = props;

    return (

        <View style={styles.dataContainer}>
            <ScrollView>
                <DTitle style={styles.contentTitle}>Заказ</DTitle>
                <DText>Номер заказа: {order.orderNumber}</DText>
                <DText>Маркетплейс: {order.marketplaceName}</DText>
                <DText>Селлер: {order.sellerName}</DText>
                <DText>Создан: {order.createdOn}</DText>
                <DText>Отгрузка: {order.shipmentDate}</DText>
                <DText>Статус: {OrderStatusDictionary[order.status as OrderStatus]}</DText>
                <DText>Склад отгрузки: {order.shippingWarehouse}</DText>
                <DText>Город: {order.city}</DText>
                <DText>{""}</DText>
                <DTitle style={styles.contentTitle}>Товар</DTitle>
                <DText>Арт. DENCO: {selectedProduct?.dencoArticle}</DText>
                <DText>Арт. поставщика: {selectedProduct?.supplierArticle}</DText>
                <DText>Фасовка: {selectedProduct?.inBlock} шт.</DText>
                <DText>Поставщик: {selectedProduct?.supplierName}</DText>
            </ScrollView>

        </View>
    )
}

const styles = StyleSheet.create({
    dataContainer: {
        backgroundColor: "white",
        padding: RFPercentage(2),
        flex: 0.5,
        borderRadius: RFPercentage(3),
    },
    contentTitle: {
        alignSelf: "center"
    },

})

export default OrderInfoView;