Bug 9021 [QA Followup] - Add feedback to delete button if provider is being used
* Change links to buttons * Add warning class to delete button if provider is being used Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
4afc8550c6
commit
cd6e8db177
|
|
@ -21,6 +21,8 @@ use Modern::Perl;
|
|||
|
||||
use Carp;
|
||||
|
||||
use Koha::Borrowers;
|
||||
|
||||
use base qw(Koha::Object);
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -34,6 +36,20 @@ Koha::SMS::Provider - Koha SMS Provider object class
|
|||
|
||||
=cut
|
||||
|
||||
=head3 patrons_using
|
||||
|
||||
my $count = $provider->patrons_using()
|
||||
|
||||
Gives the number of patrons using this provider
|
||||
|
||||
=cut
|
||||
|
||||
sub patrons_using {
|
||||
my ( $self ) = @_;
|
||||
|
||||
return Koha::Borrowers->search( { sms_provider_id => $self->id } )->count();
|
||||
}
|
||||
|
||||
=head3 type
|
||||
|
||||
=cut
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ function delete_provider( id ) {
|
|||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Domain</th>
|
||||
<th title="Patrons using this provider">Patrons</th>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
|
|
@ -70,8 +71,23 @@ function delete_provider( id ) {
|
|||
<tr>
|
||||
<td id="name_[% p.id %]">[% p.name %]</td>
|
||||
<td id="domain_[% p.id %]">[% p.domain %]</td>
|
||||
<td><a href="#" id="edit_[% p.id %]" class="edit" onclick="edit_provider( [% p.id %] );">Edit</td>
|
||||
<td><a href="#" id="delete_[% p.id %]" class="delete" onclick="delete_provider( [% p.id %] );">Delete</td>
|
||||
<td id="patrons_using_[% p.id %]">[% p.patrons_using %]</td>
|
||||
<td>
|
||||
<a class="btn" href="#" id="edit_[% p.id %]" class="edit" onclick="edit_provider( [% p.id %] );">
|
||||
<i class="fa fa-pencil"></i> Edit
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
[% IF p.patrons_using %]
|
||||
<a class="btn btn-danger" href="#" id="delete_[% p.id %]" class="delete" onclick="delete_provider( [% p.id %] );">
|
||||
<span style="color:white"><i class="fa fa-trash"></i> Delete</span>
|
||||
</a>
|
||||
[% ELSE %]
|
||||
<a class="btn" href="#" id="delete_[% p.id %]" class="delete" onclick="delete_provider( [% p.id %] );">
|
||||
<i class="fa fa-trash"></i> Delete
|
||||
</a>
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
|
|
@ -83,11 +99,19 @@ function delete_provider( id ) {
|
|||
<tr>
|
||||
<td><input type="text" id="name" name="name" /></td>
|
||||
<td><input type="text" id="domain" name="domain" size="40"/></td>
|
||||
<td>
|
||||
<input id="submit_save" type="submit" value="Add new">
|
||||
<input id="submit_update" type="submit" value="Update">
|
||||
<td colspan="2">
|
||||
<button class="btn" id="submit_save" type="submit">
|
||||
<i class="fa fa-plus"></i> Add new
|
||||
</button>
|
||||
<button class="btn" id="submit_update" type="submit">
|
||||
<i class="fa fa-plus-circle"></i> Update
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn" id="cancel" href="#" onclick="cancel_edit()">
|
||||
<i class="fa fa-ban"></i> Cancel
|
||||
</a>
|
||||
</td>
|
||||
<td><a id="cancel" href="#" onclick="cancel_edit()">Cancel</a></td>
|
||||
</tr>
|
||||
</form>
|
||||
</tfoot>
|
||||
|
|
|
|||
Loading…
Reference in New Issue