import { Input, Button, Form, Card, Select, Col, DatePicker, Row, Tooltip, Tabs, Modal, Typography, Tag, Popconfirm } from 'antd';
import Table, { ColumnProps } from 'antd/lib/table';
import moment from 'moment';
import React, { useEffect, useRef, useState } from 'react';
import { BarcodeOutlined, DownloadOutlined, EditOutlined, SafetyCertificateOutlined, SearchOutlined, UndoOutlined } from '@ant-design/icons';
import Highlighter from 'react-highlight-words';
import { AntiBioticsReportService, RMGrnService } from '@gtpl/shared-services/raw-material-procurement';
import { AlertMessages } from '@gtpl/shared-utils/alert-messages';
import { useForm } from 'antd/lib/form/Form';
import { Link } from 'react-router-dom';
import { Excel } from 'antd-table-saveas-excel';
import { title } from 'process';
import { SortOrder } from 'antd/lib/table/interface';
import { PassOrFail } from '@gtpl/shared-models/common-models';
import { RejectedIndentReq } from './rejected-indent-req';


const RejectedIndentReport = () => {

    const [searchText, setSearchText] = useState('');
    const [searchedColumn, setSearchedColumn] = useState('');
    const searchInput = useRef(null);
      const antiMicroTInfoService = new AntiBioticsReportService();
      const [data ,setData] = useState([])
      const { Option } = Select;
      const [form ] = useForm()
      const { RangePicker } = DatePicker;
      const [indentCode,setIndentCode] = useState<any[]>([])
      const [grnNumber,setGrnNumber] = useState<any[]>([])
      const [counts,setCounts] = useState<any[]>([])
      const [farmers,setFarmers] = useState<any[]>([])
      const [rejectedData, setRejectedData] = useState<any[]>([]);
      const [page, setPage] = React.useState(1); 
      const { TabPane } = Tabs;
      const { Text } = Typography;
      const rMGrnService = new RMGrnService()
      const antiBioticsReportService = new AntiBioticsReportService()

      
      useEffect(()=> {
        getRejectedData()
        getAll()
      },[])

      const getAll = () =>{

        antiBioticsReportService.getAllAntiBioticsFailedIndentsNumbers().then((res)=>{
          if(res.status){
              setIndentCode(res.data)
          }
      })
      antiBioticsReportService.getAllAntiBioticsFailedGrnNumbers ().then((res)=>{
        if(res.status){
            setGrnNumber(res.data)
        }
    }) 
    antiBioticsReportService.getAllAntiBioticsFailedFarmer ().then((res)=>{
      if(res.status){
          setFarmers(res.data)
      }
    })
    antiBioticsReportService.getAllAntiBioticsFailedCount ().then((res)=>{
      if(res.status){
          setCounts(res.data)
      }
    })
  }
  const getRejectedData = () => {
    const req = new RejectedIndentReq();
    const grnDate = form.getFieldValue('grnDate');
    const indentDate = form.getFieldValue('indentDate');
    const indentNum = form.getFieldValue('indentNum');
    const grnNum = form.getFieldValue('grnNum');
    const count = form.getFieldValue('count');
    const farmer = form.getFieldValue('farmer');
    const testAt = form.getFieldValue('testAt')
  
    if (grnDate && grnDate[0] && grnDate[1]) {
      req.grnFromDate = grnDate[0].format('YYYY-MM-DD');
      req.grnToDate = grnDate[1].format('YYYY-MM-DD');
    }
  
    if (indentDate && indentDate[0] && indentDate[1]) {
      req.indentFromdate = indentDate[0].format('YYYY-MM-DD');
      req.indentToDate = indentDate[1].format('YYYY-MM-DD');
    }
  
    if (indentNum) {
      req.indentNumber = indentNum;
    }
  
    if (grnNum) {
      req.grnNumber = grnNum;
    }
  
    if (count) {
      req.count = count;
    }
  
    if (farmer) {
      req.farmer = farmer;
    }

    if (testAt) {
      req.testAt = testAt;
    }
  
    console.log('Request Payload:', req); 
  
    antiBioticsReportService.getAllAntiBioticsRejectedIndentsData(req)
      .then((res) => {
        if (res.status) {
          setRejectedData(res.data);
        } else {
          AlertMessages.getErrorMessage(res.internalMessage);
          setRejectedData([]);
        }
      })
      .catch((err) => {
        AlertMessages.getErrorMessage(err.message);
        setRejectedData([]);
      });
  };

      const exportExcel = () => {
        if (!rejectedData || rejectedData.length === 0) return;
      
        const excelData = rejectedData.map((item, index) => {
          return {
            "S.No": index + 1,
            "Indent Code": item.indentNumber || "-",
            "Indent Date": item.indentDate ? moment(item.indentDate).format('DD-MM-YYYY') : "-",
            "GRN Number": item.grnNumber || "-",
            "GRN Date": item.grnDate ? moment(item.grnDate).format('DD-MM-YYYY') : "-",
            "Supplier Type":item.supplierType || '-',
            "Supplier Name": item.supplierType === "Dealer" ? (item.dealerName || "-") : (item.farmerName || "-"),
            "Test Type": item.testType || "-",
            "Count": item.count || "-",
            "indentQuantity":item.indentQuantity || '-',
            "grnQuantity":item.grnQuantity || '-',
            "HONQuantity":item.HONQuantity || '-',
            "CAP": item.cap || "-",
            "capReason": item.capReason || "-",
            "AOZ": item.aoz || "-",
            "aozReason": item.aozReason || "-",
            "AMOZ": item.amoz || "-",
            "amozReason": item.amozReason || "-",
            "SEM": item.sem || "-",
            "semReason": item.semReason || "-",
            "AHD": item.ahd || "-",
            "ahdReason": item.ahdReason || "-",
            "Rejected Reason": getAllReasonsAsString(item) || "-",
          };
        });
      
        const excel = new Excel();
        excel
          .addSheet("rm-rejected-indent-report.xlsx")
          .addColumns([
            { title: "S.No", dataIndex: "S.No", width: 50 },
            { title: "Indent Code", dataIndex: "Indent Code", width: 150 },
            { title: "Indent Date", dataIndex: "Indent Date", width: 120 },
            { title: "GRN Number", dataIndex: "GRN Number", width: 150 },
            { title: "GRN Date", dataIndex: "GRN Date", width: 120 },
            { title: "Supplier Type", dataIndex: "Supplier Type", width: 120 },
            { title: "Supplier Name", dataIndex: "Supplier Name", width: 200 },
            { title: "Test Type", dataIndex: "Test Type", width: 100 },
            { title: "Count", dataIndex: "Count", width: 100 },
            { title: "Indent Quantity", dataIndex: "indentQuantity", width: 100 },
            { title: "GRN Quantity", dataIndex: "grnQuantity", width: 100 },
            { title: "HON Quantity", dataIndex: "HONQuantity", width: 100 },
            { title: "CAP", dataIndex: "CAP", width: 80 },
            { title: "CAP Rejected Reason", dataIndex: "capReason", width: 80 },
            { title: "AOZ", dataIndex: "AOZ", width: 80 },
            { title: "AOZ Rejected Reason", dataIndex: "aozReason", width: 80 },
            { title: "AMOZ", dataIndex: "AMOZ", width: 80 },
            { title: "AMOZ Rejected Reason", dataIndex: "amozReason", width: 80 },
            { title: "SEM", dataIndex: "SEM", width: 80 },
            { title: "SEM Rejected Reason", dataIndex: "semReason", width: 80 },
            { title: "AHD", dataIndex: "AHD", width: 80 },
            { title: "AHD Rejected Reason", dataIndex: "ahdReason", width: 80 },
          ])
          .addDataSource(excelData, { str2num: true });
        excel.saveAs("rm-rejected-indent-report.xlsx");
      };
      
      

    function handleSearch(selectedKeys: React.SetStateAction<string>[], confirm: () => void, dataIndex: React.SetStateAction<string>) {
        confirm();
        setSearchText(selectedKeys[0]);
        setSearchedColumn(dataIndex);
      };
    
      function handleReset(clearFilters: () => void) {
        clearFilters();
        setSearchText('');
        setSearchedColumn('')
      };
      

    const getColumnSearchProps = (dataIndex: string) => ({
        filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
          <div style={{ padding: 8 }}>
            <Input
              ref={searchInput}
              placeholder={`Search ${dataIndex}`}
              value={selectedKeys[0]}
              onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
              onPressEnter={() => handleSearch(selectedKeys, confirm, dataIndex)}
              style={{ width: 188, marginBottom: 8, display: 'block' }}
            />
            <Button
              type="primary"
              onClick={() => handleSearch(selectedKeys, confirm, dataIndex)}
              icon={<SearchOutlined />}
              size="small"
              style={{ width: 90, marginRight: 8 }}
            >
              Search
            </Button>
            <Button onClick={() => handleReset(clearFilters)} size="small" style={{ width: 90 }}>
              Reset
            </Button>
          </div>
        ),
        filterIcon: (filtered: any) => (
          <SearchOutlined type="search" style={{ color: filtered ? '#1890ff' : undefined }} />
        ),
        onFilter: (value: string, record: { [x: string]: { toString: () => string; }; }) =>
          record[dataIndex]
            ? record[dataIndex]
              .toString()
              .toLowerCase()
              .includes(value.toLowerCase())
            : false,
        onFilterDropdownVisibleChange: (visible: any) => {
          if (visible) { setTimeout(() => searchInput.current.select()); }
        },
        render: (text: { toString: () => any; }) =>
          text ? (
            searchedColumn === dataIndex ? (
              <Highlighter
                highlightStyle={{ backgroundColor: '#ffc069', padding: 0 }}
                searchWords={[searchText]}
                autoEscape
                textToHighlight={text.toString()}
              />
            ) : text
          ) : null
      });

      const getAllReasonsAsString = (record) => {
        const reasons = [
            record.capReason,
            record.aozReason,
            record.amozReason,
            record.semReason,
            record.ahdReason
        ].filter(reason => reason); 
        return reasons.join(', ');
    };

    const onFinish = (val) => {
      console.log(val);
      
      getRejectedData()
      };
    
      const onReset = () => {
        form.resetFields();
        getRejectedData();
      };
    

    const Column: ColumnProps<any>[] =  [
        {
          title: 'S No',
          key: 'id',
          responsive: ['md'],
          align: 'left',
          render: (text, object, index) => (page - 1) * 10 + (index + 1),
        },
        
                {
                  title: "Indent Code",
                  key: "indentNumber",
                  dataIndex: "indentNumber",
                  ...getColumnSearchProps("indentNumber"),
                  render: (value, record) => record.indentNumber ?record.indentNumber :  "-",
                  sorter: (a, b) => a.indentNumber?.localeCompare(b.indentNumber),
                  sortDirections: ["descend", "ascend"] as SortOrder[],
  
                },
                {
                  title: "Indent Date",
                  key: "indentDate",
                  dataIndex: "indentDate",
                  width:'120',
                  sorter: (a, b) => a.indentDate?.localeCompare(b.indentDate),
                  // ...getColumnSearchProps("indentDate"),
                  render: (text, record) => {
                    return (
                      <>
                        {record.indentDate ? moment(record.indentDate).format('DD-MM-YYYY') : '-'}
                      </>
                    );
                  },
                },
            {
              title: 'GRN Number',
              key: 'grnNumber',
              dataIndex:'grnNumber',
              ...getColumnSearchProps('grnNumber'),
              sorter: (a, b) => a.grnNumber?.localeCompare(b.grnNumber),
              render: (value, record) => record.grnNumber ?record.grnNumber :  "-",
              sortDirections: ['descend', 'ascend'] as SortOrder[],
          },
          {
            title: "GRN Date",
            key: "grnDate",
            dataIndex: "grnDate",
            // ...getColumnSearchProps("grnDate"),
            sorter: (a, b) => a.grnDate?.localeCompare(b.grnDate),
            render:(text,record) => {
              return(
                <>
                {record.grnDate ? moment(record.grnDate).format('DD-MM-YYYY') : '-'}
                </>
              )
            }
          },
            
              
            // {
            //   title: 'LOT Number',
            //   key: 'lotNumber',
            //   dataIndex:'lotNumber',
            //   ...getColumnSearchProps("lotNumber"),
            //   sorter: (a, b) => a.lotNumber?.localeCompare(b.lotNumber),
            //   render: (value, record) => (record.lotNumber ? record.lotNumber : "-"),
            //   sortDirections: ["descend", "ascend"] as SortOrder[],
            //   },
          {
            title: "Supplier Type",
            key: "supplierType",
            dataIndex: "supplierType",
            // ...getColumnSearchProps("supplierType"),
            sorter: (a, b) => a.supplierType?.localeCompare(b.supplierType),
            render: (value, record) => (record.supplierType ? record.supplierType : "-"),
            sortDirections: ["descend", "ascend"] as SortOrder[],
          },
            {
              title: `Supplier Name`,
              key: "farmerName",
              dataIndex: "farmerName",
              ...getColumnSearchProps("farmerName"),
              sorter: (a, b) => {
                const nameA = (a.supplierType === "Dealer" ? a.dealerName : a.farmerName) || "";
                const nameB = (b.supplierType === "Dealer" ? b.dealerName : b.farmerName) || "";
                return nameA.localeCompare(nameB);
              },
              render: (value, record) => {
                if (record.supplierType === "Dealer") {
                  return record.dealerName ? record.dealerName : "-";
                }
                return record.farmerName ? record.farmerName : "-";
              },
              sortDirections: ["descend", "ascend"] as SortOrder[],
            },
            {
              title: 'Test Type',
              key: 'testType',
              dataIndex:'testType',
              responsive: ['md'],
              align: 'left',
              // ...getColumnSearchProps('testType'), 
              sorter: (a, b) => a.testType?.localeCompare(b.testType),
              render: (value, record) => (record.testType ? record.testType : "-"),
              sortDirections: ["descend", "ascend"] as SortOrder[],
          },
            
          {
              title: 'Count',
              key: 'count',
              dataIndex:'count',
              responsive: ['md'],
              align: 'left',
              sorter: (a, b) => a.count - b.count,
              render: (value, record) => record.count ?record.count :  "-",
              // ...getColumnSearchProps('count'), 
          },
          {
            title: "Indent Quantity",
            key: "indentQuantity",
            dataIndex: "indentQuantity",
            render: (value, record) => {
              const quantity = parseFloat(record.indentQuantity);
              return isNaN(quantity) ? "-" : quantity.toFixed(2);
            },
            sorter: (a, b) => a.indentQuantity - b.indentQuantity,
            ...getColumnSearchProps("indentQuantity"),
          },
          {
            title: "GRN Quantity",
            key: "grnQuantity",
            dataIndex: "grnQuantity",
            render: (value, record) => {
              const quantity = parseFloat(record.grnQuantity);
              return isNaN(quantity) ? "-" : quantity.toFixed(2);
            },
            sorter: (a, b) => parseFloat(a.grnQuantity) - parseFloat(b.grnQuantity),
            ...getColumnSearchProps("grnQuantity"),
          },
          
          {
            title: "HON Quantity",
            key: "HONQuantity",
            dataIndex: "HONQuantity",
            render: (value, record) => {
              const quantity = parseFloat(record.HONQuantity);
              return isNaN(quantity) ? "-" : quantity.toFixed(2);
            },
            sorter: (a, b) => a.HONQuantity - b.HONQuantity,
            ...getColumnSearchProps("HONQuantity"),
          },
       
          {
              title: 'CAP',
              key: 'cap',
              dataIndex:'cap',
              responsive: ['md'],
              align: 'left',
              // ...getColumnSearchProps('cap'),
              // sorter: (a, b) => a.cap?.localeCompare(b.cap),
              // sortDirections: ['descend', 'ascend'],
              filters: [
                { text: 'PASS', value: PassOrFail.PASS },
                { text: 'FAIL', value: PassOrFail.FAIL },
              ],
              onFilter: (value, record) => record.cap === value,
  
          },
          {
            title: 'CAP Rejected Reason',
            key: 'capReason',
           dataIndex: 'capReason',
            responsive: ['md'],
            align: 'left',
            ...getColumnSearchProps('capReason'),
            sorter: (a, b) => a.capReason?.localeCompare(b.capReason),
            render: (value, record) => record.capReason ?record.capReason :  "-",
       
  
  
        },
          {
              title: 'AOZ',
              key: 'aoz',
              dataIndex: 'aoz',
              responsive: ['md'],
              align: 'left',
              // ...getColumnSearchProps('aoz'),
              // sorter:(a,b) => a.aoz.localeCompare(b.aoz),
              // sortDirections: ['descend', 'ascend'],
              filters: [
                { text: 'PASS', value: PassOrFail.PASS },
                { text: 'FAIL', value: PassOrFail.FAIL },
              ],
              onFilter: (value, record) => record.aoz === value,
          },
          {
            title: 'AOZ Rejected Reason',
            key: 'aozReason',
            dataIndex: 'aozReason',
            responsive: ['md'],
            align: 'left',
            ...getColumnSearchProps('aozReason'),
            sorter: (a, b) => a.aozReason?.localeCompare(b.aozReason),
            sortDirections: ['descend', 'ascend'],
            render: (value, record) => (record.aozReason ? record.aozReason : "-"),
  
  
        },
          
          {
              title: 'AMOZ',
              key: 'amoz',
              dataIndex: 'amoz',
              responsive: ['md'],
              align: 'left',
              // ...getColumnSearchProps('amoz'),
              // sorter: (a, b) => a.amoz-b.amoz,
              // sortDirections: ['descend', 'ascend'],
              render: (value, record) => record.amoz ?record.amoz :  "-",
              filters: [
                { text: 'PASS', value: PassOrFail.PASS },
                { text: 'FAIL', value: PassOrFail.FAIL },
              ],
              onFilter: (value, record) => record.amoz === value,
              // render:(index,val) =>{
              //     return <span>{val.amoz?moment(val.amoz).format("DD-MM-YYYY"):'-'}</span>
              // }
  
  
  
          },
          {
            title: 'AMOZ Rejected Reason',
            key: 'amozReason',
            dataIndex: 'amozReason',
            responsive: ['md'],
            align: 'left',
            ...getColumnSearchProps('amozReason'),
            sorter: (a, b) => a.amozReason?.localeCompare(b.amozReason),
            sortDirections: ['descend', 'ascend'],
            render: (value, record) => (record.amozReason ? record.amozReason : "-"),
  
  
        },
          
          {
              title: 'SEM',
              key: 'sem',
             dataIndex: 'sem',
              responsive: ['md'],
              align: 'left',
              // ...getColumnSearchProps('sem'),
              // sorter: (a, b) => a.sem-b.sem,
              // sortDirections: ['descend', 'ascend'],
              filters: [
                { text: 'PASS', value: PassOrFail.PASS },
                { text: 'FAIL', value: PassOrFail.FAIL },
              ],
              onFilter: (value, record) => record.sem === value,
  
  
          },
          {
            title: 'SEM Rejected Reason',
            key: 'semReason',
            dataIndex: 'semReason',
            responsive: ['md'],
            align: 'left',
            ...getColumnSearchProps('semReason'),
            sorter: (a, b) => a.semReason?.localeCompare(b.semReason),
            sortDirections: ['descend', 'ascend'],
            render: (value, record) => (record.semReason ? record.semReason : "-"),
  
  
        },
          {
              title: 'AHD',
              key: 'ahd',
              dataIndex: 'ahd',
              responsive: ['md'],
              align: 'left',
              // ...getColumnSearchProps('ahd'),
              // sorter: (a, b) => a.ahd.localeCompare(b.ahd),
              // sortDirections: ['descend', 'ascend'],
              filters: [
                { text: 'PASS', value: PassOrFail.PASS },
                { text: 'FAIL', value: PassOrFail.FAIL },
              ],
              onFilter: (value, record) => record.ahd === value,
  
          },
         
        
       
          {
              title: 'AHD Rejected Reason',
              key: 'ahdReason',
              dataIndex: 'ahdReason',
              responsive: ['md'],
              align: 'left',
              ...getColumnSearchProps('ahdReason'),
              sorter: (a, b) => a.ahdReason?.localeCompare(b.ahdReason),
              sortDirections: ['descend', 'ascend'],
              render: (value, record) => (record.ahdReason ? record.ahdReason : "-"),
  
  
          },
      //   {
      //     title: 'Rejected Reason',
      //     key: 'rejectedReason',
      //     dataIndex: 'rejectedReason',
      //     responsive: ['md'],
      //     align: 'left',
      //     ...getColumnSearchProps('rejectedReason'),
      //     sorter: (a, b) => {
      //         const aReasons = getAllReasonsAsString(a);
      //         const bReasons = getAllReasonsAsString(b);
      //         return aReasons.localeCompare(bReasons);
      //     },
      //     render: (_, record) => {
      //         const reasonStr = getAllReasonsAsString(record);
      //         return reasonStr || "-";
      //     },
      // },
      
    
          
  
      
    ]
  return (
    <div>
       <Card
      size="small"
      title={<span style={{ color: 'white' }}>Indent Rejected Report</span>}
      style={{ textAlign: 'center' }}
      headStyle={{ backgroundColor: '#69c0ff', border: 0 }} extra={
         <Button icon={<DownloadOutlined />} onClick={() => { exportExcel() }} style={{marginRight:30}}>
                  Get Excel
                </Button>    
      }
    >
         <Form form={form} 
        onFinish={onFinish}
        layout="vertical"
        >
        <Row gutter={12}>
        <Col span={5}>
            <Form.Item label="Indent date" name="indentDate">
              <RangePicker />
            </Form.Item>
          </Col>
        <Col span={5}>
            <Form.Item label="GRN Date" name="grnDate">
              <RangePicker />
            </Form.Item>
          </Col>
          <Col xs={24} sm={12} md={8} lg={8} xl={4}>
            <Form.Item name="indentNum" label="Indent Code">
              <Select
                showSearch
                placeholder="Select Indent Code"
                optionFilterProp="children"
                allowClear
              >
                {indentCode.filter(indent => indent.indentNumber !== null).map((qc: any) => (
                  <Select.Option key={qc.indentId} value={qc.indentId}>
                    {qc.indentNumber}
                  </Select.Option>
                ))}
              </Select>
            </Form.Item>   
          </Col>
        <Col xs={24} sm={12} md={8} lg={6} xl={4}>
            <Form.Item name="grnNum" label="GRN Number">
              <Select
                showSearch
                placeholder="Select GRN Number"
                optionFilterProp="children"
                allowClear
              >
                {grnNumber.filter(grn => grn.grnNumber !== null).map((qc: any) => (
                  <Select.Option key={qc.grnId} value={qc.grnId}>
                    {qc.grnNumber}
                  </Select.Option>
                ))}
              </Select>
            </Form.Item>   
          </Col>
       
          
          <Col xs={24} sm={12} md={8} lg={6} xl={5}>
            <Form.Item name="farmer" label="Farmer">
              <Select
                showSearch
                placeholder="Select Farmer"
                optionFilterProp="children"
                allowClear
                dropdownMatchSelectWidth={false}
              >
                {farmers.filter(far => far.name !== null).map((qc: any) => (
                  <Select.Option key={qc.name} value={qc.name}>
                    {qc.name}
                  </Select.Option>
                ))}
              </Select>
            </Form.Item>   
          </Col>
         
          <Col xs={24} sm={12} md={8} lg={6} xl={5}>
            <Form.Item name="count" label="Count">
              <Select
                showSearch
                placeholder="Select Count"
                optionFilterProp="children"
                allowClear
                dropdownMatchSelectWidth={false}
              >
                {counts.filter(c => c.count !== null ).map((qc: any) => (
                  <Select.Option key={qc.count} value={qc.count}>
                    {qc.count}
                  </Select.Option>
                ))}
              </Select>
            </Form.Item>   
          </Col>
          <Col xs={24} sm={12} md={8} lg={8} xl={4}>
            <Form.Item name="testAt" label="Test At">
              <Select
                showSearch
                placeholder="Select Test At"
                optionFilterProp="children"
                allowClear
              >
                <Select.Option value="PRE HARVEST">PRE HARVEST</Select.Option>
                <Select.Option value="GRADING">GRADING</Select.Option>
              </Select>
            </Form.Item>
          </Col>


              {/* </Row>
       <Row style={{justifyContent:'flex-end'}}> */}

          <Col style={{ paddingLeft: '10px', marginTop: '30px' }}>
            <Form.Item>
              <Button
                htmlType='submit'
                type="primary"
                style={{ width: '100px', marginRight: "10px" }}>
                Get Report
              </Button>
            </Form.Item>
          </Col>
          <Col style={{ paddingLeft: '10px', marginTop: '30px' }}>
            <Form.Item>
              <Button
                type="primary"
                icon={<UndoOutlined />}
                onClick={onReset}
                
              >
                Reset
              </Button>
            </Form.Item>
          </Col>
       </Row>
          </Form>
           <Row gutter={16} style={{height:'45px'}}>
            <Col span={5}>
              <Tag color="#92d8b4" style={{ display: 'flex', color: 'black', justifyContent: 'center', alignItems: 'center', height: 35, padding: '6px' }}>
                Total No.Of Indent Rejected : {rejectedData.length || 0}
              </Tag></Col>
              </Row>
      <Table
        columns={Column}
        dataSource={rejectedData}
        scroll={{ x: 'max-content' }}
        pagination={{
          current: page,
          onChange: (current) => setPage(current),
        }}
    /> 
    </Card>
    </div>
  )
}

export default RejectedIndentReport
