This commit is contained in:
2025-09-26 22:17:37 +03:00
parent 2216f21c47
commit 1f90602550
14 changed files with 1040 additions and 95 deletions

View File

@@ -2038,6 +2038,33 @@ def generate_labels_pdf(order_id, paper_saving_mode='true'):
traceback.print_exc()
return jsonify({'error': str(e)}), 500
@bp.route('/update_printed_status/<int:order_id>', methods=['POST'])
def update_printed_status(order_id):
"""Update printed status for direct printing (without PDF generation)"""
print(f"DEBUG: update_printed_status called for order_id: {order_id}")
if 'role' not in session or session['role'] not in ['superadmin', 'warehouse_manager', 'etichete']:
print(f"DEBUG: Access denied for role: {session.get('role')}")
return jsonify({'error': 'Access denied. Required roles: superadmin, warehouse_manager, etichete'}), 403
try:
from .pdf_generator import update_order_printed_status
# Update printed status in database
update_success = update_order_printed_status(order_id)
if update_success:
print(f"DEBUG: Successfully updated printed status for order {order_id}")
return jsonify({'success': True, 'message': f'Order {order_id} marked as printed'})
else:
print(f"WARNING: Could not update printed status for order {order_id}")
return jsonify({'error': 'Could not update printed status'}), 500
except Exception as e:
print(f"DEBUG: Error in update_printed_status: {e}")
return jsonify({'error': 'Internal server error'}), 500
@bp.route('/get_order_data/<int:order_id>', methods=['GET'])
def get_order_data(order_id):
"""Get specific order data for preview"""