mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-03 07:26:12 +00:00
Add return path support for ticket creation and editing
This commit introduces support for a return path query parameter during ticket creation and editing operations. This enables a more user-friendly redirection after a form submission operation where the return path provides more context on the next page. The return path is now also considered in the Vue.js components, with necessary checks and validations. A 'Cancel' button has been added to the ActionToolbarComponent.vue where the return path exists.
This commit is contained in:
parent
a9c0567ee1
commit
d2a61ce69b
@ -63,8 +63,13 @@ final readonly class CreateTicketController
|
|||||||
|
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
$query = [];
|
||||||
|
if ($request->query->has('returnPath')) {
|
||||||
|
$query['returnPath'] = $request->query->get('returnPath');
|
||||||
|
}
|
||||||
|
|
||||||
return new RedirectResponse(
|
return new RedirectResponse(
|
||||||
$this->urlGenerator->generate('chill_ticket_ticket_edit', ['id' => $ticket->getId()])
|
$this->urlGenerator->generate('chill_ticket_ticket_edit', ['id' => $ticket->getId(), ...$query])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,6 @@ class Ticket implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
#[ORM\OneToMany(targetEntity: PersonHistory::class, mappedBy: 'ticket')]
|
#[ORM\OneToMany(targetEntity: PersonHistory::class, mappedBy: 'ticket')]
|
||||||
private Collection $personHistories;
|
private Collection $personHistories;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->addresseeHistory = new ArrayCollection();
|
$this->addresseeHistory = new ArrayCollection();
|
||||||
|
@ -47,6 +47,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="footer-ticket-main">
|
<div class="footer-ticket-main">
|
||||||
<ul class="nav nav-tabs justify-content-end">
|
<ul class="nav nav-tabs justify-content-end">
|
||||||
|
<li v-if="hasReturnPath" class="nav-item p-2 go-back">
|
||||||
|
<a :href="returnPath" class="btn btn-cancel">Annuler</a>
|
||||||
|
</li>
|
||||||
<li class="nav-item p-2">
|
<li class="nav-item p-2">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@ -157,6 +160,22 @@ export default defineComponent({
|
|||||||
);
|
);
|
||||||
const users = computed(() => store.getters.getUsers as User[]);
|
const users = computed(() => store.getters.getUsers as User[]);
|
||||||
|
|
||||||
|
const hasReturnPath = computed((): boolean => {
|
||||||
|
const params = new URL(document.location.toString()).searchParams;
|
||||||
|
return params.has('returnPath');
|
||||||
|
});
|
||||||
|
|
||||||
|
const returnPath = computed((): string => {
|
||||||
|
const params = new URL(document.location.toString()).searchParams;
|
||||||
|
const returnPath = params.get('returnPath');
|
||||||
|
|
||||||
|
if (null === returnPath) {
|
||||||
|
throw new Error("there isn't any returnPath, please check the existence before");
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnPath;
|
||||||
|
})
|
||||||
|
|
||||||
const motive = ref(
|
const motive = ref(
|
||||||
ticket.value.currentMotive
|
ticket.value.currentMotive
|
||||||
? ticket.value.currentMotive
|
? ticket.value.currentMotive
|
||||||
@ -217,6 +236,7 @@ export default defineComponent({
|
|||||||
alert("Sera disponible plus tard");
|
alert("Sera disponible plus tard");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
actionIcons: ref(store.getters.getActionIcons),
|
actionIcons: ref(store.getters.getActionIcons),
|
||||||
activeTab,
|
activeTab,
|
||||||
@ -229,12 +249,19 @@ export default defineComponent({
|
|||||||
content,
|
content,
|
||||||
submitAction,
|
submitAction,
|
||||||
handleClick,
|
handleClick,
|
||||||
|
hasReturnPath,
|
||||||
|
returnPath,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
.go-back {
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.sticky-form-buttons {
|
.sticky-form-buttons {
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
background: none;
|
background: none;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import { defineComponent, ref, watch } from "vue";
|
import { defineComponent, ref, watch } from "vue";
|
||||||
|
|
||||||
import CKEditor from "@ckeditor/ckeditor5-vue";
|
import CKEditor from "@ckeditor/ckeditor5-vue";
|
||||||
import ClassicEditor from "../../../../../../../ChillMainBundle/Resources/public/module/ckeditor5";
|
import ClassicEditor from "../../../../../../../ChillMainBundle/Resources/public/module/ckeditor5/editor_config";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "AddCommentComponent",
|
name: "AddCommentComponent",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user