pipeline new version update
This commit is contained in:
parent
949cad9926
commit
eaef44363a
@ -252,7 +252,6 @@ export class ZinoClient {
|
|||||||
|
|
||||||
dailySalesReport(data: Record<string, unknown>): Promise<any> {
|
dailySalesReport(data: Record<string, unknown>): Promise<any> {
|
||||||
return this.request('POST', PIPELINE.endpoints.dailySalesReport, data, {
|
return this.request('POST', PIPELINE.endpoints.dailySalesReport, data, {
|
||||||
'TemplateID': '157',
|
|
||||||
'sec-ch-ua-platform': '"Android"',
|
'sec-ch-ua-platform': '"Android"',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -253,10 +253,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 {
|
||||||
@ -57,9 +57,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));
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import {
|
|||||||
WfLookupField,
|
WfLookupField,
|
||||||
RadioField,
|
RadioField,
|
||||||
} from './fields';
|
} from './fields';
|
||||||
import { ORDER_BOOKING, STORE, DAILY_REPORTS, HIDDEN_FORM_FIELDS, SELECT_OPTION_LIMIT } from '../../api/config';
|
import { ORDER_BOOKING, STORE, DAILY_REPORTS, HIDDEN_FORM_FIELDS, SELECT_OPTION_LIMIT, PIPELINE } from '../../api/config';
|
||||||
|
|
||||||
export interface DynamicFormProps {
|
export interface DynamicFormProps {
|
||||||
client: ZinoClient;
|
client: ZinoClient;
|
||||||
@ -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'
|
|
||||||
};
|
|
||||||
headers['orgid'] = '57';
|
|
||||||
headers['groupid'] = '25';
|
|
||||||
|
|
||||||
const summaryRes = await client.request<any>(
|
const summaryRes = await client.request<any>(
|
||||||
'POST',
|
'POST',
|
||||||
'/api/papi2/productive-call-summary',
|
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)) {
|
||||||
@ -478,12 +470,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) => {
|
||||||
|
|||||||
@ -64,11 +64,7 @@ export function NearestStoresMap() {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'accept': 'application/json, text/plain, */*',
|
'accept': 'application/json, text/plain, */*',
|
||||||
'content-type': 'application/json',
|
'content-type': 'application/json'
|
||||||
'groupid': '25',
|
|
||||||
'orgid': '57',
|
|
||||||
'templateid': '189',
|
|
||||||
'x-pipeline-version': 'latest'
|
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
latitude: lat,
|
latitude: lat,
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { Phone, Plus } from 'lucide-react';
|
|||||||
import { Button } from '../components/buttons/Button';
|
import { Button } from '../components/buttons/Button';
|
||||||
import { LogVisitForm } from '../components/forms/LogVisitForm';
|
import { LogVisitForm } from '../components/forms/LogVisitForm';
|
||||||
import { DynamicForm } from '../components/forms/DynamicForm';
|
import { DynamicForm } from '../components/forms/DynamicForm';
|
||||||
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() {
|
||||||
@ -40,9 +40,8 @@ export function CallsPage() {
|
|||||||
|
|
||||||
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,
|
payload
|
||||||
{ 'TemplateID': '146' }
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const rawPotential = response.potential?.potential || [];
|
const rawPotential = response.potential?.potential || [];
|
||||||
|
|||||||
@ -27,15 +27,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);
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { Plus, ShoppingBag } from 'lucide-react';
|
|||||||
import { Button } from '../components/buttons/Button';
|
import { Button } from '../components/buttons/Button';
|
||||||
import { LogVisitForm } from '../components/forms/LogVisitForm';
|
import { LogVisitForm } from '../components/forms/LogVisitForm';
|
||||||
import { DynamicForm } from '../components/forms/DynamicForm';
|
import { DynamicForm } from '../components/forms/DynamicForm';
|
||||||
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 OrdersPage() {
|
export function OrdersPage() {
|
||||||
@ -42,9 +42,8 @@ export function OrdersPage() {
|
|||||||
|
|
||||||
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,
|
payload
|
||||||
{ 'TemplateID': '146' }
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const rawPotential = response.potential?.potential || [];
|
const rawPotential = response.potential?.potential || [];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user