mirror of
http://forgejo-oa09toasww4dgii9cj3gpzda.187.127.164.61.sslip.io/iamcoolvivek007/bharath.git
synced 2026-06-11 00:06:51 +00:00
- Multi-language support (English, Hindi, Tamil, Telugu) with icon-based UI - Voice input (Web Speech API) for low-literacy users - Driver tools: Ledger, Trip Planner, Return Load, Safety, Maintenance, FASTag - Marketplace: WhatsApp share, Rate Intelligence, Classifieds, Fleet - Engagement: Gamification (XP/Levels), Challenges, Leaderboard, Referrals, Feed - Business: Invoice (GST+UPI), Reports+CSV, Notifications, Documents, Bank - Games: Rate Guesser, Route Quiz - SEO: Sitemap, public load share pages with OG tags - India utilities: vehicle validation, UPI links, toll/fuel calculator - 29 routes, 54 templates, 4 languages, 3 migration files
22 lines
1.1 KiB
JavaScript
22 lines
1.1 KiB
JavaScript
const express = require('express');
|
|
const router = express.Router();
|
|
const supabase = require('../services/supabase');
|
|
const { WHATSAPP_TEMPLATES } = require('../lib/india');
|
|
|
|
// Public share page with OG tags for WhatsApp preview
|
|
router.get('/share/:id', async (req, res) => {
|
|
const { data: load } = await supabase.from('loads').select('*').eq('id', req.params.id).single();
|
|
if (!load) return res.status(404).render('pages/404');
|
|
res.render('pages/load-share', { load, layout: false });
|
|
});
|
|
|
|
// Generate WhatsApp share link
|
|
router.get('/whatsapp/:id', async (req, res) => {
|
|
const { data: load } = await supabase.from('loads').select('*').eq('id', req.params.id).single();
|
|
if (!load) return res.status(404).json({ error: 'Not found' });
|
|
const link = `${req.protocol}://${req.get('host')}/loadboard/share/${load.id}`;
|
|
const msg = WHATSAPP_TEMPLATES.load_available({ origin: load.origin_city, destination: load.destination_city, budget: load.budget, truck_type: load.truck_type, weight: load.weight_tons, link });
|
|
res.redirect(`https://wa.me/?text=${encodeURIComponent(msg)}`);
|
|
});
|
|
|
|
module.exports = router;
|