DocumentDetails.vue 21.8 KB
Newer Older
dbulatovicx32's avatar
dbulatovicx32 committed
1
<template>
BojanSovticEngIT's avatar
BojanSovticEngIT committed
2
    <div v-if="viewMode === 'document-detail' || $route.name === 'document-details-new-document' || $route.name === 'document-details-edit-document'" id="document-details-container" class="p-d-flex p-flex-column kn-flex kn-height-full">
3
4
5
6
7
8
        <Toolbar class="kn-toolbar kn-toolbar--primary p-p-0 p-m-0 p-col-12">
            <template #start>
                {{ $t('documentExecution.documentDetails.title') }}
            </template>
            <template #end>
                <Button icon="pi pi-save" class="p-button-text p-button-rounded p-button-plain" v-tooltip.bottom="$t('common.save')" @click="saveDocument" :disabled="invalidDrivers > 0 || invalidOutputParams > 0 || v$.$invalid" />
9
                <Button v-if="propMode === 'execution'" icon="pi pi-times" class="p-button-text p-button-rounded p-button-plain" v-tooltip.bottom="$t('common.close')" @click="closeDocument" />
10
11
            </template>
        </Toolbar>
dbulatovicx32's avatar
dbulatovicx32 committed
12
        <ProgressSpinner v-if="loading" class="doc-details-spinner" :style="mainDescriptor.style.spinnerStyle" />
13

dbulatovicx32's avatar
dbulatovicx32 committed
14
        <div class="document-details-tab-container p-d-flex p-flex-column kn-flex">
dbulatovicx32's avatar
dbulatovicx32 committed
15
            <TabView class="document-details-tabview p-d-flex p-flex-column kn-flex" @tab-change="onTabChange">
dbulatovicx32's avatar
dbulatovicx32 committed
16
17
18
19
20
                <TabPanel>
                    <template #header>
                        <span>{{ $t('documentExecution.documentDetails.info.infoTitle') }}</span>
                    </template>
                    <InformationsTab
dbulatovicx32's avatar
dbulatovicx32 committed
21
                        v-if="!loading"
dbulatovicx32's avatar
dbulatovicx32 committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
                        :selectedDocument="selectedDocument"
                        :availableFolders="availableFolders"
                        :documentTypes="types"
                        :documentEngines="engines"
                        :availableDatasources="dataSources"
                        :availableStates="states"
                        :selectedDataset="selectedDataset"
                        :availableTemplates="templates"
                        :availableAttributes="attributes"
                        @setTemplateForUpload="setTemplateForUpload"
                        @setImageForUpload="setImageForUpload"
                        @deleteImage="deleteImage"
                    />
                </TabPanel>
                <TabPanel v-if="this.selectedDocument?.id">
                    <template #header>
                        <span v-bind:class="{ 'details-warning-color': invalidDrivers }">{{ $t('documentExecution.documentDetails.drivers.title') }}</span>
                        <Badge :value="invalidDrivers" class="p-ml-2" severity="danger" v-if="invalidDrivers > 0"></Badge>
                    </template>
                    <DriversTab :selectedDocument="selectedDocument" :availableDrivers="drivers" :availableAnalyticalDrivers="analyticalDrivers" />
                </TabPanel>
                <TabPanel v-if="this.selectedDocument?.id">
                    <template #header>
                        <span v-bind:class="{ 'details-warning-color': invalidOutputParams }">{{ $t('documentExecution.documentDetails.outputParams.title') }}</span>
                        <Badge :value="invalidOutputParams" class="p-ml-2" severity="danger" v-if="invalidOutputParams > 0"></Badge>
                    </template>
                    <OutputParamsTab :selectedDocument="selectedDocument" :typeList="parTypes" :dateFormats="dateFormats" />
                </TabPanel>
                <TabPanel v-if="this.selectedDocument?.id">
                    <template #header>
                        <span>{{ $t('documentExecution.documentDetails.dataLineage.title') }}</span>
                    </template>

                    <DataLineageTab :selectedDocument="selectedDocument" :metaSourceResource="metaSourceResource" :savedTables="savedTables" />
                </TabPanel>
                <TabPanel v-if="this.selectedDocument?.id">
                    <template #header>
                        <span>{{ $t('documentExecution.documentDetails.history.title') }}</span>
                    </template>
                    <HistoryTab :selectedDocument="selectedDocument" />
                </TabPanel>
                <TabPanel v-if="this.selectedDocument?.id && this.selectedDocument?.typeCode == 'REPORT' && this.selectedDocument?.engine == 'knowagejasperreporte'">
                    <template #header>
                        <span>{{ $t('documentExecution.documentDetails.subreports.title') }}</span>
                    </template>
