import ApiDashboardWidget from "../../../api/factory/dashboard/widget.js"; export default { emits: [ "change", "assignWidgets" ], props: { dashboard_id: Number, widgets: Array }, methods: { sendChange(widget_id) { let allow = !this.widgets.find(el => el.widget_id == widget_id).allowed; this.$api .call(ApiDashboardWidget.setAllowed(this.dashboard_id, widget_id, allow)) .catch(this.$fhcAlert.handleSystemError); } }, created() { this.$api .call(ApiDashboardWidget.list(this.dashboard_id)) .then(result => { this.$emit('assignWidgets', result.data.map(el => ({ ...el, allowed: !!el.allowed }))); }) .catch(this.$fhcAlert.handleSystemError); }, template: `
` }