From f99a0ab57326333fc4cda314d6ff461fc580fe28 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 26 Nov 2023 00:54:06 +0100 Subject: [PATCH] cmr --- public/locales/de/translation.json | 50 +++ public/locales/en/translation.json | 92 ++++++ src/Components/AppRoutes/index.js | 17 + src/Components/SideMenu/index.js | 57 ++++ src/Pages/Crm/index.js | 513 +++++++++++++++++++++++++++++ src/utils.js | 17 + 6 files changed, 746 insertions(+) create mode 100644 src/Pages/Crm/index.js diff --git a/public/locales/de/translation.json b/public/locales/de/translation.json index 969c34c..e3551fa 100644 --- a/public/locales/de/translation.json +++ b/public/locales/de/translation.json @@ -46,6 +46,12 @@ "menuCategory": "Robotik", "robots": "Roboter" }, + "crm": { + "menuCategory": "CRM", + "customers": "Kunden", + "dmcPipeline": "DMC-Pipeline", + "setterCloser": "Setter / Closer" + }, "adminArea": { "menuCategory": "Adminbereich", "roles": "Rollen", @@ -233,6 +239,50 @@ } } }, + "crm": { + "customers": { + "pageTitle": "Kunden" + }, + "dmcPipeline": { + "pageTitle": "DMC-Pipeline", + "segmentedOptions": [ + "Recherchierte Leads", + "Geprüfte Leads", + "DMC versendet", + "Follow Up", + "Ungeeignet" + ] + }, + "setterCloser": { + "pageTitle": "Setter / Closer", + "segmentedOptions": [ + "Anfrage eingegangen", + "Nachverfolgung", + "Qualifiziert (ohne Termin)", + "Erstgespräch", + "Folgegespräch", + "Verkauft", + "Nicht verkauft", + "Unqualifiziert" + ] + }, + "table": { + "firstName": "Vorname", + "lastName": "Nachname", + "createdAt": "Erstellt am", + "telephone": "Telefon", + "email": "E-Mail", + "lastContact": "Letzter Kontakt", + "createdBy": "Erstellt von", + "notes": "Notizen" + }, + "buttonNew": "Neu", + "tabs": { + "dealInfo": "Deal-Informationen", + "activities": "Aktivitäten", + "notes": "Notizen" + } + }, "logCard": { "popover": { "groupTaskId.title": "Gruppenaufgabe", diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 0485bcb..5dda425 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -46,6 +46,12 @@ "menuCategory": "Robotics", "robots": "Robots" }, + "crm": { + "menuCategory": "CRM", + "customers": "Customers", + "dmcPipeline": "DMC-Pipeline", + "setterCloser": "Setter / Closer" + }, "adminArea": { "menuCategory": "Admin Area", "roles": "Roles", @@ -233,6 +239,92 @@ } } }, + "crm": { + "customers": { + "pageTitle": "Customers" + }, + "dmcPipeline": { + "pageTitle": "DMC-Pipeline", + "segmentedOptions": [ + "Researched Leads", + "Checked Leads", + "DMC sent", + "Follow Up", + "Unsuitable" + ] + }, + "setterCloser": { + "pageTitle": "Setter / Closer", + "segmentedOptions": [ + "Request received", + "Tracking", + "Qualified (without appointment)", + "Fist meeting", + "Follow-up meeting", + "Sold", + "Not sold", + "Unqualified" + ] + }, + "table": { + "firstName": "First Name", + "lastName": "Last Name", + "createdAt": "Created at", + "telephone": "Telephone", + "email": "Email", + "lastContact": "Last Contact", + "createdBy": "Created by", + "notes": "Notes" + }, + "buttonNew": "New", + "tabs": { + "dealInfo": "Deal Info", + "activities": "Activities", + "notes": "Notes" + }, + "tabContent": { + "dealInfo": { + "collapseDealStatus": { + "label": "Deal Status", + "pipeline": "Pipeline", + "dealPhase": "Deal Phase" + }, + "collapseMasterDataOfContact": { + "label": "Master data of the contact", + "firstName": "First Name", + "lastName": "Last Name", + "telephone": "Telephone", + "email": "Email", + "company": "Company", + "zipCode": "Zip Code", + "address": "Address", + "city": "City", + "country": "Country", + "federalState": "Federal State", + "website": "Website", + "leadOrigin": "Lead Origin" + }, + "collapseSetterInfo": { + "label": "Setter Info", + "numberOfEmployees": "Number of Employees", + "numberOfJobsSearchedFor": "Number of Jobs Searched for", + "jobTitle": "Job Title", + "numberOfEmployeesRequired": "Number of Employees Required", + "howLongHadHeBeenSearching": "How long had he been searching?", + "turnover": "Turnover" + }, + "collapseDealProperties": { + "label": "Deal properties", + "dateOfcompletion": "Date of completion", + "orderVolume": "Order volume", + "numberOfInstallments": "Number of installments", + "amountsOfTheInstallments": "Amounts of the installments", + "bookedPackages": "Booked packages", + "assignedEmployee": "Assigned employee" + } + } + } + }, "logCard": { "popover": { "groupTaskId.title": "Group Task", diff --git a/src/Components/AppRoutes/index.js b/src/Components/AppRoutes/index.js index fcf5d94..576e4a1 100644 --- a/src/Components/AppRoutes/index.js +++ b/src/Components/AppRoutes/index.js @@ -23,6 +23,7 @@ const ViewEquipmentDocumentations = lazy(() => ); const Consoles = lazy(() => import("../../Pages/Consoles")); const RoboticsRobots = lazy(() => import("../../Pages/Robotics/Robots")); +const Crm = lazy(() => import("../../Pages/Crm")); function SuspenseFallback({ children }) { return ( @@ -264,6 +265,22 @@ export default function AppRoutes({ userSession, setUserSession }) { /> )} + {hasOnePermission( + appContext.userPermissions, + Constants.PERMISSIONS.CRM.CUSTOMERS.VIEW, + Constants.PERMISSIONS.CRM.DMC_PIPELINE.VIEW, + Constants.PERMISSIONS.CRM.SETTER_CLOSER.VIEW + ) && ( + + + + } + /> + )} + , + key: Constants.ROUTE_PATHS.CRM + Constants.CRM_TYPE.CUSTOMERS, + }); + } + + if ( + hasPermission( + appContext.userPermissions, + Constants.PERMISSIONS.CRM.DMC_PIPELINE.VIEW + ) + ) { + crmGroup.children.push({ + label: t("sideMenu.crm.dmcPipeline"), + icon: , + key: Constants.ROUTE_PATHS.CRM + Constants.CRM_TYPE.DMC_PIPELINE, + }); + } + + if ( + hasPermission( + appContext.userPermissions, + Constants.PERMISSIONS.CRM.SETTER_CLOSER.VIEW + ) + ) { + crmGroup.children.push({ + label: t("sideMenu.crm.setterCloser"), + icon: , + key: Constants.ROUTE_PATHS.CRM + Constants.CRM_TYPE.SETTER_CLOSER, + }); + } + + items.push(crmGroup); + } + // admin area if ( hasOnePermission( diff --git a/src/Pages/Crm/index.js b/src/Pages/Crm/index.js new file mode 100644 index 0000000..7a1ab79 --- /dev/null +++ b/src/Pages/Crm/index.js @@ -0,0 +1,513 @@ +import { + Button, + Col, + Collapse, + Drawer, + Form, + Input, + Row, + Segmented, + Select, + Space, + Table, + Tabs, + Typography, +} from "antd"; +import { useTranslation } from "react-i18next"; +import { useParams } from "react-router-dom"; +import { AppStyle, Constants } from "../../utils"; +import { useEffect, useState } from "react"; +import { PlusOutlined } from "@ant-design/icons"; +import { t } from "i18next"; + +export default function Crm() { + const { t } = useTranslation(); + const { paramType } = useParams(); + const [isDrawerOpen, setIsDrawerOpen] = useState(false); + + const title = + paramType === Constants.CRM_TYPE.CUSTOMERS + ? "crm.customers.pageTitle" + : paramType === Constants.CRM_TYPE.DMC_PIPELINE + ? "crm.dmcPipeline.pageTitle" + : "crm.setterCloser.pageTitle"; + + const segmentedOptions = t( + paramType === Constants.CRM_TYPE.DMC_PIPELINE + ? "crm.dmcPipeline.segmentedOptions" + : "crm.setterCloser.segmentedOptions", + { + returnObjects: true, + } + ); + + const [selectedSegmentedValue, setSelectedSegmentedValue] = useState( + segmentedOptions[0] + ); + + const getTableContent = () => { + return [ + { + title: t("crm.table.firstName"), + dataIndex: "firstName", + key: "firstName", + }, + { + title: t("crm.table.lastName"), + dataIndex: "lastName", + key: "lastName", + }, + { + title: t("crm.table.createdAt"), + + dataIndex: "createdAt", + key: "createdAt", + }, + { + title: t("crm.table.telephone"), + dataIndex: "telephone", + key: "telephone", + }, + { + title: t("crm.table.email"), + dataIndex: "email", + key: "email", + }, + { + title: t("crm.table.lastContact"), + dataIndex: "lastContact", + key: "lastContact", + }, + { + title: t("crm.table.createdBy"), + dataIndex: "createdBy", + key: "createdBy", + }, + { + title: t("crm.table.notes"), + dataIndex: "notes", + key: "notes", + }, + ]; + }; + + const getTableItems = () => { + return [ + { + key: "1", + id: "", + firstName: "Max", + }, + { + key: "2", + id: "", + firstName: "Peter", + }, + { + key: "3", + id: "", + firstName: "Anna", + }, + ]; + }; + + useEffect(() => { + if (paramType === Constants.CRM_TYPE.CUSTOMERS) return; + + setSelectedSegmentedValue(segmentedOptions[0]); + }, [paramType]); + + return ( + <> +
+ {t(title)} + + +
+ + {paramType !== Constants.CRM_TYPE.CUSTOMERS && ( + setSelectedSegmentedValue(value)} + options={segmentedOptions} + style={{ marginBottom: AppStyle.app.margin }} + /> + )} + + { + return { + onClick: (event) => { + console.log("row", record, rowIndex); + setIsDrawerOpen(true); + }, + }; + }} + /> + + setIsDrawerOpen(false)} + /> + + ); +} + +function CustomerDrawer({ isOpen, onClose }) { + const { t } = useTranslation(); + + const tabItems = [ + { + key: "0", + label: t("crm.tabs.dealInfo"), + children: , + }, + { + key: "1", + label: t("crm.tabs.activities"), + children: "Tab 2 content", + }, + { + key: "2", + label: t("crm.tabs.notes"), + children: "Tab 3 content", + }, + ]; + + return ( + + + + ); +} + +function Content({ children }) { + return ( +
+ +
+ {children[0]} + + + {children[1]} + + + + ); +} + +function CollapseContainer({ children, label }) { + return ( + + ); +} + +function TabContentDealInfo() { + const [selectedPipeline, setSelectedPipeline] = useState(0); + const [selectedDealPhase, setSelectedDealPhase] = useState(0); + + return ( + + + + + setSelectedDealPhase(value)} + options={t( + selectedPipeline === 0 + ? "crm.dmcPipeline.segmentedOptions" + : "crm.setterCloser.segmentedOptions", + { returnObjects: true } + ).map((item, index) => { + return { + value: index, + label: item, + }; + })} + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +} diff --git a/src/utils.js b/src/utils.js index 8251f9e..6522174 100644 --- a/src/utils.js +++ b/src/utils.js @@ -90,6 +90,12 @@ export const Constants = { ADMIN_AREA_MANAGE: "/admin-area/manage", CONSOLES: "/consoles", ROBOTICS_ROBOTS: "/robotics/robots", + CRM: "/crm/", + }, + CRM_TYPE: { + CUSTOMERS: "customers", + DMC_PIPELINE: "dmc-pipeline", + SETTER_CLOSER: "setter-closer", }, GROUP_TASKS_STATUS: { FINISHED: 1, @@ -200,6 +206,17 @@ export const Constants = { "robotics.robots.view_swagger_documentation", }, }, + CRM: { + CUSTOMERS: { + VIEW: "crm.customers.view", + }, + DMC_PIPELINE: { + VIEW: "crm.dmc_pipeline.view", + }, + SETTER_CLOSER: { + VIEW: "crm.setter_closer.view", + }, + }, }, SYSTEM_LOG_TYPE: { INFO: 0,