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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
# SnapLocal Implementation Guide

## βœ… MVP Features Implemented (Complete)

### Backend (Node.js + MongoDB)

#### 1. **Package System** βœ“
- **Model**: `server/src/models/Package.js`
- **Routes**: `server/src/routes/packageRoutes.js`
- **Endpoints**:
  - `GET /api/packages/photographer/:photographerId` - Get photographer's packages
  - `GET /api/packages/:id` - Get single package
  - `POST /api/packages` - Create new package (auth required)
  - `PUT /api/packages/:id` - Update package (auth required)
  - `DELETE /api/packages/:id` - Delete package (auth required)

#### 2. **Photographer Verification** βœ“
- **Model**: `server/src/models/Verification.js`
- **Routes**: `server/src/routes/verificationRoutes.js`
- **Endpoints**:
  - `GET /api/verification/status/:photographerId` - Get verification status
  - `POST /api/verification/submit` - Upload documents (auth required)
  - `POST /api/verification/:verificationId/approve` - Admin approve
  - `POST /api/verification/:verificationId/reject` - Admin reject

#### 3. **Photo Delivery** βœ“
- **Model**: `server/src/models/PhotoDelivery.js`
- **Routes**: `server/src/routes/deliveryRoutes.js`
- **Endpoints**:
  - `GET /api/delivery/booking/:bookingId` - Get delivery status
  - `POST /api/delivery/booking/:bookingId` - Create delivery record
  - `POST /api/delivery/:deliveryId/upload` - Upload photos (auth required)
  - `POST /api/delivery/:deliveryId/complete` - Mark as delivered
  - `POST /api/delivery/:deliveryId/request-revision` - Request revisions

#### 4. **Invoice Generator** βœ“
- **Model**: `server/src/models/Invoice.js`
- **Routes**: `server/src/routes/invoiceRoutes.js`
- **Endpoints**:
  - `GET /api/invoices/:id` - Get invoice
  - `GET /api/invoices/user/:userId` - Get user's invoices
  - `POST /api/invoices` - Create invoice
  - `PUT /api/invoices/:id/payment` - Update payment status
  - `GET /api/invoices/:id/download` - Download invoice

#### 5. **Smart Tags (Enhanced Search)** βœ“
- Implemented in `Photographer.js` model with tags array
- Frontend Search component with tag filters

#### 6. **Additional Models Created** βœ“
- **Loyalty Points** (`server/src/models/LoyaltyPoints.js`)
- **Report System** (`server/src/models/Report.js`)
- **Trip Planner** (`server/src/models/TripPlan.js`)
- **Dynamic Pricing** (`server/src/models/DynamicPrice.js`)
- **Deals/Discounts** (`server/src/models/Deal.js`)

---

### Frontend (React + Vite)

#### Components Created βœ“

**Photographer Dashboard Components:**
- `PackagePanel.jsx` - Create and manage packages
- `PackageCard.jsx` - Individual package card display
- `CreatePackageModal.jsx` - Modal form for creating/editing packages
- `VerificationPanel.jsx` - Verification document upload and status
- `DeliveryPanel.jsx` - Photo upload and delivery management
- `InvoiceView.jsx` - Invoice display and download

**Customer Dashboard Components:**
- `TrendingSpots.jsx` - Popular photography locations
- `LastMinuteDeals.jsx` - Time-limited discount offers
- `Leaderboard.jsx` - Top photographers by rating
- `ShootTimeline.jsx` - Booking progress timeline

**Utilities:**
- `src/utils/invoiceGenerator.js` - Invoice HTML generation and PDF export

---

## πŸ“± Technology Stack

### Backend
- **Express.js** - REST API server
- **MongoDB** - Database
- **Mongoose** - ODM
- **JWT** - Authentication
- **Socket.io** - Real-time messaging (already in place)

### Frontend
- **React 19.2.4** - UI framework
- **Vite 8.0.0** - Build tool
- **Tailwind CSS 4.2.1** - Styling
- **Lucide React** - Icons
- **Axios** - HTTP client

---

## πŸš€ How to Run

### Prerequisites
- Node.js 18+
- MongoDB running locally or cloud URL in `.env`
- npm or yarn

### 1. Install Dependencies

```bash
# Backend
cd server
npm install

# Frontend
cd ../client
npm install
```

### 2. Configure Environment

Create `server/.env`:
```env
MONGODB_URI=mongodb://localhost:27017/snaplocal
PORT=5000
JWT_SECRET=your_secret_key
```

### 3. Start Development Servers