dbulatovicx32's avatar
dbulatovicx32 committed
67
68

                    <SubreportsTab :selectedDocument="selectedDocument" :allDocumentDetailsProp="allDocumentDetails" />
dbulatovicx32's avatar
dbulatovicx32 committed
69
70
71
                </TabPanel>
            </TabView>
        </div>
72
73
74
    </div>

    <!-- </Dialog> -->
dbulatovicx32's avatar
dbulatovicx32 committed
75
76
77
</template>

<script lang="ts">
dbulatovicx32's avatar
dbulatovicx32 committed
78
79
80
81
82
83
84
85
86
import { defineComponent } from 'vue'
import { AxiosResponse } from 'axios'
import useValidate from '@vuelidate/core'
import mainDescriptor from './DocumentDetailsDescriptor.json'
import InformationsTab from './tabs/informations/DocumentDetailsInformations.vue'
import DriversTab from './tabs/drivers/DocumentDetailsDrivers.vue'
import OutputParamsTab from './tabs/outputParams/DocumentDetailsOutputParameters.vue'
import DataLineageTab from './tabs/dataLineage/DocumentDetailsDataLineage.vue'
import HistoryTab from './tabs/history/DocumentDetailsHistory.vue'
dbulatovicx32's avatar
dbulatovicx32 committed
87
import SubreportsTab from './tabs/subreports/DocumentDetailsSubreports.vue'
88
// import Dialog from 'primevue/dialog'
dbulatovicx32's avatar
dbulatovicx32 committed
89
90
91
import TabView from 'primevue/tabview'
import Badge from 'primevue/badge'
import TabPanel from 'primevue/tabpanel'
dbulatovicx32's avatar
dbulatovicx32 committed
92
import ProgressSpinner from 'primevue/progressspinner'
dbulatovicx32's avatar
dbulatovicx32 committed
93
import { iDataSource, iAnalyticalDriver, iDriver, iEngine, iTemplate, iAttribute, iParType, iDateFormat, iFolder, iTableSmall, iOutputParam, iDocumentType } from '@/modules/documentExecution/documentDetails/DocumentDetails'
dbulatovicx32's avatar
dbulatovicx32 committed
94

