Add a border to indicate duplicate or delete status

This commit is contained in:
Deon George 2024-10-06 23:16:55 +11:00
parent 47d0846f99
commit a8b7d1f5b5
3 changed files with 45 additions and 3 deletions

View File

@ -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;
}
})
});
</script>
@append

View File

@ -1 +1 @@
<input type="checkbox" name="{{ $name }}[{{ $id }}]" value="{{ $value ?? TRUE }}" @checked($checked)>
<input type="checkbox" name="{{ $name }}[{{ $id }}]" value="{{ $value ?? TRUE }}" data-name="{{$name}}" @checked($checked)>

View File

@ -7,7 +7,7 @@
'Dimensions'=>['height','dimensions'],
];?>
<div class="card card-widget">
<div @class(['card','border-danger'=>$o->remove,'border-success'=>(! $o->remove && ! $o->duplicate),'border-light'=>(! $o->remove) && $o->duplicate])style="border: 1px solid;">
<div class="card-header">
<div class="user-block">
<i class="fas fa-2x fa-camera float-left"></i><span class="username"><a href="{{ url('p/info',$o->id) }}">#{{ $o->id }} - {{ Str::limit($o->filename,12).Str::substr($o->filename,-16) }}</a></span>
@ -27,7 +27,7 @@
<span class="btn btn-sm btn-outline-dark float-right swapscroll m-1"> <i class="fas fa-fw fa-exchange-alt"></i><i class="fas fa-fw fa-level-down-alt"></i></span>
</div>
<div class="card-footer card-comments">
<div class="card-footer">
<table class="table table-sm table-striped">
<tr><th>ID</th><td><x-photo.info :id="$o->id"/></td></tr>