Skip to content

Commit

Permalink
[FIX] helpdesk_mgmt: modify JS in order to make it compatible with we…
Browse files Browse the repository at this point in the history
…bsite
  • Loading branch information
etobella committed Jan 17, 2025
1 parent a9988ec commit a6f3a3e
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 86 deletions.
88 changes: 44 additions & 44 deletions helpdesk_mgmt/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Channels
3. Set the name for the channel.
4. You can also Activate or Deactivate channels.

|image1|
|image0|

Categories
----------
Expand All @@ -66,7 +66,7 @@ Categories
3. Set the name for the category.
4. You can also Activate or Deactivate categories.

|image2|
|image1|

Stages
------
Expand All @@ -83,7 +83,7 @@ Stages
8. You can add a description for the stage.
9. You can also Activate or Deactivate stages.

|image3|
|image2|

You can also sort the stage sequence if you move up or down the stages
in the list view.
Expand All @@ -97,7 +97,7 @@ Teams
4. Add the teams members.
5. You can also Activate or Deactivate teams.

|image4|
|image3|

Tags
----
Expand All @@ -109,7 +109,7 @@ Tags
4. Set the color index for the tag.
5. You can also Activate or Deactivate tags.

|image5|
|image4|

Permissions
-----------
Expand All @@ -125,11 +125,11 @@ permissions set in Helpdesk.
not assigned to any team nor user.
3. *User*: User is able to see all the tickets.

.. |image1| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Channels.PNG
.. |image2| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Categories.PNG
.. |image3| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Stages.PNG
.. |image4| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Teams.PNG
.. |image5| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Tags.PNG
.. |image0| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Channels.PNG
.. |image1| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Categories.PNG
.. |image2| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Stages.PNG
.. |image3| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Teams.PNG
.. |image4| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Tags.PNG

Usage
=====
Expand Down Expand Up @@ -162,11 +162,11 @@ To create a new ticket from the kanban view:
Known issues / Roadmap
======================

- Add a tour feature similar to what the ``project`` module defines to
discover projects / tasks.
- Update portal tests defined in ``tests/test_portal.py`` to rely on
tour specs (in JS) in order to replicate the navigation behavior of
portal users.
- Add a tour feature similar to what the ``project`` module defines to
discover projects / tasks.
- Update portal tests defined in ``tests/test_portal.py`` to rely on
tour specs (in JS) in order to replicate the navigation behavior of
portal users.

Bug Tracker
===========
Expand Down Expand Up @@ -195,54 +195,54 @@ Authors
Contributors
------------

- `Domatix <https://www.domatix.com>`__:
- `Domatix <https://www.domatix.com>`__:

- Carlos Martínez
- Catalin Airimitoaie
- Álvaro López
- Samuel Calvo
- Carlos Martínez
- Catalin Airimitoaie
- Álvaro López
- Samuel Calvo

- `Adaptive City <https://www.adaptivecity.com>`__:
- `Adaptive City <https://www.adaptivecity.com>`__:

- Aitor Bouzas
- Aitor Bouzas

- `SDi Soluciones, S.L. <https://www.sdi.es>`__:
- `SDi Soluciones, S.L. <https://www.sdi.es>`__:

- Oscar Soto
- Jorge Luis Quinteros
- Oscar Soto
- Jorge Luis Quinteros

- `C2i Change 2 improve <http://www.c2i.es>`__:
- `C2i Change 2 improve <http://www.c2i.es>`__:

- Eduardo Magdalena <[email protected]>
- Eduardo Magdalena <[email protected]>

- `Factor Libre <https://factorlibre.com>`__:
- `Factor Libre <https://factorlibre.com>`__:

- María Alhambra
- Daniel Cano
- María Alhambra
- Daniel Cano

- `Tecnativa <https://www.tecnativa.com>`__:
- `Tecnativa <https://www.tecnativa.com>`__:

- Pedro M. Baeza
- Víctor Martínez
- Carolina Fernandez
- Carlos Roca
- Pedro M. Baeza
- Víctor Martínez
- Carolina Fernandez
- Carlos Roca

- `ID42 Sistemas <https://www.id42.com.br>`__:
- `ID42 Sistemas <https://www.id42.com.br>`__:

- Marcel Savegnago
- Eduardo Aparício
- Marcel Savegnago
- Eduardo Aparício

- `Obertix <https://www.obertix.net>`__:
- `Obertix <https://www.obertix.net>`__:

- Vicent Cubells
- Vicent Cubells

- `Solvos <https://www.solvos.es>`__:
- `Solvos <https://www.solvos.es>`__:

