text: import React from 'react';
  import * as Yup from "yup";
  import { sortCaret } from "../../../../_themeBase/_helpers";
  import * as columnFormatters from "../../../../_themeBase/layout/components/basePage/pages/objects-table/column-formatters";
  import { Input } from "../../../../_themeBase/_partials/controls";
  import { SelectStatus } from '../../customComponents/SelectStatus';
  export {filterFields} from "../../customComponents/filterFields";
   
    
    export const initObject = {
      id: undefined,
      title: "",
      isDeleted: false
    };
    
    export const columns = [
      {
        dataField: "title",
        text: columnFormatters.translateByMessageId("MODULES.BASEINFO.Group.TITLE"),
        // text: "نام گروه",
        sort: true,
        sortCaret: sortCaret,
      },
      {
        dataField: "IsDeleted",
        text: columnFormatters.translateByMessageId("MODULES.GENERAL.STATUS"),
        // text: "وضعیت",
        sort: true,
        sortCaret: sortCaret,
        formatter: columnFormatters.StatusColumnFormatter,
      },
      {
        dataField: "action",
        text: columnFormatters.translateByMessageId("MODULES.GENERAL.ACTION"),
        // text: "Actions",
        formatter: columnFormatters.ActionsColumnFormatter,
        formatExtraData: {
          // openEditObjectPage: objectsUIProps.openEditObjectPage,
          // openDeleteObjectDialog: objectsUIProps.openDeleteObjectDialog,
        },
        classes: "text-right pr-0",
        headerClasses: "text-right pr-3",
        style: {
          minWidth: "100px",
        },
      },
    ];
    
    export const formFields = [
      {
        row: 1,
        list: [
          {
            name: "title",
            type: "text",
            component: Input,
            placeholder: "MODULES.BASEINFO.Group.TITLE_PH",
            label: "MODULES.BASEINFO.Group.TITLE",
            rowIdx: 1,
            class: "col-lg-4"
          },
          
        ]
      },
    
    ];
    
    export const otherFields = [
      // {
      //   name: "description",
      //   lable: "Description",
      //   type: "textarea",
      //   as: "textarea",
      //   rowOrder: 1,
      //   rowIdx: 1,
      //   class: "form-control"
      // },
    
    ];
    
    
    
    export const filterInitialValues ={
      isDeleted: "", // values => All=""/Selling=0/Sold=1
      searchText: "",
    }
   
    export const prepareFilter = (queryParams, values) => {
      const { isDeleted, searchText } = values;
    const newQueryParams = { ...queryParams };
    const filter = {};
    // Filter by isDeleted
    filter.isDeleted = isDeleted !== "" ? +isDeleted : undefined;
  
    // Filter by all fields
    filter.title = searchText;
    if (searchText) {
      filter.title = searchText;
    }
    newQueryParams.filter = filter;
   
    let whereClause = "title.contains(@0)"
    const whereClauseParameters = [];
    whereClauseParameters.push(searchText)
  
  if(filter.isDeleted !== undefined){
    whereClause = whereClause + " and isDeleted=@1"
    whereClauseParameters.push(filter.isDeleted === 0 ? false : true)
  }
  
   newQueryParams.whereClause = whereClause;
   newQueryParams.whereClauseParameters = whereClauseParameters;
  
    return newQueryParams;
    };
  
    
  // Validation schema
  export const ObjectEditSchema = Yup.object().shape({
    title: Yup.string()
        .required("title is required"),
    });
    
    