pipeline version change
This commit is contained in:
parent
ab626fb506
commit
3192b6f500
@ -260,10 +260,14 @@ export const SALES_REPORT_SO_NAMES = [
|
|||||||
// --- Pipeline Endpoints ---
|
// --- Pipeline Endpoints ---
|
||||||
export const PIPELINE = {
|
export const PIPELINE = {
|
||||||
endpoints: {
|
endpoints: {
|
||||||
nearestStores: '/api/papi2/nearest-stores',
|
nearestStores: '/api/p/krishna-group/v1/nearest-stores',
|
||||||
dailySalesReport: '/api/papi2/daily-sales-report',
|
dailySalesReport: '/api/p/krishna-group/v1/daily-sales-report',
|
||||||
productiveCallSummary: '/api/papi2/productive-call-summary',
|
productiveCallSummary: '/api/p/krishna-group/v1/productive-call-summary',
|
||||||
salesOfficers: '/api/papi2/sales-officers'
|
salesOfficers: '/api/p/krishna-group/v1/sales-officers',
|
||||||
|
autoCloseOrders: '/api/p/krishna-group/v1/auto-close-orders',
|
||||||
|
editOrder: '/api/p/krishna-group/v1/edit-orders',
|
||||||
|
order: '/api/p/krishna-group/v1/orders',
|
||||||
|
potentialMining: '/api/p/krishna-group/v1/potential-mining'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { useEffect, useState, type ReactNode } from 'react';
|
import { useEffect, useState, type ReactNode } from 'react';
|
||||||
import { orderBookingClient } from '../../api/clients';
|
import { orderBookingClient } from '../../api/clients';
|
||||||
import { ORDER_BOOKING, APP_ID } from '../../api/config';
|
import { ORDER_BOOKING, APP_ID, PIPELINE } from '../../api/config';
|
||||||
import { Spinner } from '../reusable/Spinner';
|
import { Spinner } from '../reusable/Spinner';
|
||||||
import { EmptyState } from '../reusable/EmptyState';
|
import { EmptyState } from '../reusable/EmptyState';
|
||||||
import {
|
import {
|
||||||
@ -92,9 +92,8 @@ export function CallDetail({
|
|||||||
if (storeCode) {
|
if (storeCode) {
|
||||||
orderBookingClient.request<{ potential: { potential: any[] } }>(
|
orderBookingClient.request<{ potential: { potential: any[] } }>(
|
||||||
'POST',
|
'POST',
|
||||||
'/api/papi2/potential-mining',
|
PIPELINE.endpoints.potentialMining,
|
||||||
{ store_code: storeCode, instance_id: String(instanceId) },
|
{ store_code: storeCode, instance_id: String(instanceId) }
|
||||||
{ 'TemplateID': '146' }
|
|
||||||
).then(res => {
|
).then(res => {
|
||||||
if (live) setPotentialData(res.potential?.potential || []);
|
if (live) setPotentialData(res.potential?.potential || []);
|
||||||
}).catch(e => console.warn("Failed to fetch potential mining", e));
|
}).catch(e => console.warn("Failed to fetch potential mining", e));
|
||||||
|
|||||||
@ -141,18 +141,10 @@ export function DynamicForm({ client, activityId: initialActivityId, instanceId:
|
|||||||
const userEmail = user?.email;
|
const userEmail = user?.email;
|
||||||
if (userEmail) {
|
if (userEmail) {
|
||||||
try {
|
try {
|
||||||
const headers: Record<string, string> = {
|
|
||||||
'templateid': '192',
|
|
||||||
'x-pipeline-version': 'latest',
|
|
||||||
'orgid': '57',
|
|
||||||
'groupid': '25'
|
|
||||||
};
|
|
||||||
|
|
||||||
const summaryRes = await client.request<any>(
|
const summaryRes = await client.request<any>(
|
||||||
'POST',
|
'POST',
|
||||||
PIPELINE.endpoints.productiveCallSummary,
|
PIPELINE.endpoints.productiveCallSummary,
|
||||||
{ email: userEmail },
|
{ email: userEmail }
|
||||||
headers
|
|
||||||
);
|
);
|
||||||
let summaryData = summaryRes.data || summaryRes;
|
let summaryData = summaryRes.data || summaryRes;
|
||||||
if (Array.isArray(summaryData)) {
|
if (Array.isArray(summaryData)) {
|
||||||
@ -786,12 +778,11 @@ export function DynamicForm({ client, activityId: initialActivityId, instanceId:
|
|||||||
try {
|
try {
|
||||||
const pmRes = await client.request<{ potential: { potential: any[] } }>(
|
const pmRes = await client.request<{ potential: { potential: any[] } }>(
|
||||||
'POST',
|
'POST',
|
||||||
'/api/papi2/potential-mining',
|
PIPELINE.endpoints.potentialMining,
|
||||||
{
|
{
|
||||||
instance_id: String(res.instance_id ?? currentInstanceId),
|
instance_id: String(res.instance_id ?? currentInstanceId),
|
||||||
store_code: storeCodeToSend
|
store_code: storeCodeToSend
|
||||||
},
|
}
|
||||||
{ 'TemplateID': '146' }
|
|
||||||
);
|
);
|
||||||
const rawPotential = pmRes.potential?.potential || [];
|
const rawPotential = pmRes.potential?.potential || [];
|
||||||
const mappedPotential = rawPotential.map((row: any) => {
|
const mappedPotential = rawPotential.map((row: any) => {
|
||||||
|
|||||||
@ -71,12 +71,6 @@ export function DailyLogMap({
|
|||||||
{
|
{
|
||||||
latitude: lat,
|
latitude: lat,
|
||||||
longitude: lng
|
longitude: lng
|
||||||
},
|
|
||||||
{
|
|
||||||
groupid: '25',
|
|
||||||
orgid: '57',
|
|
||||||
templateid: '189',
|
|
||||||
'x-pipeline-version': 'latest'
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { useEffect, useState } from 'react';
|
|||||||
import { Button } from '../components/buttons/Button';
|
import { Button } from '../components/buttons/Button';
|
||||||
import { Plus } from 'lucide-react';
|
import { Plus } from 'lucide-react';
|
||||||
import { DynamicForm, LogVisitForm } from '../components/forms';
|
import { DynamicForm, LogVisitForm } from '../components/forms';
|
||||||
import { ORDER_BOOKING } from '../api/config';
|
import { ORDER_BOOKING, PIPELINE } from '../api/config';
|
||||||
import { orderBookingClient } from '../api/clients';
|
import { orderBookingClient } from '../api/clients';
|
||||||
|
|
||||||
export function CallsPage() {
|
export function CallsPage() {
|
||||||
@ -46,16 +46,13 @@ export function CallsPage() {
|
|||||||
console.warn("Store code not found on selected row, proceeding anyway.");
|
console.warn("Store code not found on selected row, proceeding anyway.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = {
|
|
||||||
store_code: storeCode,
|
|
||||||
instance_id: String(instanceId)
|
|
||||||
};
|
|
||||||
|
|
||||||
const response = await orderBookingClient.request<{ potential: { potential: any[] } }>(
|
const response = await orderBookingClient.request<{ potential: { potential: any[] } }>(
|
||||||
'POST',
|
'POST',
|
||||||
'/api/papi2/potential-mining',
|
PIPELINE.endpoints.potentialMining,
|
||||||
payload,
|
{
|
||||||
{ 'TemplateID': '146' }
|
instance_id: String(instanceId),
|
||||||
|
store_code: storeCode
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const rawPotential = response.potential?.potential || [];
|
const rawPotential = response.potential?.potential || [];
|
||||||
|
|||||||
@ -26,15 +26,7 @@ export function DailySalesReportPage() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchSOs() {
|
async function fetchSOs() {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${BASE_URL}${PIPELINE.endpoints.salesOfficers}`, {
|
const res = await fetch(`${BASE_URL}${PIPELINE.endpoints.salesOfficers}`);
|
||||||
headers: {
|
|
||||||
'TemplateID': '194',
|
|
||||||
'X-Pipeline-Version': 'latest',
|
|
||||||
'OrgID': '57',
|
|
||||||
'GroupID': '25',
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
if (data?.response?.options) {
|
if (data?.response?.options) {
|
||||||
setSoOptions(data.response.options);
|
setSoOptions(data.response.options);
|
||||||
@ -242,7 +234,6 @@ export function DailySalesReportPage() {
|
|||||||
const res = await fetch(`${BASE_URL}${PIPELINE.endpoints.dailySalesReport}`, {
|
const res = await fetch(`${BASE_URL}${PIPELINE.endpoints.dailySalesReport}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'TemplateID': '157',
|
|
||||||
'Accept': 'application/json, text/plain, */*',
|
'Accept': 'application/json, text/plain, */*',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { useEffect, useState } from 'react';
|
|||||||
import { Button } from '../components/buttons/Button';
|
import { Button } from '../components/buttons/Button';
|
||||||
import { Plus } from 'lucide-react';
|
import { Plus } from 'lucide-react';
|
||||||
import { DynamicForm, LogVisitForm } from '../components/forms';
|
import { DynamicForm, LogVisitForm } from '../components/forms';
|
||||||
import { ORDER_BOOKING } from '../api/config';
|
import { ORDER_BOOKING, PIPELINE } from '../api/config';
|
||||||
import { orderBookingClient } from '../api/clients';
|
import { orderBookingClient } from '../api/clients';
|
||||||
import { useAuth } from '../auth/context';
|
import { useAuth } from '../auth/context';
|
||||||
|
|
||||||
@ -49,16 +49,13 @@ export function MyCallsPage() {
|
|||||||
console.warn("Store code not found on selected row, proceeding anyway.");
|
console.warn("Store code not found on selected row, proceeding anyway.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = {
|
|
||||||
store_code: storeCode,
|
|
||||||
instance_id: String(instanceId)
|
|
||||||
};
|
|
||||||
|
|
||||||
const response = await orderBookingClient.request<{ potential: { potential: any[] } }>(
|
const response = await orderBookingClient.request<{ potential: { potential: any[] } }>(
|
||||||
'POST',
|
'POST',
|
||||||
'/api/papi2/potential-mining',
|
PIPELINE.endpoints.potentialMining,
|
||||||
payload,
|
{
|
||||||
{ 'TemplateID': '146' }
|
instance_id: String(instanceId),
|
||||||
|
store_code: storeCode
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const rawPotential = response.potential?.potential || [];
|
const rawPotential = response.potential?.potential || [];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user