Skip to content

Commit

Permalink
feat: add-print-button-on-waypoint-page
Browse files Browse the repository at this point in the history
  • Loading branch information
Ljld committed Jul 13, 2023
1 parent d4db352 commit 64d9e4c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/views/document/utils/boxes/RoutesBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@
<span v-translate>Filter results</span>&nbsp;<span class="badge">{{ totalRoutes }}</span>
</router-link>
<add-link document-type="route" :query="query" class="button is-primary" />
<print-button
class="button is-primary"
forced-document-type="route"
:forced-query="query"
:forced-route-name="'routes/print'"
/>
</div>
</div>
</template>

<script>
import { requireDocumentProperty } from '@/js/properties-mixins';
import PrintButton from '@/views/documents/utils/PrintButton';
export default {
components: { PrintButton },
mixins: [requireDocumentProperty],
props: {
hideButtons: {
Expand Down
18 changes: 17 additions & 1 deletion src/views/documents/utils/PrintButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,27 @@ export default {
type: String,
default: 'button',
},
forcedDocumentType: {
type: String,
default: null,
},
forcedQuery: {
type: Object,
default: null,
},
forcedRouteName: {
type: String,
default: null,
},
},
computed: {
path() {
return { path: this.documentType + 's/print', query: this.$route.query };
return {
path: (this.forcedDocumentType ? this.forcedDocumentType : this.documentType) + 's/print',
query: this.forcedQuery ? this.forcedQuery : this.$route.query,
name: this.forcedRouteName ? this.forcedRouteName : null,
};
},
},
};
Expand Down

0 comments on commit 64d9e4c

Please sign in to comment.