dbulatovicx32's avatar
dbulatovicx32 committed
95
96
export default defineComponent({
    name: 'document-details',
97
98
99
100
101
102
103
104
105
106
107
108
109
    components: {
        InformationsTab,
        DriversTab,
        OutputParamsTab,
        DataLineageTab,
        HistoryTab,
        SubreportsTab,
        TabView,
        TabPanel,
        // Dialog,
        Badge,
        ProgressSpinner
    },
BojanSovticEngIT's avatar
Hotfix    
BojanSovticEngIT committed
110
    props: { propDocId: { type: String }, propFolderId: { type: String }, propMode: { type: String }, viewMode: { type: String } },
BojanSovticEngIT's avatar
Update    
BojanSovticEngIT committed
111
    emits: ['closeDetails', 'documentSaved'],
dbulatovicx32's avatar
dbulatovicx32 committed
112
113
114
115
116
    data() {
        return {
            v$: useValidate() as any,
            mainDescriptor,
            loading: false,
dbulatovicx32's avatar
dbulatovicx32 committed
117
118
            docId: null as any,
            folderId: null as any,
dbulatovicx32's avatar
dbulatovicx32 committed
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
            templateToUpload: null as any,
            imageToUpload: null as any,
            selectedDataset: {} as any,
            selectedDocument: {} as any,
            dataSources: [] as iDataSource[],
            analyticalDrivers: [] as iAnalyticalDriver[],
            drivers: [] as iDriver[],
            engines: [] as iEngine[],
            templates: [] as iTemplate[],
            attributes: [] as iAttribute[],
            parTypes: [] as iParType[],
            dateFormats: [] as iDateFormat[],
            metaSourceResource: [] as any,
            savedTables: [] as iTableSmall[],
            availableFolders: [] as iFolder[],
            states: mainDescriptor.states,
dbulatovicx32's avatar
dbulatovicx32 committed
135
136
137
138
            types: [] as iDocumentType[],
            allDocumentDetails: [] as any,
            savedSubreports: [] as any,
            selectedSubreports: [] as any
dbulatovicx32's avatar
dbulatovicx32 committed
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
        }
    },
    computed: {
        invalidOutputParams(): number {
            if (this.selectedDocument && this.selectedDocument.outputParameters) {
                return this.selectedDocument.outputParameters.filter((parameter: any) => parameter.numberOfErrors > 0).length
            }
            return 0
        },
        invalidDrivers(): number {
            if (this.selectedDocument && this.selectedDocument.drivers) {
                return this.selectedDocument.drivers.filter((parameter: any) => parameter.numberOfErrors > 0).length
            }
            return 0
        }
    },
BojanSovticEngIT's avatar
Update    
BojanSovticEngIT committed
155
156
157
158
159
160
    watch: {
        async propDocId() {
            this.isForEdit()
            await this.loadPage(this.docId)
        }
    },
dbulatovicx32's avatar
dbulatovicx32 committed
161
    async created() {
BojanSovticEngIT's avatar
BojanSovticEngIT committed
162
        if (this.viewMode !== 'document-detail' && this.$route.name !== 'document-details-new-document' && this.$route.name !== 'document-details-edit-document') return
dbulatovicx32's avatar
dbulatovicx32 committed
163
        this.isForEdit()
dbulatovicx32's avatar
dbulatovicx32 committed
164
165
166
        await this.loadPage(this.docId)
    },
    methods: {
dbulatovicx32's avatar
dbulatovicx32 committed
167
        isForEdit() {
168
169
170
171
172
173
174
            if (this.propMode === 'execution') {
                this.loadAsExecution()
            } else {
                this.loadAsDetail()
            }
        },
        loadAsExecution() {
BojanSovticEngIT's avatar
Update    
BojanSovticEngIT committed
175
176
            this.docId = this.propDocId
            this.folderId = this.propFolderId
177
178
179
        },
        loadAsDetail() {
            this.$route.params.docId ? (this.docId = this.$route.params.docId) : (this.folderId = this.$route.params.folderId)
dbulatovicx32's avatar
dbulatovicx32 committed
180
        },
dbulatovicx32's avatar
dbulatovicx32 committed
181
182
183
184
185
        async loadPage(id) {
            this.loading = true
            await Promise.all([
                await this.getSelectedDocumentById(id),
                this.getFunctionalities(),
dbulatovicx32's avatar
dbulatovicx32 committed
186
                this.getAnalyticalDrivers(),
dbulatovicx32's avatar
dbulatovicx32 committed
187
188
189
190
191
192
193
194
                this.getDatasources(),
                this.getTypes(),
                this.getEngines(),
                this.getAttributes(),
                this.getParTypes(),
                this.getDateFormats(),
                this.getSavedTablesByDocumentID(),
                this.getDataset(),
dbulatovicx32's avatar
dbulatovicx32 committed
195
                this.getDataSources()
dbulatovicx32's avatar
dbulatovicx32 committed
196
197
198
199
200
201
202
203
            ])
            this.loading = false
        },
        async getSelectedDocumentById(id) {
            if (id) {
                await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documents/${id}`).then((response: AxiosResponse<any>) => (this.selectedDocument = response.data))
            } else {
                this.selectedDocument = { ...this.mainDescriptor.newDocument }
dbulatovicx32's avatar
dbulatovicx32 committed
204
                this.selectedDocument.functionalities = []
dbulatovicx32's avatar
dbulatovicx32 committed
205
206
207
            }
        },
        async getFunctionalities() {
dbulatovicx32's avatar
dbulatovicx32 committed
208
209
210
211
212
213
214
            await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/folders?includeDocs=false`).then((response: AxiosResponse<any>) => {
                this.availableFolders = response.data
                if (this.$route.params.folderId) {
                    let sourceFolder = this.availableFolders.find((folder) => folder.id == parseInt(this.folderId)) as iFolder
                    this.selectedDocument.functionalities.push(sourceFolder.path)
                }
            })
dbulatovicx32's avatar
dbulatovicx32 committed
215
216
217
218
219
220
221
222
223
224
        },
        async getAnalyticalDrivers() {
            await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/analyticalDrivers`).then((response: AxiosResponse<any>) => (this.analyticalDrivers = response.data))
        },
        async getDatasources() {
            await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/datasources`).then((response: AxiosResponse<any>) => (this.dataSources = response.data))
        },
        async getDocumentDrivers() {
            if (this.selectedDocument?.id) {
                await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documentdetails/${this.selectedDocument?.id}/drivers`).then((response: AxiosResponse<any>) => (this.drivers = response.data))
dbulatovicx32's avatar
dbulatovicx32 committed
225
226
            }
        },
dbulatovicx32's avatar
dbulatovicx32 committed
227
228
229
        async getTemplates() {
            if (this.selectedDocument?.id) {
                await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documentdetails/${this.selectedDocument?.id}/templates`).then((response: AxiosResponse<any>) => (this.templates = response.data))
dbulatovicx32's avatar
dbulatovicx32 committed
230
231
            }
        },
dbulatovicx32's avatar
dbulatovicx32 committed
232
233
        async getTypes() {
            await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `1.0/document-detail/types`).then((response: AxiosResponse<any>) => (this.types = response.data))
dbulatovicx32's avatar
dbulatovicx32 committed
234
        },
