Facebook
From akoto, 4 Years ago, written in Plain Text.
This paste is a reply to Re: SearchPayeePanel from akoto - go back
Embed
Viewing differences between Re: SearchPayeePanel and ApproveRestrictedPayeeCTR
/**
 * SearchPayeePanel.ApproveRestrictedPayeeCTR.js
 */

import React, { Component } from "react";
import Helmet from "react-helmet";
import { observer BaseContainers, BaseComponents } from "mobx-react";
"frontend-react-f4-base-ui";
import { BaseContext } from "frontend-react-f4-base-commons";
import { BaseComponents observer } from "frontend-react-f4-base-ui";
"mobx-react";
import TextArea from "../../components/TextArea/TextArea";
import moment from "moment";
import { Modal } from "antd";
import RightPanel MaintenanceApprovalConfirmPanel from "../RightPanel/RightPanel";
/../components/MaintenanceApprovalConfirmPanel/MaintenanceApprovalConfirmPanel";
import MaintenanceApprovalPanel from "../../components/MaintenanceApprovalPanel/MaintenanceApprovalPanel";
import CitrineFunctionCodes from "../../enums/CitrineFunctionCodes";
import MaintenanceApprovalAckPanel from "../../components/MaintenanceApprovalAckPanel/MaintenanceApprovalAckPanel";
import ViewPage from "../../components/ViewPage/ViewPage";
import AckMessage from "../../components/AckMessage/AckMessage";
import _ from "underscore";
import { browserHistory } from "react-router";
import BoNoRecords 
ApproveRejectViewPageActionPanel from "../../components/BoNoRecords/BoNoRecords";
/components/ApproveRejectViewPageActionPanel/ApproveRejectViewPageActionPanel";

import TemplateTable BoNewViewPage from "../TemplateTable/TemplateTable";
/../components/BoNewViewPage/BoNewViewPage";
import FeedbackModalMessage NewViewRestrictedPayeePanel from "../FeedbackModalMessage/FeedbackModalMessage";

/../components/NewViewRestrictedPayeePanel/NewViewRestrictedPayeePanel";

const { connect } = BaseContext;

