From 539895fff4e35bec9371aec21b8ea89c63d63472 Mon Sep 17 00:00:00 2001 From: Sagar Date: Thu, 16 Jan 2025 16:09:11 +0100 Subject: [PATCH 1/2] fix: implemented the tooltip logic with the new drawyer table and handled IUPAC name display with italics. --- app/Livewire/MoleculeHistoryTimeline.php | 15 +- .../molecule-history-timeline.blade.php | 231 +++++++++++------- 2 files changed, 153 insertions(+), 93 deletions(-) diff --git a/app/Livewire/MoleculeHistoryTimeline.php b/app/Livewire/MoleculeHistoryTimeline.php index 5d74e7e1..62696bf7 100644 --- a/app/Livewire/MoleculeHistoryTimeline.php +++ b/app/Livewire/MoleculeHistoryTimeline.php @@ -32,9 +32,18 @@ public function getHistory() $audit_data[$index]['affected_columns'][$affected_column]['new_value'] = $audit->new_values ? array_values($audit->new_values)[0] : null; } else { foreach ($audit->getModified() as $affected_column => $value) { - - $audit_data[$index]['affected_columns'][$affected_column]['old_value'] = array_key_exists('old', $value) ? $value['old'] : null; - $audit_data[$index]['affected_columns'][$affected_column]['new_value'] = array_key_exists('new', $value) ? $value['new'] : null; + // Pre-process IUPAC names with italic conversion + if ($affected_column === 'iupac_name') { + $audit_data[$index]['affected_columns'][$affected_column]['old_value'] = + array_key_exists('old', $value) ? convert_italics_notation($value['old']) : null; + $audit_data[$index]['affected_columns'][$affected_column]['new_value'] = + array_key_exists('new', $value) ? convert_italics_notation($value['new']) : null; + } else { + $audit_data[$index]['affected_columns'][$affected_column]['old_value'] = + array_key_exists('old', $value) ? $value['old'] : null; + $audit_data[$index]['affected_columns'][$affected_column]['new_value'] = + array_key_exists('new', $value) ? $value['new'] : null; + } } } } diff --git a/resources/views/livewire/molecule-history-timeline.blade.php b/resources/views/livewire/molecule-history-timeline.blade.php index b7c3bc5c..ab5eead2 100644 --- a/resources/views/livewire/molecule-history-timeline.blade.php +++ b/resources/views/livewire/molecule-history-timeline.blade.php @@ -1,3 +1,4 @@ +
--}} - + @break + @case('active') + @if ($column_values['new_value']) + Activated + @else + Deactivated + @endif + @break + @case('created') + Initial creation of the compound on COCONUT + @break + @case('organisms') + @case('sampleLocations') + @if ($column_values['old_value']) + Detached from:
{{$column_values['old_value']?:'N/A'}}
+ @endif + @if ($column_values['new_value']) + Attached to:
{{$column_values['new_value']?:'N/A'}}
+ @endif + @break + @case('synonyms') + @if (array_diff($column_values['old_value'], $column_values['new_value'])) + Removed:
{{implode(', ',array_diff($column_values['old_value'], $column_values['new_value']))}}
+ @endif + @if (array_diff($column_values['new_value'], $column_values['old_value'])) + Added:
{{implode(', ',array_diff($column_values['new_value'], $column_values['old_value']))}}
+ @endif + @break + @case('cas') + @if (array_diff($column_values['old_value'], $column_values['new_value'])) + Removed:
{{implode(', ',array_diff($column_values['old_value'], $column_values['new_value']))}}
+ @endif + @if (array_diff($column_values['new_value'], $column_values['old_value'])) + Added:
{{implode(', ',array_diff($column_values['new_value'], $column_values['old_value']))}}
+ @endif + @break + @case('citations') + @if ($column_values['old_value']) + Detached from:
{{$column_values['old_value']?:'N/A'}}
+ @endif + @if ($column_values['new_value']) + Attached to:
{{$column_values['new_value']?:'N/A'}}
+ @endif + @break + @default + Old Value:
{{$column_values['old_value']??'N/A'}}
+ New Value:
{{$column_values['new_value']??'N/A'}} + @endswitch + + --}} - @endforeach - - @endif - @endforeach - + @endforeach + + @endif + @endforeach + -
- -
- -
-
-

- -
-
-
+ \ No newline at end of file From 323efd99b452fda0f57a3f2363d04520d30ec9ce Mon Sep 17 00:00:00 2001 From: Sagar Date: Sun, 19 Jan 2025 13:54:45 +0100 Subject: [PATCH 2/2] fix: better handling of cas and synonymns --- .../molecule-history-timeline.blade.php | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/resources/views/livewire/molecule-history-timeline.blade.php b/resources/views/livewire/molecule-history-timeline.blade.php index ab5eead2..9e4efae5 100644 --- a/resources/views/livewire/molecule-history-timeline.blade.php +++ b/resources/views/livewire/molecule-history-timeline.blade.php @@ -146,11 +146,9 @@ - @@ -172,9 +170,20 @@