Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Planning Twig UI #16947

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -311,6 +311,7 @@ The present file will list all changes made to the project; according to the
- `NetworkPort::resetConnections()`
- `OlaLevel::showForSLA()`. Replaced by `LevelAgreementLevel::showForLA()`.
- `PlanningExternalEvent::addVisibilityRestrict()`
- `PlanningRecall::specificForm()`
- `Plugin::migrateItemType()`
- `ProfileRight::updateProfileRightAsOtherRight()`
- `ProfileRight::updateProfileRightsAsOtherRights()`
Expand Down Expand Up @@ -378,6 +379,7 @@ The present file will list all changes made to the project; according to the
- `DropdownTranslation::getTranslationByName()`
- `addgroup` and `deletegroup` actions in `front/user.form.php`.
- `ajax/ticketassigninformation.php` script. Use `ajax/actorinformation.php` instead.
- AJAX file `ajax/planningcheck.php` (Replaced with `Planning::showPlanningCheck`).


## [10.0.16] unreleased
Expand Down
80 changes: 0 additions & 80 deletions ajax/planningcheck.php

This file was deleted.

7 changes: 0 additions & 7 deletions css/legacy/includes/_planning.scss
Expand Up @@ -93,13 +93,6 @@
flex-wrap: wrap;
align-items: center;

.actor_icon {
padding-bottom: 2px;
vertical-align: top;
font-size: 14px;
margin-left: 5px;
}

label {
padding-left: 5px;
line-height: 16px;
Expand Down
35 changes: 20 additions & 15 deletions js/planning.js
Expand Up @@ -601,6 +601,7 @@ var GLPIPlanning = {
end: end.toISOString(),
res_itemtype: itemtype,
res_items_id: items_id,
in_modal: 1
},
dialogclass: 'modal-lg planning-modal',
title: __('Add an event'),
Expand Down Expand Up @@ -726,21 +727,7 @@ var GLPIPlanning = {
});

$('#planning_filter .delete_planning').on( 'click', function() {
var deleted = $(this);
var li = deleted.closest('ul.filters > li');
$.ajax({
url: CFG_GLPI.root_doc+"/ajax/planning.php",
type: 'POST',
data: {
action: 'delete_filter',
filter: deleted.attr('value'),
type: li.attr('event_type')
},
success: function() {
li.remove();
GLPIPlanning.refresh();
}
});
GLPIPlanning.deletePlanning(this);
});

var sendDisplayEvent = function(current_checkbox, refresh_planning) {
Expand Down Expand Up @@ -841,6 +828,24 @@ var GLPIPlanning = {
});
},

deletePlanning: (trigger_element) => {
const deleted = $(trigger_element);
const li = deleted.closest('ul.filters > li');
$.ajax({
url: CFG_GLPI.root_doc+"/ajax/planning.php",
type: 'POST',
data: {
action: 'delete_filter',
filter: deleted.attr('value'),
type: li.attr('event_type')
},
success: function() {
li.remove();
GLPIPlanning.refresh();
}
});
},

// send ajax for event storage (on event drag/resize)
editEventTimes: function(info, move_instance) {
move_instance = move_instance || false;
Expand Down
6 changes: 5 additions & 1 deletion src/Application/View/Extension/ItemtypeExtension.php
Expand Up @@ -266,7 +266,11 @@ private function getItemInstance($item, ?int $id = null): ?CommonDBTM
return $instance ?: null;
}

public function getItemtypeForeignKey(string $itemtype): ?string
/**
* @param class-string|object $itemtype The itemtype or an item instance.
* @return string|null The foreign key field name of the itemtype or null if not found.
*/
public function getItemtypeForeignKey(string|object $itemtype): ?string
{
if (is_a($itemtype, CommonDBTM::class, true)) {
return $itemtype::getForeignKeyField();
Expand Down