import { View } from "@tarojs/components";

export default function VehicleInfo(props: { module: any }) {
  const { module } = props;
  const { config } = module;

  return (
    <View
      key={module.id}
      className={"preview grid w-full grid-cols-8 gap-0 text-base"}
    >
      {config.showDriverPhone && (
        <>
          <View className="col-span-2 flex items-end justify-center">
            司机号码:
          </View>
          <View className="col-span-6 flex items-end justify-center border-b border-black">
            {config.driverPhone}
          </View>
        </>
      )}
      {config.showLicensePlate && (
        <>
          <View className="col-span-2 flex items-end justify-center">
            车牌:
          </View>
          <View className="col-span-6 flex items-end justify-center border-b border-black">
            {config.licensePlate}
          </View>
        </>
      )}
      {config.showEstimatedArrivalTime && (
        <>
          <View className="col-span-2 flex items-end justify-center">
            预计到仓时间:
          </View>
          <View className="col-span-6 flex items-end justify-center border-b border-black">
            {config.estimatedArrivalTime}
          </View>
        </>
      )}
      {config.showRemarks && (
        <>
          <View className="col-span-2 flex items-end justify-center">
            备注:
          </View>
          <View className="col-span-6 flex items-end justify-center border-b border-black">
            {config.remarks}
          </View>
        </>
      )}
      {config.showFreightDebt && (
        <>
          <View className="col-span-2 flex items-end justify-center">
            {config.freightDebtTitle || "运费欠"}:
          </View>
          <View className="col-span-2 flex items-end justify-center border-b border-black">
            {config.freightDebt}
          </View>
        </>
      )}
      {config.showStrawMatDebt && (
        <>
          <View className="col-span-2 flex items-end justify-center">
            草帘欠:
          </View>
          <View className="col-span-2 flex items-end justify-center border-b border-black">
            {config.strawMatDebt}
          </View>
        </>
      )}
    </View>
  );
}
