2025-05-13 18:50:30 +02:00
|
|
|
export interface VesselData {
|
|
|
|
|
imo: string;
|
|
|
|
|
vesselName: string;
|
|
|
|
|
type: string;
|
|
|
|
|
length: number;
|
|
|
|
|
width: number;
|
|
|
|
|
estimatedEnginePower: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface CarbonCalculation {
|
|
|
|
|
yearlyEmissions: number;
|
|
|
|
|
offsetCost: number;
|
|
|
|
|
recommendedProjects: Array<{
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
description: string;
|
|
|
|
|
costPerTon: number;
|
|
|
|
|
}>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface CarbonEstimate {
|
|
|
|
|
fuelConsumption: number; // liters per year
|
|
|
|
|
co2Emissions: number; // tons per year
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TripEstimate {
|
|
|
|
|
distance: number; // nautical miles
|
|
|
|
|
duration: number; // hours
|
|
|
|
|
fuelConsumption: number; // liters
|
|
|
|
|
co2Emissions: number; // tons
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Currency {
|
|
|
|
|
code: string;
|
|
|
|
|
symbol: string;
|
|
|
|
|
rate: number; // Exchange rate relative to USD
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CurrencyCode = 'USD' | 'EUR' | 'GBP' | 'CHF';
|
|
|
|
|
|
|
|
|
|
export interface Portfolio {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
description: string;
|
|
|
|
|
projects: OffsetProject[];
|
|
|
|
|
pricePerTon: number;
|
|
|
|
|
currency: CurrencyCode;
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-29 21:45:14 +01:00
|
|
|
export type CertificationStatus =
|
|
|
|
|
| 'standard 2020'
|
|
|
|
|
| 'standard 2023'
|
|
|
|
|
| 'nonstandard'
|
|
|
|
|
| 'in progress';
|
|
|
|
|
|
2025-05-13 18:50:30 +02:00
|
|
|
export interface OffsetProject {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
description: string;
|
|
|
|
|
shortDescription: string;
|
|
|
|
|
imageUrl: string;
|
|
|
|
|
pricePerTon: number;
|
2025-10-29 21:45:14 +01:00
|
|
|
percentage?: number; // Project's contribution to portfolio
|
|
|
|
|
certificationStatus?: CertificationStatus; // Wren certification standard
|
2025-05-13 18:50:30 +02:00
|
|
|
location: string;
|
|
|
|
|
type: string;
|
|
|
|
|
verificationStandard: string;
|
|
|
|
|
impactMetrics: {
|
|
|
|
|
co2Reduced: number;
|
|
|
|
|
treesPlanted?: number;
|
|
|
|
|
livelihoodsImproved?: number;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-29 21:45:14 +01:00
|
|
|
export type OffsetOrderSource =
|
|
|
|
|
| 'subscription'
|
|
|
|
|
| 'flight'
|
|
|
|
|
| 'gift'
|
|
|
|
|
| 'custom-duration'
|
|
|
|
|
| 'one-off'
|
|
|
|
|
| 'referral-bonus'
|
|
|
|
|
| 'annual-incentive'
|
|
|
|
|
| 'public-api'
|
|
|
|
|
| 'special-offer';
|
|
|
|
|
|
2025-05-13 18:50:30 +02:00
|
|
|
export interface OffsetOrder {
|
|
|
|
|
id: string;
|
2025-10-29 21:45:14 +01:00
|
|
|
amountCharged: number; // Amount in cents (amount_paid_by_customer from API)
|
2025-05-13 18:50:30 +02:00
|
|
|
currency: CurrencyCode;
|
|
|
|
|
tons: number;
|
|
|
|
|
portfolio: Portfolio;
|
|
|
|
|
status: 'pending' | 'completed' | 'failed';
|
|
|
|
|
createdAt: string;
|
|
|
|
|
dryRun: boolean;
|
2025-10-29 21:45:14 +01:00
|
|
|
source?: OffsetOrderSource; // Source of the payment
|
|
|
|
|
note?: string; // Optional note attached to the order
|
2025-05-13 18:50:30 +02:00
|
|
|
}
|
|
|
|
|
|
2025-11-02 19:13:15 +01:00
|
|
|
export type CalculatorType = 'trip' | 'annual' | 'mobile';
|
2025-10-29 21:45:14 +01:00
|
|
|
|
|
|
|
|
// Stripe Checkout Types
|
|
|
|
|
export interface CheckoutSession {
|
|
|
|
|
sessionId: string;
|
|
|
|
|
url: string;
|
|
|
|
|
orderId: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface StoredOrder {
|
|
|
|
|
id: string;
|
|
|
|
|
stripeSessionId: string;
|
|
|
|
|
stripePaymentIntent: string | null;
|
|
|
|
|
wrenOrderId: string | null;
|
|
|
|
|
customerEmail: string | null;
|
|
|
|
|
tons: number;
|
|
|
|
|
portfolioId: number;
|
|
|
|
|
baseAmount: number; // in cents
|
|
|
|
|
processingFee: number; // in cents
|
|
|
|
|
totalAmount: number; // in cents
|
|
|
|
|
currency: CurrencyCode;
|
|
|
|
|
status: 'pending' | 'paid' | 'fulfilled' | 'failed';
|
|
|
|
|
createdAt: string;
|
|
|
|
|
updatedAt: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface OrderDetailsResponse {
|
|
|
|
|
order: {
|
|
|
|
|
id: string;
|
|
|
|
|
tons: number;
|
|
|
|
|
portfolioId: number;
|
|
|
|
|
baseAmount: number;
|
|
|
|
|
processingFee: number;
|
|
|
|
|
totalAmount: number;
|
|
|
|
|
currency: string;
|
|
|
|
|
status: string;
|
|
|
|
|
wrenOrderId: string | null;
|
2025-10-31 17:24:51 +01:00
|
|
|
stripeSessionId: string;
|
2025-10-29 21:45:14 +01:00
|
|
|
createdAt: string;
|
2025-10-31 17:24:51 +01:00
|
|
|
portfolio?: Portfolio; // Portfolio data with projects for pie chart
|
2025-10-29 21:45:14 +01:00
|
|
|
};
|
|
|
|
|
session: {
|
|
|
|
|
paymentStatus: string;
|
|
|
|
|
customerEmail?: string;
|
|
|
|
|
};
|
|
|
|
|
}
|
Integrate NocoDB backend for admin portal with real data
Phase 2 Backend Integration Complete:
Backend Infrastructure:
- Created NocoDB client abstraction layer (src/api/nocodbClient.ts)
- Clean TypeScript API hiding NocoDB query syntax complexity
- Helper methods for orders, stats, search, timeline, and filtering
- Automatic date range handling and pagination support
API Routes:
- POST /api/admin/stats - Dashboard statistics with time range filtering
- GET /api/admin/orders - List orders with search, filter, sort, pagination
- GET /api/admin/orders/[id] - Single order details
- PATCH /api/admin/orders/[id] - Update order fields
- DELETE /api/admin/orders/[id] - Cancel order (soft delete)
- GET /api/admin/orders/export - CSV/Excel export with filters
Dashboard Updates:
- Real-time data fetching from NocoDB
- Time range selector (7d, 30d, 90d, all time)
- Recharts line chart for orders timeline
- Recharts pie chart for status distribution
- Loading states and error handling
- Dynamic stat cards with real numbers
Dependencies Added:
- papaparse - CSV export
- xlsx - Excel export with styling
- @types/papaparse - TypeScript support
Data Types:
- OrderRecord interface for NocoDB data structure
- DashboardStats, TimelineData, OrderFilters interfaces
- Full type safety across API and UI
Environment Configuration:
- NOCODB_BASE_URL, NOCODB_BASE_ID configured
- NOCODB_API_KEY, NOCODB_ORDERS_TABLE_ID configured
- All credentials stored securely in .env.local
Ready for testing with sample data in NocoDB!
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 10:40:25 +01:00
|
|
|
|
|
|
|
|
// NocoDB Order Record (Admin Portal)
|
|
|
|
|
export interface OrderRecord {
|
|
|
|
|
// NocoDB metadata
|
|
|
|
|
Id: number;
|
|
|
|
|
CreatedAt: string;
|
|
|
|
|
UpdatedAt: string;
|
|
|
|
|
|
|
|
|
|
// Order identification
|
|
|
|
|
orderId: string;
|
|
|
|
|
status: 'pending' | 'paid' | 'fulfilled' | 'cancelled';
|
Add NocoDB integration for order management with comprehensive Stripe webhook logging
Features:
- Complete NocoDB schema with 42 fields supporting B2B and B2C customers
- Server-side NocoDB client (REST API integration)
- Stripe session data mapper with automatic field mapping
- Enhanced webhook handler with comprehensive logging
- Automatic order creation in NocoDB after payment
- Fulfillment data updates with Wren order IDs
- Support for business customers (VAT/EIN, business names)
- Complete billing address capture
- Non-blocking error handling (webhook succeeds even if NocoDB fails)
Files Added:
- server/utils/nocodbClient.js - NocoDB REST API client
- server/utils/nocodbMapper.js - Stripe to NocoDB data mapper
- docs/NOCODB_SCHEMA.md - Complete field reference (42 columns)
- docs/NOCODB_INTEGRATION_GUIDE.md - Testing and deployment guide
- docs/TESTING_STRIPE_WEBHOOK.md - Webhook testing instructions
- docs/STRIPE_INTEGRATION_SUMMARY.md - Project overview
Files Modified:
- server/routes/webhooks.js - Added NocoDB integration and enhanced logging
- src/types.ts - Updated OrderRecord interface with new fields
- src/api/nocodbClient.ts - Added createOrder() method
- .env.example - Added NocoDB configuration template
Schema includes:
- Payment tracking (Stripe session/intent/customer IDs, amounts, fees)
- Carbon offset details (tons, portfolio, Wren order ID)
- Customer information (name, email, phone, business name)
- Tax ID collection (VAT, EIN, etc.)
- Complete billing address
- Optional vessel/trip details for yacht calculations
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 16:35:15 +01:00
|
|
|
source?: string; // 'web', 'mobile-app', 'manual', 'api'
|
|
|
|
|
|
|
|
|
|
// Payment information
|
|
|
|
|
stripeSessionId?: string; // Stripe Checkout Session ID
|
|
|
|
|
stripePaymentIntent?: string; // Stripe Payment Intent ID (for refunds)
|
|
|
|
|
baseAmount: string; // Pre-fee amount in cents (from Stripe metadata)
|
|
|
|
|
processingFee: string; // Stripe processing fee in cents (from Stripe metadata)
|
|
|
|
|
totalAmount: string; // Total charged amount in cents (baseAmount + processingFee)
|
|
|
|
|
currency: string; // 'USD', 'EUR', 'GBP', 'CHF'
|
|
|
|
|
amountUSD?: string; // Amount converted to USD for reporting
|
|
|
|
|
paymentMethod?: string; // Payment method type (e.g., "card", "bank_transfer")
|
Integrate NocoDB backend for admin portal with real data
Phase 2 Backend Integration Complete:
Backend Infrastructure:
- Created NocoDB client abstraction layer (src/api/nocodbClient.ts)
- Clean TypeScript API hiding NocoDB query syntax complexity
- Helper methods for orders, stats, search, timeline, and filtering
- Automatic date range handling and pagination support
API Routes:
- POST /api/admin/stats - Dashboard statistics with time range filtering
- GET /api/admin/orders - List orders with search, filter, sort, pagination
- GET /api/admin/orders/[id] - Single order details
- PATCH /api/admin/orders/[id] - Update order fields
- DELETE /api/admin/orders/[id] - Cancel order (soft delete)
- GET /api/admin/orders/export - CSV/Excel export with filters
Dashboard Updates:
- Real-time data fetching from NocoDB
- Time range selector (7d, 30d, 90d, all time)
- Recharts line chart for orders timeline
- Recharts pie chart for status distribution
- Loading states and error handling
- Dynamic stat cards with real numbers
Dependencies Added:
- papaparse - CSV export
- xlsx - Excel export with styling
- @types/papaparse - TypeScript support
Data Types:
- OrderRecord interface for NocoDB data structure
- DashboardStats, TimelineData, OrderFilters interfaces
- Full type safety across API and UI
Environment Configuration:
- NOCODB_BASE_URL, NOCODB_BASE_ID configured
- NOCODB_API_KEY, NOCODB_ORDERS_TABLE_ID configured
- All credentials stored securely in .env.local
Ready for testing with sample data in NocoDB!
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 10:40:25 +01:00
|
|
|
|
|
|
|
|
// Carbon offset details
|
Add NocoDB integration for order management with comprehensive Stripe webhook logging
Features:
- Complete NocoDB schema with 42 fields supporting B2B and B2C customers
- Server-side NocoDB client (REST API integration)
- Stripe session data mapper with automatic field mapping
- Enhanced webhook handler with comprehensive logging
- Automatic order creation in NocoDB after payment
- Fulfillment data updates with Wren order IDs
- Support for business customers (VAT/EIN, business names)
- Complete billing address capture
- Non-blocking error handling (webhook succeeds even if NocoDB fails)
Files Added:
- server/utils/nocodbClient.js - NocoDB REST API client
- server/utils/nocodbMapper.js - Stripe to NocoDB data mapper
- docs/NOCODB_SCHEMA.md - Complete field reference (42 columns)
- docs/NOCODB_INTEGRATION_GUIDE.md - Testing and deployment guide
- docs/TESTING_STRIPE_WEBHOOK.md - Webhook testing instructions
- docs/STRIPE_INTEGRATION_SUMMARY.md - Project overview
Files Modified:
- server/routes/webhooks.js - Added NocoDB integration and enhanced logging
- src/types.ts - Updated OrderRecord interface with new fields
- src/api/nocodbClient.ts - Added createOrder() method
- .env.example - Added NocoDB configuration template
Schema includes:
- Payment tracking (Stripe session/intent/customer IDs, amounts, fees)
- Carbon offset details (tons, portfolio, Wren order ID)
- Customer information (name, email, phone, business name)
- Tax ID collection (VAT, EIN, etc.)
- Complete billing address
- Optional vessel/trip details for yacht calculations
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 16:35:15 +01:00
|
|
|
co2Tons: string; // Tons of CO2 offset (from Stripe metadata.tons)
|
|
|
|
|
portfolioId: string; // Wren portfolio ID (from Stripe metadata)
|
|
|
|
|
portfolioName?: string; // Human-readable portfolio name
|
|
|
|
|
wrenOrderId?: string; // Wren API order ID (populated after fulfillment)
|
|
|
|
|
certificateUrl?: string; // URL to offset certificate
|
|
|
|
|
fulfilledAt?: string; // Timestamp when order was fulfilled with Wren
|
Integrate NocoDB backend for admin portal with real data
Phase 2 Backend Integration Complete:
Backend Infrastructure:
- Created NocoDB client abstraction layer (src/api/nocodbClient.ts)
- Clean TypeScript API hiding NocoDB query syntax complexity
- Helper methods for orders, stats, search, timeline, and filtering
- Automatic date range handling and pagination support
API Routes:
- POST /api/admin/stats - Dashboard statistics with time range filtering
- GET /api/admin/orders - List orders with search, filter, sort, pagination
- GET /api/admin/orders/[id] - Single order details
- PATCH /api/admin/orders/[id] - Update order fields
- DELETE /api/admin/orders/[id] - Cancel order (soft delete)
- GET /api/admin/orders/export - CSV/Excel export with filters
Dashboard Updates:
- Real-time data fetching from NocoDB
- Time range selector (7d, 30d, 90d, all time)
- Recharts line chart for orders timeline
- Recharts pie chart for status distribution
- Loading states and error handling
- Dynamic stat cards with real numbers
Dependencies Added:
- papaparse - CSV export
- xlsx - Excel export with styling
- @types/papaparse - TypeScript support
Data Types:
- OrderRecord interface for NocoDB data structure
- DashboardStats, TimelineData, OrderFilters interfaces
- Full type safety across API and UI
Environment Configuration:
- NOCODB_BASE_URL, NOCODB_BASE_ID configured
- NOCODB_API_KEY, NOCODB_ORDERS_TABLE_ID configured
- All credentials stored securely in .env.local
Ready for testing with sample data in NocoDB!
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 10:40:25 +01:00
|
|
|
|
|
|
|
|
// Customer information
|
Add NocoDB integration for order management with comprehensive Stripe webhook logging
Features:
- Complete NocoDB schema with 42 fields supporting B2B and B2C customers
- Server-side NocoDB client (REST API integration)
- Stripe session data mapper with automatic field mapping
- Enhanced webhook handler with comprehensive logging
- Automatic order creation in NocoDB after payment
- Fulfillment data updates with Wren order IDs
- Support for business customers (VAT/EIN, business names)
- Complete billing address capture
- Non-blocking error handling (webhook succeeds even if NocoDB fails)
Files Added:
- server/utils/nocodbClient.js - NocoDB REST API client
- server/utils/nocodbMapper.js - Stripe to NocoDB data mapper
- docs/NOCODB_SCHEMA.md - Complete field reference (42 columns)
- docs/NOCODB_INTEGRATION_GUIDE.md - Testing and deployment guide
- docs/TESTING_STRIPE_WEBHOOK.md - Webhook testing instructions
- docs/STRIPE_INTEGRATION_SUMMARY.md - Project overview
Files Modified:
- server/routes/webhooks.js - Added NocoDB integration and enhanced logging
- src/types.ts - Updated OrderRecord interface with new fields
- src/api/nocodbClient.ts - Added createOrder() method
- .env.example - Added NocoDB configuration template
Schema includes:
- Payment tracking (Stripe session/intent/customer IDs, amounts, fees)
- Carbon offset details (tons, portfolio, Wren order ID)
- Customer information (name, email, phone, business name)
- Tax ID collection (VAT, EIN, etc.)
- Complete billing address
- Optional vessel/trip details for yacht calculations
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 16:35:15 +01:00
|
|
|
customerName: string; // From Stripe customer_details.name (business_name or individual_name)
|
|
|
|
|
customerEmail: string; // From Stripe customer_details.email
|
|
|
|
|
customerPhone?: string; // From Stripe customer_details.phone (if phone collection enabled)
|
|
|
|
|
businessName?: string; // From Stripe customer_details.business_name (B2B purchases)
|
|
|
|
|
stripeCustomerId?: string; // From Stripe customer (reusable customer ID)
|
|
|
|
|
taxIdType?: string; // From Stripe customer_details.tax_ids[0].type (e.g., "eu_vat", "us_ein")
|
|
|
|
|
taxIdValue?: string; // From Stripe customer_details.tax_ids[0].value
|
|
|
|
|
billingCity?: string; // From Stripe address.city
|
|
|
|
|
billingCountry?: string; // From Stripe address.country
|
|
|
|
|
billingLine1?: string; // From Stripe address.line1
|
|
|
|
|
billingLine2?: string; // From Stripe address.line2
|
|
|
|
|
billingPostalCode?: string; // From Stripe address.postal_code
|
|
|
|
|
billingState?: string; // From Stripe address.state
|
|
|
|
|
|
|
|
|
|
// Vessel information (optional - for yacht calculations)
|
|
|
|
|
vesselName?: string; // Name of vessel
|
|
|
|
|
imoNumber?: string; // IMO vessel identification number
|
|
|
|
|
vesselType?: string; // Type of vessel (e.g., "Motor Yacht")
|
|
|
|
|
vesselLength?: string; // Vessel length in meters
|
|
|
|
|
|
|
|
|
|
// Trip details (optional - for trip-based calculations)
|
|
|
|
|
departurePort?: string; // Departure port name
|
|
|
|
|
arrivalPort?: string; // Arrival port name
|
|
|
|
|
distance?: string; // Distance in nautical miles
|
|
|
|
|
avgSpeed?: string; // Average speed in knots
|
|
|
|
|
duration?: string; // Trip duration in hours
|
|
|
|
|
enginePower?: string; // Engine power in horsepower
|
Integrate NocoDB backend for admin portal with real data
Phase 2 Backend Integration Complete:
Backend Infrastructure:
- Created NocoDB client abstraction layer (src/api/nocodbClient.ts)
- Clean TypeScript API hiding NocoDB query syntax complexity
- Helper methods for orders, stats, search, timeline, and filtering
- Automatic date range handling and pagination support
API Routes:
- POST /api/admin/stats - Dashboard statistics with time range filtering
- GET /api/admin/orders - List orders with search, filter, sort, pagination
- GET /api/admin/orders/[id] - Single order details
- PATCH /api/admin/orders/[id] - Update order fields
- DELETE /api/admin/orders/[id] - Cancel order (soft delete)
- GET /api/admin/orders/export - CSV/Excel export with filters
Dashboard Updates:
- Real-time data fetching from NocoDB
- Time range selector (7d, 30d, 90d, all time)
- Recharts line chart for orders timeline
- Recharts pie chart for status distribution
- Loading states and error handling
- Dynamic stat cards with real numbers
Dependencies Added:
- papaparse - CSV export
- xlsx - Excel export with styling
- @types/papaparse - TypeScript support
Data Types:
- OrderRecord interface for NocoDB data structure
- DashboardStats, TimelineData, OrderFilters interfaces
- Full type safety across API and UI
Environment Configuration:
- NOCODB_BASE_URL, NOCODB_BASE_ID configured
- NOCODB_API_KEY, NOCODB_ORDERS_TABLE_ID configured
- All credentials stored securely in .env.local
Ready for testing with sample data in NocoDB!
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 10:40:25 +01:00
|
|
|
|
|
|
|
|
// Admin notes
|
Add NocoDB integration for order management with comprehensive Stripe webhook logging
Features:
- Complete NocoDB schema with 42 fields supporting B2B and B2C customers
- Server-side NocoDB client (REST API integration)
- Stripe session data mapper with automatic field mapping
- Enhanced webhook handler with comprehensive logging
- Automatic order creation in NocoDB after payment
- Fulfillment data updates with Wren order IDs
- Support for business customers (VAT/EIN, business names)
- Complete billing address capture
- Non-blocking error handling (webhook succeeds even if NocoDB fails)
Files Added:
- server/utils/nocodbClient.js - NocoDB REST API client
- server/utils/nocodbMapper.js - Stripe to NocoDB data mapper
- docs/NOCODB_SCHEMA.md - Complete field reference (42 columns)
- docs/NOCODB_INTEGRATION_GUIDE.md - Testing and deployment guide
- docs/TESTING_STRIPE_WEBHOOK.md - Webhook testing instructions
- docs/STRIPE_INTEGRATION_SUMMARY.md - Project overview
Files Modified:
- server/routes/webhooks.js - Added NocoDB integration and enhanced logging
- src/types.ts - Updated OrderRecord interface with new fields
- src/api/nocodbClient.ts - Added createOrder() method
- .env.example - Added NocoDB configuration template
Schema includes:
- Payment tracking (Stripe session/intent/customer IDs, amounts, fees)
- Carbon offset details (tons, portfolio, Wren order ID)
- Customer information (name, email, phone, business name)
- Tax ID collection (VAT, EIN, etc.)
- Complete billing address
- Optional vessel/trip details for yacht calculations
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 16:35:15 +01:00
|
|
|
notes?: string; // Internal admin notes
|
Integrate NocoDB backend for admin portal with real data
Phase 2 Backend Integration Complete:
Backend Infrastructure:
- Created NocoDB client abstraction layer (src/api/nocodbClient.ts)
- Clean TypeScript API hiding NocoDB query syntax complexity
- Helper methods for orders, stats, search, timeline, and filtering
- Automatic date range handling and pagination support
API Routes:
- POST /api/admin/stats - Dashboard statistics with time range filtering
- GET /api/admin/orders - List orders with search, filter, sort, pagination
- GET /api/admin/orders/[id] - Single order details
- PATCH /api/admin/orders/[id] - Update order fields
- DELETE /api/admin/orders/[id] - Cancel order (soft delete)
- GET /api/admin/orders/export - CSV/Excel export with filters
Dashboard Updates:
- Real-time data fetching from NocoDB
- Time range selector (7d, 30d, 90d, all time)
- Recharts line chart for orders timeline
- Recharts pie chart for status distribution
- Loading states and error handling
- Dynamic stat cards with real numbers
Dependencies Added:
- papaparse - CSV export
- xlsx - Excel export with styling
- @types/papaparse - TypeScript support
Data Types:
- OrderRecord interface for NocoDB data structure
- DashboardStats, TimelineData, OrderFilters interfaces
- Full type safety across API and UI
Environment Configuration:
- NOCODB_BASE_URL, NOCODB_BASE_ID configured
- NOCODB_API_KEY, NOCODB_ORDERS_TABLE_ID configured
- All credentials stored securely in .env.local
Ready for testing with sample data in NocoDB!
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 10:40:25 +01:00
|
|
|
}
|