Bugzilla – Attachment 174205 Details for
Bug 38010
Migrate vendors to Vue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38010: Add a contracts table to the vendor show component
Bug-38010-Add-a-contracts-table-to-the-vendor-show.patch (text/plain), 8.27 KB, created by
Matt Blenkinsop
on 2024-11-07 13:33:02 UTC
(
hide
)
Description:
Bug 38010: Add a contracts table to the vendor show component
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2024-11-07 13:33:02 UTC
Size:
8.27 KB
patch
obsolete
>From 67127e34346c9133940b09de831eb93432a300e4 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Wed, 25 Sep 2024 14:49:41 +0000 >Subject: [PATCH] Bug 38010: Add a contracts table to the vendor show component > >--- > .../components/Vendors/VendorContracts.vue | 153 ++++++++++-------- > 1 file changed, 90 insertions(+), 63 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue >index cb991ec9687..3bece17a122 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue >@@ -1,73 +1,13 @@ > <template> > <h2>{{ $__("Contract(s)") }}</h2> > <div class="dataTables_wrapper no-footer"> >- <table id="contractst"> >- <thead> >- <tr> >- <th scope="col">{{ $__("Name") }}</th> >- <th scope="col">{{ $__("Description") }}</th> >- <th scope="col">{{ $__("Start date") }}</th> >- <th scope="col">{{ $__("End date") }}</th> >- <th >- v-if=" >- isUserPermitted( >- 'CAN_user_acquisition_contracts_manage' >- ) >- " >- scope="col" >- class="NoSort noExport" >- > >- {{ $__("Actions") }} >- </th> >- </tr> >- </thead> >- <tbody> >- <tr v-for="(contract, i) in vendor.contracts" :key="i"> >- <td> >- <a >- :href="`/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=${contract.contractnumber}&booksellerid=${contract.booksellerid}`" >- >{{ contract.contractname }}</a >- > >- </td> >- <td>{{ contract.contractdescription }}</td> >- <td :data-order="contract.contractstartdate"> >- {{ contract.contractstartdate }} >- </td> >- <td :data-order="contract.contractenddate"> >- {{ contract.contractenddate }} >- </td> >- <td >- class="actions" >- v-if=" >- isUserPermitted( >- 'CAN_user_acquisition_contracts_manage' >- ) >- " >- > >- <a >- class="btn btn-default btn-xs" >- :href="`/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=${contract.contractnumber}&booksellerid=${contract.booksellerid}`" >- ><i >- class="fa-solid fa-pencil" >- aria-hidden="true" >- ></i> >- {{ $__("Edit") }}</a >- > >- <a >- class="btn btn-default btn-xs" >- :href="`/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=${contract.contractnumber}&booksellerid=${contract.booksellerid}`" >- ><i class="fa fa-trash-can"></i> >- {{ $__("Delete") }}</a >- > >- </td> >- </tr> >- </tbody> >- </table> >+ <table :id="table_id"></table> > </div> > </template> > > <script> > import { inject } from "vue" >+import { useDataTable } from "../../composables/datatables" > > export default { > props: { >@@ -75,13 +15,100 @@ export default { > }, > setup() { > const permissionsStore = inject("permissionsStore") >- > const { isUserPermitted } = permissionsStore > >+ const table_id = "vendor_contracts_table" >+ useDataTable(table_id) >+ > return { > isUserPermitted, >+ table_id, > } > }, >+ methods: { >+ buildDatatable() { >+ let contracts = this.vendor.contracts >+ let table_id = this.table_id >+ let isUserPermitted = this.isUserPermitted >+ >+ $.fn.dataTable.ext.search = $.fn.dataTable.ext.search.filter( >+ search => search.name != "apply_filter" >+ ) >+ $("#" + table_id).dataTable( >+ $.extend(true, {}, dataTablesDefaults, { >+ data: contracts, >+ embed: [], >+ ordering: false, >+ dom: '<"top pager"<"table_entries"ilp>>tr<"bottom pager"ip>', >+ aLengthMenu: [ >+ [10, 20, 50, 100], >+ [10, 20, 50, 100], >+ ], >+ autoWidth: false, >+ columns: [ >+ { >+ title: __("Name"), >+ data: "contractname", >+ searchable: false, >+ orderable: false, >+ render(data, type, row, meta) { >+ return ( >+ `<a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&booksellerid=${row.booksellerid}&contractnumber=${row.contractnumber}">` + >+ escape_str(row.contractname) + >+ "</a>" >+ ) >+ }, >+ }, >+ { >+ title: __("Description"), >+ data: "contractdescription", >+ searchable: false, >+ orderable: false, >+ }, >+ { >+ title: __("Start date"), >+ data: "contractstartdate", >+ searchable: false, >+ orderable: false, >+ }, >+ { >+ title: __("End date"), >+ data: "contractenddate", >+ searchable: false, >+ orderable: false, >+ }, >+ ...(isUserPermitted( >+ "CAN_user_acquisition_contracts_manage" >+ ) >+ ? [ >+ { >+ title: __("Actions"), >+ data: "contractnumber", >+ searchable: false, >+ orderable: false, >+ render(data, type, row, meta) { >+ return ( >+ `<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>` + >+ " " + >+ __("Edit") + >+ "</a>" + >+ `<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>` + >+ " " + >+ __("Delete") + >+ "</a>" >+ ) >+ }, >+ }, >+ ] >+ : []), >+ ], >+ }) >+ ) >+ }, >+ }, >+ mounted() { >+ this.buildDatatable() >+ }, > } > </script> > >-- >2.39.3 (Apple Git-146)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38010
:
174119
|
174120
|
174121
|
174122
|
174123
|
174124
|
174125
|
174126
|
174128
|
174129
|
174130
|
174131
|
174132
|
174133
|
174134
|
174135
|
174136
|
174137
|
174138
|
174139
|
174140
|
174141
|
174142
|
174143
|
174144
|
174145
|
174146
|
174147
|
174148
|
174151
|
174152
|
174153
|
174154
|
174155
|
174156
|
174157
|
174158
|
174159
|
174160
|
174161
|
174162
|
174163
|
174164
|
174165
|
174166
|
174167
|
174168
|
174169
|
174170
|
174171
|
174172
|
174173
|
174174
|
174175
|
174176
|
174177
|
174178
|
174179
|
174194
|
174196
|
174197
|
174198
|
174199
|
174200
|
174201
|
174202
|
174203
|
174204
|
174205
|
174206
|
174207
|
174208
|
174209
|
174210
|
174211
|
174212
|
174213
|
174214
|
174215
|
174216
|
174217
|
174218
|
174220
|
174221
|
174222
|
174223
|
174224
|
174225
|
174226
|
174248
|
174266
|
174267
|
174269
|
174270
|
174273
|
174327
|
174328
|
174329
|
174330
|
174331
|
174332
|
174333
|
174334
|
174335
|
174336
|
174337
|
174338
|
174339
|
174340
|
174341
|
174342
|
174343
|
174344
|
174345
|
174346
|
174347
|
174348
|
174349
|
174350
|
174351
|
174352
|
174353
|
174354
|
174355
|
174356
|
174357
|
174358
|
174359
|
174360
|
174603