bharath/webapp/src/views/pages/trips.ejs
Vivek ed320e82c1 feat: add 35+ features - i18n, voice input, gamification, driver tools, marketplace
- 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
2026-05-31 09:19:16 +00:00

46 lines
2.6 KiB
Text

<% var title = t('actions.myTrips'); %>
<%- include('../partials/header') %>
<div class="tricolor-strip"><div class="tricolor-saffron"></div><div class="tricolor-white"></div><div class="tricolor-green"></div></div>
<section class="section" style="padding-top:var(--space-lg)">
<div class="container">
<h2 style="font-size:1.3rem;margin-bottom:var(--space-md)">🚚 <%= t('actions.myTrips') %></h2>
<% if (trips.length === 0) { %>
<div class="card text-center" style="padding:var(--space-2xl)">
<p><%= t('trips.noTrips') %></p>
</div>
<% } else { %>
<div style="display:grid;gap:var(--space-md)">
<% trips.forEach(trip => { %>
<div class="card card-accent">
<div style="display:flex;justify-content:space-between;align-items:start">
<div>
<strong>📍 <%= trip.load ? trip.load.origin_city + ' → ' + trip.load.destination_city : 'N/A' %></strong>
<div style="font-size:0.8rem;color:var(--gray-700);margin-top:4px">
₹<%= Number(trip.amount).toLocaleString('en-IN') %>
<% if (trip.load) { %> | <%= trip.load.weight_tons %> <%= t('common.tons') %> | <%= trip.load.truck_type %><% } %>
</div>
</div>
<span class="badge badge-<%= trip.status === 'delivered' ? 'delivered' : trip.status === 'cancelled' ? 'cancelled' : 'transit' %>"><%= trip.status %></span>
</div>
<% if (user.role === 'driver' && trip.status !== 'delivered' && trip.status !== 'cancelled') { %>
<div style="margin-top:var(--space-md);display:flex;gap:var(--space-sm)">
<% if (trip.status === 'confirmed') { %>
<form method="POST" action="/trips/<%= trip.id %>/status"><input type="hidden" name="status" value="picked_up"><button class="btn btn-primary btn-sm">📦 <%= t('trips.pickedUp') %></button></form>
<% } else if (trip.status === 'picked_up') { %>
<form method="POST" action="/trips/<%= trip.id %>/status"><input type="hidden" name="status" value="in_transit"><button class="btn btn-primary btn-sm">🚛 <%= t('trips.inTransit') %></button></form>
<% } else if (trip.status === 'in_transit') { %>
<form method="POST" action="/trips/<%= trip.id %>/status"><input type="hidden" name="status" value="delivered"><button class="btn btn-success btn-sm">✅ <%= t('trips.delivered') %></button></form>
<% } %>
</div>
<% } %>
</div>
<% }) %>
</div>
<% } %>
</div>
</section>
<%- include('../partials/footer') %>