')
# Now we need to MOVE widgets from "inner-center-col" (where everything currently is) to "inner-left-col".
# The widgets we want to move are:
# 'relations'
# 'call-history'
# 'pipeline'
def move_widget(widget_name, dest_id, current_html):
pattern = f'data-module="{widget_name}"'
match = current_html.find(pattern)
if match == -1:
return current_html
div_start = current_html.rfind('
\n'
dest_pos = current_html.find(dest_pattern)
if dest_pos != -1:
insert_pos = dest_pos + len(dest_pattern)
current_html = current_html[:insert_pos] + widget + "\n" + current_html[insert_pos:]
return current_html
html = move_widget('relations', 'inner-left-col', html)
html = move_widget('call-history', 'inner-left-col', html)
html = move_widget('pipeline', 'inner-left-col', html)
# Nogle widgets ligger i right-col, som vi gerne vil have i left col nu?
# Contacts, Customers, Locations
# De ligger ikke i en
, de er bare direkte `'
current_html = current_html[:div_start] + current_html[end_idx:]
dest_pattern = f'id="{dest_id}">\n'
dest_pos = current_html.find(dest_pattern)
if dest_pos != -1:
insert_pos = dest_pos + len(dest_pattern)
current_html = current_html[:insert_pos] + widget + "\n" + current_html[insert_pos:]
return current_html
html = move_card('contacts', 'inner-left-col', html)
html = move_card('customers', 'inner-left-col', html)
html = move_card('locations', 'inner-left-col', html)
with open('app/modules/sag/templates/detail.html', 'w', encoding='utf-8') as f:
f.write(html)
print("Drejede kolonnerne på plads!")
if __name__ == '__main__':
fix_columns()