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

(-)a/Koha/REST/V1/Acquisitions/Vendors.pm (+21 lines)
Lines 169-172 sub delete { Link Here
169
    };
169
    };
170
}
170
}
171
171
172
=head3 config
173
174
Return the configuration options needed for the ERM Vue app
175
176
=cut
177
178
sub config {
179
    my $c = shift->openapi->valid_input or return;
180
181
    my $patron      = $c->stash('koha.user');
182
    my $userflags   = C4::Auth::getuserflags( $patron->flags, $patron->id );
183
    my $permissions = Koha::Auth::Permissions->get_authz_from_flags( { flags => $userflags } );
184
185
    return $c->render(
186
        status  => 200,
187
        openapi => {
188
            permissions => $permissions,
189
        },
190
    );
191
}
192
172
1;
193
1;
(-)a/api/v1/swagger/definitions/vendors_config.yaml (+7 lines)
Line 0 Link Here
1
---
2
type: object
3
properties:
4
  permissions:
5
    type: object
6
    description: List of permissions for the user
7
additionalProperties: false
(-)a/api/v1/swagger/paths/acquisitions_vendors_config.yaml (+38 lines)
Line 0 Link Here
1
---
2
/acquisitions/vendors/config:
3
  get:
4
    x-mojo-to: Acquisitions::Vendors#config
5
    operationId: getVendorsconfig
6
    description: This resource returns a list of options needed for the Vendors Vue app
7
    summary: get the Vendors config
8
    tags:
9
      - vendors_config
10
    produces:
11
      - application/json
12
    responses:
13
      200:
14
        description: The Vendors config
15
        schema:
16
          $ref: "../swagger.yaml#/definitions/vendors_config"
17
      400:
18
        description: Bad request
19
        schema:
20
          $ref: "../swagger.yaml#/definitions/error"
21
      403:
22
        description: Access forbidden
23
        schema:
24
          $ref: "../swagger.yaml#/definitions/error"
25
      500:
26
        description: |
27
          Internal server error. Possible `error_code` attribute values:
28
29
          * `internal_server_error`
30
        schema:
31
          $ref: "../swagger.yaml#/definitions/error"
32
      503:
33
        description: Under maintenance
34
        schema:
35
          $ref: "../swagger.yaml#/definitions/error"
36
    x-koha-authorization:
37
      permissions:
38
        acquisition: 1
(-)a/api/v1/swagger/swagger.yaml (+4 lines)
Lines 188-193 definitions: Link Here
188
    $ref: ./definitions/vendor.yaml
188
    $ref: ./definitions/vendor.yaml
189
  vendor_issue:
189
  vendor_issue:
190
    $ref: ./definitions/vendor_issue.yaml
190
    $ref: ./definitions/vendor_issue.yaml
191
  vendors_config:
192
    $ref: ./definitions/vendors_config.yaml
191
paths:
193
paths:
192
  /acquisitions/baskets:
194
  /acquisitions/baskets:
193
    $ref: ./paths/acquisitions_baskets.yaml#/~1acquisitions~1baskets
195
    $ref: ./paths/acquisitions_baskets.yaml#/~1acquisitions~1baskets
Lines 207-212 paths: Link Here
207
    $ref: "./paths/acquisitions_orders.yaml#/~1acquisitions~1orders~1{order_id}"
209
    $ref: "./paths/acquisitions_orders.yaml#/~1acquisitions~1orders~1{order_id}"
208
  /acquisitions/vendors:
210
  /acquisitions/vendors:
209
    $ref: ./paths/acquisitions_vendors.yaml#/~1acquisitions~1vendors
211
    $ref: ./paths/acquisitions_vendors.yaml#/~1acquisitions~1vendors
212
  /acquisitions/vendors/config:
213
    $ref: ./paths/acquisitions_vendors_config.yaml#/~1acquisitions~1vendors~1config
210
  "/acquisitions/vendors/{vendor_id}":
214
  "/acquisitions/vendors/{vendor_id}":
211
    $ref: "./paths/acquisitions_vendors.yaml#/~1acquisitions~1vendors~1{vendor_id}"
215
    $ref: "./paths/acquisitions_vendors.yaml#/~1acquisitions~1vendors~1{vendor_id}"
212
  "/acquisitions/vendors/{vendor_id}/issues":
216
  "/acquisitions/vendors/{vendor_id}/issues":
(-)a/koha-tmpl/intranet-tmpl/prog/js/fetch/acquisition-api-client.js (+9 lines)
Lines 5-10 export class AcquisitionAPIClient { Link Here
5
        });
5
        });
6
    }
6
    }
7
7
8
    get config() {
9
        return {
10
            get: moduleEndpoint =>
11
                this.httpClient.get({
12
                    endpoint: moduleEndpoint + "/config",
13
                }),
14
        };
15
    }
16
8
    get vendors() {
17
    get vendors() {
9
        return {
18
        return {
10
            get: id =>
19
            get: id =>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/Main.vue (-12 / +16 lines)
Lines 32-37 import LeftMenu from "../LeftMenu.vue"; Link Here
32
import Dialog from "../Dialog.vue";
32
import Dialog from "../Dialog.vue";
33
import "vue-select/dist/vue-select.css";
33
import "vue-select/dist/vue-select.css";
34
import { storeToRefs } from "pinia";
34
import { storeToRefs } from "pinia";
35
import { APIClient } from "../../fetch/api-client.js";
35
36
36
export default {
37
export default {
37
    setup() {
38
    setup() {
Lines 61-78 export default { Link Here
61
62
62
        this.loadAuthorisedValues(this.authorisedValues, this.vendorStore).then(
63
        this.loadAuthorisedValues(this.authorisedValues, this.vendorStore).then(
63
            () => {
64
            () => {
64
                this.userPermissions = userPermissions;
65
                const client = APIClient.acquisition;
65
                this.config.settings.edifact = edifact;
66
                client.config.get("vendors").then(config => {
66
                this.config.settings.marcOrderAutomation = marcOrderAutomation;
67
                    this.userPermissions = config.permissions;
67
                this.vendorStore.currencies = currencies;
68
                    this.config.settings.edifact = edifact;
68
                this.vendorStore.gstValues = gstValues.map(gv => {
69
                    this.config.settings.marcOrderAutomation =
69
                    return {
70
                        marcOrderAutomation;
70
                        label: `${Number(gv.option * 100).format_price()}%`,
71
                    this.vendorStore.currencies = currencies;
71
                        value: gv.option,
72
                    this.vendorStore.gstValues = gstValues.map(gv => {
72
                    };
73
                        return {
74
                            label: `${Number(gv.option * 100).format_price()}%`,
75
                            value: gv.option,
76
                        };
77
                    });
78
                    this.loaded();
79
                    this.initialized = true;
73
                });
80
                });
74
                this.loaded();
75
                this.initialized = true;
76
            }
81
            }
77
        );
82
        );
78
    },
83
    },
79
- 

Return to bug 38010