file_path = 'core/templates/core/settings.html'
with open(file_path, 'r') as f:
content = f.read()
print("File length:", len(content))
# Check context for Nav Tab
if 'id="devices-tab"' in content:
print("Devices tab already exists.")
else:
context_str = 'id="whatsapp-tab" data-bs-toggle="pill" data-bs-target="#whatsapp" type="button" role="tab">
{% trans "WhatsApp Gateway" %}
'
if context_str in content:
print("Found Nav Tab context.")
else:
print("Nav Tab context NOT found. Dumping nearby content:")
# Find rough location
idx = content.find('id="whatsapp-tab"')
if idx != -1:
print(content[idx:idx+300])
# Check context for Tab Pane
if 'id="devices" role="tabpanel"' in content:
print("Devices pane already exists.")
else:
# Try to find the end of tab content
# Look for Add Tier Modal
idx = content.find('')
if idx != -1:
print("Found Add Tier Modal at index:", idx)
print("Preceding content:")
print(content[idx-100:idx])
else:
print("Add Tier Modal NOT found.")