Skip to content

feat: User ticket close/reopen functionality + docs restructure#8

Merged
inventory69 merged 1 commit intomainfrom
userTicketClose_andDokuUpdate
Dec 5, 2025
Merged

feat: User ticket close/reopen functionality + docs restructure#8
inventory69 merged 1 commit intomainfrom
userTicketClose_andDokuUpdate

Conversation

@inventory69
Copy link
Owner

This PR implements user-facing ticket management capabilities and completely restructures the project documentation to match HazeBot standards.

🎯 What's New

1. User Ticket Actions ✨

Users can now manage their own tickets directly in the app:

  • Close tickets with optional closing message (max 500 chars)
  • Reopen closed tickets with confirmation dialog (up to 3 times)
  • Visual feedback with status badges and counters
  • AppBar action buttons for seamless UX

2. Documentation Restructure 📚

Complete documentation overhaul for better maintainability:

  • Moved all docs to docs/ subdirectory
  • Created comprehensive docs/README.md index
  • Fixed broken emoji characters
  • Updated all cross-references
  • Sanitized sensitive data

3. Project Organization 🗂️

Improved project structure:

  • Scripts moved to scripts/ subdirectory
  • Removed unused test/ directory
  • Cleaner root directory

🚀 Features Implemented

Ticket Close/Reopen Flow

Close Ticket:

  1. Red lock button (🔒) appears in AppBar for open tickets
  2. Click → Optional closing message dialog
  3. API call → Success feedback → Navigation back to list
  4. Ticket status changes to "Closed"

Reopen Ticket:

  1. Blue unlock button (🔓) appears in AppBar for closed tickets
  2. Only visible if reopen count < 3
  3. Click → Confirmation dialog with remaining reopens
  4. API call → Success feedback → Navigation back to list
  5. Ticket status changes to "Open", reopen count increments

Visual Feedback:

  • Orange badge: "Reopened X/3 times"
  • Red warning badge: "Reopen limit reached (3/3)"
  • Loading indicator during API operations
  • Success/Error SnackBars

📊 Files Changed

Core Changes

lib/models/ticket.dart                    | +4     | Added reopenCount field
lib/screens/user/tickets_screen.dart      | +283   | Converted to StatefulWidget, added close/reopen

Documentation

docs/README.md                            | +102   | New comprehensive index
docs/BUILDING.md                          | +88    | Added scripts documentation
docs/APK_DOWNLOAD.md                      | +25    | Updated links
docs/FIREBASE_SETUP.md                    | +19    | Updated references
docs/GITHUB_ACTIONS.md                    | +22    | Updated paths
docs/CHANGELOG.md                         | +13    | Updated format
docs/DEVELOPMENT.md                       | +22    | Updated structure
docs/SETUP_CHECKLIST.md                   | +17    | Updated links
docs/GITHUB_SECRETS_SETUP.md             | +9     | Updated references

Project Structure

scripts/create_notification_icon.sh       | Moved from root
scripts/generate_adaptive_icons.sh        | Moved from root
scripts/spa_server.py                     | Moved from root
test/widget_test.dart                     | Removed (unused placeholder)

Planning Documents (New)

IMPLEMENTATION_COMPLETE.md                | +295   | Complete implementation guide
TICKET_USER_ACTIONS_PLAN.md              | +339   | Detailed implementation plan
TICKET_UI_MOCKUP.md                       | +485   | UI mockups and flows

🔒 Backend Integration

No backend changes required!

This PR only implements the frontend. The backend API endpoints already exist:

  • POST /api/tickets/{id}/close - Close ticket with optional message
  • POST /api/tickets/{id}/reopen - Reopen ticket (3x limit enforced on backend)

Permissions are already correctly implemented:

  • Users can close/reopen their own tickets
  • Admins/Moderators can manage all tickets
  • Reopen limit (3x) enforced server-side

🧪 Testing Checklist

Close Ticket

  • User can close own open ticket
  • Close message dialog appears
  • Optional message saved correctly
  • Ticket status changes to "Closed"
  • Success SnackBar shown
  • Navigation back to list works
  • Button disappears after close

Reopen Ticket

  • User can reopen own closed ticket
  • Reopen confirmation dialog appears
  • Remaining reopens displayed
  • Reopen count increments
  • Ticket status changes to "Open"
  • Success SnackBar shown
  • Navigation back to list works

