HH/verify_checklist_item_feature.sh

126 lines
4.6 KiB
Bash
Executable File

#!/bin/bash
echo "=========================================="
echo "VERIFYING CHECKLIST ITEM FEATURE"
echo "=========================================="
echo ""
# Check if template file exists
echo "1. Checking template file..."
if [ -f "templates/accounts/onboarding/checklist_list.html" ]; then
echo " ✅ Template file exists"
else
echo " ❌ Template file not found"
fi
echo ""
# Check for modal in template
echo "2. Checking for modal in template..."
if grep -q "createChecklistItemModal" templates/accounts/onboarding/checklist_list.html; then
echo " ✅ Modal found in template"
else
echo " ❌ Modal not found in template"
fi
echo ""
# Check for save function
echo "3. Checking for JavaScript save function..."
if grep -q "saveChecklistItem" templates/accounts/onboarding/checklist_list.html; then
echo " ✅ saveChecklistItem function found"
else
echo " ❌ saveChecklistItem function not found"
fi
echo ""
# Check for API endpoint in template
echo "4. Checking for API endpoint reference..."
if grep -q "/api/accounts/onboarding/checklist/" templates/accounts/onboarding/checklist_list.html; then
echo " ✅ API endpoint referenced in template"
else
echo " ❌ API endpoint not referenced"
fi
echo ""
# Check for form fields
echo "5. Checking for required form fields..."
fields=("code" "text_en" "text_ar" "is_required" "is_active" "order")
all_fields_present=true
for field in "${fields[@]}"; do
if grep -q "name=\"$field\"" templates/accounts/onboarding/checklist_list.html; then
echo " ✅ Field '$field' present"
else
echo " ❌ Field '$field' missing"
all_fields_present=false
fi
done
echo ""
# Check if ui_views.py passes content_list
echo "6. Checking ui_views.py for content_list..."
if grep -q "content_list = AcknowledgementContent.objects" apps/accounts/ui_views.py; then
echo " ✅ content_list is being fetched in ui_views.py"
else
echo " ❌ content_list not found in ui_views.py"
fi
echo ""
# Check if content_list is passed to template
echo "7. Checking if content_list is passed to template..."
if grep -A5 "'content_list'" apps/accounts/ui_views.py | grep -q "content_list"; then
echo " ✅ content_list is passed to template context"
else
echo " ❌ content_list not passed to template context"
fi
echo ""
# Check for role dropdown
echo "8. Checking for role dropdown in template..."
if grep -q "name=\"role\"" templates/accounts/onboarding/checklist_list.html; then
echo " ✅ Role dropdown present"
else
echo " ❌ Role dropdown not found"
fi
echo ""
# Check for content dropdown
echo "9. Checking for content dropdown in template..."
if grep -q "name=\"content\"" templates/accounts/onboarding/checklist_list.html; then
echo " ✅ Content dropdown present"
else
echo " ❌ Content dropdown not found"
fi
echo ""
# Check for bootstrap modal classes
echo "10. Checking for Bootstrap modal structure..."
if grep -q "class=\"modal fade\"" templates/accounts/onboarding/checklist_list.html; then
echo " ✅ Bootstrap modal classes present"
else
echo " ❌ Bootstrap modal classes not found"
fi
echo ""
echo "=========================================="
echo "VERIFICATION COMPLETE"
echo "=========================================="
echo ""
echo "Summary:"
echo "- Template file: $([ -f "templates/accounts/onboarding/checklist_list.html" ] && echo "✅ OK" || echo "❌ Missing")"
echo "- Modal implementation: $(grep -q "createChecklistItemModal" templates/accounts/onboarding/checklist_list.html && echo "✅ OK" || echo "❌ Missing")"
echo "- JavaScript function: $(grep -q "saveChecklistItem" templates/accounts/onboarding/checklist_list.html && echo "✅ OK" || echo "❌ Missing")"
echo "- API endpoint: $(grep -q "/api/accounts/onboarding/checklist/" templates/accounts/onboarding/checklist_list.html && echo "✅ OK" || echo "❌ Missing")"
echo "- UI view updated: $(grep -q "content_list = AcknowledgementContent.objects" apps/accounts/ui_views.py && echo "✅ OK" || echo "❌ Missing")"
echo ""
echo "The 'Add Checklist Item' feature has been implemented with:"
echo " - Modal form for creating new checklist items"
echo " - All required fields (code, role, text, etc.)"
echo " - JavaScript function to handle form submission"
echo " - Integration with existing API endpoint"
echo " - Dropdowns for roles and linked content"
echo ""
echo "To test the feature:"
echo "1. Run the development server: python manage.py runserver"
echo "2. Login as a PX Admin user"
echo "3. Navigate to: /accounts/onboarding/checklist/"
echo "4. Click 'Add Checklist Item' button"
echo "5. Fill in the form and submit"