import { Image } from "antd";
import { getFileUrl } from "zy-react-library/utils";

function DisclaimerSign({
  colSpan,
  firstColSpan,
  lastColSpan,
  safetyRemarks,
  safetySignPath,
  safetySignTime,
  AcceptRemarks,
  AcceptSignPath,
  AcceptSignTime,
}) {
  const showFirst = safetyRemarks || safetySignPath || safetySignTime;
  const showLast = AcceptRemarks || AcceptSignPath || AcceptSignTime;

  return (
    <tr>
      {
        showFirst && (
          <td colSpan={(firstColSpan || colSpan) + (!showLast ? (lastColSpan || colSpan) : 0)}>
            <div className="flex">
              <div>
                <span>安全交底人：</span>
                <span>{safetyRemarks}</span>
              </div>
              <div className="right">
                <div>
                  {safetySignPath && <Image src={getFileUrl() + safetySignPath} width={50} height={50} />}
                </div>
                <div>{safetySignTime}</div>
              </div>
            </div>
          </td>
        )
      }
      {
        showLast && (
          <td colSpan={(lastColSpan || colSpan) + (!showFirst ? (firstColSpan || colSpan) : 0)}>
            <div className="flex">
              <div>
                <span>接受交底人：</span>
                <span>{AcceptRemarks}</span>
              </div>
              <div className="right">
                <div>
                  {AcceptSignPath && <Image src={getFileUrl() + AcceptSignPath} width={50} height={50} />}
                </div>
                <div>{AcceptSignTime}</div>
              </div>
            </div>
          </td>
        )
      }
    </tr>
  );
}

export default DisclaimerSign;