dbulatovicx32's avatar
dbulatovicx32 committed
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
        async getEngines() {
            await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `1.0/document-detail/engines`).then((response: AxiosResponse<any>) => (this.engines = response.data))
        },
        async getAttributes() {
            await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/attributes`).then((response: AxiosResponse<any>) => (this.attributes = response.data))
        },
        async getParTypes() {
            await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/domains/listByCode/PAR_TYPE`).then((response: AxiosResponse<any>) => (this.parTypes = response.data))
        },
        async getDateFormats() {
            await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/domains/listByCode/DATE_FORMAT`).then((response: AxiosResponse<any>) => (this.dateFormats = response.data))
        },
        async getDataSources() {
            await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/metaSourceResource/`).then((response: AxiosResponse<any>) => (this.metaSourceResource = response.data))
        },
        async getSavedTablesByDocumentID() {
            if (this.selectedDocument.id) {
                await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/metaDocumetRelationResource/document/${this.selectedDocument.id}`).then((response: AxiosResponse<any>) => (this.savedTables = response.data))
            }
        },
        async getDataset() {
            if (this.selectedDocument?.dataSetId) {
                await this.$http
                    .get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `1.0/datasets/dataset/id/${this.selectedDocument?.dataSetId}`, { headers: { 'X-Disable-Errors': 'true' } })
                    .then((response: AxiosResponse<any>) => {
                        this.selectedDataset = response.data[0]
dbulatovicx32's avatar
dbulatovicx32 committed
261
                    })
dbulatovicx32's avatar
dbulatovicx32 committed
262
263
                    .catch((error) => {
                        this.$store.commit('setError', { title: this.$t('common.toast.errorTitle'), msg: error.message })
dbulatovicx32's avatar
dbulatovicx32 committed
264
                    })
dbulatovicx32's avatar
dbulatovicx32 committed
265
266
            }
        },
dbulatovicx32's avatar
dbulatovicx32 committed
267
        async getAllSubreports() {
dbulatovicx32's avatar
dbulatovicx32 committed
268
            this.loading = true
dbulatovicx32's avatar
dbulatovicx32 committed
269
            await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documentdetails/`).then((response: AxiosResponse<any>) => (this.allDocumentDetails = response.data))
dbulatovicx32's avatar
dbulatovicx32 committed
270
            this.loading = false
dbulatovicx32's avatar
dbulatovicx32 committed
271
        },
