|
Lines 1-73
Link Here
|
| 1 |
<template> |
1 |
<template> |
| 2 |
<h2>{{ $__("Contract(s)") }}</h2> |
2 |
<h2>{{ $__("Contract(s)") }}</h2> |
| 3 |
<div class="dataTables_wrapper no-footer"> |
3 |
<div class="dataTables_wrapper no-footer"> |
| 4 |
<table id="contractst"> |
4 |
<table :id="table_id"></table> |
| 5 |
<thead> |
|
|
| 6 |
<tr> |
| 7 |
<th scope="col">{{ $__("Name") }}</th> |
| 8 |
<th scope="col">{{ $__("Description") }}</th> |
| 9 |
<th scope="col">{{ $__("Start date") }}</th> |
| 10 |
<th scope="col">{{ $__("End date") }}</th> |
| 11 |
<th |
| 12 |
v-if=" |
| 13 |
isUserPermitted( |
| 14 |
'CAN_user_acquisition_contracts_manage' |
| 15 |
) |
| 16 |
" |
| 17 |
scope="col" |
| 18 |
class="NoSort noExport" |
| 19 |
> |
| 20 |
{{ $__("Actions") }} |
| 21 |
</th> |
| 22 |
</tr> |
| 23 |
</thead> |
| 24 |
<tbody> |
| 25 |
<tr v-for="(contract, i) in vendor.contracts" :key="i"> |
| 26 |
<td> |
| 27 |
<a |
| 28 |
:href="`/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=${contract.contractnumber}&booksellerid=${contract.booksellerid}`" |
| 29 |
>{{ contract.contractname }}</a |
| 30 |
> |
| 31 |
</td> |
| 32 |
<td>{{ contract.contractdescription }}</td> |
| 33 |
<td :data-order="contract.contractstartdate"> |
| 34 |
{{ contract.contractstartdate }} |
| 35 |
</td> |
| 36 |
<td :data-order="contract.contractenddate"> |
| 37 |
{{ contract.contractenddate }} |
| 38 |
</td> |
| 39 |
<td |
| 40 |
class="actions" |
| 41 |
v-if=" |
| 42 |
isUserPermitted( |
| 43 |
'CAN_user_acquisition_contracts_manage' |
| 44 |
) |
| 45 |
" |
| 46 |
> |
| 47 |
<a |
| 48 |
class="btn btn-default btn-xs" |
| 49 |
:href="`/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=${contract.contractnumber}&booksellerid=${contract.booksellerid}`" |
| 50 |
><i |
| 51 |
class="fa-solid fa-pencil" |
| 52 |
aria-hidden="true" |
| 53 |
></i> |
| 54 |
{{ $__("Edit") }}</a |
| 55 |
> |
| 56 |
<a |
| 57 |
class="btn btn-default btn-xs" |
| 58 |
:href="`/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=${contract.contractnumber}&booksellerid=${contract.booksellerid}`" |
| 59 |
><i class="fa fa-trash-can"></i> |
| 60 |
{{ $__("Delete") }}</a |
| 61 |
> |
| 62 |
</td> |
| 63 |
</tr> |
| 64 |
</tbody> |
| 65 |
</table> |
| 66 |
</div> |
5 |
</div> |
| 67 |
</template> |
6 |
</template> |
| 68 |
|
7 |
|
| 69 |
<script> |
8 |
<script> |
| 70 |
import { inject } from "vue" |
9 |
import { inject } from "vue" |
|
|
10 |
import { useDataTable } from "../../composables/datatables" |
| 71 |
|
11 |
|
| 72 |
export default { |
12 |
export default { |
| 73 |
props: { |
13 |
props: { |
|
Lines 75-87
export default {
Link Here
|
| 75 |
}, |
15 |
}, |
| 76 |
setup() { |
16 |
setup() { |
| 77 |
const permissionsStore = inject("permissionsStore") |
17 |
const permissionsStore = inject("permissionsStore") |
| 78 |
|
|
|
| 79 |
const { isUserPermitted } = permissionsStore |
18 |
const { isUserPermitted } = permissionsStore |
| 80 |
|
19 |
|
|
|
20 |
const table_id = "vendor_contracts_table" |
| 21 |
useDataTable(table_id) |
| 22 |
|
| 81 |
return { |
23 |
return { |
| 82 |
isUserPermitted, |
24 |
isUserPermitted, |
|
|
25 |
table_id, |
| 83 |
} |
26 |
} |
| 84 |
}, |
27 |
}, |
|
|
28 |
methods: { |
| 29 |
buildDatatable() { |
| 30 |
let contracts = this.vendor.contracts |
| 31 |
let table_id = this.table_id |
| 32 |
let isUserPermitted = this.isUserPermitted |
| 33 |
|
| 34 |
$.fn.dataTable.ext.search = $.fn.dataTable.ext.search.filter( |
| 35 |
search => search.name != "apply_filter" |
| 36 |
) |
| 37 |
$("#" + table_id).dataTable( |
| 38 |
$.extend(true, {}, dataTablesDefaults, { |
| 39 |
data: contracts, |
| 40 |
embed: [], |
| 41 |
ordering: false, |
| 42 |
dom: '<"top pager"<"table_entries"ilp>>tr<"bottom pager"ip>', |
| 43 |
aLengthMenu: [ |
| 44 |
[10, 20, 50, 100], |
| 45 |
[10, 20, 50, 100], |
| 46 |
], |
| 47 |
autoWidth: false, |
| 48 |
columns: [ |
| 49 |
{ |
| 50 |
title: __("Name"), |
| 51 |
data: "contractname", |
| 52 |
searchable: false, |
| 53 |
orderable: false, |
| 54 |
render(data, type, row, meta) { |
| 55 |
return ( |
| 56 |
`<a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&booksellerid=${row.booksellerid}&contractnumber=${row.contractnumber}">` + |
| 57 |
escape_str(row.contractname) + |
| 58 |
"</a>" |
| 59 |
) |
| 60 |
}, |
| 61 |
}, |
| 62 |
{ |
| 63 |
title: __("Description"), |
| 64 |
data: "contractdescription", |
| 65 |
searchable: false, |
| 66 |
orderable: false, |
| 67 |
}, |
| 68 |
{ |
| 69 |
title: __("Start date"), |
| 70 |
data: "contractstartdate", |
| 71 |
searchable: false, |
| 72 |
orderable: false, |
| 73 |
}, |
| 74 |
{ |
| 75 |
title: __("End date"), |
| 76 |
data: "contractenddate", |
| 77 |
searchable: false, |
| 78 |
orderable: false, |
| 79 |
}, |
| 80 |
...(isUserPermitted( |
| 81 |
"CAN_user_acquisition_contracts_manage" |
| 82 |
) |
| 83 |
? [ |
| 84 |
{ |
| 85 |
title: __("Actions"), |
| 86 |
data: "contractnumber", |
| 87 |
searchable: false, |
| 88 |
orderable: false, |
| 89 |
render(data, type, row, meta) { |
| 90 |
return ( |
| 91 |
`<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>` + |
| 92 |
" " + |
| 93 |
__("Edit") + |
| 94 |
"</a>" + |
| 95 |
`<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>` + |
| 96 |
" " + |
| 97 |
__("Delete") + |
| 98 |
"</a>" |
| 99 |
) |
| 100 |
}, |
| 101 |
}, |
| 102 |
] |
| 103 |
: []), |
| 104 |
], |
| 105 |
}) |
| 106 |
) |
| 107 |
}, |
| 108 |
}, |
| 109 |
mounted() { |
| 110 |
this.buildDatatable() |
| 111 |
}, |
| 85 |
} |
112 |
} |
| 86 |
</script> |
113 |
</script> |
| 87 |
|
114 |
|
| 88 |
- |
|
|