BaseContext;
const {
  strings,
  // F4DataTable,
  FeedbackModal1,
  Feedback,
  F4Confirmation,
  ActionButton
{ F4ContentContainer } = BaseContainers;
const { strings, F4Stepper, Feedback 
} = BaseComponents;

import ClientConfig from "../../config/ClientConfig";

@observer
@connect
class SearchPayeePanel ApproveRestrictedPayeeCTR extends Component {
  constructor(props) {
    super(props);

    this.state = {
      pages: {
        initial: 0,
        confirm: 1,
        ack: 2,
        view: 3,
        viewForConfirmAck: 4,
        ackForSingle: 5
      },
      showErrorModal: false,
      errorModalMsg: "",
      hasAuth: readOnly: false,
      prevPage: 0,
      isForView: false,
      clickedApprove: false,
      clickedReject: 
false
    };
  }

  checkAuth = () => {
    const { SessionStore, auth } = this.context.store;
    SessionStore.checkFuncAuthorization(
      auth.sessionUser.user.grp.id,
      CitrineFunctionCodes.RESTRICTED_PAYEE_NM_DEL
    ).then(hasAuth => {
      if (hasAuth) {
        this.setState({
          hasAuth: hasAuth
        });
      }
    });
  };

  onClickCd = data => 
componentDidMount() {
    const { RestrictedPayeeStore } = this.context.store;
    let fields const { onLoadResults } RestrictedPayeeStore.payeeFields;

this.props;
    RestrictedPayeeStore.restrictedPayeeInputs = data;
    console.log("id input: ", RestrictedPayeeStore.restrictedPayeeInputs);
    RestrictedPayeeStore.restrictedPayeeList = null;
    RestrictedPayeeStore.resetSearchFields();
    RestrictedPayeeStore.resetErrorList();
    RestrictedPayeeStore.selectedMenuOnSearch = 1;
    // browserHistory.push("/bo-bsc/departmentSearch");
  };

  _createData = () => {
    return [
      {
        headerTitle: strings.global_restrictedpayeenm,
        name: "payeeName",
        type: "text",
        width: 100,
        cell: props => (
                       className="linkInTable"
            onClick={() => 
resetApprovalFields();
    if (onLoadResults && onLoadResults === true) {
      
this.onClickCd(props.data)}
          >
            {props.data.payeeName}
          
        )
      },

      {
        headerTitle: strings.global_amount,
        name: "amount",
        type: "text",
        width: 100,
        align: "right"
      },
      {
        headerTitle: strings.global_action,
        name: "isAllowedStr",
        type: "text",
        width: 100,
        sortBy: "isAllowed"
      },
      {
        headerTitle: strings.global_character_ignore,
        name: "charToIgnore",
        type: "text",
        width: 100
      },

      {
        headerTitle: null,
        name: "actions",
        type: "text",
        width: 80,
        isSortable: false,
        hideInColumnDisplay: true,
        hideInGrouping: true,
        isInReport: false,
        cell: props => (
          
                           showEdit={props.data.showEdit}
              showDelete={props.data.showDelete}
              onEdit={() => this.onEdit(props.data)}
              onDelete={() => this.confirmDelete(false, props.data)}
            />
          

        )
      }
    ];
  };

  showIcon onSearch();
    }
  }

  redirectTo 
iconDirectory => {
    let icon = iconDirectory;
    return (
      
        {" "}
        {" "}
      

    );
  };

  onClickDownload = multiSort pageNo => {
    const { RestrictedPayeeStore } = this.context.store;
    return new Promise(resolve RestrictedPayeeStore.selectedMenuOnApprove = pageNo;
  };

  confirmOnClickBack = () 
=> {
{
    const { MaintenanceStore, RestrictedPayeeStore } = this.context.store;
    MaintenanceStore.approveList = null;
    RestrictedPayeeStore.resetApprovalFields();
    this.redirectTo(
      this.state.isForView ? this.state.pages.view : this.state.pages.initial
    );
    this.setState({ isForView: false });
  };

  confirmOnClickSubmit = (isApprove, succCB) => {
    const { auth, RestrictedPayeeStore, SettingsStore } = this.context.store;

    SettingsStore.isScreenLoading = true;
    this.setState({ prevPage: this.state.pages.confirm });
    RestrictedPayeeStore.approveListReqModel.localUserCd =
      auth.sessionUser.user.cd;
    RestrictedPayeeStore.approveListReqModel.isApprove = isApprove;
    RestrictedPayeeStore.approveListReqModel.remarks =
      RestrictedPayeeStore.findBySearchModel(
approvalConfirmProps.remarks;
    RestrictedPayeeStore.approveListReqModel.maintenanceList =
      RestrictedPayeeStore.approvalConfirmProps.dataList;

    if (isApprove) {
      RestrictedPayeeStore.validateApproval(
        RestrictedPayeeStore.searchFilter,
        multiSort,
approveListReqModel.maintenanceList,
        res => {
          console.log("report", log("Res on validate Approval", res);
          if (res.body && !res.res.body.error) {
            resolve(res.if (res.body.content);
error.errors) {
              _.each(res.body.error.errors, errStr => {
                RestrictedPayeeStore.errors.push(errStr.message);
              });
            } else if (res.body.error.message) {
              RestrictedPayeeStore.errors.push(res.body.error.message);
            }
            SettingsStore.isScreenLoading = false;
            this.setState({ clickedApprove: false });
            succCB && succCB();
          } else {
            this.approveList(isApprove, succCB);
            // SettingsStore.isScreenLoading = false;
          }
        }
      );
    } else {
      this.approveList(isApprove, succCB);
      // SettingsStore.isScreenLoading = false;
    }
  };

  approveList = (isApprove, succCB) => {
    const { RestrictedPayeeStore, SettingsStore } = this.context.store;

    let message = isApprove
      ? strings.formatString(
          strings.feedback_success_approval,
          strings.global_restrictedpayeenm,
          "approved"
        )
      : strings.formatString(
          strings.feedback_success_approval,
          strings.global_restrictedpayeenm,
          "rejected"
        );
    let messageSingle = isApprove
      ? "Restricted Payee Name was approved."
      : "Restricted Payee Name was rejected.";
    RestrictedPayeeStore.approveList(
      RestrictedPayeeStore.approveListReqModel,
      res => {
        console.log("Approve List: ", res);
        if (!res.body && res.text) {
          RestrictedPayeeStore.approvalAckProps = {
            dataList: RestrictedPayeeStore.approvalConfirmProps.dataList,
            action: isApprove
              ? strings.global_approve.toLowerCase()
              : strings.global_reject.toLowerCase(),
            remarks: RestrictedPayeeStore.approvalConfirmProps.remarks,
            refNo: res.text,
            message: this.state.isForView ? messageSingle : message
          };
          if (this.state.isForView) {
            let maintenanceList =
              RestrictedPayeeStore.approvalAckProps.dataList;
            RestrictedPayeeStore.restrictedPayeeDtlString =
              maintenanceList &&
              maintenanceList.length > 0 &&
              JSON.parse(maintenanceList[0].dtlString);
            this.redirectTo(this.state.pages.ackForSingle);
            this.setState({
              prevPage: this.state.pages.ackForSingle
            });
          } else {
            this.redirectTo(this.state.pages.ack);
            this.setState({ prevPage: this.state.pages.ack });
          }
          SettingsStore.isScreenLoading = false;
          succCB && succCB();
        } else {
          if (res.body.error.errors) {
            _.each(res.body.error.errors, errStr => {
              RestrictedPayeeStore.errors.push(errStr.message);
            });
          } else if (res.body.error.message) {
            RestrictedPayeeStore.errors.push(res.body.error.message);
          }
          SettingsStore.isScreenLoading = false;
          succCB && succCB();
        }
      }
    );
  };

  onClickRefNo = data => {
    const { RestrictedPayeeStore, MaintenanceStore } = this.context.store;
    RestrictedPayeeStore.resetErrorList();
    RestrictedPayeeStore.viewPageMaintenanceData = data;

    MaintenanceStore.remarks = null;
    RestrictedPayeeStore.resetApprovalFields();
    this.redirectTo(this.state.pages.view);
    this.setState({
      readOnly: false,
      prevPage: this.state.pages.confirm,
      isForView: true
    });
  };

  showDataTable onClickRefNoForConfirmAck () data => {
    const { RestrictedPayeeStore, DownloadReportStore MaintenanceStore } = this.context.store;
    if (
      
RestrictedPayeeStore.restrictedPayeeList &&
      
viewPageMaintenanceData = data;
    this.redirectTo(this.state.pages.viewForConfirmAck);
    this.setState({ readOnly: true });
  };

  onClickApprove = (maintenanceList, remarks, succCB) => {
    const {
      RestrictedPayeeStore,
      MaintenanceStore,
      auth,
      SettingsStore
    } = this.context.store;
    MaintenanceStore.errors = [];
    SettingsStore.isScreenLoading = true;
    this.setState({ clickedApprove: true });
    
RestrictedPayeeStore.restrictedPayeeList.length > 0
    ) 
validateApproval(maintenanceList, res => {
      return (
        
                       tableKey={CitrineFunctionCodes.RESTRICTED_PAYEE_NM_SEARCH}
            onClickDownload={this.onClickDownload}
            downloadProps={{
              isDynamic: true,
              params: 
console.log("Res on Validate Payee Approval: ", res);
      if (res.body && res.body.error) {
        if (res.body.error.errors) {
          _.each(res.body.error.errors, errStr => {
            MaintenanceStore.errors.push(errStr.message);
            RestrictedPayeeStore.errors.push(errStr.message);
          });
        } else if (res.body.error.message) {
          MaintenanceStore.errors.push(res.body.error.message);
          RestrictedPayeeStore.errors.push(res.body.error.message);
        }
        MaintenanceStore.remarks = null;
        SettingsStore.isScreenLoading = false;
        this.setState({ clickedApprove: false });
        succCB && succCB();
      } else {
        console.log("No Errors.");
        MaintenanceStore.validateApprovalReqModel.isApprove = true;
        MaintenanceStore.validateApprovalReqModel.maintenanceList = maintenanceList;
        MaintenanceStore.validateApprovalReqModel.modelNm =
          strings.global_payee;
        MaintenanceStore.validateApprovalReqModel.remarks = remarks;
        MaintenanceStore.validateApprovalReqModel.requiresApprovalFuncCd =
          CitrineFunctionCodes.RESTRICTED_PAYEE_NM_REQUIRES_APPROVAL;
        //CitrineFunctionCodes.COURIER_MAINTENANCE_REQUIRES_APPROVAL;
        MaintenanceStore.validateApprovalReqModel.userCd =
          auth.sessionUser.user.cd;

        MaintenanceStore.validateApproval(
          MaintenanceStore.validateApprovalReqModel,
          res => {
            if (res.body && res.body.error) {
              _.each(res.body.error.errors, errStr => 
{
                reportHeader2: strings.formatString(
                  strings.global_reportobj,
                  strings.global_restrictedpayeenm
                )
              },
              fileName: "Restricted_Payee_Report"
            }}
            dataTableRef={table => (RestrictedPayeeStore.dataTableRef 
MaintenanceStore.errors.push(errStr.message);
              });
              this.setState({ clickedApprove: false });
              SettingsStore.isScreenLoading 
table)}
            options={this._createData()}
            data={
false;
              succCB && succCB();
            } else {
              console.log("No Errors.");

              RestrictedPayeeStore.restrictedPayeeList
                ? 
approvalConfirmProps = {
                action: strings.global_approve.toLowerCase(),
                remarks: remarks,
                dataList: maintenanceList
              };
              
RestrictedPayeeStore.restrictedPayeeList
                : null
resetErrorList();
              if (this.state.isForView) {
                this.confirmOnClickSubmit(true, null);
              } else {
                this.redirectTo(this.state.pages.confirm);
                this.setState({
                  prevPage: this.state.pages.confirm
                });
                SettingsStore.isScreenLoading = false;
              }
              MaintenanceStore.remarks = null;
              this.setState({ clickedApprove: false });
              succCB && succCB();
            }
            hasSelectAll={this.state.hasAuth}\n            defaultSort={{ updatedDt: "DESC" }}\n            serverSideTotalCount={\n              RestrictedPayeeStore.responseBody.totalElements\n            }\n            onSearch={this.onSearch}\n            showDeleteButton={this.state.hasAuth}\n            hasExpandable={false}\n            onDelete={() => {\n              const { RestrictedPayeeStore } = this.context.store;\n              let data = RestrictedPayeeStore.dataTableRef.getSelectedRows();\n              this.confirmDelete(true, data);\n            }}\n          />\n        
\n      );\n    } else if (\n      RestrictedPayeeStore.restrictedPayeeList &&\n      RestrictedPayeeStore.restrictedPayeeList.length === 0\n    ) {\n      return ;\n    } else {\n      let searchIcon = "images/ego-icons/search.svg";\n      return (\n        \n          \n            {" "}\n            {this.showIcon(searchIcon)}\n            {" "}\n          
\n          \n            {strings.message_searchusingrightpanel}\n          \n        \n      );\n    }\n          }
        );
      }
    });
  };

  showSearchIcon onClickReject () (maintenanceList, remarks, succCB) => {
    const {
      RestrictedPayeeStore,
      MaintenanceStore,
      auth,
      SettingsStore
    } = this.context.store;

    SettingsStore.isScreenLoading = true;
    MaintenanceStore.errors = [];
    this.setState({ clickedReject: true });

    MaintenanceStore.validateApprovalReqModel.isApprove = false;
    MaintenanceStore.validateApprovalReqModel.maintenanceList = maintenanceList;
    MaintenanceStore.validateApprovalReqModel.modelNm = strings.global_payee;
    MaintenanceStore.validateApprovalReqModel.remarks = remarks;
    MaintenanceStore.validateApprovalReqModel.requiresApprovalFuncCd =
      CitrineFunctionCodes.RESTRICTED_PAYEE_NM_REQUIRES_APPROVAL;
    // CitrineFunctionCodes.COURIER_MAINTENANCE_REQUIRES_APPROVAL;
    MaintenanceStore.validateApprovalReqModel.userCd = auth.sessionUser.user.cd;

    MaintenanceStore.validateApproval(
      MaintenanceStore.validateApprovalReqModel,
      res => {
        if (res.body && res.body.error) {
          _.each(res.body.error.errors, errStr => {
            MaintenanceStore.errors.push(errStr.message);
          });

          this.setState({
            showErrorModal: true,
            errorModalMsg: MaintenanceStore.errors[0],
            clickedReject: false
          });
          SettingsStore.isScreenLoading = false;
          succCB && succCB();
        } else {
          
console.log("Entered at showSearchIcon");
    let searchIcon 
log("No Errors.");
          RestrictedPayeeStore.approvalConfirmProps 
"images/ego-icons/search.svg";
    return (
      
        
          {this.showIcon(searchIcon)}
          
        
        
          {strings.message_searchusingrightpanel}
        
      
{
            action: strings.global_reject.toLowerCase(),
            remarks: remarks,
            dataList: maintenanceList
          };
          RestrictedPayeeStore.resetErrorList();
          if (this.state.isForView) {
            this.confirmOnClickSubmit(false, () => {
              this.setState({
                clickedReject: false
              });
            });
          } else {
            this.redirectTo(this.state.pages.confirm);
            this.setState({
              prevPage: this.state.pages.confirm,
              clickedReject: false
            });
          }
          SettingsStore.isScreenLoading = false;
          succCB && succCB();
        }
        MaintenanceStore.remarks = null;
      }
    );
  };

  onSearch = multiSort => {
    const { auth, RestrictedPayeeStore RestrictedPayeeStore, MaintenanceStore, auth } = this.context.store;

    RestrictedPayeeStore.resetErrorList();\n\n    if (!multiSort) {
      multiSort = {
        page: 0,
        count: 10,
        sortList: [
          {
            direction: "desc",
            sort: "updatedDt"
          }
        ]
      };
    }

    let fields = RestrictedPayeeStore.searchRestrictedPayeeFields;

approvalFields;
    {
      fields != undefined &&
        fields.map(
          field =>
            (RestrictedPayeeStore.searchFilter[field.(MaintenanceStore.searchRequestModel[field.index] = field.value)
        );
    }

    RestrictedPayeeStore.searchFilter.grpId MaintenanceStore.errors = [];

    MaintenanceStore.searchRequestModel.notCreatedBy 
= auth.sessionUser.user.grp.id;
    RestrictedPayeeStore.searchFilter.filterList 
cd;
    MaintenanceStore.searchRequestModel.filterTypeOne 
[
      RestrictedPayeeStore.searchFilter.payeeName,
      RestrictedPayeeStore.searchFilter.amount,
      RestrictedPayeeStore.searchFilter.isAllowed,
      RestrictedPayeeStore.searchFilter.charToIgnore
    ];

    RestrictedPayeeStore.findBySearchModelForMaintenance(
      RestrictedPayeeStore.searchFilter,
{
      isCaseSensitive: false,
      isEq: true
    };
    MaintenanceStore.searchRequestModel.filterTypeTwo = {
      isCaseSensitive: false,
      isEq: false
    };
    MaintenanceStore.searchRequestModel.funcCd =
      CitrineFunctionCodes.RESTRICTED_PAYEE_NM_REQUIRES_APPROVAL;
    //CitrineFunctionCodes.COURIER_MAINTENANCE_REQUIRES_APPROVAL;

    MaintenanceStore.findBySearchModel(
      MaintenanceStore.searchRequestModel,
      multiSort,
      res => {
        console.log("res on Search: ", res);\n        if (res.body && !res.body.error) {
          RestrictedPayeeStore.copyFromStore = res.body;
          RestrictedPayeeStore.
console.log("app res: ", res);
          MaintenanceStore.
responseBody = res.body;
          RestrictedPayeeStore.restrictedPayeeList MaintenanceStore.approveList = res.body.content;
          let data = RestrictedPayeeStore.restrictedPayeeList;
          RestrictedPayeeStore.
MaintenanceStore.approveList;
          MaintenanceStore.
dataTableRef.setState({
            data: data,
            copyOfData: data,
            totalItemsCount: res.body.totalElements
          });
          RestrictedPayeeStore.MaintenanceStore.dataTableRef &&
            MaintenanceStore.
dataTableRef.forceUpdate();
        } else {
          console.log("Error:", log("Error", res.body.error);
          _.each(res.body.error.errors, errStr => {\n            RestrictedPayeeStore.errors.push(errStr.message);\n          });\n        }
        // this.setState({ hasClickedSearch: true });
      }
    );
  };

  onEdit _createData data () => {
    const { RestrictedPayeeStore } = this.context.store;

    RestrictedPayeeStore.resetSearchFields();
    RestrictedPayeeStore.restrictedPayeeInputs = data;
    console.log("id input:  ", RestrictedPayeeStore.restrictedPayeeInputs);
    //console.log("props datas: ", props.data);
    RestrictedPayeeStore.restrictedPayeeList = null;
    browserHistory.push("/bo-bsc/restrictedPayeeEdit");
  };

  confirmDelete = (isMultiple, data) => {
    const {
      RestrictedPayeeStore,
      auth,
      SettingsStore,
      MaintenanceStore
    } = this.context.store;

    MaintenanceStore.requestModel.localUserCd = auth.sessionUser.user.cd;
    MaintenanceStore.requestModel.requiresApprovalFuncCd =
      CitrineFunctionCodes.RESTRICTED_PAYEE_NM_REQUIRES_APPROVAL;
    MaintenanceStore.requestModel.editFuncCd =
      CitrineFunctionCodes.RESTRICTED_PAYEE_NM_EDIT;
    MaintenanceStore.requestModel.deleteFuncCd =
      CitrineFunctionCodes.RESTRICTED_PAYEE_NM_DEL;
    MaintenanceStore.requestModel.actnFuncCd =
      CitrineFunctionCodes.RESTRICTED_PAYEE_NM_DEL;
    MaintenanceStore.requestModel.approveRejectFuncCd =
      CitrineFunctionCodes.RESTRICTED_PAYEE_NM_APPROVE_REJECT;
    MaintenanceStore.requestModel.modelNm = strings.global_payee;
    MaintenanceStore.requestModel.grpId = auth.sessionUser.user.grp.id;
    MaintenanceStore.requestModel.dtlString = JSON.stringify({
      id: data.id,
      payeeName: data.payeeName,
      amount: data.amount,
      isAllowed: data.isAllowed,
      charToIgnore: data.charToIgnore
    });

    if (!isMultiple) {
      SettingsStore.confirm(
        strings.message_del,
        () => {
          MaintenanceStore.requestModel.filterValues = [
            data.payeeName,
            data.amount,
            data.isAllowed,
            data.charToIgnore
          ];
          MaintenanceStore.requestModel.uniqueCds = [data.payeeName];

          MaintenanceStore.saveOrUpdate(
            MaintenanceStore.requestModel,
            response => {
              RestrictedPayeeStore.resetErrorList();
              if (response.body && response.body.error) {
                console.log("Error on Del: ", response);
                MaintenanceStore.errors = [];
                response.body.error.errors.map(error => {
                  MaintenanceStore.errors.push(error.message);
                });
                this.setState({
                  showErrorModal: true,
                  errorModalMsg: MaintenanceStore.errors
                });
                SettingsStore.isScreenLoading = false;
              } else if (!response.body && response.text) {
                console.log("Res on Del: ", response);
                RestrictedPayeeStore.ackMessage = {
                  header: strings.formatString(
                    strings.feedback_success_forapproval,
                    strings.formatString(
                      strings.global_deleteobj,
                      strings.global_restrictedpayeenm
                    )
                  ),
                  refNo: response.text
                };

                SettingsStore.modalSettings.message = (
                                       header={RestrictedPayeeStore.ackMessage.header}
                    refNo={RestrictedPayeeStore.ackMessage.refNo}
                  />
                );
                SettingsStore.modalSettings.showModal = true;

                SettingsStore.isScreenLoading = false;
                RestrictedPayeeStore.isForApproval = true;
                RestrictedPayeeStore.resetSearchFields();
                RestrictedPayeeStore.restrictedPayeeList = null;
                RestrictedPayeeStore.reset();
                RestrictedPayeeStore.dataTableRef.forceUpdate();
              } else if (!response.text) {
                let request = data;
                request.localUserCd = auth.sessionUser.user.cd;
                if (request && request.localUserCd) {
                  this.onDelete(request);
                }
              }
            }
          );
        },
        () => {
          SettingsStore.isScreenLoading = false;
        }
      );
    } else {
      if (data.length > 0) 
return [
      
{
        let maintenanceList = [];
        {
          data.map(item => {
            maintenanceList.push({
              localUserCd: auth.sessionUser.user.cd,
              requiresApprovalFuncCd:
                CitrineFunctionCodes.RESTRICTED_PAYEE_NM_REQUIRES_APPROVAL,
              editFuncCd: CitrineFunctionCodes.RESTRICTED_PAYEE_NM_EDIT,
              deleteFuncCd: CitrineFunctionCodes.RESTRICTED_PAYEE_NM_DEL,
              approveRejectFuncCd:
                CitrineFunctionCodes.RESTRICTED_PAYEE_NM_APPROVE_REJECT,
              actnFuncCd: CitrineFunctionCodes.RESTRICTED_PAYEE_NM_DEL,
              modelNm: 
headerTitle: strings.global_payee,
              grpId: auth.sessionUser.user.grp.id,
              isAdd: false,
              dtlString: JSON.stringify({
                id: item.id,
                payeeName: item.payeeName,
                amount: item.amount,
                isAllowed: item.isAllowed,
                charToIgnore: item.charToIgnore
              }),
              filterValues: [
                item.payeeName,
                item.amount,
                item.isAllowed,
                item.charToIgnore
              ],
              uniqueCds: [item.payeeName]
            });
          });
        }

        SettingsStore.confirm(
          
global_refno,
        name: "refNo",
        type: "link",
        width: 100,
        cell: props => (
                       className="linkInTable"
            onClick={() => this.onClickRefNo(props.data)}
          >
            {" "}
            {props.data.refNo}{" "}
          
        )
      },
      {
        headerTitle: 
strings.global_confirm_delete_records,
          () => {
            SettingsStore.isScreenLoading = true;
            MaintenanceStore.saveOrUpdateMultiple(
              {
                requiresApprovalFuncCd:
                  CitrineFunctionCodes.RESTRICTED_PAYEE_NM_REQUIRES_APPROVAL,
                grpId: auth.sessionUser.user.grp.id,
                list: maintenanceList,
                localUserCd: auth.sessionUser.user.cd
              },
              response => {
                MaintenanceStore.errors = [];
                if (response.body && response.body.error.errors) {
                  console.log("Error on Del: ", response);
                  MaintenanceStore.errors = [];
                  response.body.error.errors.map(error => {
                    MaintenanceStore.errors.push(error.message);
                  });
                  this.setState({
                    showErrorModal: true,
                    errorModalMsg: MaintenanceStore.errors
                  });
                  SettingsStore.isScreenLoading = false;
                  RestrictedPayeeStore.restrictedPayeeList = null;
                  RestrictedPayeeStore.reset();
                } else if (!response.body && response.text) {
                  console.log("Res on saveOrUpdate DelMultiple: ", response);

                  SettingsStore.modalSettings.message = (
                                           header={strings.formatString(
                        
global_restrictedpayeenm,
        name: "filterOne",
        type: "text",
        width: 100
      },
      {
        headerTitle: 
strings.feedback_success_forapproval_plural,
                        
global_amount,
        name: "filterTwo",
        type: "text",
        width: 100
      },
      {
        headerTitle: 
strings.formatString(
                          
global_func,
        // name: "actnFuncCd",
        name: "actnFunc.description",
        type: "text",
        width: 150,
        sortBy: "actnFunc.description",
        cell: props => (
          
            {props.data.actnFunc.description}
          
        )
      },
      {
        headerTitle: 
strings.global_deleteobj,
                          
global_creatdby,
        name: "createdBy",
        type: "text",
        width: 150
      },
      {
        headerTitle: 
strings.global_restrictedpayeenms
                        )
                      )}
                      refNo={response.text}
                    />
                  );
                  SettingsStore.modalSettings.showModal = true;

                  RestrictedPayeeStore.isForApproval = true;
                  RestrictedPayeeStore.resetSearchFields();
                  RestrictedPayeeStore.restrictedPayeeList = null;
                  RestrictedPayeeStore.reset();
                  SettingsStore.isScreenLoading = false;
                } else if (!response.body && !response.text) {
                  this.onDeleteMultiple(data);
                }
              }
            );
          },
          () => {
            SettingsStore.isScreenLoading = false;
          }
        );
global_createdt,
        name: "createdDt",
        type: "text",
        width: 150,
        formatter: "date"
      }
    }
];
  };

  setErrors _createDataForConfirmAck (resBody, showOnModal) () => {
    const { RestrictedPayeeStore, SettingsStore } = this.context.store;
    if (resBody && resBody.error) {
      RestrictedPayeeStore.resetErrorList();
      if (resBody.error.errors && resBody.error.errors.length > 0) 
return [
      
{
        resBody.error.errors.map(err headerTitle: strings.global_refno,
        name: "refNo",
        type: "link",
        width: 100,
        cell: props 
=> {
          RestrictedPayeeStore.errors.push(err.message);
        });
      } else 
(
                       className="linkInTable"
            onClick={() => this.onClickRefNoForConfirmAck(props.data)}
          >
            {" "}
            {props.data.refNo}{" "}
          
        )
      },
      
{
        RestrictedPayeeStore.errors.push(resBody.error.message);
headerTitle: strings.global_restrictedpayeenm,
        name: "filterOne",
        type: "text",
        width: 100
      },
      {
        headerTitle: strings.global_amount,
        name: "filterTwo",
        type: "text",
        width: 100
      },
      {
        headerTitle: strings.global_func,
        // name: "actnFuncCd",
        name: "actnFunc.description",
        type: "text",
        width: 150,
        sortBy: "actnFunc.description",
        cell: props => (
          
            {props.data.actnFunc.description}
          
        )
      },
      {
        headerTitle: strings.global_creatdby,
        name: "createdBy",
        type: "text",
        width: 150
      },
      {
        headerTitle: strings.global_createdt,
        name: "createdDt",
        type: "text",
        width: 120,
        formatter: "date"
      }
      if (\n        showOnModal &&\n        RestrictedPayeeStore.errors &&\n        RestrictedPayeeStore.errors.length > 0\n      ) {\n        SettingsStore.modalSettings = {\n          status: "error",\n          message: RestrictedPayeeStore.errors,\n          showModal: true\n        };\n      }\n    }\n    ];
  };

  onDelete onClickDownload payeee multiSort => {
    const { RestrictedPayeeStore, SettingsStore MaintenanceStore, auth } = this.context.store;

    console.log("ID TO BE DELETED: ", payeee);
    RestrictedPayeeStore.deleteRestrictedPayee(payeee, res 
store;
    return new Promise(resolve 
=> {
      console.log("DELETE res:", res);
      
MaintenanceStore.findBySearchModel(
        MaintenanceStore.searchRequestModel,
        multiSort,
        res => {
          
if (res.body && !res.body.error) {
        RestrictedPayeeStore.payeeSaved = res.body;\n        SettingsStore.isScreenLoading = false;\n        SettingsStore.modalSettings = {\n          status: "success",\n          message: (\n            \n          ),\n          showModal: true\n        };\n\n        RestrictedPayeeStore.resetInputs();\n        RestrictedPayeeStore.resetSearchFields();\n        RestrictedPayeeStore.restrictedPayeeList = null;\n        RestrictedPayeeStore.dataTableRef.reset();\n      } else {\n        this.setErrors(res.body, true);\n        console.log("pending for approval");\n        SettingsStore.modalSettings = {\n          status: "error",\n          message: "Selected transaction is still pending for approval",\n          showModal: true\n        };\n        SettingsStore.isScreenLoading = false;\n      }\n    });\n  };\n\n  onDeleteMultiple = data => {\n    const { RestrictedPayeeStore, SettingsStore, auth } = this.context.store;\n    let userCd = auth.sessionUser.user.cd;\n\n    if (data.length > 0) {\n      console.log("asdasdasd", data);\n      RestrictedPayeeStore.deleteMultiplerestrictedPayee(\n        userCd,\n        data,\n        response => {\n          console.log("Delete Multiple Res: ", response);\n          if (!response.body && response.text) {\n            RestrictedPayeeStore.refNoDeleteMultiple = response.text;\n            console.log("Response Body on Delete Multiple: ", response.body);\n\n            SettingsStore.isScreenLoading = false;\n            SettingsStore.modalSettings = {\n              status: "success",\n              message: (\n                \n              ),\n              showModal: true\n            };\n\n            RestrictedPayeeStore.resetInputs();\n            RestrictedPayeeStore.resetSearchFields();\n            RestrictedPayeeStore.restrictedPayeeList = null;\n            RestrictedPayeeStore.dataTableRef.reset();\n          } else {\n            SettingsStore.isScreenLoading = false;\n            this.setErrors(res.body, true);\n            RestrictedPayeeStore.resetInputs();\n            RestrictedPayeeStore.resetSearchFields();\n            RestrictedPayeeStore.restrictedPayeeList = null;\n            RestrictedPayeeStore.dataTableRef.reset();\n            resolve(res.body.content);
          }
        }
      );
    } else {
      this.setState({
        errorModalMsg: "Selected transaction is still pending for approval",
        showModal: true
      });
      // SettingsStore.modalSettings = {
      //   status: "error",
      //   message: "Selected transaction is still pending for approval",
      //   showModal: true
      // };
      SettingsStore.isScreenLoading = false;
    }
});
  };

  componentDidMount() _showMaintenanceApprovalPanel() {
    const { SettingsStore, RestrictedPayeeStore } = this.context.store;
    SettingsStore.confirmationRef return (
               reportProps={{
          onClickDownload: this.onClickDownload,
          reportHeader2: "Approve/Reject Checkbook Type Report",
          fileName: "Approve_Reject_Payee"
        }}
        title={strings.formatString(
          strings.portlet_title_maintenance,
          strings.global_restrictedpayeenm
        )}
        initialFields={RestrictedPayeeStore.approvalFields}
        funcCd={CitrineFunctionCodes.RESTRICTED_PAYEE_NM_APPROVE_REJECT}
        //funcCd={CitrineFunctionCodes.COURIER_MAINTENANCE_APPROVE_REJECT}
        columnHeaders={this._createData()}
        onSearchApprove={this.onSearch}
        onApprove={this.onClickApprove}
        onReject={this.onClickReject}
      />
    );
  }

  _showMaintenanceApprovalConfirmPanel() {
    const { MaintenanceStore, RestrictedPayeeStore } 
= this.confirmation;
    this.checkAuth();
    
context.store;
    let isApprove =
      
RestrictedPayeeStore.approvalConfirmProps.action === "approve";
    return (
               isMultiple={true}
        isAck={false}
        isConfirm={true}
        columnHeaders={this._createDataForConfirmAck()}
        action={RestrictedPayeeStore.approvalConfirmProps.action}
        remarks={RestrictedPayeeStore.approvalConfirmProps.remarks}
        dataList={RestrictedPayeeStore.approvalConfirmProps.dataList}
        onClickBack={() => {
          MaintenanceStore.remarks = null;
          RestrictedPayeeStore.
resetErrorList();
          this.confirmOnClickBack();
        }}
        onClickSubmit={() => this.confirmOnClickSubmit(isApprove, null)}
        errorFeedback={RestrictedPayeeStore.errors}
        stepWizardHeader={"Confirm Details"}
        modelName={strings.global_payee}
      />
    );
  }

  _showMaintenanceApprovalAckPanel() {
    const { MaintenanceStore, RestrictedPayeeStore } = this.context.store;
    return (
               isMultiple={true}
        isAck={true}
        isConfirm={false}
        header={RestrictedPayeeStore.approvalAckProps.message}
        refNo={RestrictedPayeeStore.approvalAckProps.refNo}
        columnHeaders={this._createDataForConfirmAck()}
        action={RestrictedPayeeStore.approvalAckProps.action}
        remarks={RestrictedPayeeStore.approvalAckProps.remarks}
        dataList={RestrictedPayeeStore.approvalAckProps.dataList}
        hasButtons
        modelName={strings.global_payee}
        backButtonLabel={strings.formatString(
          strings.button_middle_backxtopage,
          strings.formatString(
            strings.global_approveobj,
            strings.global_restrictedpayeenms
          )
        )}
        onClickBack={() => {
          MaintenanceStore.remarks = null;
          RestrictedPayeeStore.resetApprovalFields();
          MaintenanceStore.approveList = null;
          this.redirectTo(this.state.pages.initial);
        }}
        stepWizardHeader={strings.global_acknowledgement}
      />
    );
  }

  _showViewPage(actionButtons) {
    const { RestrictedPayeeStore, MaintenanceStore } = this.context.store;
    let dtlStringData = RestrictedPayeeStore.viewPageMaintenanceData
      ? JSON.parse(RestrictedPayeeStore.viewPageMaintenanceData.dtlString)
      : null;
    let funcDscp =
      RestrictedPayeeStore.viewPageMaintenanceData &&
      RestrictedPayeeStore.viewPageMaintenanceData.actnFunc.description;
    return (
               errorList={RestrictedPayeeStore.errors}
        isApproveReject
        funcDscp={funcDscp}
        hasBackButton
        backButtonLabel={strings.formatString(
          strings.global_approveobj,
          strings.global_restrictedpayeenm
        )}
        store={MaintenanceStore}
        modelNm={strings.global_payee}
        viewPanel={
                       isView={true}
            data={dtlStringData ? dtlStringData : null}
          />
        }
        onClickBack={() => {
          MaintenanceStore.resetRemarks();
          MaintenanceStore.errors = [];
          RestrictedPayeeStore.resetErrorList();
          MaintenanceStore.approveList = null;
          this.setState({ isForView: false });
          this.redirectTo(this.state.pages.initial);
        }}
        onClickApprove={() => {
          this.setState({ isForView: true });
          let data = [];
          data.push(RestrictedPayeeStore.viewPageMaintenanceData);
          this.onClickApprove(data, MaintenanceStore.remarks);
          MaintenanceStore.errors = [];
        }}
        onClickReject={() => {
          this.setState({ isForView: true });
          let data = [];
          data.push(RestrictedPayeeStore.viewPageMaintenanceData);
          this.checkIfHasRemarks(data);
          MaintenanceStore.errors = [];
        }}
      />
    );
  }

  _showViewPageForConfirmAck() {
    const { RestrictedPayeeStore, MaintenanceStore } = this.context.store;
    let dtlStringData = this.showViewPageConfirmAckData();
    return (
               fullView={true}
        errorList={RestrictedPayeeStore.errors}
        // isApproveReject
        hasBackButton
        backButtonLabel={
          this.state.prevPage == this.state.pages.ack
            ? strings.global_acknowledgement
            : strings.global_confirm
        }
        store={MaintenanceStore}
        modelNm={strings.global_payee}
        viewPanel={
                       isView={true}
            data={dtlStringData ? dtlStringData : null}
          />
        }
        onClickBack={() => {
          this.state.prevPage == this.state.pages.ack
            ? this.redirectTo(this.state.pages.ack)
            : this.redirectTo(this.state.pages.confirm);
        }}
      />
    );
  }

  _showAckForSingle() {
    const { MaintenanceStore, RestrictedPayeeStore } = this.context.store;
    let data = RestrictedPayeeStore.restrictedPayeeDtlString;
    let funcDscp =
      RestrictedPayeeStore.viewPageMaintenanceData &&
      RestrictedPayeeStore.viewPageMaintenanceData.actnFunc.description;
    return (
               isAck={true}
        isConfirm={false}
        funcDscp={funcDscp}
        columnHeaders={this._createDataForConfirmAck()}
        action={RestrictedPayeeStore.approvalAckProps.action}
        remarks={RestrictedPayeeStore.approvalAckProps.remarks}
        dataList={RestrictedPayeeStore.approvalAckProps.dataList}
        hasButtons
        modelName={strings.global_payee}
        backButtonLabel={strings.formatString(
          strings.button_middle_backxtopage,
          strings.formatString(
            strings.global_approveobj,
            strings.global_restrictedpayeenm
          )
        )}
        onClickBack={() => {
          MaintenanceStore.remarks = null;
          MaintenanceStore.approveList = null;
          RestrictedPayeeStore.resetApprovalFields();
          this.redirectTo(this.state.pages.initial);
          this.setState({
            isForView: false
          });
        }}
        viewPanel={
                       header={RestrictedPayeeStore.approvalAckProps.message}
            refNo={RestrictedPayeeStore.approvalAckProps.refNo}
            isConfirm={false}
            isAck={true}
            data={data ? data : null}
            store={MaintenanceStore}
            errorFeedback={MaintenanceStore.errors}
            hideStepper={true}
          />
        }
      />
    );
  }

  showViewPageConfirmAckData() {
    const { RestrictedPayeeStore } = this.context.store;
    return RestrictedPayeeStore.viewPageMaintenanceData
      ? JSON.parse(RestrictedPayeeStore.viewPageMaintenanceData.dtlString)
      : null;
  }

  handleCancel = () => {
    this.setState({
      showErrorModal: false,
      errorModalMsg: ""
    });
  };

  handleKeyDown = e => {
    const { MaintenanceStore } = this.context.store;
    MaintenanceStore.remarks = e.target.value;
  };

  checkIfHasRemarks = data => {
    const { MaintenanceStore, SettingsStore } = this.context.store;
    if (!MaintenanceStore.remarks) {
      let errorList = [
        strings.formatString(
          strings.feedback_bad_isrequired,
          strings.global_remarks
        )
      ];
      RestrictedPayeeStore.errors = errorList;
      this.setState({
        showErrorModal: true,
        errorModalMsg: errorList[0]
      });
      SettingsStore.isScreenLoading = false;
    } else {
      this.onClickReject(data, MaintenanceStore.remarks);
    }
  };

  render() {
    const { RestrictedPayeeStore, SettingsStore MaintenanceStore } = this.context.store;
    return 
store;

    const actionButtons = 
(
      

        className="forSearch">
          
            
              
                {strings.formatString(
                  strings.global_searchobj,
                  strings.global_restrictedpayeenm
                )}
              

            


             (this.confirmation = r)} isBo isYesNo />
                           title="Success"
              modalSettings={SettingsStore.modalSettings}
            />
            {this.showDataTable()}
          
                       initialFields={RestrictedPayeeStore.searchRestrictedPayeeFields}
            onClickSearch={e => {
              this.onSearch(null);
              RestrictedPayeeStore.dataTableRef &&
                RestrictedPayeeStore.dataTableRef.reset();
            }}
            funcCd={CitrineFunctionCodes.RESTRICTED_PAYEE_NM_SEARCH}
            hasSuggestedLinks
            hasSearchFilters
            hasAddToBookmarks
className="row approval-remarks">
                       labelField={strings.global_remarks}
            value={MaintenanceStore.remarks}
            placeHolder={strings.global_remarks}
            onChange={this.handleKeyDown}
            maxLength="255"
          />
        
        
          
        
                   approveMessage={strings.formatString(
            strings.global_approveobj,
            strings.global_restrictedpayeenm
          )}
          rejectMessage={strings.formatString(
            strings.global_rejectobj,
            strings.global_restrictedpayeenm
          )}
          onClickApprove={() => {
            this.setState({ isForView: true });
            let data = [];
            data.push(RestrictedPayeeStore.viewPageMaintenanceData);
            this.onClickApprove(data, MaintenanceStore.remarks);
            MaintenanceStore.errors = [];
          }}
          onClickReject={() => {
            this.setState({ isForView: true });
            let data = [];
            data.push(RestrictedPayeeStore.viewPageMaintenanceData);
            this.checkIfHasRemarks(data);
            MaintenanceStore.errors = [];
          }}
        />
      
    );

    const data = [
      { key: 0, content: this._showMaintenanceApprovalPanel() },
      { key: 1, content: this._showMaintenanceApprovalConfirmPanel() },
      { key: 2, content: this._showMaintenanceApprovalAckPanel() },
      { key: 3, content: this._showViewPage(actionButtons) },
      { key: 4, content: this._showViewPageForConfirmAck() },
      { key: 5, content: this._showAckForSingle() }
    ];

    return (
      
        
                   visible={this.state.showErrorModal}
          closable={true}
          onClose={this.handleCancel}
          onCancel={this.handleCancel}
          okButtonProps={{
            style: { display: "none" }
          }}
          cancelButtonProps={{
            style: { display: "none" }
          }}
          destroyOnClose={true}
          className="errorModalFeedback"
        >
          {this.state.showErrorModal ? (
            

                               class="swal2-icon swal2-error swal2-animate-error-icon"
                style={{ display: "flex" }}
              >
                
                  
                  
                
              

              {this.state.errorModalMsg}
            
          ) : null}
        
                   data={data}
          activeKey="key"
          activeValue={RestrictedPayeeStore.selectedMenuOnApprove}
        />
      

    );
  }
}

SearchPayeePanel.propTypes = {
  // props definition
};

SearchPayeePanel.defaultProps = {
  // default props
};

export default SearchPayeePanel;
ApproveRestrictedPayeeCTR;

Replies to ApproveRestrictedPayeeCTR rss

Title Name Language When
RestrictedPayeeStore akoto text 4 Years ago.