mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 09:52:22 +00:00
refactor
This commit is contained in:
+6
-21
@@ -1,33 +1,18 @@
|
||||
export default {
|
||||
|
||||
getNonConfirmedActiveAmpeln: function () {
|
||||
open: function () {
|
||||
return this.$fhcApi.get(
|
||||
FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
`/api/frontend/v1/Ampeln/getNonConfirmedActiveAmpeln`,{});
|
||||
`/api/frontend/v1/Ampeln/open`,{});
|
||||
},
|
||||
|
||||
getAllActiveAmpeln: function () {
|
||||
all: function () {
|
||||
return this.$fhcApi.get(
|
||||
FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
`/api/frontend/v1/Ampeln/getAllActiveAmpeln`,{});
|
||||
`/api/frontend/v1/Ampeln/all`,{});
|
||||
},
|
||||
|
||||
|
||||
|
||||
confirmAmpel: function (ampel_id) {
|
||||
confirm: function (ampel_id) {
|
||||
return this.$fhcApi.get(
|
||||
FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
`/api/frontend/v1/Ampeln/confirmAmpel/${ampel_id}`,{});
|
||||
},
|
||||
|
||||
alleAmpeln: function () {
|
||||
return this.$fhcApi.get(
|
||||
FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
`/api/frontend/v1/Ampeln/alleAmpeln`,{});
|
||||
`/api/frontend/v1/Ampeln/confirm/${ampel_id}`,{});
|
||||
},
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
import {CoreNavigationCmpt} from '../../components/navigation/Navigation.js';
|
||||
import DashboardAdmin from '../../components/Dashboard/Admin.js';
|
||||
import Phrasen from "../../plugin/Phrasen.js"
|
||||
import FhcAlert from "../../plugin/FhcAlert.js"
|
||||
import Phrasen from "../../plugin/Phrasen.js";
|
||||
|
||||
const app = Vue.createApp({
|
||||
data: () => ({
|
||||
@@ -13,5 +12,5 @@ const app = Vue.createApp({
|
||||
}
|
||||
});
|
||||
app.config.unwrapInjectedRef = true;
|
||||
app.use(Phrasen).use(FhcAlert);
|
||||
app.use(Phrasen);
|
||||
app.mount('#main');
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import FhcDashboard from '../../components/Dashboard/Dashboard.js';
|
||||
import Phrasen from "../../plugin/Phrasen.js"
|
||||
import FhcAlert from "../../plugin/FhcAlert.js"
|
||||
|
||||
const app = Vue.createApp({
|
||||
data: () => ({
|
||||
@@ -11,5 +10,5 @@ const app = Vue.createApp({
|
||||
}
|
||||
});
|
||||
app.config.unwrapInjectedRef = true;
|
||||
app.use(Phrasen).use(FhcAlert);
|
||||
app.use(Phrasen);
|
||||
app.mount('#content');
|
||||
|
||||
@@ -10,7 +10,6 @@ export default {
|
||||
source: '',
|
||||
allAmpeln:null,
|
||||
activeAmpeln:null,
|
||||
isPhrasenLoaded: false,
|
||||
}),
|
||||
mixins: [
|
||||
AbstractWidget
|
||||
@@ -52,12 +51,9 @@ export default {
|
||||
default: return data;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
toggleFilter(value){
|
||||
this.filter === value ? this.filter = '' : this.filter = value;
|
||||
},
|
||||
|
||||
closeOffcanvasAmpeln()
|
||||
{
|
||||
for (let i = 0; i < this.ampelnComputed.length; i++)
|
||||
@@ -81,19 +77,17 @@ export default {
|
||||
// maybe we also want to reset the source (open/alle) of the displayed ampeln
|
||||
},
|
||||
async fetchNonConfirmedActiveAmpeln(){
|
||||
|
||||
await this.$fhcApi.factory.ampeln.getNonConfirmedActiveAmpeln().then(res=>{
|
||||
await this.$fhcApi.factory.ampeln.open().then(res=>{
|
||||
this.activeAmpeln = res.data.sort((a,b) => new Date(b.deadline) - new Date(a.deadline));
|
||||
});
|
||||
},
|
||||
async fetchAllActiveAmpeln(){
|
||||
|
||||
await this.$fhcApi.factory.ampeln.getAllActiveAmpeln().then(res=>{
|
||||
await this.$fhcApi.factory.ampeln.all().then(res=>{
|
||||
this.allAmpeln = res.data.sort((a,b) => new Date(b.deadline) - new Date(a.deadline));
|
||||
});
|
||||
},
|
||||
async confirm(ampelId){
|
||||
this.$fhcApi.factory.ampeln.confirmAmpel(ampelId)
|
||||
this.$fhcApi.factory.ampeln.confirm(ampelId)
|
||||
.then(res => res.data)
|
||||
.then(result => {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ampeln','ampelBestaetigt'));
|
||||
@@ -114,13 +108,9 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$p.loadCategory(['ampel','ui']).then(() => {
|
||||
this.isPhrasenLoaded = true;
|
||||
});
|
||||
this.$emit('setConfig', false);
|
||||
},
|
||||
async mounted() {
|
||||
|
||||
await this.fetchNonConfirmedActiveAmpeln();
|
||||
await this.fetchAllActiveAmpeln();
|
||||
},
|
||||
|
||||
@@ -36,7 +36,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.$emit('setConfig', false);
|
||||
/* axios
|
||||
axios
|
||||
.get(this.apiurl + '/components/Cis/Stundenplan/Stunden').then(res => {
|
||||
res.data.retval.forEach(std => {
|
||||
this.stunden[std.stunde] = std; // TODO(chris): geht besser
|
||||
@@ -57,7 +57,7 @@ export default {
|
||||
})
|
||||
.catch(err => { console.log(err);console.error('ERROR: ', err.response.data) });
|
||||
})
|
||||
.catch(err => { console.error('ERROR: ', err.response.data) }); */
|
||||
.catch(err => { console.error('ERROR: ', err.response.data) });
|
||||
},
|
||||
template: `
|
||||
<div class="dashboard-widget-stundenplan d-flex flex-column h-100">
|
||||
|
||||
Reference in New Issue
Block a user