Reopen Limit

  • After 3 reopens, button disappears
  • Warning badge shows limit reached
  • No further reopens possible

UI/UX

  • AppBar buttons correctly placed
  • Button colors correct (red/blue)
  • Loading indicator during processing
  • Badges display correctly
  • Dialogs work as expected
  • Error handling works

Code Quality

  • Flutter analyze passes (only deprecation warnings)
  • No syntax errors
  • Code compiles successfully
  • Documentation complete

📱 Deployment

Web Deployment: ✅ Deployed to admin.haze.pro

flutter build web --release
tar -czf hazebot-admin-web.tar.gz -C build/web .
scp hazebot-admin-web.tar.gz root@hzwd:/root/
ssh root@hzwd "cd /var/www/hazebot-admin && tar -xzf /root/hazebot-admin-web.tar.gz"

Mobile Apps: No changes required (uses direct API connection)


🔄 Migration Notes

No breaking changes!

This PR is fully backward compatible:

  • Existing mobile apps continue to work
  • No database migrations needed
  • No API changes required
  • Old builds remain functional

📸 Screenshots

Before

  • No close/reopen functionality for users
  • Documentation scattered in root directory

After

  • ✅ Close button in AppBar (red lock icon)
  • ✅ Reopen button in AppBar (blue unlock icon)
  • ✅ Status badges showing reopen count
  • ✅ Organized docs in docs/ subdirectory
  • ✅ Scripts in scripts/ subdirectory

🎯 Related Issues

Closes #XX (if applicable)


👥 Reviewers

@inventory69


📋 Merge Checklist

Before merging:

  • All tests passing
  • Code review approved
  • Documentation updated
  • Deployed to production (web)
  • Manually tested all features
  • No merge conflicts

🔗 Related PRs/Commits

Previous related work:

  • Documentation updates for HazeBot
  • API ticket endpoints implementation (already in main)

📈 Statistics

  • Files Changed: 21
  • Insertions: +1,678
  • Deletions: -93
  • Net Change: +1,585 lines
  • Commits: 1
  • Time Invested: ~3-4 hours

🚀 Post-Merge Actions

After merging:

  1. Monitor production for issues
  2. Collect user feedback on new features
  3. Consider adding push notifications for ticket status changes
  4. Update mobile app stores (if needed)
  5. Archive planning documents (TICKET_*.md)

💡 Future Enhancements

Potential follow-up features:

  • Push notifications on ticket close/reopen
  • Ticket history view (show all reopen events)
  • Admin override for reopen limit
  • Require reopen reason field
  • Analytics dashboard for ticket metrics

Ready to merge!

## Features
- ✨ Users can now close and reopen their own tickets
- 🔒 Close button (red lock icon) in AppBar for open tickets
- 🔓 Reopen button (blue lock_open icon) in AppBar for closed tickets
- 📝 Optional closing message dialog (max 500 chars)
- ⚠️ Reopen limit: 3x per ticket (enforced on backend)
- 🎨 Visual feedback: reopen counter badge, limit warning badge
- ⏳ Loading states during API operations

## Documentation
- 📚 Reorganized all docs to docs/ subdirectory
- 📄 Created docs/README.md as comprehensive index
- 🔧 Fixed broken emoji characters in README.md
- 🔗 Updated all cross-references between docs

## Project Structure
- 📂 Moved scripts to scripts/ subdirectory
  - spa_server.py
  - generate_adaptive_icons.sh
  - create_notification_icon.sh
- 🗑️ Removed placeholder test/ directory

## Code Changes
- lib/models/ticket.dart: Added reopenCount field
- lib/screens/user/tickets_screen.dart: Converted to StatefulWidget
  - Added _closeTicket() and _reopenTicket() methods
  - Implemented conditional AppBar action buttons
  - Added dialogs and visual feedback

## Backend
- No backend changes required (endpoints already exist)
- API: POST /api/tickets/{id}/close
- API: POST /api/tickets/{id}/reopen
- Permissions: Users can manage their own tickets
@inventory69 inventory69 merged commit 835dd27 into main Dec 5, 2025
1 check failed
@inventory69 inventory69 deleted the userTicketClose_andDokuUpdate branch December 5, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant