krishna_sales/src/api/config.ts
2026-07-30 12:32:09 +05:30

251 lines
8.2 KiB
TypeScript

// Krishna Sales — sandbox app 434 (base https://sandbox.getzino.in).
// Three workflows share the app: Order Booking, Store, Daily Reports. Each has
// its own workflow_uuid + version_uuid; instantiate one ZinoClient per workflow
// (new ZinoClient(baseUrl, WORKFLOWS.<x>.workflowUuid)). All ids from the API
// docs under src/docs/api.
export const APP_ID = '434';
export const BASE_URL = 'https://dev.getzino.in';
// --- Order Booking (src/docs/api/order_booking.md) ---
export const ORDER_BOOKING = {
workflowUuid: 'b5a21627-9422-40cf-b7f5-31fa070bf42f',
versionUuid: 'f19b2146-88e5-448a-9a51-e517ebce680a',
activities: {
LOG_VISIT: {
uid: '42b7f47d-96f0-4289-a6d9-38f455ad57dd', // init
fields: {
selectStore: 'select_store', // wf_lookup
dateOfVisit: 'date_of_visit', // date
timeOfVisit: 'time_of_visit', // time
uploadImage: 'upload_image', // image
},
},
PLACE_ORDER: {
uid: 'f66403d7-e31f-4d64-bcfd-ff5485aec8b8',
fields: {
dateOfOrder: 'date_of_order', // date
orderDetails: 'order_details', // grid: br_code, sku_code, product_category, product_name, sku, bags
totalBags: 'total_bags', // number
totalKgs: 'total_kgs', // number
},
},
EDIT_ORDER: {
uid: '296e418e-5b31-43ad-aba4-4e9a1027ccd9',
fields: {
dateOfOrder: 'date_of_order', // date
orderDetails: 'order_details', // grid
totalBags: 'total_bags', // number
totalKgs: 'total_kgs', // number
},
},
PRODUCTIVITY_OF_VISIT: {
uid: '11bd10f9-a001-470e-867f-33dee8eabe4b',
fields: {
isProductiveCall: 'is_productive_call', // radio
storeStatus: 'store_status', // select
orderReceivedChannel: 'order_received_channel', // select
remarks: 'remarks', // longtext
action: 'action', // radio
},
},
POTENTIAL_MINING: {
uid: 'af8ac8df-d868-4f7d-88b2-123955d69c56',
fields: {
potential: 'potential', // grid: product_category_, total_ordered, actual_potential, difference, reason, potential_remarks
},
},
CLOSE_ORDER: {
uid: '8580d7a2-5d31-40ab-b7ea-2a38d144e59a',
fields: {
remarks: 'remarks_2', // longtext
},
},
},
recordViews: {
ORDERS: '63714ac2-c9fb-40e2-abba-d4081a70b768',
CALLS: '56b21b46-6d2c-4e10-b5a3-c63d058d0afa',
PRODUCT_WISE_ORDERS: 'f1b372de-9e00-4cc6-81b5-1e1a98e7daef',
ROUTE_WISE_ORDERS: 'bfb346b6-b512-4870-946b-a6f2e621870e',
SO_WISE_ORDERS: 'c155d266-4eef-420d-9fb8-cd6ace43c569',
SO_WISE_VISITS: '08767452-6f0d-46cc-ae7f-ddf2cb480159',
YEARLY_ORDERS: 'b8fd04da-f076-4e8d-b711-cf9282bf450a',
MONTHLY_ORDERS: '6d4ce86a-7a05-446b-8c81-cd0b98b6b244',
WEEKLY_ORDERS: 'c6e2c57f-ed17-4c92-a2de-189c61c89422',
STORE_WISE_PRODUCTS: 'f8d71b1d-dffd-450a-b9c9-3a63db8992c5'
},
detailViews: {
ORDERS: '0804c6c3-6cf9-4050-94bb-fa48dd5de87d',
CALLS: '09a32bfe-9e43-4e0f-bb7d-db89c8a2557c',
},
} as const;
// --- Store (src/docs/api/store.md) ---
export const STORE = {
workflowUuid: '2f827d27-b7a4-4ed9-9336-879fa46dbcba',
versionUuid: 'ced1fb5b-c6a4-4305-b85d-3c263d9d618e',
activities: {
// Init (fields carry the _2 suffix).
INIT: {
uid: '8626a77f-9e70-448e-8ac9-2c51eae5015b', // init
fields: {
businessName: 'business_name_2', // text
area: 'area_2', // text
completeAddress: 'complete_address_2', // longtext
pinCode: 'pin_code_2', // number
ownerName: 'owner_name_2', // text
phoneNumber: 'phone_number_2', // phone
email: 'email_2', // email
storeLocation: 'store_location_2', // geolocation
storeImage: 'store_image_2', // image
routeName: 'route_name_2', // select
routeCode: 'route_code_2', // select
subRoute: 'sub_route_2', // select
distributorName: 'distributor_name_2', // select
distributorOwnerName: 'distributor_owner_name_2', // text
distributorEmail: 'distributor_email_2', // email
distributorPhoneNumber: 'distributor_phone_number_2', // phone
notes: 'notes_2', // longtext
potential: 'potential_2', // grid: product_category_1, quantity_1
},
},
// Edit (same fields, _3 suffix).
EDIT_STORE: {
uid: '87647fae-3b07-445f-9615-21881b163276',
fields: {
businessName: 'business_name_3', // text
area: 'area_3', // text
completeAddress: 'complete_address_3', // longtext
pinCode: 'pin_code_3', // number
ownerName: 'owner_name_3', // text
phoneNumber: 'phone_number_3', // phone
email: 'email_3', // email
storeLocation: 'store_location_3', // geolocation
storeImage: 'store_image_3', // image
routeName: 'route_name_3', // select
routeCode: 'route_code_3', // select
subRoute: 'sub_route_3', // select
distributorName: 'distributor_name_3', // select
distributorOwnerName: 'distributor_owner_name_3', // text
distributorEmail: 'distributor_email_3', // email
distributorPhoneNumber: 'distributor_phone_number_3', // phone
notes: 'notes_3', // longtext
potential: 'potential_3', // grid: col_1, col_2
},
},
},
recordViews: {
STORE: 'c03b411a-8454-4d8b-8220-00095e92a5de',
},
detailViews: {
STORE: 'af868269-d340-4ea9-9793-5fabe4f6ae27',
},
} as const;
// --- Daily Reports (src/docs/api/daily_reports.md) ---
export const DAILY_REPORTS = {
workflowUuid: 'c420dc04-2ba3-488e-902d-66bc9a2032cd',
versionUuid: 'd4d4c738-bf74-4b44-a297-9a6653458f3a',
activities: {
INIT: {
uid: 'ac04a444-9b96-463d-bc91-447fa80b028f', // init
fields: {
salesOfficerName: 'sales_officer_name', // app_user
date: 'date', // date
time: 'field_1', // time
routeCode: 'route_code', // select
subRoute: 'sub_route', // select
storeImage: 'store_image', // image
dayPlanNotes: 'day_plan_notes', // longtext
},
},
PUNCH_OUT: {
uid: '37c218fc-fd91-41d1-9964-fcaeade54e74',
fields: {
totalProductiveCalls: 'total_productive_calls', // number
totalNonProductiveCalls: 'total_non_productive_calls', // number
eodNotesRemarks: 'eod_notes_remarks', // longtext
},
},
},
recordViews: {
DAILY_LOGS: '269da629-1701-477a-a37b-a78bb056d4b3',
},
detailViews: {
DAILY_LOGS: '26b3c6de-a1d7-4f71-be88-7e4929932b0b',
},
} as const;
// --- User Management (src/docs/api/user.md) ---
export const USER = {
workflowUuid: '9874af12-78b7-4730-834a-19a32221f3aa',
versionUuid: '', // No version UUID provided, server will use latest
activities: {
ADD_USER: {
uid: '3a8f132e-8c63-4d4d-b466-67595d345a99', // init
fields: {
name: 'name', // text
email: 'email', // email
password: 'password', // password
},
},
EDIT_USER: {
uid: '3091530c-4315-42b9-b53b-a148f2c54a81',
fields: {
name: 'name_3', // text
email: 'email_3', // email
},
},
},
recordViews: {
SALES_OFFICERS: '406f89d7-09f6-42ba-ba35-84334ccb6204',
},
} as const;
// All workflows keyed by slug, for generic lookup.
export const WORKFLOWS = {
orderBooking: ORDER_BOOKING,
store: STORE,
dailyReports: DAILY_REPORTS,
user: USER,
} as const;
// --- Daily Sales Report Constants ---
export const SALES_REPORT_ROUTES = [
'Krishna',
'East-1',
'East-2',
'East-3',
'East-4',
'West-1',
'West-2',
'West-3',
'West-4'
];
export const ROUTE_WISE_DISTRIBUTORS: Record<string, string[]> = {
"Krishna": ["Banashree Multi Millet Flour"],
"East-1": ["Shiva nandi Enterprises"],
"East-2": ["BPK & Co"],
"East-3": ["BPK & Co"],
"East-4": ["Gaviranga "],
"West-1": ["Bhagwan Enterprises"],
"West-2": ["Shreshtaa Trading Co "],
"West-3": ["Rajarajeshwari Enterprises "],
"West-4": ["Byraveshwara Trading Co"],
};
export const SALES_REPORT_SO_NAMES = [
'Surya C'
];
// --- Pipeline Endpoints ---
export const PIPELINE = {
endpoints: {
nearestStores: '/api/papi2/nearest-stores',
dailySalesReport: '/api/papi2/daily-sales-report',
productiveCallSummary: '/api/papi2/productive-call-summary'
}
};