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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/display_ticket.inc (+2 lines)
Lines 20-25 Link Here
20
                        <li class="rows">
20
                        <li class="rows">
21
                            <label for="public">Notify: </label>
21
                            <label for="public">Notify: </label>
22
                            <input type="checkbox" name="public" id="public">
22
                            <input type="checkbox" name="public" id="public">
23
                            <label for="assignee_id">Change assignee: </label>
24
                            <select name="assignee_id" id="assignee_id"></select>
23
                        </li>
25
                        </li>
24
                    </ol>
26
                    </ol>
25
                </fieldset>
27
                </fieldset>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt (-1 / +8 lines)
Lines 182-187 Link Here
182
                                } else {
182
                                } else {
183
                                    result += _("Open");
183
                                    result += _("Open");
184
                                }
184
                                }
185
                                if (row.assignee) {
186
                                    result += '<span class="clearfix">' + _("Assigned to: ") + $patron_to_html(row.assignee, {
187
                                        display_cardnumber: false,
188
                                        url: true
189
                                    }) + '</span>';
190
                                }
185
                            }
191
                            }
186
                            return result;
192
                            return result;
187
                        },
193
                        },
Lines 191-197 Link Here
191
                    {
197
                    {
192
                        "data": function(row, type, val, meta) {
198
                        "data": function(row, type, val, meta) {
193
                            let resolved = ( row.resolved_date ) ? true : false;
199
                            let resolved = ( row.resolved_date ) ? true : false;
194
                            let result = '<a class="btn btn-default btn-xs" role="button" href="#" data-toggle="modal" data-target="#ticketDetailsModal" data-concern="' + encodeURIComponent(row.ticket_id) + '" data-resolved="'+resolved+'"><i class="fa-solid fa-eye" aria-hidden="true"></i> ' + _("Details") + '</a>';
200
                            let result = '<a class="btn btn-default btn-xs" role="button" href="#" data-toggle="modal" data-target="#ticketDetailsModal" data-concern="' + encodeURIComponent(row.ticket_id) + '" data-resolved="'+resolved+'" data-assignee="'+$patron_to_html(row.assignee, { display_cardnumber: false, url: false })+'"><i class="fa-solid fa-eye" aria-hidden="true"></i> ' + _("Details") + '</a>';
195
                            return result;
201
                            return result;
196
                        },
202
                        },
197
                        "searchable": false,
203
                        "searchable": false,
Lines 245-250 Link Here
245
            [% END %]
251
            [% END %]
246
        });
252
        });
247
    </script>
253
    </script>
254
    [% INCLUDE 'select2.inc' %]
248
    [% Asset.js("js/modals/display_ticket.js") | $raw %]
255
    [% Asset.js("js/modals/display_ticket.js") | $raw %]
