|
Lines 39-120
export default {
Link Here
|
| 39 |
$.fn.dataTable.ext.search = $.fn.dataTable.ext.search.filter( |
39 |
$.fn.dataTable.ext.search = $.fn.dataTable.ext.search.filter( |
| 40 |
search => search.name != "apply_filter" |
40 |
search => search.name != "apply_filter" |
| 41 |
); |
41 |
); |
| 42 |
$("#" + table_id).dataTable( |
42 |
$("#" + table_id).kohaTable({ |
| 43 |
$.extend(true, {}, dataTablesDefaults, { |
43 |
data: contracts, |
| 44 |
data: contracts, |
44 |
embed: [], |
| 45 |
embed: [], |
45 |
dom: '<<"table_entries">>', |
| 46 |
ordering: false, |
46 |
autoWidth: false, |
| 47 |
dom: '<<"table_entries">>', |
47 |
columns: [ |
| 48 |
aLengthMenu: [ |
48 |
{ |
| 49 |
[10, 20, 50, 100], |
49 |
title: __("Name"), |
| 50 |
[10, 20, 50, 100], |
50 |
data: "contractname", |
| 51 |
], |
51 |
render: function (data, type, row, meta) { |
| 52 |
autoWidth: false, |
52 |
return ( |
| 53 |
columns: [ |
53 |
`<a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&booksellerid=${row.booksellerid}&contractnumber=${row.contractnumber}">` + |
| 54 |
{ |
54 |
escape_str(row.contractname) + |
| 55 |
title: __("Name"), |
55 |
"</a>" |
| 56 |
data: "contractname", |
56 |
); |
| 57 |
searchable: false, |
|
|
| 58 |
orderable: false, |
| 59 |
render: function (data, type, row, meta) { |
| 60 |
return ( |
| 61 |
`<a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&booksellerid=${row.booksellerid}&contractnumber=${row.contractnumber}">` + |
| 62 |
escape_str(row.contractname) + |
| 63 |
"</a>" |
| 64 |
); |
| 65 |
}, |
| 66 |
}, |
57 |
}, |
| 67 |
{ |
58 |
}, |
| 68 |
title: __("Description"), |
59 |
{ |
| 69 |
data: "contractdescription", |
60 |
title: __("Description"), |
| 70 |
searchable: false, |
61 |
data: "contractdescription", |
| 71 |
orderable: false, |
62 |
}, |
|
|
63 |
{ |
| 64 |
title: __("Start date"), |
| 65 |
data: "contractstartdate", |
| 66 |
render: function (data, type, row, meta) { |
| 67 |
return type == "sort" |
| 68 |
? row.contractstartdate |
| 69 |
: format_date(row.contractstartdate); |
| 72 |
}, |
70 |
}, |
| 73 |
{ |
71 |
}, |
| 74 |
title: __("Start date"), |
72 |
{ |
| 75 |
data: "contractstartdate", |
73 |
title: __("End date"), |
| 76 |
searchable: false, |
74 |
data: "contractenddate", |
| 77 |
orderable: false, |
75 |
render: function (data, type, row, meta) { |
| 78 |
render: function (data, type, row, meta) { |
76 |
return type == "sort" |
| 79 |
return format_date(row.contractstartdate); |
77 |
? row.contractenddate |
| 80 |
}, |
78 |
: format_date(row.contractenddate); |
| 81 |
}, |
79 |
}, |
| 82 |
{ |
80 |
}, |
| 83 |
title: __("End date"), |
81 |
...(isUserPermitted("CAN_user_acquisition_contracts_manage") |
| 84 |
data: "contractenddate", |
82 |
? [ |
| 85 |
searchable: false, |
83 |
{ |
| 86 |
orderable: false, |
84 |
title: __("Actions"), |
| 87 |
render: function (data, type, row, meta) { |
85 |
data: "contractnumber", |
| 88 |
return format_date(row.contractenddate); |
86 |
searchable: false, |
| 89 |
}, |
87 |
orderable: false, |
| 90 |
}, |
88 |
render: function (data, type, row, meta) { |
| 91 |
...(isUserPermitted( |
89 |
return ( |
| 92 |
"CAN_user_acquisition_contracts_manage" |
90 |
`<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=${row.contractnumber}&booksellerid=${row.booksellerid}"><i class="fa-solid fa-pencil" aria-hidden="true"></i>` + |
| 93 |
) |
91 |
" " + |
| 94 |
? [ |
92 |
__("Edit") + |
| 95 |
{ |
93 |
"</a>" + |
| 96 |
title: __("Actions"), |
94 |
`<a style="margin-left: 5px;" class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=${row.contractnumber}&booksellerid=${row.booksellerid}"><i class="fa-solid fa-trash-can" aria-hidden="true"></i>` + |
| 97 |
data: "contractnumber", |
95 |
" " + |
| 98 |
searchable: false, |
96 |
__("Delete") + |
| 99 |
orderable: false, |
97 |
"</a>" |
| 100 |
render: function (data, type, row, meta) { |
98 |
); |
| 101 |
return ( |
|
|
| 102 |
`<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=${row.contractnumber}&booksellerid=${row.booksellerid}"><i class="fa-solid fa-pencil" aria-hidden="true"></i>` + |
| 103 |
" " + |
| 104 |
__("Edit") + |
| 105 |
"</a>" + |
| 106 |
`<a style="margin-left: 5px;" class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=${row.contractnumber}&booksellerid=${row.booksellerid}"><i class="fa-solid fa-trash-can" aria-hidden="true"></i>` + |
| 107 |
" " + |
| 108 |
__("Delete") + |
| 109 |
"</a>" |
| 110 |
); |
| 111 |
}, |
| 112 |
}, |
99 |
}, |
| 113 |
] |
100 |
}, |
| 114 |
: []), |
101 |
] |
| 115 |
], |
102 |
: []), |
| 116 |
}) |
103 |
], |
| 117 |
); |
104 |
}); |
| 118 |
}, |
105 |
}, |
| 119 |
}, |
106 |
}, |
| 120 |
mounted() { |
107 |
mounted() { |
| 121 |
- |
|
|