@igea/oac_frontend 1.0.17 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igea/oac_frontend",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Frontend service for the OAC project",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -45,5 +45,14 @@
45
45
  "editor": "Editor",
46
46
  "reader": "Reader"
47
47
  }
48
+ },
49
+ "search": {
50
+ "fast": {
51
+ "title": "Fast search"
52
+ },
53
+ "advanced": {
54
+ "title": "Advanced search"
55
+ }
56
+
48
57
  }
49
58
  }
@@ -45,5 +45,14 @@
45
45
  "editor": "Editore",
46
46
  "reader": "Lettore"
47
47
  }
48
+ },
49
+ "search": {
50
+ "fast": {
51
+ "title": "Ricerca veloce"
52
+ },
53
+ "advanced": {
54
+ "title": "Ricerca avanzata"
55
+ }
56
+
48
57
  }
49
58
  }
@@ -6,12 +6,14 @@ class DataModel {
6
6
  this.options = options;
7
7
  }
8
8
 
9
- toJson(){
10
- return {
9
+ toJson(){
10
+ let json = {
11
11
  user: this.user,
12
12
  cur_id: this.user.id || 0,
13
13
  ...this.options
14
14
  };
15
+ console.log(json)
16
+ return json
15
17
  }
16
18
 
17
19
  }
@@ -79,9 +79,10 @@ document.addEventListener('DOMContentLoaded', () => {
79
79
  username: this.user.username,
80
80
  email: this.user.email,
81
81
  mobile: this.user.mobile,
82
- password: this.user.password,
83
82
  role: this.user.role
84
83
  };
84
+ if(this.user.password.length > 0)
85
+ payload["password"] = this.user.password;
85
86
  let request;
86
87
  if(this.user.id == 0) {
87
88
  delete payload["id"];
@@ -11,6 +11,7 @@ document.addEventListener('DOMContentLoaded', () => {
11
11
  return {
12
12
  root: el.dataset.root,
13
13
  cur_id: parseInt(el.dataset.cur_id) || 0,
14
+ cur_role: parseInt(el.dataset.cur_role),
14
15
  labels: {
15
16
  role_sudo: el.dataset.role_sudo,
16
17
  role_admin: el.dataset.role_admin,
@@ -29,7 +30,7 @@ document.addEventListener('DOMContentLoaded', () => {
29
30
  axios.get("/backend/users/").then(response => {
30
31
  var data = response.data;
31
32
  if(data.success) {
32
- this.users = data.data;
33
+ this.users = data.data.filter(u => u.role != 0 || this.cur_role == 0);
33
34
  } else {
34
35
  console.error("Failed to fetch users:", data.message);
35
36
  }
@@ -1,24 +1,36 @@
1
1
  {% block sidebar %}
2
-
3
- {% if user.id > 0 %}
4
-
5
- <!-- abilitare solo per utenti ADMIN -->
6
- {% if cur_role != "admin" %}
7
- <div class="menu-item">
8
- <a href="/{{ root }}/users/manage">
9
- <i class="fa-solid fa-users-between-lines"></i>
10
- <span>{{ t('users.manage.title') }}</span>
11
- </a>
12
- </div>
13
- {% endif %}
14
2
 
15
- <div class="menu-item">
16
- <a href="/{{ root }}/users/{{ cur_id }}">
17
- <i class="fa-solid fa-id-badge"></i>
18
- {{ t('users.profile.title') }}
3
+ <!-- abilitare solo per utenti ADMIN -->
4
+ {% if user.role == 0 or user.role == 1 %}
5
+ <div class="menu-item">
6
+ <a href="/{{ root }}/users/manage">
7
+ <i class="fa-solid fa-users-between-lines"></i>
8
+ <span>{{ t('users.manage.title') }}</span>
19
9
  </a>
20
10
  </div>
11
+ {% endif %}
21
12
 
13
+ {% if user.id > 0 %}
14
+ <div class="menu-item">
15
+ <a href="/{{ root }}/users/{{ cur_id }}">
16
+ <i class="fa-solid fa-id-badge"></i>
17
+ {{ t('users.profile.title') }}
18
+ </a>
19
+ </div>
22
20
  {% endif %}
23
21
 
22
+ <div class="menu-item">
23
+ <a href="/{{ root }}/search/fast">
24
+ <i class="fa-solid fa-magnifying-glass"></i>
25
+ {{ t('search.fast.title') }}
26
+ </a>
27
+ </div>
28
+
29
+ <div class="menu-item">
30
+ <a href="/{{ root }}/search/advanced">
31
+ <i class="fa-solid fa-magnifying-glass-dollar"></i>
32
+ {{ t('search.advanced.title') }}
33
+ </a>
34
+ </div>
35
+
24
36
  {% endblock %}
@@ -16,6 +16,7 @@
16
16
  data-role_reader="{{ t('users.role.reader') }}"
17
17
  data-confirm_delete="{{ t('users.manage.confirm_delete') }}"
18
18
  data-cur_id="{{ cur_id }}"
19
+ data-cur_role="{{ user.role }}"
19
20
  >
20
21
  <h2 style="display:flex; justify-content:space-between; align-items:center;">
21
22
  <span>{{ t('users.manage.title') }}</span>