From a8b7d1f5b53be4cab919935b8243d86772b327a7 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 6 Oct 2024 23:16:55 +1100 Subject: [PATCH] Add a border to indicate duplicate or delete status --- .../views/catalog/deletereview.blade.php | 42 +++++++++++++++++++ resources/views/components/checkbox.blade.php | 2 +- .../views/photo/widgets/thumbnail.blade.php | 4 +- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/resources/views/catalog/deletereview.blade.php b/resources/views/catalog/deletereview.blade.php index 928f7f3..232c672 100644 --- a/resources/views/catalog/deletereview.blade.php +++ b/resources/views/catalog/deletereview.blade.php @@ -85,6 +85,48 @@ swap($(this)); scroll($(this)); }); + + $('input[type="checkbox"]').on('click',function(item) { + var card = $(this).closest('div').parent(); + + switch ($(this).data('name')) { + case 'duplicate': + if (card.hasClass('border-success')) { + card.removeClass('border-success').addClass('border-light'); + break; + + } else if (card.hasClass('border-danger')) { + // Do nothing + + } else { + card.toggleClass('border-light'); + } + + break; + + case 'remove': + if ($(this).is(':checked')) { + if (card.hasClass('border-light')) + card.removeClass('border-light'); + else + card.removeClass('border-success'); + + card.addClass('border-danger'); + + } else { + if (card.hasClass('border-danger')) { + card.removeClass('border-danger'); + } + + if ($(this).closest('tr').parent().find('input[name^="duplicate"]').is(':checked')) + card.addClass('border-light') + else + card.addClass('border-success'); + } + + break; + } + }) }); @append \ No newline at end of file diff --git a/resources/views/components/checkbox.blade.php b/resources/views/components/checkbox.blade.php index d11f5f0..a491baa 100644 --- a/resources/views/components/checkbox.blade.php +++ b/resources/views/components/checkbox.blade.php @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/resources/views/photo/widgets/thumbnail.blade.php b/resources/views/photo/widgets/thumbnail.blade.php index c9bd1b7..f74a9bd 100644 --- a/resources/views/photo/widgets/thumbnail.blade.php +++ b/resources/views/photo/widgets/thumbnail.blade.php @@ -7,7 +7,7 @@ 'Dimensions'=>['height','dimensions'], ];?> -
+
$o->remove,'border-success'=>(! $o->remove && ! $o->duplicate),'border-light'=>(! $o->remove) && $o->duplicate])style="border: 1px solid;">