🎯 RESTORE: Enhanced admin user management functionality
✅ Added user search functionality to admin users page ✅ Created comprehensive user detail template with: - Complete user information display - User action buttons (activate/deactivate/delete) - Quotation history for each user - Improved tooltips and responsive design ✅ Enhanced admin users table with better action buttons ✅ Added proper error handling and confirmation dialogs SAFE: Only affects admin pages, calculator functionality unchanged
This commit is contained in:
+16
-2
@@ -57,9 +57,23 @@ def dashboard():
|
||||
def users():
|
||||
try:
|
||||
page = request.args.get('page', 1, type=int)
|
||||
search = request.args.get('search', '').strip()
|
||||
per_page = 20
|
||||
|
||||
users = User.query.order_by(User.created_at.desc()).paginate(
|
||||
# Build query with search functionality
|
||||
query = User.query
|
||||
|
||||
if search:
|
||||
# Search by username or email (case-insensitive)
|
||||
search_filter = f"%{search.lower()}%"
|
||||
query = query.filter(
|
||||
db.or_(
|
||||
User.username.ilike(search_filter),
|
||||
User.email.ilike(search_filter)
|
||||
)
|
||||
)
|
||||
|
||||
users = query.order_by(User.created_at.desc()).paginate(
|
||||
page=page, per_page=per_page, error_out=False
|
||||
)
|
||||
|
||||
@@ -229,7 +243,7 @@ def delete_quotation():
|
||||
if not request.is_json:
|
||||
return jsonify({'error': 'Invalid request format'}), 400
|
||||
|
||||
data = request.get_json()
|
||||
data = request.get_json()
|
||||
quotation_id = data.get('quotation_id')
|
||||
|
||||
if not quotation_id:
|
||||
|
||||
Reference in New Issue
Block a user