```bash
# Terminal 1: Backend
cd server
npm run dev
# Server runs on http://localhost:5000

# Terminal 2: Frontend
cd client
npm run dev
# Client runs on http://localhost:5173
```

---

## πŸ“Š API Usage Examples

### Create a Package (Photographer)
```javascript
// POST http://localhost:5000/api/packages
{
  "name": "Premium Wedding Package",
  "description": "8 hours coverage with 300+ edited photos",
  "price": 15000,
  "priceUnit": "session",
  "duration": 8,
  "deliverables": {
    "numPhotos": 350,
    "numEdited": 200,
    "numLocations": 2,
    "includesAlbum": true
  },
  "tags": ["wedding", "bride", "groom"]
}
```

### Submit Verification
```javascript
// POST http://localhost:5000/api/verification/submit
{
  "idDocumentUrl": "https://example.com/aadhar.jpg",
  "portfolioUrls": [
    "https://example.com/photo1.jpg",
    "https://example.com/photo2.jpg"
  ]
}
```

### Upload Photos for Delivery
```javascript
// POST http://localhost:5000/api/delivery/{deliveryId}/upload
{
  "photoUrls": [
    "https://example.com/photo1.jpg",
    "https://example.com/photo2.jpg",
    // ... more photos
  ]
}
```

### Create Invoice
```javascript
// POST http://localhost:5000/api/invoices
{
  "bookingId": "booking_id_here",
  "photographerId": "photographer_id",
  "customerId": "customer_id",
  "items": [
    {
      "description": "Premium Wedding Photography",
      "quantity": 1,
      "unitPrice": 15000,
      "total": 15000
    }
  ],
  "subtotal": 15000,
  "tax": 2700,
  "taxRate": 18,
  "totalAmount": 17700
}
```

---

## 🎯 Dashboard Features

### Photographer Dashboard
1. **Overview** - Statistics (bookings, revenue, pending, rating)
2. **My Profile** - Edit bio, specialty, rate, experience
3. **Portfolio** - Upload images/videos
4. **Packages** ⭐ - Create and manage service packages
5. **Verification** ⭐ - Upload documents for verification badge
6. **Availability** - Set weekly schedule
7. **Bookings** - Manage booking requests with timeline
8. **Photo Delivery** ⭐ - Upload and deliver photos to customers
9. **Reports** - View and respond to customer complaints

### Customer Dashboard
1. **Search** - Find photographers (enhanced with tag filters)
2. **Trending Spots** ⭐ - Popular photography locations
3. **Last-Minute Deals** ⭐ - Time-limited discounts
4. **Nearby Photographers** - Map view with location filtering
5. **My Bookings** - Manage reservations and download photos
6. **Leaderboard** ⭐ - Top-rated photographers
7. **Loyalty/Rewards** - Points and tier benefits
8. **Trip Planner** - Plan photo shoot trips

---

## πŸ“‚ File Structure Summary

```
server/src/
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ Package.js           βœ“ NEW
β”‚   β”œβ”€β”€ Verification.js      βœ“ NEW
β”‚   β”œβ”€β”€ PhotoDelivery.js     βœ“ NEW
β”‚   β”œβ”€β”€ Invoice.js           βœ“ NEW
β”‚   β”œβ”€β”€ LoyaltyPoints.js     βœ“ NEW
β”‚   β”œβ”€β”€ Report.js            βœ“ NEW
β”‚   β”œβ”€β”€ TripPlan.js          βœ“ NEW
β”‚   β”œβ”€β”€ DynamicPrice.js      βœ“ NEW
β”‚   └── Deal.js              βœ“ NEW
β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ packageRoutes.js     βœ“ NEW
β”‚   β”œβ”€β”€ verificationRoutes.jsβœ“ NEW
β”‚   β”œβ”€β”€ deliveryRoutes.js    βœ“ NEW
β”‚   β”œβ”€β”€ invoiceRoutes.js     βœ“ NEW
β”‚   β”œβ”€β”€ reportRoutes.js      βœ“ NEW
β”‚   β”œβ”€β”€ loyaltyRoutes.js     βœ“ NEW
β”‚   β”œβ”€β”€ tripPlanRoutes.js    βœ“ NEW
β”‚   └── dealRoutes.js        βœ“ NEW
└── index.js                 βœ“ UPDATED

client/src/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ PackagePanel.jsx     βœ“ NEW
β”‚   β”œβ”€β”€ PackageCard.jsx      βœ“ NEW
β”‚   β”œβ”€β”€ CreatePackageModal.jsxβœ“ NEW
β”‚   β”œβ”€β”€ VerificationPanel.jsx βœ“ NEW
β”‚   β”œβ”€β”€ DeliveryPanel.jsx    βœ“ NEW
β”‚   β”œβ”€β”€ InvoiceView.jsx      βœ“ NEW
β”‚   β”œβ”€β”€ TrendingSpots.jsx    βœ“ NEW
β”‚   β”œβ”€β”€ LastMinuteDeals.jsx  βœ“ NEW
β”‚   β”œβ”€β”€ Leaderboard.jsx      βœ“ NEW
β”‚   └── ShootTimeline.jsx    βœ“ NEW
└── utils/
    └── invoiceGenerator.js  βœ“ NEW
```

---

## ✨ Next Steps (Phase 2+)

### Advanced Features
1. **AI-Powered Features**
   - Style matching (upload reference photo for similar photographers)
   - Dynamic pricing suggestions based on demand
   - Smart recommendations

2. **Enhanced Search**
   - Geolocation-based photographer search
   - Advanced filters (availability, price range, ratings, tags)

3. **Performance Analytics**
   - Charts and graphs for photographer earnings/bookings
   - Customer analytics for trends

4. **Trip Planning**
   - Itinerary builder
   - Recommended photography spots
   - Travel packages

5. **Additional Features**
   - Watermark protection for portfolio images
   - Live photographer availability map
   - Video introductions for photographers
   - Social sharing buttons

---

## πŸ” Security Notes

- All protected routes require JWT authentication
- Password hashing with bcryptjs (already implemented)
- CORS enabled for development
- Input validation needed (in production)
- Rate limiting recommended for API endpoints

---

## πŸ“Š Database Schema Overview

### Package
```
{
  photographerId, name, description, price, priceUnit, duration,
  deliverables: { numPhotos, numEdited, numLocations, includesAlbum },
  active, bookingCount, tags, timestamps
}
```

### Verification
```
{
  photographerId, status (pending|verified|rejected),
  idDocument, portfolioSamples[], submittedAt, verifiedAt,
  adminNotes, rejectionReason, timestamps
}
```

### Invoice
```
{
  invoiceNumber, bookingId, photographerId, customerId,
  items[], subtotal, tax, taxRate, discount, totalAmount,
  paymentStatus, paidAt, timestamps
}
```

### PhotoDelivery
```
{
  bookingId, photographerId, customerId, photos[],
  status (pending|partially_delivered|delivered|revision_requested),
  deliveredAt, downloadLink, linkExpiresAt, revisionNotes, timestamps
}
```

---

## πŸŽ“ Code Examples

### Use PackagePanel in Dashboard
```jsx
import PackagePanel from '../components/PackagePanel';

export default function PhotographerDashboard() {
  const { user } = useAuth();
  return <PackagePanel photographerId={user.id} />;
}
```

### Use DeliveryPanel in Booking Page
```jsx
import DeliveryPanel from '../components/DeliveryPanel';

export default function BookingDetail({ bookingId }) {
  return (
    <DeliveryPanel
      bookingId={bookingId}
      photographerId={currentPhotographerId}
      role="photographer"
    />
  );
}
```

### Generate and Download Invoice
```jsx
import { downloadInvoiceAsPDF } from '../utils/invoiceGenerator';

const handleDownload = (invoice, photographer, customer) => {
  downloadInvoiceAsPDF(invoice, photographer, customer);
};
```

---

## πŸ› Troubleshooting

### Port Already in Use
```bash
# Kill process on port 5000
lsof -i :5000
kill -9 <PID>
```

### MongoDB Connection Failed
- Ensure MongoDB is running: `mongod`
- Check MONGODB_URI in `.env`
- Verify connection string format

### Components Not Loading
- Clear Vite cache: `rm -rf client/node_modules/.vite`
- Restart dev server

---

## πŸ“ Future Enhancements

- [ ] Payment gateway integration (Stripe/Razorpay)
- [ ] Email notifications for bookings
- [ ] SMS alerts for photographers
- [ ] Multi-language support
- [ ] Mobile app (React Native)
- [ ] Admin dashboard
- [ ] Analytics and reporting
- [ ] Advanced booking calendar with time slots
- [ ] Subscription tiers for photographers
- [ ] Automated invoice generation and payment reminders

---

## πŸ“ž Support

For issues or questions:
1. Check the Feature Implementation Map: `/FEATURE_IMPLEMENTATION_MAP.md`
2. Review API routes in respective `server/src/routes/` files
3. Check component prop requirements in `client/src/components/`

---

**Version**: 1.0.0 MVP
**Last Updated**: March 18, 2026
**Status**: βœ… Complete and Running