- David Alonso
- David Alonso

- `XCG Consulting <https://xcg-consulting.fr>`__:
- `XCG Consulting <https://xcg-consulting.fr>`__:

- Houzéfa Abbasbhay
- Houzéfa Abbasbhay

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion helpdesk_mgmt/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"demo": ["demo/helpdesk_demo.xml"],
"assets": {
"web.assets_frontend": [
"helpdesk_mgmt/static/src/js/new_ticket.js",
"helpdesk_mgmt/static/src/js/new_ticket.esm.js",
],
},
"development_status": "Production/Stable",
Expand Down
10 changes: 5 additions & 5 deletions helpdesk_mgmt/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ <h2><a class="toc-backref" href="#toc-entry-2">Channels</a></h2>
<li>Set the name for the channel.</li>
<li>You can also Activate or Deactivate channels.</li>
</ol>
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Channels.PNG" /></p>
<p><img alt="image0" src="https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Channels.PNG" /></p>
</div>
<div class="section" id="categories">
<h2><a class="toc-backref" href="#toc-entry-3">Categories</a></h2>
Expand All @@ -424,7 +424,7 @@ <h2><a class="toc-backref" href="#toc-entry-3">Categories</a></h2>
<li>Set the name for the category.</li>
<li>You can also Activate or Deactivate categories.</li>
</ol>
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Categories.PNG" /></p>
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Categories.PNG" /></p>
</div>
<div class="section" id="stages">
<h2><a class="toc-backref" href="#toc-entry-4">Stages</a></h2>
Expand All @@ -441,7 +441,7 @@ <h2><a class="toc-backref" href="#toc-entry-4">Stages</a></h2>
<li>You can add a description for the stage.</li>
<li>You can also Activate or Deactivate stages.</li>
</ol>
<p><img alt="image3" src="https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Stages.PNG" /></p>
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Stages.PNG" /></p>
<p>You can also sort the stage sequence if you move up or down the stages
in the list view.</p>
</div>
Expand All @@ -454,7 +454,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Teams</a></h2>
<li>Add the teams members.</li>
<li>You can also Activate or Deactivate teams.</li>
</ol>
<p><img alt="image4" src="https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Teams.PNG" /></p>
<p><img alt="image3" src="https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Teams.PNG" /></p>
</div>
<div class="section" id="tags">
<h2><a class="toc-backref" href="#toc-entry-6">Tags</a></h2>
Expand All @@ -466,7 +466,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Tags</a></h2>
<li>Set the color index for the tag.</li>
<li>You can also Activate or Deactivate tags.</li>
</ol>
<p><img alt="image5" src="https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Tags.PNG" /></p>
<p><img alt="image4" src="https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Tags.PNG" /></p>
</div>
<div class="section" id="permissions">
<h2><a class="toc-backref" href="#toc-entry-7">Permissions</a></h2>
Expand Down
35 changes: 35 additions & 0 deletions helpdesk_mgmt/static/src/js/new_ticket.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// /** @odoo-module **/
import {_t} from "@web/core/l10n/translation";
import {humanNumber} from "@web/core/utils/numbers";
import publicWidget from "@web/legacy/js/public/public_widget";

publicWidget.registry.NewTicket = publicWidget.Widget.extend({
selector: "form[action='/submitted/ticket']",
events: {
'change input[name="attachment"]': "_onChangeAttachment",
},
_onChangeAttachment(ev) {
ev.preventDefault();
const attachment_input = document.getElementById("attachment");
const information_input = document.getElementById("attachment_information");
information_input.style.display = "none";
const max_upload_size = parseInt(
attachment_input.getAttribute("max_upload_size"),
10
);
const dt = new DataTransfer();
for (const file of attachment_input.files) {
if (file.size > max_upload_size) {
information_input.textContent = _t(
"The selected file (%sB) is over the maximum allowed file size (%sB).",
humanNumber(file.size),
humanNumber(max_upload_size)
);
information_input.style.display = "";
} else {
dt.items.add(file);
}
}
attachment_input.files = dt.files;
},
});
36 changes: 0 additions & 36 deletions helpdesk_mgmt/static/src/js/new_ticket.js

This file was deleted.

5 changes: 5 additions & 0 deletions helpdesk_mgmt/views/helpdesk_ticket_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,11 @@
t-att-max_upload_size="max_upload_size"
/>
</div>
<div
id="attachment_information"
style="display: none;"
class="text-danger"
/>
</div>
</div>
<div class="form-group">
Expand Down

0 comments on commit a6f3a3e

Please sign in to comment.