Commit 8f746484 authored by Guillaume Heurtier's avatar Guillaume Heurtier

Merge remote-tracking branch 'origin/develop' into develop

parents 0342ab2e d44e825c
......@@ -192,7 +192,7 @@ $app->delete('/folders/{id}', \Folder\controllers\FolderController::class . ':de
$app->get('/folders/{id}/resources', \Folder\controllers\FolderController::class . ':getResourcesById');
$app->post('/folders/{id}/resources', \Folder\controllers\FolderController::class . ':addResourcesById');
$app->delete('/folders/{id}/resources', \Folder\controllers\FolderController::class . ':removeResourcesById');
$app->get('/folders/{id}/resources/{resId}/events', \Folder\controllers\FolderController::class . ':getEventsFromFolder');
$app->get('/folders/{id}/resources/{resId}/baskets', \Folder\controllers\FolderController::class . ':getBasketsFromFolder');
$app->get('/folders/{id}/filters', \Folder\controllers\FolderController::class . ':getFilters');
$app->put('/folders/{id}/sharing', \Folder\controllers\FolderController::class . ':sharing');
......
......@@ -523,7 +523,7 @@ class FolderController
return $response->withJson(['countResources' => count($foldersResources) - count($resourcesToUnclassify)]);
}
public function getEventsFromFolder(Request $request, Response $response, array $args)
public function getBasketsFromFolder(Request $request, Response $response, array $args)
{
if (!Validator::numeric()->notEmpty()->validate($args['id'])) {
return $response->withStatus(400)->withJson(['errors' => 'Route id is not an integer']);
......@@ -539,11 +539,11 @@ class FolderController
}
$baskets = BasketModel::getWithPreferences([
'select' => ['baskets.id', 'baskets.basket_id', 'baskets.basket_name', 'baskets.basket_clause', 'users_baskets_preferences.group_serial_id', 'usergroups.group_desc'],
'select' => ['baskets.id', 'baskets.basket_name', 'baskets.basket_clause', 'users_baskets_preferences.group_serial_id', 'usergroups.group_desc'],
'where' => ['users_baskets_preferences.user_serial_id = ?'],
'data' => [$GLOBALS['id']]
]);
$events = [];
$groupsBaskets = [];
$inCheckedBaskets = [];
$outCheckedBaskets = [];
foreach ($baskets as $basket) {
......@@ -559,19 +559,11 @@ class FolderController
}
}
$inCheckedBaskets[] = $basket['id'];
$group = GroupModel::getById(['id' => $basket['group_serial_id'], 'select' => ['group_id']]);
$groupBasket = GroupBasketModel::get([
'select' => ['list_event'],
'where' => ['group_id = ?', 'basket_id = ?'],
'data' => [$group['group_id'], $basket['basket_id']]
]);
if (!empty($groupBasket[0]['list_event'])) {
$events[] = ['groupId' => $basket['group_serial_id'], 'groupName' => $basket['group_desc'], 'basketId' => $basket['id'], 'basketName' => $basket['basket_name'], 'event' => $groupBasket[0]['list_event']];
}
$groupsBaskets[] = ['groupId' => $basket['group_serial_id'], 'groupName' => $basket['group_desc'], 'basketId' => $basket['id'], 'basketName' => $basket['basket_name']];
}
}
return $response->withJson(['events' => $events]);
return $response->withJson(['groupsBaskets' => $groupsBaskets]);
}
public function getFilters(Request $request, Response $response, array $args)
......
......@@ -911,10 +911,9 @@ class ResourceListController
} elseif ($value['value'] == 'getOpinionLimitDate') {
$value['displayValue'] = $resource['opinion_limit_date'];
$display[] = $value;
} elseif ($value['value'] == 'getFolders') {
$formattedResources[$key]['folders'] = ResourceListController::getFolders(['resId' => $resource['res_id'], 'userId' => $args['userId']]);
}
}
$formattedResources[$key]['folders'] = ResourceListController::getFolders(['resId' => $resource['res_id'], 'userId' => $args['userId']]);
$formattedResources[$key]['display'] = $display;
}
}
......
......@@ -60,8 +60,6 @@ export class FolderActionListComponent implements OnInit {
open(x: number, y: number, row: any) {
//this.loadActionList(row.res_id);
// Adjust the menu anchor position
this.contextMenuPosition.x = x + 'px';
this.contextMenuPosition.y = y + 'px';
......@@ -76,81 +74,6 @@ export class FolderActionListComponent implements OnInit {
return false;
}
/*launchEvent(action: any, row: any) {
this.arrRes = [];
this.currentAction = action;
this.arrRes = this.selectedRes;
if (this.contextMode && this.selectedRes.length > 1) {
this.contextMenuTitle = '';
this.contextResId = 0;
}
if (row !== undefined){
this.contextMenuTitle = row.alt_identifier;
}
if (action.component == 'v1Action' && this.arrRes.length > 1) {
alert(this.lang.actionMassForbidden);
} else if (action.component !== null) {
this.http.put('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/lock', { resources: this.arrRes })
.subscribe((data: any) => {
try {
let msgWarn = this.lang.warnLockRes + ' : ' + data.lockers.join(', ');
if (data.lockedResources != this.arrRes.length) {
msgWarn += this.lang.warnLockRes2 + '.';
}
if (data.lockedResources > 0) {
alert(data.lockedResources + ' ' + msgWarn);
}
if (data.lockedResources != this.arrRes.length) {
this.lock();
this[action.component]();
}
}
catch (error) {
console.log(error);
console.log(action.component);
alert(this.lang.actionNotExist);
}
this.loading = false;
}, (err: any) => {
this.notify.handleErrors(err);
});
}
} */
loadActionList(resId: number) {
this.http.get('../../rest/folders/' + this.currentFolderInfo.id + '/resources/' + resId + '/events').pipe(
tap((data) => {
console.log(data);
})
).subscribe();
}
/* lock() {
this.currentLock = setInterval(() => {
this.http.put('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/lock', { resources: this.arrRes })
.subscribe((data: any) => { }, (err: any) => { });
}, 50000);
}
unlock() {
clearInterval(this.currentLock);
}
unlockRest() {
this.http.put('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/unlock', { resources: this.arrRes })
.subscribe((data: any) => { }, (err: any) => { });
}*/
refreshFolders() {
this.refreshPanelFolders.emit();
}
......@@ -174,10 +97,10 @@ export class FolderActionListComponent implements OnInit {
}
getBaskets() {
this.http.get('../../rest/folders/' + this.currentFolderInfo.id + '/resources/' + this.selectedRes + '/events').pipe(
this.http.get('../../rest/folders/' + this.currentFolderInfo.id + '/resources/' + this.selectedRes + '/baskets').pipe(
tap((data: any) => {
this.basketList.groups = data.events.filter((x: any, i: any, a: any) => x && a.map((info: any) => info.groupId).indexOf(x.groupId) === i);
this.basketList.list = data.events;
this.basketList.groups = data.groupsBaskets.filter((x: any, i: any, a: any) => x && a.map((info: any) => info.groupId).indexOf(x.groupId) === i);
this.basketList.list = data.groupsBaskets;
})
).subscribe();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment