import React, { Component } from 'react'
import { Form, Button, Select, Input, InputNumber, Row, Col, Divider, Checkbox, DatePicker, PageHeader, Descriptions,Tooltip } from "antd"
import Helper from "../../../../Helper/Helper";
import DataService from "../../../../Provider/Service/DataService";
import { MaskedInput } from 'antd-mask-input';
import moment from 'moment';
import 'antd/dist/antd.css';
import { SaveOutlined, ProfileTwoTone, SendOutlined, ClearOutlined,PlusOutlined ,MinusOutlined} from '@ant-design/icons';
import Product from "../../../../Enum/Product"
import ParameterGroup from "../../../../Enum/ParameterGroup";
import ArrivalChannel from "../../../../Enum/ArrivalChannel";
import ArrivalChannelType from "../../../../Enum/ArrivalChannelType";
import ProductType from "../../../../Enum/ProductType";
import { Actions } from "../../../../Redux";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";
import Swal from 'sweetalert2';
import { Redirect } from "react-router-dom";
import Status from '../../../../Enum/Status';
import NumberFormat from 'react-number-format';
import LeadNegativeReasonType from "../../../../Enum/LeadNegativeReasonType";
import ProcessStage from '../../../../Enum/ProcessStage';
const dateFormat = 'DD.MM.YYYY';
const dateAllFormat = 'DD.MM.YYYY HH:mm';
const initialState = {
loading: false,
arrivalChannelId: "",
arrivalChannelIdHelp: "",
arrivalChannelIdStatus: "",
productId: "",
productIdHelp: "",
productIdStatus: "",
companyName: "",
companyNameStatus: "",
companyNameHelp: "",
contactName: "",
contactNameStatus: "",
contactNameHelp: "",
staffCount: "",
staffCountStatus: "",
staffCountHelp: "",
monthlyCardLoadAmount: "",
monthlyCardLoadAmountStatus: "",
monthlyCardLoadAmountHelp: "",
email: "",
emailStatus: "",
emailHelp: "",
phoneNumber: "",
phoneNumberStatus: "",
phoneNumberHelp: "",
regEmail: new RegExp(
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
),
cityId: "",
countyId: "",
address: "",
addressHelp: "",
addressStatus: "",
currentSystemId: "",
currentSystemIdHelp: "",
currentSystemIdStatus: "",
description: "",
descriptionStatus: "",
descriptionHelp: "",
requestStatusId: 2,
requestStatusIdHelp: "",
requestStatusIdStatus: "",
isIndividualRequest: false,
id: "",
requestDate: "",
callDate: "",
callDateHelp: "",
callDateStatus: "",
callDateString: "",
countyIdStatus: "",
countyIdHelp: "",
cityIdStatus: "",
cityIdHelp: "",
isSetCardCustomer: false,
loadFrequencyHelp: "",
loadFrequencyStatus: "",
loadFrequency: "",
currentDiscountAmount: 0,
currentDiscountAmountHelp: "",
currentDiscountAmountStatus: "",
currentAccomodationInfo: "",
currentAccomodationInfoHelp: "",
currentAccomodationInfoStatus: "",
leadBankList: [],
leadRequestedServices:[],
leadRequestedServicesHelp: "",
leadRequestedServicesStatus: "",
previousPaymentTypeId: undefined,
previousPaymentTypeIdHelp: "",
previousPaymentTypeIdStatus: "",
previousPaymentTypeExpiry: "",
previousPaymentTypeExpiryHelp: "",
previousPaymentTypeExpiryStatus: "",
leadBankListHelp: "",
leadBankListStatus: "",
salesRepId: "",
salesRepIdStatus: "",
salesRepIdHelp: "",
groupCompanyId: "",
groupCompanyIdHelp: "",
groupCompanyIdStatus: "",
sectorId: "",
sectorIdHelp: "",
sectorIdStatus: "",
isInfoAboutOtherProducts: false,
leadProductList: [],
leadProductListHelp: "",
leadProductListStatus: "",
userId: "",
leadNegativeReasonId: "",
leadNegativeReasonIdHelp: "",
leadNegativeReasonIdStatus: "",
errorList: [],
redirect: false,
isChanged: false,
isThereLeadHasSamePhoneNumber: false,
isThereLeadHasSameCompanyName: false,
isThereLeadHasSameContactName: false,
addGroupCompany: false,
groupCompanyName: "",
groupCompanyNameHelp: "",
groupCompanyNameStatus: "",
};
class index extends Component {
state = {
arrivalChannelList: [],
isEditingForm: false,
productList: [],
cityList: [],
cityOptions: [],
countyList: [],
countyOptions: [],
currentSystemList: [],
requestStatusList: [],
currentFuelSystemList: [],
bankList: [],
previousPaymentTypeList: [],
salesRepList: [],
groupCompanyList: [],
sectorList: [],
productAndArrivalChannelList: [],
leadNegativeReasonList: [],
loadFrequencyTypeList:[],
isAdmin: false,
isInRole: false,
currentAccomodationList:[],
requestedServiceList:[],
...initialState
}
componentDidMount() {
if (this.props.location.state != undefined && this.props.location.state.leadId != undefined && this.props.location.state.leadId != null && this.props.location.state.leadId > 0) {
const leadId = this.props.location.state.leadId;
this.getLeadForEdit(leadId);
this.setState({ isEditingForm: true, id: leadId });
const { history } = this.props;
history.replace();
}
this.selectLoadFrequencyTypeList();
let userId = this.props.getLoginInfo.userId;
this.setState({ userId: userId });
this.validateUser();
this.selectArrivalChannelList();
this.selectProductList();
this.selectGlobalAddressItems();
this.selectCurrentSystemList();
this.selectRequestStatusList();
this.selectFuelCurrentSystemList();
this.selectPreviousPaymentTypeList();
this.selectCurrentAccomodationList();
this.selectBankList();
this.selectCompanyGroupList();
this.selectActivitySectorList();
this.selectLeadNegativeReason();
this.selectRequestedServiceList();
}
selectLoadFrequencyTypeList = async () => {
try {
this.setState({ loading: true });
const params = { GroupId: ParameterGroup.GiftLoadFrequencyType };
const itemlist = await DataService.selectParameterByGroupId(params);
this.setState({ loadFrequencyTypeList: itemlist, loading: false });
}
catch (error) {
Helper.ErrorMessage("Yükleme sıklığı listesi yüklenemedi.");
this.setState({ loading: false });
}
}
validateUser = () => {
let obj = this.props.getLoginInfo.userRoleList.find(o => o.name === 'CollectionRequestScanning');
let isInRole = obj === null || obj === '' || obj === undefined ? false : true;
this.setState({ isInRole: isInRole })
}
getLeadForEdit = async (id) => {
try {
this.setState({ loading: true });
const params = { id: id };
const leadData = await DataService.selectLeadById(params);
const dateString = leadData.callDate;
leadData.callDate = (dateString === null || dateString === undefined || dateString.length === 0) ? null : moment(dateString);
this.handleReset()
this.setState({ ...leadData, loading: false });
if (leadData.cityId > 0) this.citySelectOnChange("DidMount", leadData.cityId);
this.selectProcessUserListForSales(leadData.arrivalChannelId, leadData.productId);
let obj = this.props.getLoginInfo.userRoleList.find(o => o.name === 'CollectionAdmin' || o.name === 'CollectionBusinessAdmin');
let isAdmin = this.state.isAdmin;
isAdmin = obj === null || obj === '' || obj === undefined ? false : true;
this.setState({ isAdmin: isAdmin });
this.isThereLeadHasSameCompanyName(leadData.id, leadData.requestDate, leadData.companyName);
if (leadData.contactName !== null && leadData.contactName !== '' && leadData.contactName !== undefined) {
this.isThereLeadHasSameContactName(leadData.id, leadData.requestDate, leadData.contactName);
}
if (leadData.phoneNumber !== null && leadData.phoneNumber !== '' && leadData.phoneNumber !== undefined && leadData.phoneNumber.length >= 10) {
this.isThereLeadHasSamePhoneNumber(leadData.id, leadData.requestDate, leadData.phoneNumber);
}
if (isAdmin === true) {
this.selectProductList(true);
this.selectArrivalChannelList(true);
}
}
catch (error) {
Helper.ErrorMessage("Müşteri talebi yüklenemedi.");
this.setState({ loading: false });
}
}
selectActivitySectorList = async () => {
try {
this.setState({ loading: true });
const itemlist = await DataService.selectActivitySectorList();
this.setState({ sectorList: itemlist, loading: false });
}
catch (error) {
Helper.ErrorMessage("Hizmet sektörü listesi yüklenemedi.");
this.setState({ loading: false });
}
}
selectCompanyGroupList = async () => {
try {
this.setState({ loading: true });
const itemlist = await DataService.selectCompanyGroupList();
this.setState({ groupCompanyList: itemlist, loading: false });
}
catch (error) {
Helper.ErrorMessage("Grup firma listesi yüklenemedi.");
this.setState({ loading: false });
}
}
selectProductAndArrivalChannelListByUserId = async () => {
try {
this.setState({ loading: true });
const list = await DataService.selectProductAndArrivalChannelListByUserId();
this.setState({ productAndArrivalChannelList: list, loading: false });
}
catch (error) {
Helper.ErrorMessage("Yetki listesi yüklenemedi.");
this.setState({ loading: false });
}
}
selectArrivalChannelList = async (isAdmin) => {
try {
this.setState({ loading: true });
if (isAdmin === true) {
DataService.selectArrivalChannelList().then((itemlist1) => {
let itemlist = itemlist1
itemlist = itemlist.filter(arr => arr.type === ArrivalChannelType.Lead && (arr.isHidden === false ||
(arr.isHidden === true && this.state.id > 0 && this.state.arrivalChannelId === arr.id)));
this.setState({ arrivalChannelList: itemlist, loading: false });
})
.catch(() => {
this.setState({ loading: false })
});
} else {
DataService.selectProductAndArrivalChannelListByUserId().then((list) => {
DataService.selectArrivalChannelList().then((itemlist1) => {
let itemlist = itemlist1
itemlist = itemlist.filter(arr => arr.type === ArrivalChannelType.Lead && list.some(l => l.arrivalChannelId === arr.id) && (arr.isHidden === false ||
(arr.isHidden === true && this.state.id > 0 && this.state.arrivalChannelId === arr.id)));
this.setState({ arrivalChannelList: itemlist, productAndArrivalChannelList: list, loading: false });
})
.catch(() => {
this.setState({ loading: false })
});
})
.catch(() => {
this.setState({ loading: false })
});
}
}
catch (error) {
Helper.ErrorMessage("Geliş Kanalı yüklenemedi.");
this.setState({ loading: false });
}
}
selectProductList = async (isAdmin) => {
try {
this.setState({ loading: true });
if (isAdmin === true) {
DataService.selectProductList().then((itemlist1) => {
let itemlist = itemlist1
itemlist = itemlist.filter(arr => arr.type === ProductType.Customer);
this.setState({ productList: itemlist, loading: false });
})
.catch(() => {
this.setState({ loading: false })
});
} else {
DataService.selectProductAndArrivalChannelListByUserId().then((list) => {
DataService.selectProductList().then((itemlist1) => {
let itemlist = itemlist1
itemlist = itemlist.filter(arr => arr.type === ProductType.Customer && list.some(l => l.productId === arr.id));
this.setState({ productList: itemlist, productAndArrivalChannelList: list, loading: false });
})
.catch(() => {
this.setState({ loading: false })
});
})
.catch(() => {
this.setState({ loading: false })
});
}
}
catch (error) {
Helper.ErrorMessage("Ürün yüklenemedi.");
this.setState({ loading: false });
}
}
selectGlobalAddressItems = async () => {
try {
this.setState({ loading: true });
const globalAddressItems = await DataService.selectGlobalAddressItems();
this.setState({ globalAddressItems });
let cityOptions = [];
const cityList = globalAddressItems.cityList;
for (const key in cityList) {
if (cityList.hasOwnProperty(key)) {
const element = cityList[key];
const { id, name } = element;
cityOptions.push({
id,
name,
});
}
}
this.setState({ cityList, cityOptions });
//İlçe yükle
const countyList = globalAddressItems.countyList;
this.setState({ countyList, loading: false });
if (this.state.cityId > 0) this.citySelectOnChange("DidMount", this.state.cityId);
}
catch (error) {
Helper.ErrorMessage("Adres bilgileri yüklenemedi.");
this.setState({ loading: false });
}
}
selectPreviousPaymentTypeList = async () => {
try {
this.setState({ loading: true });
const params = { GroupId: ParameterGroup.PreviousPaymentType };
const itemlist = await DataService.selectParameterByGroupId(params);
this.setState({ previousPaymentTypeList: itemlist, loading: false });
}
catch (error) {
Helper.ErrorMessage("Önceki Ödeme şekli yüklenemedi.");
this.setState({ loading: false });
}
}
selectCurrentAccomodationList = async () => {
try {
this.setState({ loading: true });
const params = { GroupId: ParameterGroup.CurrentAccomodationInfo };
const itemlist = await DataService.selectParameterByGroupId(params);
this.setState({ currentAccomodationList: itemlist, loading: false });
}
catch (error) {
Helper.ErrorMessage("Mevcut hizmet şekli yüklenemedi.");
this.setState({ loading: false });
}
}
selectRequestedServiceList = async () => {
try {
this.setState({ loading: true });
const params = { GroupId: ParameterGroup.AccomodationRequestedServices };
const itemlist = await DataService.selectParameterByGroupId(params);
this.setState({ requestedServiceList: itemlist, loading: false });
}
catch (error) {
Helper.ErrorMessage("Talep edilen hizmetler yüklenemedi.");
this.setState({ loading: false });
}
}
selectCurrentSystemList = async () => {
try {
this.setState({ loading: true });
const params = { GroupId: ParameterGroup.CurrentSystem };
const itemlist = await DataService.selectParameterByGroupId(params);
this.setState({ currentSystemList: itemlist, loading: false });
}
catch (error) {
Helper.ErrorMessage("Kullandığı sistem yüklenemedi.");
this.setState({ loading: false });
}
}
selectFuelCurrentSystemList = async () => {
try {
this.setState({ loading: true });
const params = { GroupId: ParameterGroup.FuelSystem };
const itemlist = await DataService.selectParameterByGroupId(params);
this.setState({ currentFuelSystemList: itemlist, loading: false });
}
catch (error) {
Helper.ErrorMessage("Kullandığı yakıt sistem yüklenemedi.");
this.setState({ loading: false });
}
}
selectRequestStatusList = async () => {
try {
this.setState({ loading: true });
const params = { GroupId: ParameterGroup.RequestStatus };
const itemlist = await DataService.selectParameterByGroupId(params);
this.setState({ requestStatusList: itemlist, loading: false });
}
catch (error) {
Helper.ErrorMessage("Durum yüklenemedi.");
this.setState({ loading: false });
}
}
selectBankList = async () => {
try {
this.setState({ loading: true });
const itemlist = await DataService.selectBankList();
this.setState({ bankList: itemlist, loading: false });
}
catch (error) {
Helper.ErrorMessage("Banka listesi yüklenemedi.");
this.setState({ loading: false });
}
}
selectProcessUserListForSales = async (arrivalChannelId, productId) => {
try {
this.setState({ loading: true });
const puParams = { ArrivalChannelId: arrivalChannelId, ProductId: productId };
const itemlist = await DataService.selectProcessUserListForSales(puParams);
const userId = this.state.userId;
let salesRepId = this.state.salesRepId;
if (salesRepId === null || salesRepId === undefined || salesRepId === '') {
salesRepId = '';
if (userId !== '' && userId !== undefined && userId !== null && itemlist.some(item => item.userId === userId)) {
salesRepId = userId;
}
}
this.setState({ salesRepList: itemlist, loading: false, salesRepId: salesRepId });
}
catch (error) {
Helper.ErrorMessage("Satış personeli listesi yüklenemedi.");
this.setState({ loading: false });
}
}
selectLeadNegativeReason = async () => {
try {
this.setState({ loading: true });
const params = { GroupId: ParameterGroup.LeadNegativeReason };
const itemlist = await DataService.selectParameterByGroupId(params);
this.setState({ leadNegativeReasonList: itemlist, loading: false });
}
catch (error) {
Helper.ErrorMessage("Olumsuz talep sebepleri yüklenemedi.");
this.setState({ loading: false });
}
}
isThereLeadHasSamePhoneNumber = async (leadId, requestDate, phoneNumber) => {
try {
// this.setState({ loading: true });
const params = { RequestDate: requestDate, PhoneNumber: phoneNumber, LeadId: leadId };
const isThere = await DataService.isThereLeadHasSamePhoneNumber(params);
this.setState({ isThereLeadHasSamePhoneNumber: isThere });
// this.setState({ loading: false });
}
catch (error) {
// Helper.ErrorMessage("Olumsuz talep sebepleri yüklenemedi.");
// this.setState({ loading: false });
}
}
isThereLeadHasSameCompanyName = async (leadId, requestDate, companyName) => {
try {
// this.setState({ loading: true });
const params = { RequestDate: requestDate, CompanyName: companyName, LeadId: leadId };
const isThere = await DataService.isThereLeadHasSameCompanyName(params);
this.setState({ isThereLeadHasSameCompanyName: isThere });
// this.setState({ loading: false });
}
catch (error) {
// Helper.ErrorMessage("Olumsuz talep sebepleri yüklenemedi.");
// this.setState({ loading: false });
}
}
isThereLeadHasSameContactName = async (leadId, requestDate, contactName) => {
try {
// this.setState({ loading: true });
const params = { RequestDate: requestDate, ContactName: contactName, LeadId: leadId };
const isThere = await DataService.isThereLeadHasSameContactName(params);
this.setState({ isThereLeadHasSameContactName: isThere });
// this.setState({ loading: false });
}
catch (error) {
// Helper.ErrorMessage("Olumsuz talep sebepleri yüklenemedi.");
// this.setState({ loading: false });
}
}
onChange(e) {
let name = e.target.name;
let value = e.target.value;
if (name == "contactName") {
if (value.length > 10) {
let leadId = this.state.id === null || this.state.id === undefined || this.state.id === '' ? 0 : this.state.id
let requestDate =leadId> 0 ? this.state.requestDate : moment(new Date(), dateFormat).add(3, 'hours');
this.isThereLeadHasSameContactName(leadId, requestDate, value);
}
}
if (name == "companyName") {
if (value.length > 5) {
let leadId = this.state.id === null || this.state.id === undefined || this.state.id === '' ? 0 : this.state.id
let requestDate = leadId > 0 ? this.state.requestDate : moment(new Date(), dateFormat).add(3, 'hours');
this.isThereLeadHasSameCompanyName(leadId, requestDate, value);
}
}
if (name == "phoneNumber") {
let leadId = this.state.id === null || this.state.id === undefined || this.state.id === '' ? 0 : this.state.id
var phoneValue = e.target.value
.replace(/-/g, "")
.replace("(", "")
.replace(")", "");
if (phoneValue !== null && phoneValue !== '' && phoneValue !== undefined && !isNaN(phoneValue) && phoneValue.length >= 10) {
let requestDate = leadId > 0 ? this.state.requestDate : moment(new Date(), dateFormat).add(3, 'hours');
this.isThereLeadHasSamePhoneNumber(leadId, requestDate, phoneValue);
}
this.setState({
[name]: e.target.value
.replace(/-/g, "")
.replace("(", "")
.replace(")", "")
});
this.setState({
[e.target.name + "Status"]: "",
[e.target.name + "Help"]: "",
});
}
else {
this.setState({
[name]: value,
[e.target.name + "Status"]: "",
[e.target.name + "Help"]: ""
});
}
this.setState({ isChanged: true })
}
IdOnChange(value, name) {
this.setState({
[name]: value,
[name + "Status"]: "",
[name + "Help"]: ""
});
this.setState({ isChanged: true })
}
dateOnChanged = (value, dateString) => {
if (dateString === null || dateString === undefined || dateString.length === 0) {
this.setState({
callDateString: null,
callDate: null
});
return;
} else if (this.validateDate(value)) {
this.setState({
callDate: value,
callDateString: dateString.toLocaleString(),
callDateHelp: "",
callDateStatus: "",
});
}
else {
this.setState({
callDateString: null,
callDate: null
});
}
this.setState({ isChanged: true })
}
arrivalChannelOnChange = (screenOpenType, value) => {
this.setState({
arrivalChannelId: value,
arrivalChannelIdStatus: "",
arrivalChannelIdHelp: ""
});
if (screenOpenType == "Change") {
let salesRepId = this.state.salesRepId;
salesRepId = '';
this.setState({ salesRepId: salesRepId });
if (value === ArrivalChannel.Sales) {
if (this.state.productId === '' || this.state.productId === undefined || this.state.productId === null || this.state.productId === 0) {
Helper.warningMessage("Satış personeli listesini yüklemek için lütfen ürün seçiniz.");
} else {
this.selectProcessUserListForSales(value, this.state.productId)
}
}
this.setState({ isChanged: true })
}
}
productOnChange = (screenOpenType, value) => {
this.setState({
productId: value,
productIdStatus: "",
productIdHelp: ""
});
if (screenOpenType == "Change") {
let currentSystemId = this.state.currentSystemId;
currentSystemId = 0;
this.setState({ currentSystemId: currentSystemId });
let salesRepId = this.state.salesRepId;
salesRepId = '';
this.setState({ salesRepId: salesRepId });
let leadBankList = this.state.leadBankList;
leadBankList = [];
this.setState({ leadBankList: leadBankList });
let leadRequestedServices = this.state.leadRequestedServices;
leadRequestedServices = [];
this.setState({ leadRequestedServices: leadRequestedServices });
this.setState({ currentAccomodationInfo: "" });
this.setState({ previousPaymentTypeId: "" });
this.setState({ previousPaymentTypeExpiry: "" });
this.setState({ currentDiscountAmount: "" });
this.setState({ loadFrequency: "" });
this.setState({ staffCount: "" });
this.setState({ monthlyCardLoadAmount: "" });
this.setState({ isSetCardCustomer: "" });
if (!(value === '' || value === undefined || value === null || value === 0)) {
if (this.state.arrivalChannelId === ArrivalChannel.Sales) {
this.selectProcessUserListForSales(this.state.arrivalChannelId, value)
}
}
this.setState({ isChanged: true })
}
}
leadBankOnChange(value) {
const datas = value;
const leadBankList = this.state.leadBankList;
leadBankList.splice(0);
datas.map(v => {
leadBankList.push(v);
})
this.setState({ leadBankList: leadBankList, leadBankListHelp: "", leadBankListStatus: "" });
this.setState({ isChanged: true })
}
leadRequestedServicesOnChange(value) {
const datas = value;
const leadRequestedServices = this.state.leadRequestedServices;
leadRequestedServices.splice(0);
const requestedServiceList = this.state.requestedServiceList;
if (datas && datas.length && datas.includes("all")) {
if (datas.length === requestedServiceList.length + 1) {
leadRequestedServices = []
}
requestedServiceList.map(v => {
leadRequestedServices.push(v.parameterKey)
})
}else{
datas.map(v => {
leadRequestedServices.push(v)
})
}
this.setState({ leadRequestedServices: leadRequestedServices, leadRequestedServicesHelp: "", leadRequestedServicesStatus: "" })
this.setState({ isChanged: true })
}
leadProductOnChange(value) {
const datas = value;
const leadProductList = this.state.leadProductList;
leadProductList.splice(0);
datas.map(v => {
leadProductList.push(v);
})
this.setState({ leadProductList: leadProductList, leadProductListHelp: "", leadProductListStatus: "" });
this.setState({ isChanged: true })
}
citySelectOnChange(screenOpenType, value) {
if (screenOpenType == "Change") {
this.setState({ cityIdHelp: "", cityIdStatus: "", countyId: "", isChanged: true });
}
let countyOptions = [];
let countyListByCity = [];
const countyList = this.state.countyList;
countyListByCity = countyList.filter(a => a.cityID == value);
for (const key in countyListByCity) {
if (countyListByCity.hasOwnProperty(key)) {
const element = countyListByCity[key];
const { id, name } = element;
countyOptions.push({
id,
name,
});
}
}
this.setState({ cityId: value, cityIdStatus: "", cityIdHelp: "", countyOptions });
}
countySelectOnChange(screenOpenType, value) {
if (screenOpenType == "Change") this.setState({ countyIdHelp: "", countyIdStatus: "", districtId: "", isChanged: true });
this.setState({ countyId: value, countyIdStatus: "", countyIdHelp: "" });
}
chkIsIndividualRequestOnchange = (e) => {
this.setState({ isIndividualRequest: e.target.checked })
this.setState({ isChanged: true })
};
chkIsInfoAboutOtherProductsOnchange = (e) => {
if (e.target.checked === false) {
const leadProductList = this.state.leadProductList;
leadProductList.splice(0);
this.setState({ leadProductList: leadProductList })
}
this.setState({ isInfoAboutOtherProducts: e.target.checked })
this.setState({ isChanged: true })
};
chkIsSetCardCustomerOnchange = (e) => {
this.setState({ isSetCardCustomer: e.target.checked })
this.setState({ isChanged: true })
};
handleReset = () => {
const leadProductList = this.state.leadProductList;
leadProductList.splice(0);
const leadBankList = this.state.leadBankList;
leadBankList.splice(0);
const leadRequestedServices = this.state.leadRequestedServices;
leadRequestedServices.splice(0);
this.setState({ leadProductList: leadProductList, leadBankList: leadBankList ,leadRequestedServices:leadRequestedServices});
this.setState(initialState);
}
btnGoToListOnClick = async () => {
const isChanged = this.state.isChanged;
if (isChanged) {
try {
Swal.fire({
text: "Kaydedilmemiş bilgiler var kayıt yapmak istiyor musunuz?",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Evet',
cancelButtonText: "Hayır"
//async (e) => {
}).then(async (result) => {
if (result.value) {
await this.btnAddClick(true).then((result) => {
if (result !== false) {
return this.props.history.push("/newleadlist")
}
})
} else {
return this.props.history.push("/newleadlist")
}
})
} catch (error) {
Helper.ErrorMessage("Beklenmeyen bir hata oluştu." + error.toString());
}
} else {
return this.props.history.push("/newleadlist")
}
}
btnAddOnClick = async (processId) => {
try {
Swal.fire({
text: "Akışa göndermek istiyor musunuz?",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Evet',
cancelButtonText: "Hayır"
//async (e) => {
}).then(async (result) => {
if (result.value) {
this.btnFlowClick();
} else {
this.btnAddClick();
}
})
} catch (error) {
Helper.ErrorMessage("Beklenmeyen bir hata oluştu." + error.toString());
}
}
btnAddClick = async (isredirect) => {
if (await this.validationAddOn()) {
const params = {
id: this.state.id,
companyName: this.state.companyName,
contactName: this.state.contactName,
phoneNumber: this.state.phoneNumber === '' || this.state.phoneNumber === undefined ? null : this.state.phoneNumber,
email: this.state.email === '' || this.state.email === undefined ? null : this.state.email,
currentSystemId: this.state.currentSystemId === '' || this.state.currentSystemId === undefined ? 0 : this.state.currentSystemId,
address: this.state.address,
cityId: this.state.cityId === '' || this.state.cityId === undefined ? 0 : this.state.cityId,
countyId: this.state.countyId === '' || this.state.countyId === undefined ? 0 : this.state.countyId,
staffCount: this.state.staffCount === '' || this.state.staffCount === undefined || this.state.staffCount === null ? 0 : this.state.staffCount,
arrivalChannelId: this.state.arrivalChannelId === '' || this.state.arrivalChannelId === undefined ? 0 : this.state.arrivalChannelId,
monthlyCardLoadAmount: this.state.monthlyCardLoadAmount === undefined || this.state.monthlyCardLoadAmount === '' || this.state.monthlyCardLoadAmount === null ? 0 : parseFloat(this.state.monthlyCardLoadAmount).toFixed(2),
description: this.state.description,
productId: this.state.productId === '' || this.state.productId === undefined ? 0 : this.state.productId,
requestStatusId: this.state.requestStatusId === '' || this.state.requestStatusId === undefined ? 0 : this.state.requestStatusId,
isIndividualRequest: this.state.isIndividualRequest,
callDate: this.state.callDate === '' || this.state.callDate === undefined || this.state.callDate === null ? null:this.state.callDate.add(3, 'hours'),
currentAccomodationInfo: this.state.currentAccomodationInfo === '' || this.state.currentAccomodationInfo === undefined ? null : this.state.currentAccomodationInfo,
previousPaymentTypeId: this.state.previousPaymentTypeId === '' || this.state.previousPaymentTypeId === undefined ? null : this.state.previousPaymentTypeId,
previousPaymentTypeExpiry: this.state.previousPaymentTypeExpiry === '' || this.state.previousPaymentTypeExpiry === undefined ? null : this.state.previousPaymentTypeExpiry,
isSetCardCustomer: this.state.isSetCardCustomer === '' || this.state.isSetCardCustomer === undefined ? null : this.state.isSetCardCustomer,
currentDiscountAmount: this.state.currentDiscountAmount === '' || this.state.currentDiscountAmount === undefined ? null : this.state.currentDiscountAmount,
loadFrequency: this.state.loadFrequency === '' || this.state.loadFrequency === undefined ? null : this.state.loadFrequency,
leadBankList: this.state.leadBankList,
salesRepId: this.state.arrivalChannelId === ArrivalChannel.Sales ? this.state.salesRepId === '' || this.state.salesRepId === undefined ? null : this.state.salesRepId : null,
groupCompanyId: this.state.groupCompanyId === '' || this.state.groupCompanyId === undefined ? null : this.state.groupCompanyId,
sectorId: this.state.sectorId === '' || this.state.sectorId === undefined ? null : this.state.sectorId,
isInfoAboutOtherProducts: this.state.isInfoAboutOtherProducts === '' || this.state.isInfoAboutOtherProducts === undefined ? false : this.state.isInfoAboutOtherProducts,
leadProductList: this.state.leadProductList,
leadNegativeReasonId: this.state.leadNegativeReasonId === '' || this.state.leadNegativeReasonId === undefined ? null : this.state.leadNegativeReasonId,
leadRequestedServices: this.state.leadRequestedServices,
};
this.setState({ loading: true });
if (this.state.id > 0) {
DataService.updateLead(params).then((data) => {
if (isredirect) {
return true
} else {
Helper.SuccessMessage("Müşteri başarıyla güncellendi.");
// this.handleReset();
this.setState({ id: params.id });
this.getLeadForEdit(params.id);
this.setState({ isEditingForm: true });
this.setState({ loading: false });
this.setState({ redirect: true });
}
})
.catch(() => {
this.setState({ loading: false })
return false
});
} else {
DataService.insertLead(params).then((data) => {
if (isredirect) {
return true
} else {
Helper.SuccessMessage("Müşteri başarıyla oluşturuldu.");
// this.handleReset();
this.setState({ id: data.id });
this.getLeadForEdit(data.id);
this.setState({ isEditingForm: true });
this.setState({ loading: false });
this.setState({ redirect: true });
}
})
.catch(() => {
this.setState({ loading: false })
return false
});
}
}
else {
let errorList = this.state.errorList;
this.setState({ loading: false });
Helper.MultipleErrorMessage(errorList);
return false
}
this.setState({ loading: false });
};
btnFlowClick = async (e) => {
if (await this.validation()) {
if (!this.state.productAndArrivalChannelList.some(pa => pa.arrivalChannelId === this.state.arrivalChannelId && pa.productId === this.state.productId)) {
Helper.ErrorMessage("Ürün ve geliş kanalı için müşteri talebi açma yetkiniz bulunmamaktadır!");
return false;
}
const params = {
id: this.state.id,
companyName: this.state.companyName,
contactName: this.state.contactName,
phoneNumber: this.state.phoneNumber === '' || this.state.phoneNumber === undefined ? null : this.state.phoneNumber,
email: this.state.email === '' || this.state.email === undefined ? null : this.state.email,
currentSystemId: this.state.currentSystemId === '' || this.state.currentSystemId === undefined ? 0 : this.state.currentSystemId,
address: this.state.address,
cityId: this.state.cityId === '' || this.state.cityId === undefined ? 0 : this.state.cityId,
countyId: this.state.countyId === '' || this.state.countyId === undefined ? 0 : this.state.countyId,
staffCount: this.state.staffCount === '' || this.state.staffCount === undefined || this.state.staffCount === null ? 0 : this.state.staffCount,
arrivalChannelId: this.state.arrivalChannelId === '' || this.state.arrivalChannelId === undefined ? 0 : this.state.arrivalChannelId,
monthlyCardLoadAmount: this.state.monthlyCardLoadAmount === undefined || this.state.monthlyCardLoadAmount === '' || this.state.monthlyCardLoadAmount === null ? 0 : parseFloat(this.state.monthlyCardLoadAmount).toFixed(2),
description: this.state.description,
productId: this.state.productId === '' || this.state.productId === undefined ? 0 : this.state.productId,
requestStatusId: this.state.requestStatusId === '' || this.state.requestStatusId === undefined ? 0 : this.state.requestStatusId,
isIndividualRequest: this.state.isIndividualRequest,
callDate: this.state.callDate === '' || this.state.callDate === undefined || this.state.callDate === null ? null : this.state.callDate.add(3, 'hours'),
currentAccomodationInfo: this.state.currentAccomodationInfo === '' || this.state.currentAccomodationInfo === undefined ? null : this.state.currentAccomodationInfo,
previousPaymentTypeId: this.state.previousPaymentTypeId === '' || this.state.previousPaymentTypeId === undefined ? null : this.state.previousPaymentTypeId,
previousPaymentTypeExpiry: this.state.previousPaymentTypeExpiry === '' || this.state.previousPaymentTypeExpiry === undefined ? null : this.state.previousPaymentTypeExpiry,
isSetCardCustomer: this.state.isSetCardCustomer === '' || this.state.isSetCardCustomer === undefined ? null : this.state.isSetCardCustomer,
currentDiscountAmount: this.state.currentDiscountAmount === '' || this.state.currentDiscountAmount === undefined ? null : this.state.currentDiscountAmount,
loadFrequency: this.state.loadFrequency === '' || this.state.loadFrequency === undefined ? null : this.state.loadFrequency,
leadBankList: this.state.leadBankList,
salesRepId: this.state.arrivalChannelId === ArrivalChannel.Sales ? this.state.salesRepId === '' || this.state.salesRepId === undefined ? null : this.state.salesRepId : null,
groupCompanyId: this.state.groupCompanyId === '' || this.state.groupCompanyId === undefined ? null : this.state.groupCompanyId,
sectorId: this.state.sectorId === '' || this.state.sectorId === undefined ? null : this.state.sectorId,
isInfoAboutOtherProducts: this.state.isInfoAboutOtherProducts === '' || this.state.isInfoAboutOtherProducts === undefined ? false : this.state.isInfoAboutOtherProducts,
leadProductList: this.state.leadProductList,
leadNegativeReasonId: this.state.leadNegativeReasonId === '' || this.state.leadNegativeReasonId === undefined ? null : this.state.leadNegativeReasonId,
leadRequestedServices: this.state.leadRequestedServices,
};
this.setState({ loading: true });
if (this.state.id > 0) {
DataService.updateLead(params).then((data) => {
const leadNegativeReasonId = this.state.leadNegativeReasonId === '' || this.state.leadNegativeReasonId === undefined ? null : this.state.leadNegativeReasonId
if(leadNegativeReasonId !== null && leadNegativeReasonId === LeadNegativeReasonType.Member) {
Helper.SuccessMessage("Müşteri başarıyla akışa gönderildi.");
this.handleReset();
this.setState({ isEditingForm: true });
this.setState({ loading: false });
this.setState({ redirect: true });
}else{
const paramsProcess = { LeadId: this.state.id , ProcessStageId : ProcessStage.ReqeuestControl};
DataService.doProcess(paramsProcess).then((dataFlow) => {
Helper.SuccessMessage("Müşteri başarıyla akışa gönderildi.");
this.handleReset();
this.setState({ isEditingForm: true });
this.setState({ loading: false });
this.setState({ redirect: true });
})
.catch(() => {
this.setState({ loading: false })
});
}
})
.catch(() => {
this.setState({ loading: false })
});
} else {
DataService.insertLead(params).then((data) => {
const paramsProcess = { LeadId: data.id };
DataService.doProcess(paramsProcess).then((dataFlow) => {
Helper.SuccessMessage("Müşteri başarıyla akışa gönderildi.");
this.handleReset();
this.setState({ isEditingForm: true });
this.setState({ loading: false });
this.setState({ redirect: true });
})
.catch(() => {
this.setState({ loading: false })
});
})
.catch(() => {
this.setState({ loading: false })
});
}
}
else {
let errorList = this.state.errorList;
this.setState({ loading: false });
Helper.MultipleErrorMessage(errorList);
}
};
btnAddGroupCompanyClick = async () => {
this.setState({ loading: true })
if (!this.state.isCustomerInfoDisabled) {
if (await this.validationForGroupCompany()) {
const params = { name: this.state.groupCompanyName }
DataService.insertCompanyGroup(params).then((data) => {
this.setState({ groupCompanyName: "", groupCompanyNameHelp: "", groupCompanyNameStatus: "", addGroupCompany: false });
this.selectCompanyGroupList()
this.setState({ isEditingForm: true });
this.setState({ loading: false });
})
.catch(() => {
this.setState({ loading: false })
return false
});
}
else {
let errorList = this.state.errorList;
this.setState({ loading: false });
Helper.MultipleErrorMessage(errorList);
return false
}
}
this.setState({ loading: false })
}
validationForGroupCompany = async () => {
let isOK = true;
let errorList = this.state.errorList;
errorList = [];
let groupCompanyName = this.state.groupCompanyName;
if (Helper.StringIsNullOrEmpty(groupCompanyName)) {
this.setState({ groupCompanyNametatus: "error", groupCompanyNameHelp: "Grup firma adını giriniz !" })
errorList.push("Grup firma adını giriniz !");
isOK = false;
}
this.setState({ errorList: errorList })
return isOK;
}
validationAddOn = async () => {
let isOK = true;
let errorList = this.state.errorList;
errorList = [];
let companyName = this.state.companyName;
let productId = this.state.productId;
let arrivalChannelId = this.state.arrivalChannelId;
let phoneNumber = this.state.phoneNumber;
let email = this.state.email;
if (Helper.StringIsNullOrEmpty(companyName)) {
this.setState({ companyNameStatus: "error", companyNameHelp: "Müşteri adını giriniz !" })
errorList.push("Müşteri adını giriniz !");
isOK = false;
}
if (productId === undefined || productId <= 0) {
this.setState({ productIdStatus: "error", productIdHelp: "Ürün seçiniz !" })
errorList.push("Ürün seçiniz !");
isOK = false;
}
if (arrivalChannelId === undefined || arrivalChannelId <= 0) {
this.setState({ arrivalChannelIdStatus: "error", arrivalChannelIdHelp: "Geliş kanalı seçiniz !" })
errorList.push("Geliş kanalı seçiniz !");
isOK = false;
}
if (!this.state.productAndArrivalChannelList.some(pa => pa.arrivalChannelId === arrivalChannelId && pa.productId === productId)) {
errorList.push("Ürün ve geliş kanalı için müşteri talebi açma yetkiniz bulunmamaktadır!");
isOK = false;
}
if (!(phoneNumber === null || phoneNumber === undefined || phoneNumber === '') && (isNaN(phoneNumber) || phoneNumber.length < 10)) {
this.setState({ phoneNumberStatus: "error", phoneNumberHelp: "Lütfen telefon bilgisini doğru girdiğinizden emin olunuz! " });
errorList.push("Lütfen telefon bilgisini doğru girdiğinizden emin olunuz! ")
isOK = false;
}
if (!(email === null || email === undefined || email === '') && !this.validateEmail(email)) {
this.setState({ emailStatus: "error", emailHelp: "Lütfen Email adresinizi doğru girdiğinizden emin olunuz! " });
errorList.push("Lütfen Email adresinizi doğru girdiğinizden emin olunuz! ")
isOK = false;
}
this.setState({ errorList: errorList })
return isOK;
}
validateEmail = (email) => {
return this.state.regEmail.test(String(email).toLowerCase());
}
validation = async () => {
let isOK = true;
let errorList = this.state.errorList;
errorList = [];
let companyName = this.state.companyName;
let contactName = this.state.contactName;
let productId = this.state.productId;
let arrivalChannelId = this.state.arrivalChannelId;
let phoneNumber = this.state.phoneNumber;
let email = this.state.email;
// let address = this.state.address;
let cityId = this.state.cityId;
// let countyId = this.state.countyId;
let requestStatusId = this.state.requestStatusId;
// let staffCount = this.state.staffCount == undefined || this.state.staffCount == '' ? 0 : this.state.staffCount;
// let monthlyCardLoadAmount = this.state.monthlyCardLoadAmount == undefined || this.state.monthlyCardLoadAmount == '' ? 0 : parseFloat(this.state.monthlyCardLoadAmount).toFixed(2);
// let currentSystemId = this.state.currentSystemId == '' || this.state.currentSystemId == undefined ? 0 : this.state.currentSystemId
// let description = this.state.description;
let callDate= this.state.callDate === '' || this.state.callDate === undefined || this.state.callDate === null ? null : this.state.callDate;
if (!requestStatusId > 0) {
this.setState({ requestStatusIdStatus: "error", requestStatusIdHelp: "Durum seçimi yapınız! " });
errorList.push("Durum seçimi yapınız! ")
isOK = false;
}
if (productId === undefined || productId <= 0) {
this.setState({ productIdStatus: "error", productIdHelp: "Ürün seçiniz !" })
errorList.push("Ürün seçiniz !")
isOK = false;
}
if (arrivalChannelId === undefined || arrivalChannelId <= 0) {
this.setState({ arrivalChannelIdStatus: "error", arrivalChannelIdHelp: "Geldiği kanalı seçiniz !" })
errorList.push("Geldiği kanalı seçiniz !")
isOK = false;
}
if (Helper.StringIsNullOrEmpty(companyName)) {
this.setState({ companyNameStatus: "error", companyNameHelp: "Müşteri adını giriniz !" })
errorList.push("Müşteri adını giriniz !")
isOK = false;
}
if (Helper.StringIsNullOrEmpty(contactName)) {
this.setState({ contactNameStatus: "error", contactNameHelp: "Görüşülen yetkili adını giriniz !" })
errorList.push("Görüşülen yetkili adını giriniz !")
isOK = false;
}
if (!this.state.productAndArrivalChannelList.some(pa => pa.arrivalChannelId === arrivalChannelId && pa.productId === productId)) {
errorList.push("Ürün ve geliş kanalı için müşteri talebi açma yetkiniz bulunmamaktadır!");
isOK = false;
}
if (!(phoneNumber === null || phoneNumber === undefined || phoneNumber === '') && (isNaN(phoneNumber) || phoneNumber.length < 10)) {
this.setState({ phoneNumberStatus: "error", phoneNumberHelp: "Lütfen telefon bilgisini doğru girdiğinizden emin olunuz! " });
errorList.push("Lütfen telefon bilgisini doğru girdiğinizden emin olunuz! ")
isOK = false;
}
if (!(email === null || email === undefined || email === '') && !this.validateEmail(email)) {
this.setState({ emailStatus: "error", emailHelp: "Lütfen Email adresinizi doğru girdiğinizden emin olunuz! " });
errorList.push("Lütfen Email adresinizi doğru girdiğinizden emin olunuz! ")
isOK = false;
}
if (requestStatusId === Status.Approve) {
// if (monthlyCardLoadAmount <= 0 && productId == Product.SetCard) {
// this.setState({ monthlyCardLoadAmountStatus: "error", monthlyCardLoadAmountHelp: "Aylık yükleme tutarı giriniz! " });
// errorList.push("Aylık yükleme tutarı giriniz! ")
// isOK = false;
// }
// if (monthlyCardLoadAmount <= 0 && productId == Product.Konaklama) {
// this.setState({ monthlyCardLoadAmountStatus: "error", monthlyCardLoadAmountHelp: "Aylık Ciro giriniz! " });
// errorList.push("Aylık Ciro giriniz! ")
// isOK = false;
// }
// if (monthlyCardLoadAmount <= 0 && productId == Product.Akaryakit) {
// this.setState({ monthlyCardLoadAmountStatus: "error", monthlyCardLoadAmountHelp: "Kullanım tutarı giriniz! " });
// errorList.push("Kullanım tutarı giriniz! ")
// isOK = false;
// }
// if (monthlyCardLoadAmount <= 0 && productId == Product.Gift) {
// this.setState({ monthlyCardLoadAmountStatus: "error", monthlyCardLoadAmountHelp: "Yükleme tutarı giriniz! " });
// errorList.push("Yükleme tutarı giriniz! ")
// isOK = false;
// }
// if (!staffCount > 0 && productId == Product.SetCard) {
// this.setState({ staffCountStatus: "error", staffCountHelp: "Kart kullanacak personel sayısını giriniz! " });
// errorList.push("Kart kullanacak personel sayısını giriniz! ")
// isOK = false;
// }
// if (!staffCount > 0 && productId == Product.Konaklama) {
// this.setState({ staffCountStatus: "error", staffCountHelp: "Personel sayısını giriniz! " });
// errorList.push("Personel sayısını giriniz! ")
// isOK = false;
// }
// if (!staffCount > 0 && productId == Product.Akaryakit) {
// this.setState({ staffCountStatus: "error", staffCountHelp: "Araç sayısını giriniz! " });
// errorList.push("Araç sayısını giriniz! ")
// isOK = false;
// }
// if (!staffCount > 0 && productId == Product.Gift) {
// this.setState({ staffCountStatus: "error", staffCountHelp: "Kişi sayısını giriniz! " });
// errorList.push("Kişi sayısını giriniz! ")
// isOK = false;
// }
if (phoneNumber === null || phoneNumber === undefined || isNaN(phoneNumber) || phoneNumber.length < 10) {
this.setState({ phoneNumberStatus: "error", phoneNumberHelp: "Telefon numarasını giriniz! " });
errorList.push("Telefon numarasını giriniz! ")
isOK = false;
}
if (!cityId > 0) {
this.setState({ cityIdStatus: "error", cityIdHelp: "İl seçimi yapınız! " });
errorList.push("İl seçimi yapınız! ")
isOK = false;
}
// if (!countyId > 0) {
// this.setState({ countyIdStatus: "error", countyIdHelp: "İlçe seçimi yapınız! " });
// errorList.push("İlçe seçimi yapınız! ")
// isOK = false;
// }
// if (Helper.StringIsNullOrEmpty(address)) {
// this.setState({ addressStatus: "error", addressHelp: "Adres bilgisi giriniz! " });
// errorList.push("Adres bilgisi giriniz! ")
// isOK = false;
// }
// if (currentSystemId <= 0 && productId == Product.SetCard) {
// this.setState({ currentSystemIdStatus: "error", currentSystemIdHelp: "Kullandığı Sistem seçimi yapınız! " });
// errorList.push("Kullandığı Sistem seçimi yapınız! ")
// isOK = false;
// }
// if (currentSystemId <= 0 && productId == Product.Akaryakit) {
// this.setState({ currentSystemIdStatus: "error", currentSystemIdHelp: "Kullandığı Yakıt Sistemi seçimi yapınız! " });
// errorList.push("Kullandığı Yakıt Sistemi seçimi yapınız! ")
// isOK = false;
// }
// if (Helper.StringIsNullOrEmpty(description)) {
// this.setState({ descriptionStatus: "error", descriptionHelp: "Açıklama giriniz !" })
// errorList.push("Açıklama giriniz !")
// isOK = false;
// }
// if (!this.validateEmail(email)) {
// this.setState({ emailStatus: "error", emailHelp: "Mail adresinizi giriniz! " });
// errorList.push("Mail adresinizi giriniz! ")
// isOK = false;
// }
if(callDate === null){
this.setState({ callDateStatus: "error", callDateHelp: "Arama Tarihini giriniz!" });
errorList.push("Arama Tarihini giriniz!")
isOK = false;
}
}
this.setState({ errorList: errorList })
return isOK;
}
validateDate = (value) => {
let today = moment().toDate();
let date = value.toDate();
if (today.getFullYear() === date.getFullYear() && today.getMonth() === date.getMonth() && today.getDate() === date.getDate()
&& today.getHours() > 19)
today.setHours(18, 59, 0, 0);
return !(date > today);
}
range(start, end) {
const result = [];
for (let i = start; i < end; i++) {
result.push(i);
}
return result;
}
disabledDate(current) {
return current > moment().endOf('day');
}
disabledDateTime(current) {
let today = new Date();
const hours = new Date().getHours()
const minutes = new Date().getMinutes()
today.setHours(0, 0, 0, 0);
let selected = current === null || current === undefined ? today : current.toDate()
selected.setHours(0, 0, 0, 0);
const isSameDay = +today === +selected
const first = this.range(0, 24).splice(0, 8)
let last = isSameDay && hours < 19 ? this.range(0, 24).splice(hours + 1, (24 - (hours + 1))) : this.range(0, 24).splice(19, 5)
return {
disabledHours: () => first.concat(last),
disabledMinutes: () => isSameDay && hours < 19 ? this.range((minutes + 1), 60) : null
};
}
render() {
if (this.state.redirect) {
return