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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/Main.vue (-56 / +3 lines)
Lines 37-55 import { APIClient } from "../../fetch/api-client" Link Here
37
export default {
37
export default {
38
    setup() {
38
    setup() {
39
        const vendorStore = inject("vendorStore")
39
        const vendorStore = inject("vendorStore")
40
40
        const { config } = storeToRefs(vendorStore)
41
        const AVStore = inject("AVStore")
42
41
43
        const mainStore = inject("mainStore")
42
        const mainStore = inject("mainStore")
44
45
        const { loading, loaded, setError } = mainStore
43
        const { loading, loaded, setError } = mainStore
44
        const AVStore = inject("AVStore")
46
45
47
        const permissionsStore = inject("permissionsStore")
46
        const permissionsStore = inject("permissionsStore")
48
        const { userPermissions } = storeToRefs(permissionsStore)
47
        const { userPermissions } = storeToRefs(permissionsStore)
49
48
50
        return {
49
        return {
51
            vendorStore,
50
            vendorStore,
52
            AVStore,
53
            setError,
51
            setError,
54
            loading,
52
            loading,
55
            loaded,
53
            loaded,
Lines 99-159 export default { Link Here
99
            this.initialized = true
97
            this.initialized = true
100
        })
98
        })
101
    },
99
    },
102
    beforeCreate() {
103
        this.loading()
104
105
        const fetchConfig = () => {
106
            let promises = []
107
108
            const av_client = APIClient.authorised_values
109
            const authorised_values = {
110
                vendor_types: "VENDOR_TYPE",
111
                vendor_interface_types: "VENDOR_INTERFACE_TYPE",
112
                vendor_payment_methods: "VENDOR_PAYMENT_METHOD",
113
                lang: "LANG",
114
            }
115
116
            let av_cat_array = Object.keys(authorised_values).map(function (
117
                av_cat
118
            ) {
119
                return '"' + authorised_values[av_cat] + '"'
120
            })
121
122
            promises.push(
123
                av_client.values
124
                    .getCategoriesWithValues(av_cat_array)
125
                    .then(av_categories => {
126
                        Object.entries(authorised_values).forEach(
127
                            ([av_var, av_cat]) => {
128
                                const av_match = av_categories.find(
129
                                    element => element.category_name == av_cat
130
                                )
131
                                this.AVStore[av_var] =
132
                                    av_match.authorised_values
133
                            }
134
                        )
135
                    })
136
            )
137
138
            return Promise.all(promises)
139
        }
140
141
        fetchConfig().then(() => {
142
            this.vendorStore.currencies = currencies
143
            this.vendorStore.gstValues = gstValues.map(gv => {
144
                return {
145
                    label: `${(gv.option * 100).toFixed(2)}%`,
146
                    value: gv.option,
147
                }
148
            })
149
            this.loaded()
150
            this.initialized = true
151
        })
152
    },
153
    data() {
100
    data() {
154
        this.userPermissions = userPermissions
101
        this.userPermissions = userPermissions
155
        return {
102
        return {
156
            initialized: true,
103
            initialized: false,
157
        }
104
        }
158
    },
105
    },
159
    methods: {},
106
    methods: {},
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorDetails.vue (-1 / +11 lines)
Lines 7-13 Link Here
7
            <li>
7
            <li>
8
                <label>{{ $__("Type") }}:</label>
8
                <label>{{ $__("Type") }}:</label>
9
                <span>
9
                <span>
10
                    {{ vendor.type }}
10
                    {{ get_lib_from_av("vendor_types", vendor.type) }}
11
                </span>
11
                </span>
12
            </li>
12
            </li>
13
            <li>
13
            <li>
Lines 68-77 Link Here
68
</template>
68
</template>
69
69
70
<script>
70
<script>
71
import { inject } from "vue"
72
71
export default {
73
export default {
72
    props: {
74
    props: {
73
        vendor: Object,
75
        vendor: Object,
74
    },
76
    },
77
    setup() {
78
        const AVStore = inject("AVStore")
79
        const { get_lib_from_av } = AVStore
80
81
        return {
82
            get_lib_from_av,
83
        }
84
    },
75
}
85
}
76
</script>
86
</script>
77
87
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorInterfaces.vue (-1 / +3 lines)
Lines 7-13 Link Here
7
            <legend>{{ vi.name }}</legend>
7
            <legend>{{ vi.name }}</legend>
8
            <li>
8
            <li>
9
                <label>{{ $__("Type") }}:</label>
9
                <label>{{ $__("Type") }}:</label>
10
                <span> NEED AUTHORISED VALUES </span>
10
                <span>
11
                    {{ get_lib_from_av("vendor_interface_types", vi.type) }}
12
                </span>
11
            </li>
13
            </li>
12
            <li v-if="vi.uri">
14
            <li v-if="vi.uri">
13
                <label>{{ $__("URI") }}:</label>
15
                <label>{{ $__("URI") }}:</label>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue (-4 lines)
Lines 67-79 export default { Link Here
67
67
68
        const { setConfirmationDialog, setMessage } = inject("mainStore")
68
        const { setConfirmationDialog, setMessage } = inject("mainStore")
69
69
70
        // const AVStore = inject("AVStore")
71
        // const { get_lib_from_av } = AVStore
72
73
        return {
70
        return {
74
            format_date,
71
            format_date,
75
            patron_to_html,
72
            patron_to_html,
76
            // get_lib_from_av,
77
            setConfirmationDialog,
73
            setConfirmationDialog,
78
            setMessage,
74
            setMessage,
79
        }
75
        }
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/vendors.ts (-1 / +1 lines)
Lines 21-27 import { routes as routesDef } from "../routes/vendors"; Link Here
21
21
22
import { useMainStore } from "../stores/main";
22
import { useMainStore } from "../stores/main";
23
import { useVendorStore } from "../stores/vendors";
23
import { useVendorStore } from "../stores/vendors";
24
import { useAVStore } from "../stores/authorised-values";
24
import { useAVStore } from "../stores/authorisedValues/authorised-values";
25
import { useNavigationStore } from "../stores/navigation";
25
import { useNavigationStore } from "../stores/navigation";
26
import { usePermissionsStore } from "../stores/permissions";
26
import { usePermissionsStore } from "../stores/permissions";
27
import i18n from "../i18n";
27
import i18n from "../i18n";
(-)a/webpack.config.js (-47 lines)
Lines 1-46 Link Here
1
const { VueLoaderPlugin } = require("vue-loader");
2
const autoprefixer = require("autoprefixer");
3
const path = require("path");
4
const webpack = require('webpack');
5
6
module.exports = {
7
  entry: {
8
    erm: "./koha-tmpl/intranet-tmpl/prog/js/vue/modules/erm.ts",
9
    preservation: "./koha-tmpl/intranet-tmpl/prog/js/vue/modules/preservation.ts",
10
    "admin/record_sources": "./koha-tmpl/intranet-tmpl/prog/js/vue/modules/admin/record_sources.ts",
11
    vendors: "./koha-tmpl/intranet-tmpl/prog/js/vue/modules/vendors.ts",
12
  },
13
  output: {
14
    filename: "[name].js",
15
    path: path.resolve(__dirname, "koha-tmpl/intranet-tmpl/prog/js/vue/dist/"),
16
    chunkFilename: "[name].js",
17
  },
18
  module: {
19
    rules: [
20
      {
21
        test: /\.vue$/,
22
        loader: "vue-loader",
23
        exclude: [path.resolve(__dirname, "t/cypress/")],
24
      },
25
      {
26
        test: /\.ts$/,
27
        loader: 'ts-loader',
28
        options: {
29
          appendTsSuffixTo: [/\.vue$/]
30
        },
31
        exclude: [path.resolve(__dirname, "t/cypress/")],
32
      },
33
      {
34
        test: /\.css$/,
35
        use: ['style-loader', 'css-loader'],
36
      }
37
    ],
38
  },
39
  plugins: [
40
    new VueLoaderPlugin(),
41
    new webpack.DefinePlugin({
42
      __VUE_OPTIONS_API__: true,
43
      __VUE_PROD_DEVTOOLS__: false,
44
    }),
45
  ],
46
};
47
- 

Return to bug 38010