Skip to content

Commit

Permalink
feat: add html template for additions and deletions
Browse files Browse the repository at this point in the history
(cherry picked from commit c598fde)
  • Loading branch information
GursheenK authored and mergify[bot] committed Oct 17, 2023
1 parent 56d8911 commit 902c168
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 6 deletions.
15 changes: 9 additions & 6 deletions frappe/core/doctype/document_comparator/document_comparator.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% var field_keys = Object.keys(changed).sort(); %}
{% if field_keys.length > 0 %}
<div class="p-2">
<h5> Changes </h5>
<h5><b>Fields Changed</b></h5>
<table class="table table-bordered">
<thead>
<th> Fields </th>
Expand All @@ -38,18 +38,21 @@ <h5> Changes </h5>
{% var tables = Object.keys(row_changed).sort(); %}
{% if tables.length > 0 %}
<div class="p-2">
<h5> Rows Updated </h5>
<h5><b>Rows Updated</b></h5>
<table class="table table-bordered">
<thead>
<th> Fields </th>
{% for doc in documents %}
<th>{{ doc }}</th>
{% endfor %}
</thead>
<tbody>
{% for table in tables %}
<tr>
<tr><td><b>{{ table }}</b></td></tr>
<tr>
<td><b>{{ table }}</b></td>
{% for doc in documents %}
<td><b>{{ doc }}</b></td>
{% endfor %}
</tr>

{% var rows = Object.keys(row_changed[table]).sort(); %}
{% for idx in rows %}
<tr><td><b>idx : {{ idx }}</b></td></tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<div>
{% var docs = Object.keys(added_or_removed) %}
{% for doc in docs %}
<div>
{% if Object.keys(added_or_removed[doc]).length > 0 %}
<h5>{{ doc }}</h5>
<br>
{% var tables = Object.keys(added_or_removed[doc]) %}
{% for table in tables %}
<h5 class="text-muted">{{ table }}</h5>
<table class="table table-bordered">
<thead>
{% var fieldnames = Object.keys(added_or_removed[doc][table][0]) %}
{% for fieldname in fieldnames %}
<th>{{ fieldname }}</th>
{% endfor %}
</thead>
<tbody>
{% var rows = Object.keys(added_or_removed[doc][table]) %}
{% for row in rows %}
<tr>
{% var field_keys = Object.keys(added_or_removed[doc][table][row]) %}
{% for key in field_keys %}
<td>{{ added_or_removed[doc][table][row][key] }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
{% endif %}
</div>
{% endfor %}
</div>

0 comments on commit 902c168

Please sign in to comment.