View | Details | Raw Unified | Return to bug 40061
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt (-23 / +9 lines)
Lines 105-117 Link Here
105
                                            [% IF ( text_field.select_field ) %]
105
                                            [% IF ( text_field.select_field ) %]
106
                                                <td>
106
                                                <td>
107
                                                    <a
107
                                                    <a
108
                                                        class="delete_image btn btn-default btn-xs"
108
                                                        class="btn btn-default btn-xs submit-form-link"
109
                                                        href="#"
109
                                                        data-image_id="[% text_field.field_value | html %]"
110
                                                        data-image_id="[% text_field.field_value | html %]"
110
                                                        href="/cgi-bin/koha/patroncards/image-manage.pl?op=delete&image_id=[% text_field.field_value | html %]"
111
                                                        data-action="/cgi-bin/koha/patroncards/image-manage.pl"
111
                                                        ><i class="fa fa-trash-can"></i> Delete</a
112
                                                        data-method="post"
113
                                                        data-op="cud-delete"
114
                                                        data-confirmation-msg="[% tx('Are you sure you want to delete image {image_id}?', {image_id = text_field.field_value} ) | html %]"
112
                                                    >
115
                                                    >
116
                                                        <i class="fa fa-trash-can"></i> Delete
117
                                                    </a>
113
                                                </td>
118
                                                </td>
114
                                                <td align="center"><input type="checkbox" id="image_id_[% text_field.field_value | html %]" name="image_id" value="[% text_field.field_value | html %]" /></td>
119
                                                <td><input type="checkbox" id="image_id_[% text_field.field_value | html %]" name="image_id" value="[% text_field.field_value | html %]" /></td>
115
                                            [% ELSIF ( text_field.field_value ) %]
120
                                            [% ELSIF ( text_field.field_value ) %]
116
                                                <td>[% text_field.field_value | html %]</td>
121
                                                <td>[% text_field.field_value | html %]</td>
117
                                            [% ELSE %]
122
                                            [% ELSE %]
Lines 186-209 Link Here
186
            $("#delete").click(function () {
191
            $("#delete").click(function () {
187
                return DeleteConfirm();
192
                return DeleteConfirm();
188
            });
193
            });
189
            $(".delete_image").on("click", function (ev) {
190
                ev.preventDefault();
191
                const this_image = ev.target;
192
                const image_id = this_image.dataset.image_id;
193
                for (i = 0; i < document.delete_images.image_id.length; i++) {
194
                    const row_image_id = document.delete_images.image_id[i].value;
195
                    const row_checkbox = document.querySelector(`#image_id_${row_image_id}`);
196
                    if (image_id === row_image_id) {
197
                        row_checkbox.checked = true;
198
                    } else {
199
                        row_checkbox.checked = false;
200
                    }
201
                }
202
                const confirmed = confirmDelete(_("Are you sure you want to delete image: %s?").format(image_id));
203
                if (confirmed) {
204
                    document.delete_images.submit();
205
                }
206
            });
207
        });
194
        });
208
    </script>
195
    </script>
209
[% END %]
196
[% END %]
210
- 

Return to bug 40061