dbulatovicx32's avatar
dbulatovicx32 committed
272
273
274
275
276
277
278
279
280
281
        setTemplateForUpload(event) {
            this.templateToUpload = event
        },
        async uploadTemplate(uploadedFile, responseId) {
            if (this.templateToUpload) {
                var formData = new FormData()
                formData.append('file', uploadedFile)
                await this.$http
                    .post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documentdetails/${responseId}/templates`, formData, {
                        headers: { 'Content-Type': 'multipart/form-data', 'X-Disable-Errors': 'true' }
dbulatovicx32's avatar
dbulatovicx32 committed
282
                    })
dbulatovicx32's avatar
dbulatovicx32 committed
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
                    .then(() => (this.templateToUpload = null))
                    .catch(() => {
                        this.$store.commit('setError', { title: this.$t('common.toast.errorTitle'), msg: this.$t('documentExecution.documentDetails.history.uploadError') })
                    })
            }
        },
        deleteImage() {
            this.$http
                .delete(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documentdetails/${this.selectedDocument.id}/image`, { headers: { Accept: 'application/json, text/plain, */*', 'X-Disable-Errors': 'true' } })
                .then(() => this.loadPage(this.docId))
                .catch(() => this.$store.commit('setError', { title: this.$t('common.toast.errorTitle'), msg: this.$t('documentExecution.documentDetails.info.imageError') }))
        },
        setImageForUpload(event) {
            this.imageToUpload = event
        },
        async uploadImage(uploadedFile, responseId) {
            if (this.imageToUpload) {
                var formData = new FormData()
                formData.append('file', uploadedFile)
                formData.append('fileName', uploadedFile.name)
                await this.$http
                    .post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documentdetails/${responseId}/image`, formData, {
                        headers: { 'Content-Type': 'multipart/form-data', 'X-Disable-Errors': 'true' }
                    })
                    .then(() => (this.imageToUpload = null))
                    .catch(() => {
                        this.$store.commit('setError', { title: this.$t('common.toast.errorTitle'), msg: this.$t('documentExecution.documentDetails.info.imageUploadError') })
                    })
            }
        },
        async saveOutputParams() {
            if (this.selectedDocument.outputParameters) {
                this.selectedDocument.outputParameters.forEach((parameter: iOutputParam) => {
                    if (!parameter.id) {
                        delete parameter.numberOfErrors
                        delete parameter.tempId
                        delete parameter.isChanged
                        this.$http
                            .post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documentdetails/${this.selectedDocument.id}/outputparameters`, parameter, { headers: { Accept: 'application/json, text/plain, */*', 'X-Disable-Errors': 'true' } })
                            .catch(() => this.$store.commit('setError', { title: this.$t('common.toast.errorTitle'), msg: this.$t('documentExecution.documentDetails.outputParams.persistError') }))
                    } else if (parameter.isChanged) {
                        delete parameter.numberOfErrors
                        delete parameter.isChanged
                        this.$http
                            .put(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documentdetails/${this.selectedDocument.id}/outputparameters/${parameter.id}`, parameter, { headers: { Accept: 'application/json, text/plain, */*', 'X-Disable-Errors': 'true' } })
                            .catch(() => this.$store.commit('setError', { title: this.$t('common.toast.errorTitle'), msg: this.$t('documentExecution.documentDetails.outputParams.persistError') }))
                    }
                })
            }
        },
        async saveDrivers() {
            if (this.selectedDocument.drivers) {
                this.selectedDocument.drivers.forEach((driver: iDriver) => {
                    driver.modifiable = 0
                    if (!driver.id) {
                        delete driver.numberOfErrors
                        delete driver.isChanged
                        this.$http
                            .post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documentdetails/${this.selectedDocument.id}/drivers`, driver, { headers: { Accept: 'application/json, text/plain, */*', 'X-Disable-Errors': 'true' } })
                            .catch(() => this.$store.commit('setError', { title: this.$t('common.toast.errorTitle'), msg: this.$t('documentExecution.documentDetails.drivers.persistError') }))
                    } else if (driver.isChanged) {
                        delete driver.numberOfErrors
                        delete driver.isChanged
                        this.$http
                            .put(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documentdetails/${this.selectedDocument.id}/drivers/${driver.id}`, driver, { headers: { Accept: 'application/json, text/plain, */*', 'X-Disable-Errors': 'true' } })
                            .catch(() => this.$store.commit('setError', { title: this.$t('common.toast.errorTitle'), msg: this.$t('documentExecution.documentDetails.drivers.persistError') }))
                    }
                })
dbulatovicx32's avatar
dbulatovicx32 committed
351
            }
dbulatovicx32's avatar
dbulatovicx32 committed
352
353
354
355
356
357
358
359
360
        },
        saveRequest(docToSave) {
            if (!this.selectedDocument.id) {
                return this.$http.post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documentdetails`, docToSave, { headers: { Accept: 'application/json, text/plain, */*', 'X-Disable-Errors': 'true' } })
            } else {
                return this.$http.put(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documentdetails/${docToSave.id}`, docToSave, { headers: { Accept: 'application/json, text/plain, */*', 'X-Disable-Errors': 'true' } })
            }
        },
        async saveDocument() {
dbulatovicx32's avatar
dbulatovicx32 committed
361
            this.loading = true
dbulatovicx32's avatar
dbulatovicx32 committed
362
363
364
365
366
367
368
369
370
371
372
373
374
            let docToSave = { ...this.selectedDocument }
            delete docToSave.drivers
            delete docToSave.outputParameters
            delete docToSave.dataSetLabel

            await this.saveRequest(docToSave)
                .then(async (response: AxiosResponse<any>) => {
                    await this.saveOutputParams()
                    await this.saveDrivers()
                    await this.uploadTemplate(this.templateToUpload, response.data.id)
                    await this.uploadImage(this.imageToUpload, response.data.id)
                    this.$store.commit('setInfo', { title: this.$t('common.save'), msg: this.$t('common.toast.updateSuccess') })
                    setTimeout(() => {
dbulatovicx32's avatar
dbulatovicx32 committed
375
376
                        const path = `/document-details/${response.data.id}`
                        !this.selectedDocument.id ? this.$router.push(path) : ''
BojanSovticEngIT's avatar
Fix    
BojanSovticEngIT committed
377
                        if (!docToSave.id) this.$emit('documentSaved', response.data)
dbulatovicx32's avatar
dbulatovicx32 committed
378
379
380
381
                        this.loadPage(response.data.id)
                    }, 200)
                })
                .catch((error) => this.$store.commit('setError', { title: this.$t('common.toast.errorTitle'), msg: error.message }))
dbulatovicx32's avatar
dbulatovicx32 committed
382
383
        },
        closeDocument() {
BojanSovticEngIT's avatar
Routing    
BojanSovticEngIT committed
384
            this.$emit('closeDetails')
dbulatovicx32's avatar
dbulatovicx32 committed
385
386
387
        },
        onTabChange(event) {
            event.index === 5 ? this.getAllSubreports() : ''
dbulatovicx32's avatar
dbulatovicx32 committed
388
        }
dbulatovicx32's avatar
dbulatovicx32 committed
389
390
    }
})
dbulatovicx32's avatar
dbulatovicx32 committed
391
392
393
</script>

<style lang="scss">
dbulatovicx32's avatar
dbulatovicx32 committed
394
395
396
397
398
399
.right-border {
    border-right: 1px solid #ccc;
}
.document-details-tabview .p-tabview-panels {
    padding: 0 !important;
}
BojanSovticEngIT's avatar
Routing    
BojanSovticEngIT committed
400

dbulatovicx32's avatar
dbulatovicx32 committed
401
402
.document-details-dialog.p-dialog {
    max-height: 100%;
BojanSovticEngIT's avatar
Routing    
BojanSovticEngIT committed
403
    height: 80vh;
dbulatovicx32's avatar
dbulatovicx32 committed
404
405
406
    width: calc(100vw - var(--kn-mainmenu-width));
    margin: 0;
}
dbulatovicx32's avatar
dbulatovicx32 committed
407

dbulatovicx32's avatar
dbulatovicx32 committed
408
409
410
411
412
.remove-padding.p-dialog .p-dialog-header,
.remove-padding.p-dialog .p-dialog-content {
    padding: 0;
    margin: 0;
}
dbulatovicx32's avatar
dbulatovicx32 committed
413

dbulatovicx32's avatar
dbulatovicx32 committed
414
415
416
417
418
419
.document-details-tab-container .p-tabview .p-tabview-panel,
.document-details-tab-container .p-tabview .p-tabview-panels {
    display: flex;
    flex-direction: column;
    flex: 1;
}
dbulatovicx32's avatar
dbulatovicx32 committed
420

dbulatovicx32's avatar
dbulatovicx32 committed
421
422
423
.details-warning-color {
    color: red;
}
dbulatovicx32's avatar
dbulatovicx32 committed
424
425
426
427

.doc-details-spinner .p-progress-spinner-svg {
    width: 125px;
}
dbulatovicx32's avatar
dbulatovicx32 committed
428
</style>