mann mann
This commit is contained in:
parent
3b2544e7ac
commit
e8fbc6dfcc
|
|
@ -9,6 +9,7 @@ return [
|
|||
['name' => 'agency#show', 'url' => '/getagencydata', 'verb' => 'GET'],
|
||||
['name' => 'agency#updateagencydata', 'url' => '/updateagencydata', 'verb' => 'PUT'],
|
||||
['name' => 'agency#getagencycontributors', 'url' => '/getagencycontributors', 'verb' => 'GET'],
|
||||
['name' => 'agency#updateagencygroupcontributors', 'url' => '/updateagencygroupcontributors/{gid}', 'verb' => 'POST'],
|
||||
# GROUPS
|
||||
['name' => 'group#getagencygroups', 'url' => '/getagencygroups', 'verb' => 'GET'],
|
||||
['name' => 'group#addagencygroup', 'url' => '/addagencygroup', 'verb' => 'PUT'],
|
||||
|
|
|
|||
|
|
@ -90,8 +90,7 @@ class AgencyManager {
|
|||
$return_users = array();
|
||||
// Creating a nice User-JSON-Array
|
||||
foreach($users as $user){
|
||||
#array_push($return_users, array("displayName" => $user->getDisplayName(), "uid" => $user->getUID(), "lastLogin" => $user->getLastLogin()));
|
||||
array_push($return_users, $user->getDisplayName());
|
||||
array_push($return_users, array("user" => $user->getUID(), "displayName" => $user->getDisplayName()));
|
||||
}
|
||||
return $return_users;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,4 +101,16 @@ class AgencyController extends Controller {
|
|||
return $this->agencyManager->getagencycontributors();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* Update the Group-Members
|
||||
*
|
||||
*
|
||||
*/
|
||||
# TODO: Noch prüfen, OB der Nutzer das überhautp darf und Agenturcheck usw.
|
||||
public function updateagencygroupcontributors(string $gid){
|
||||
return $_POST;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -54,7 +54,12 @@ class GroupController extends Controller {
|
|||
if(str_contains($group->getGId(), 'subgroup')){
|
||||
$isDefault = false;
|
||||
}
|
||||
array_push($response_groups, array('name' => $group->getDisplayName(), 'gid' => $group->getGid(), 'isDefault' => $isDefault));
|
||||
// Adding current Users to the Group
|
||||
$user_groups = [];
|
||||
foreach($group->getUsers() as $groupuser){
|
||||
array_push($user_groups, array("user" => $groupuser->getUID(), "displayName" => $groupuser->getDisplayName()));
|
||||
}
|
||||
array_push($response_groups, array('name' => $group->getDisplayName(), 'gid' => $group->getGid(), 'isDefault' => $isDefault, 'users' => $user_groups));
|
||||
}
|
||||
//Sorting the Array A-Z by GroupDisplayName
|
||||
$keys = array_column($response_groups, 'name');
|
||||
|
|
|
|||
|
|
@ -26,9 +26,28 @@
|
|||
<span v-else>Nicht default</span>
|
||||
<hr>
|
||||
<!-- SHAREING -->
|
||||
<Multiselect
|
||||
<!--<Multiselect
|
||||
:v-model="contributors"
|
||||
:multiple="true"
|
||||
placeholder="Suche"
|
||||
:options="agencyContributor" />
|
||||
:options="agencyContributor"
|
||||
@input="updateContributor" />-->
|
||||
<Multiselect v-model="value"
|
||||
:options="formattedContributors"
|
||||
label="displayName"
|
||||
placeholder="Mitarbeiter der Gruppe hinzufügen"
|
||||
track-by="user"
|
||||
:multiple="true"
|
||||
:user-select="true"
|
||||
style="width: 350px"
|
||||
@input="updateContributorsValue()">
|
||||
<template #singleLabel="{ option }">
|
||||
<ListItemIcon v-bind="option"
|
||||
:title="option.displayName"
|
||||
:avatar-size="24"
|
||||
:no-margin="true" />
|
||||
</template>
|
||||
</Multiselect>
|
||||
</b-card-body>
|
||||
</b-collapse>
|
||||
</b-card>
|
||||
|
|
@ -38,13 +57,14 @@
|
|||
import { generateUrl } from '@nextcloud/router'
|
||||
import axios from '@nextcloud/axios'
|
||||
import Permission from './Permission'
|
||||
import { Multiselect } from '@nextcloud/vue'
|
||||
import { Multiselect, ListItemIcon } from '@nextcloud/vue'
|
||||
|
||||
export default {
|
||||
name: 'Group',
|
||||
components: {
|
||||
Permission,
|
||||
Multiselect,
|
||||
ListItemIcon,
|
||||
},
|
||||
// Properties of Group-Elements
|
||||
props: {
|
||||
|
|
@ -61,21 +81,47 @@ export default {
|
|||
return {
|
||||
// Main Group-ID for all Accordions
|
||||
groupDefId: 'acc_groupele_',
|
||||
value: [],
|
||||
contributors: [],
|
||||
formattedContributors: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
agencyContributor() {
|
||||
return this.contributors
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getAgencyContributor()
|
||||
mounted() {
|
||||
this.getAgencyContributors()
|
||||
},
|
||||
methods: {
|
||||
async getAgencyContributor() {
|
||||
async updateContributorsValue() {
|
||||
let valueData = ''
|
||||
this.value.forEach((item) => {
|
||||
valueData += item.user + '___'
|
||||
})
|
||||
const r = await axios.post(generateUrl('/apps/agency/updateagencygroupcontributors/' + this.group.gid), valueData)
|
||||
console.log(r)
|
||||
},
|
||||
// Contributors changed, update the formattedContributors for the Field
|
||||
updateContributors() {
|
||||
this.formattedContributors = this.contributors.map(item => {
|
||||
return {
|
||||
user: item.user,
|
||||
displayName: item.displayName,
|
||||
icon: 'icon-user',
|
||||
}
|
||||
})
|
||||
},
|
||||
// Loading the Contributors for the Agency
|
||||
async getAgencyContributors() {
|
||||
const response = await axios.get(generateUrl('/apps/agency/getagencycontributors'))
|
||||
this.contributors = response.data
|
||||
// Contributors loaded, now update formattedContributors to see the result in the field
|
||||
this.updateContributors()
|
||||
// After Updating the Users in that group, add current users of the group
|
||||
this.value = this.group.users.map(item => {
|
||||
return {
|
||||
user: item.user,
|
||||
displayName: item.displayName,
|
||||
icon: 'icon-user',
|
||||
}
|
||||
})
|
||||
},
|
||||
// Toggle the Group-Accordion-Element
|
||||
accordionToggle(ele) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue