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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt (-29 / +36 lines)
Lines 165-203 Link Here
165
165
166
                const client = APIClient.circulation;
166
                const client = APIClient.circulation;
167
                if (op == "seen") {
167
                if (op == "seen") {
168
                    client.checkouts.mark_as_seen(issue_id).then(
168
                    client.checkouts
169
                        success => {
169
                        .mark_as_seen(issue_id)
170
                            if (success.seen) {
170
                        .then(response => response.text())
171
                                $("#status_" + issue_id).text(_("Seen"));
171
                        .then(response => JSON.parse(response))
172
                                $(event.target).parent().siblings(".seen0").removeClass("seen0").addClass("seen1");
172
                        .then(
173
                                $(event.target).siblings(".notseen").prop("disabled", false);
173
                            success => {
174
                                $(event.target).prop("disabled", true);
174
                                if (success.seen) {
175
                            } else {
175
                                    $("#status_" + issue_id).text(_("Seen"));
176
                                    $(event.target).parent().siblings(".seen0").removeClass("seen0").addClass("seen1");
177
                                    $(event.target).siblings(".notseen").prop("disabled", false);
178
                                    $(event.target).prop("disabled", true);
179
                                } else {
180
                                    show_error();
181
                                }
182
                            },
183
                            error => {
184
                                console.warn("Something wrong happened: %s".format(error));
176
                                show_error();
185
                                show_error();
177
                            }
186
                            }
178
                        },
187
                        );
179
                        error => {
180
                            console.warn("Something wrong happened: %s".format(error));
181
                            show_error();
182
                        }
183
                    );
184
                } else {
188
                } else {
185
                    client.checkouts.mark_as_not_seen(issue_id).then(
189
                    client.checkouts
186
                        success => {
190
                        .mark_as_not_seen(issue_id)
187
                            if (!success.seen) {
191
                        .then(response => response.text())
188
                                $("#status_" + issue_id).text(_("Not seen"));
192
                        .then(response => JSON.parse(response))
189
                                $(event.target).parent().siblings(".seen1").removeClass("seen1").addClass("seen0");
193
                        .then(
190
                                $(event.target).siblings(".seen").prop("disabled", false);
194
                            success => {
191
                                $(event.target).prop("disabled", true);
195
                                if (!success.seen) {
192
                            } else {
196
                                    $("#status_" + issue_id).text(_("Not seen"));
197
                                    $(event.target).parent().siblings(".seen1").removeClass("seen1").addClass("seen0");
198
                                    $(event.target).siblings(".seen").prop("disabled", false);
199
                                    $(event.target).prop("disabled", true);
200
                                } else {
201
                                    show_error();
202
                                }
203
                            },
204
                            error => {
205
                                console.warn("Something wrong happened: %s".format(error));
193
                                show_error();
206
                                show_error();
194
                            }
207
                            }
195
                        },
208
                        );
196
                        error => {
197
                            console.warn("Something wrong happened: %s".format(error));
198
                            show_error();
199
                        }
200
                    );
201
                }
209
                }
202
            });
210
            });
203
        });
211
        });
204
- 

Return to bug 41612