249
[% END %]
256
[% END %]
250
[% INCLUDE 'intranet-bottom.inc' %]
257
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js (-4 / +99 lines)
Lines 4-9 $(document).ready(function() { Link Here
4
        let button = $(event.relatedTarget);
4
        let button = $(event.relatedTarget);
5
        let ticket_id = button.data('concern');
5
        let ticket_id = button.data('concern');
6
        let resolved  = button.data('resolved');
6
        let resolved  = button.data('resolved');
7
        let assignee  = button.data('assignee');
7
        modal.find('.modal-footer input').val(ticket_id);
8
        modal.find('.modal-footer input').val(ticket_id);
8
9
9
        if ( resolved ) {
10
        if ( resolved ) {
Lines 17-22 $(document).ready(function() { Link Here
17
        // Display ticket details
18
        // Display ticket details
18
        let display = '<div class="list-group">';
19
        let display = '<div class="list-group">';
19
        display += '<div class="list-group-item">';
20
        display += '<div class="list-group-item">';
21
        if (assignee) {
22
            display += '<span class="pull-right"><span class="label">' + __("Assignee") + '</span>: ' + assignee + '</span>';
23
        }
20
        display += '<span class="wrapfix">' + detail + '</span>';
24
        display += '<span class="wrapfix">' + detail + '</span>';
21
        display += '</div>';
25
        display += '</div>';
22
        display += '<div id="concern-updates" class="list-group-item">';
26
        display += '<div id="concern-updates" class="list-group-item">';
Lines 32-38 $(document).ready(function() { Link Here
32
            url: "/api/v1/tickets/" + ticket_id + "/updates",
36
            url: "/api/v1/tickets/" + ticket_id + "/updates",
33
            method: "GET",
37
            method: "GET",
34
            headers: {
38
            headers: {
35
                "x-koha-embed": [ "user", "+strings" ]
39
                "x-koha-embed": [ "user", "assignee", "+strings" ]
36
            },
40
            },
37
        }).success(function(data) {
41
        }).success(function(data) {
38
            let updates_display = $('#concern-updates');
42
            let updates_display = $('#concern-updates');
Lines 52-61 $(document).ready(function() { Link Here
52
                    url: true
56
                    url: true
53
                }) + ' (' + $datetime(item.date) + ')';
57
                }) + ' (' + $datetime(item.date) + ')';
54
                if ( item.status ) {
58
                if ( item.status ) {
55
                    updates += '<span class="wrapfix pull-right">';
59
                    updates += '<span class="clearfix pull-right">';
56
                    updates += item._strings.status ? escape_str(item._strings.status.str) : "";
60
                    updates += item._strings.status ? escape_str(item._strings.status.str) : "";
57
                    updates += '</span>'
61
                    updates += '</span>'
58
                }
62
                }
63
                if ( item.assignee ) {
64
                    updates += '<span class="clearfix pull-right">';
65
                    updates += $patron_to_html(item.assignee, {
66
                                        display_cardnumber: false,
67
                                        url: true
68
                                    });
69
                    updates += '</span>'
70
                }
59
                updates += '</span>';
71
                updates += '</span>';
60
                updates += '</div>';
72
                updates += '</div>';
61
            });
73
            });
Lines 67-82 $(document).ready(function() { Link Here
67
        // Clear any previously entered update message
79
        // Clear any previously entered update message
68
        $('#update_message').val('');
80
        $('#update_message').val('');
69
        $('#public').prop( "checked", false );
81
        $('#public').prop( "checked", false );
82
83
        // Patron select2
84
        $("#assignee_id").kohaSelect({
85
           dropdownParent: $(".modal-content", "#ticketDetailsModal"),
86
           width: '50%',
87
           dropdownAutoWidth: true,
88
           allowClear: true,
89
           minimumInputLength: 3,
90
           ajax: {
91
               url: '/api/v1/patrons',
92
               delay: 250,
93
               dataType: 'json',
94
               headers: {
95
                   "x-koha-embed": "library"
96
               },
97
               data: function(params) {
98
                   let q = buildPatronSearchQuery(params.term);
99
                   let query = {
100
                       'q': JSON.stringify(q),
101
                       '_page': params.page,
102
                       '_order_by': '+me.surname,+me.firstname',
103
                   };
104
                   return query;
105
               },
106
               processResults: function(data, params) {
107
                   let results = [];
108
                   data.results.forEach(function(patron) {
109
                       patron.id = patron.patron_id;
110
                       results.push(patron);
111
                   });
112
                   return {
113
                       "results": results, "pagination": { "more": data.pagination.more }
114
                   };
115
               },
116
           },
117
           templateResult: function (patron) {
118
               if (patron.library_id == loggedInLibrary) {
119
                   loggedInClass = "ac-currentlibrary";
120
               } else {
121
                   loggedInClass = "";
122
               }
123
   
124
               let $patron = $("<span></span>")
125
                   .append(
126
                       "" +
127
                           (patron.surname
128
                               ? escape_str(patron.surname) + ", "
129
                               : "") +
130
                           (patron.firstname
131
                               ? escape_str(patron.firstname) + " "
132
                               : "") +
133
                           (patron.cardnumber
134
                               ? " (" + escape_str(patron.cardnumber) + ")"
135
                               : "") +
136
                           "<small>" +
137
                           (patron.date_of_birth
138
                               ? ' <span class="age_years">' +
139
                                 $get_age(patron.date_of_birth) +
140
                                 " " +
141
                                 __("years") +
142
                                 "</span>"
143
                               : "") +
144
                           (patron.library ?
145
                                   " <span class=\"ac-library\">" +
146
                                   escape_str(patron.library.name) +
147
                                   "</span>"
148
                               : "") +
149
                           "</small>"
150
                   )
151
                   .addClass(loggedInClass);
152
               return $patron;
153
           },
154
           templateSelection: function (patron) {
155
               if (!patron.surname) {
156
                   return patron.text;
157
               }
158
               return (
159
                   escape_str(patron.surname) + ", " + escape_str(patron.firstname)
160
               );
161
           },
162
           placeholder: "Search for a patron"
163
       });
70
    });
164
    });
71
165
72
    $('#ticketDetailsModal').on('click', '.updateSubmit', function(e) {
166
    $('#ticketDetailsModal').on('click', '.updateSubmit', function(e) {
73
        let clicked = $(this);
167
        let clicked = $(this);
74
        let ticket_id = $('#ticket_id').val();
168
        let ticket_id = $('#ticket_id').val();
169
        let assignee_id = $('#assignee_id').val();
75
        let params = {
170
        let params = {
76
            'public': $('#public').is(":checked"),
171
            'public': $('#public').is(":checked"),
77
            'message': $('#update_message').val(),
172
            'message': $('#update_message').val(),
78
            'user_id': logged_in_user_borrowernumber,
173
            'user_id': logged_in_user_borrowernumber,
79
            'status': clicked.data('status')
174
            'status': clicked.data('status'),
175
            'assignee_id': assignee_id
80
        };
176
        };
81
177
82
        $('#comment-spinner').show();
178
        $('#comment-spinner').show();
83
- 

Return to bug 35657