Procházet zdrojové kódy

ho modificato tutte le interfacce per unificarle aggiungendo le funzioni
usate all'interno delle views, modificata la posizione del tasto
amministratore.
modifiche minori in gestioneAzienda e gestioneSede
:

mauro před 10 měsíci
rodič
revize
477368441e
35 změnil soubory, kde provedl 101 přidání a 70 odebrání
  1. 2 0
      azienda/forms.py
  2. 56 16
      azienda/views.py
  3. 15 2
      comunicazione/views.py
  4. binární
      documento/__pycache__/__init__.cpython-311.pyc
  5. binární
      documento/__pycache__/admin.cpython-311.pyc
  6. binární
      documento/__pycache__/apps.cpython-311.pyc
  7. binární
      documento/__pycache__/forms.cpython-311.pyc
  8. binární
      documento/__pycache__/managefile.cpython-311.pyc
  9. binární
      documento/__pycache__/models.cpython-311.pyc
  10. binární
      documento/__pycache__/urls.cpython-311.pyc
  11. binární
      documento/__pycache__/views.cpython-311.pyc
  12. 2 2
      documento/managefile.py
  13. binární
      documento/migrations/__pycache__/0001_initial.cpython-311.pyc
  14. binární
      documento/migrations/__pycache__/0002_remove_documento_utente.cpython-311.pyc
  15. binární
      documento/migrations/__pycache__/0003_remove_documento_dataupload.cpython-311.pyc
  16. binární
      documento/migrations/__pycache__/0004_documento_utente.cpython-311.pyc
  17. binární
      documento/migrations/__pycache__/0005_documento_azienda.cpython-311.pyc
  18. binární
      documento/migrations/__pycache__/0006_documento_documento_d_documen_a68d7b_idx_and_more.cpython-311.pyc
  19. binární
      documento/migrations/__pycache__/0007_remove_documento_azienda_documento_dataupload.cpython-311.pyc
  20. binární
      documento/migrations/__pycache__/0008_alter_documento_utente.cpython-311.pyc
  21. binární
      documento/migrations/__pycache__/0009_documento_descrizione_alter_documento_crc.cpython-311.pyc
  22. binární
      documento/migrations/__pycache__/0010_documento_azienda.cpython-311.pyc
  23. binární
      documento/migrations/__pycache__/0011_documento_pertutti.cpython-311.pyc
  24. binární
      documento/migrations/__pycache__/0012_remove_documento_pertutti.cpython-311.pyc
  25. binární
      documento/migrations/__pycache__/0013_remove_documento_documento_d_documen_a68d7b_idx.cpython-311.pyc
  26. binární
      documento/migrations/__pycache__/0014_remove_documento_azienda.cpython-311.pyc
  27. binární
      documento/migrations/__pycache__/__init__.cpython-311.pyc
  28. 0 0
      documento/templates/documento.error.html
  29. 3 16
      documento/templates/documento.welcome.html
  30. 1 1
      documento/templates/documento.welcome.lista.html
  31. 2 2
      documento/views.py
  32. 1 1
      gd/settings.py
  33. 12 23
      utente/templates/utente.edit.html
  34. 3 3
      utente/templates/utente.edit.profile.html
  35. 4 4
      utente/templates/utente.welcome.html

+ 2 - 0
azienda/forms.py

@@ -8,6 +8,7 @@ class formAzienda(forms.Form):
     self.fields['mail'] = forms.CharField(required=False)
     self.fields['cambiopassword'] = forms.BooleanField(required=False)
     self.fields['forzanuovapassword' ] = forms.BooleanField(required=False)
+    self.fields['otppassword'] = forms.BooleanField(required=False)
     self.fields['cancellaazienda'] = forms.BooleanField(required=False)
 
 class formSede(forms.Form):
@@ -18,6 +19,7 @@ class formSede(forms.Form):
     self.fields['cancellasede'] = forms.BooleanField(required=False)
     self.fields['cambiopassword'] = forms.BooleanField(required=False)
     self.fields['forzanuovapassword'] = forms.BooleanField(required=False)
+    self.fields['otppassword'] = forms.BooleanField(required=False)
     self.fields['identificativo'] = forms.CharField(required=False)
 
 class formPinMail(forms.Form):

+ 56 - 16
azienda/views.py

@@ -25,7 +25,6 @@ def welcome(request):
     data['azienda'] = azienda
 
   sede = None
-
   if 'SedeId' in request.session:
     SedeId = request.session['SedeId']
     print('SedeId',SedeId)
@@ -33,7 +32,6 @@ def welcome(request):
       sede = Sede.objects.get(pk=SedeId)
     except Sede.DoesNotExist as dne:
       print("non esiste")
-
     data['sede'] = sede
 
   data['HeaderTitle'] = getConfig('HeaderTitle')
@@ -95,8 +93,6 @@ def welcome(request):
         except Azienda.DoesNotExist as dne:
           print("errore, oggetto inesistente",dne)
 
-
-
     if "sceltasede" in request.POST:
       sceltasede = request.POST.get('sceltasede')
       try:
@@ -178,9 +174,32 @@ def welcome(request):
 
 # creazione azienda
 def editAzienda(request):
+
+  if not 'AdminId' in request.session:
+    return HttpResponseRedirect(reverse("login:start"))
+
   AdminId = request.session['AdminId']
+  print('AdminId',AdminId)
+
+  data=dict()
+
+  azienda = None
+  if 'AziendaId' in request.session:
+    AziendaId = request.session['AziendaId']
+    print('AziendaId',AziendaId)
+    azienda = Azienda.objects.get(pk=AziendaId)
+    data['azienda'] = azienda
+
+  sede = None
+  if 'SedeId' in request.session:
+    SedeId = request.session['SedeId']
+    print('SedeId',SedeId)
+    try:
+      sede = Sede.objects.get(pk=SedeId)
+    except Sede.DoesNotExist as dne:
+      print("non esiste")
+    data['sede'] = sede
 
-  data={}
   data['HeaderTitle'] = getConfig('HeaderTitle')
   user = data['admin'] = Amministratore.objects.get(pk=AdminId)
 
@@ -230,7 +249,7 @@ def editAzienda(request):
       return HttpResponseRedirect(reverse('azienda:welcome'))
     else:
       print("form non valido")
-      data['azienda'] = formAzienda(request.POST)
+      data['aziendaForm'] = formAzienda(request.POST)
   else: #non è un post
     print("Non è un post")
     formAziendaField = None
@@ -254,21 +273,41 @@ def editAzienda(request):
         tmp['cambiopassword' ] = False
         formAziendaField = formAzienda(tmp)
 
-    data['azienda'] = formAziendaField
+    data['aziendaForm'] = formAziendaField
 
   return render(request,'azienda.editAzienda.html',data)
 
 def editSede(request):
+  ''' edit Sedi azienda '''
+  if not 'AdminId' in request.session:
+    return HttpResponseRedirect(reverse("login:start"))
+
   AdminId = request.session['AdminId']
-  AziendaId = request.session['AziendaId']
-  print("AziendaId",AziendaId)
+  print('AdminId',AdminId)
+
+  data = dict()
+ 
+  if 'AziendaId' in request.session:
+    AziendaId = request.session['AziendaId']
+    print('AziendaId',AziendaId)
+    data['azienda'] = Azienda.objects.get(pk=AziendaId)
+
+  if 'SedeId' in request.session:
+    SedeId = request.session['SedeId']
+    print('SedeId',SedeId)
+    try:
+      data['sede'] = Sede.objects.get(pk=SedeId)
+    except Sede.DoesNotExist as dne:
+      print("non esiste")
+
+  data['HeaderTitle'] = getConfig('HeaderTitle')
+  data['Navbar']=True
 
-  data={}
   data['HeaderTitle'] = getConfig('HeaderTitle')
   admin = data['admin'] = Amministratore.objects.get(pk=AdminId)
 
-  sede = None
   flag = False
+
   if 'SedeIdEdit' in request.session:
     print('trovato riferimento SedeIdEdit',request.session.get('SedeIdEdit'))
     seid = request.session.get('SedeIdEdit')
@@ -276,13 +315,14 @@ def editSede(request):
       sede = Sede.objects.get(pk=seid)
       print('sede trovata',sede.nome)
       flag = True
-
     except Sede.DoesNotExist as dne:
       print('Sede indicata inesistente',dne)
       sede = Sede()
       sede.azienda = Azienda.objects.get(pk=AziendaId)
+      print('sede.azienda',sede.azienda.nome)
       sede.cambiopassword = sede.azienda.cambiopassword
       sede.forzanuovapassword = sede.azienda.forzanuovapassword
+      sede.otppassword = sede.azienda.otppassword
 
   data['permesso_amministratore'] = getAMP(AdminId)
   print('permesso_amministratore',data['permesso_amministratore'])
@@ -306,6 +346,7 @@ def editSede(request):
       sede.mail = nuovasede.cleaned_data.get('mail')
       sede.cambiopassword = nuovasede.cleaned_data.get('cambiopassword')
       sede.forzanuovapassword = nuovasede.cleaned_data.get('forzanuovapassword')
+      sede.otppassword = nuovasede.cleaned_data.get('otppassword')
       sede.info = nuovasede.cleaned_data.get('info')
       sede.identificativo = nuovasede.cleaned_data.get('identificativo')
       sede.save()
@@ -327,19 +368,18 @@ def editSede(request):
       return HttpResponseRedirect(reverse('azienda:welcome'))
     else:
       print("form non valido")
-      data['sede'] = formSede(request.POST)
+      data['sedeForm'] = formSede(request.POST)
   else: #non è un post
     print("Non è un post")
-    formSedeField = None
     tmp = dict()
     tmp['nome'] = sede.nome
     tmp['info'] = sede.info
     tmp['identificativo'] = sede.identificativo
     tmp['cambiopassword'] = sede.cambiopassword
     tmp['forzanuovapassword'] = sede.forzanuovapassword
+    tmp['otppassword'] = sede.otppassword
     print('stato tmp',tmp)
-    formSedeField = formSede(tmp)
-    data['sede'] = formSedeField
+    data['sedeForm'] = formSede(tmp)
 
   return render(request,'azienda.editSede.html',data)
  

+ 15 - 2
comunicazione/views.py

@@ -194,13 +194,26 @@ def welcome(request):
   if 'UserId' in request.session:
     data['UserId'] = request.session['UserId']
 
+  sede = None
+  SedeId = None
+
+  if 'SedeId' in request.session:
+    SedeId = request.session['SedeId']
+    data['SedeId']=SedeId
+    print('Sede',SedeId)
+    try:
+      sede = Sede.objects.get(pk=SedeId)
+    except Sede.DoesNotExist as dne:
+      print("sede non esistente")
+    data['sede'] = sede
+
   #filtro:
   # selezionare tutti gli utenti per AziendaId
   data['admin'] = Amministratore.objects.get(pk=data['AdminId'])
-
   data['azienda'] = Azienda.objects.get(pk=data['AziendaId'])
+  data['sede'] = Sede.objects.get(pk=data['SedeId'])
+
   data['comunicazione'] = data['azienda'].comunicazione_set.all()
-  #data['comm'] = data['azienda'].comm
   print(data)
 
   if request.method == "POST":

binární
documento/__pycache__/__init__.cpython-311.pyc


binární
documento/__pycache__/admin.cpython-311.pyc


binární
documento/__pycache__/apps.cpython-311.pyc


binární
documento/__pycache__/forms.cpython-311.pyc


binární
documento/__pycache__/managefile.cpython-311.pyc


binární
documento/__pycache__/models.cpython-311.pyc


binární
documento/__pycache__/urls.cpython-311.pyc


binární
documento/__pycache__/views.cpython-311.pyc


+ 2 - 2
documento/managefile.py

@@ -51,13 +51,13 @@ def download_file(request,uid):
         data=dict()
         data['errore']="File non esistente o non ancora disponibile"
         data['utente'] = utente
-        return render(request,'welcome.error.html',data)
+        return render(request,'documento.error.html',data)
     else:
       print('il file non esiste',file_path)
       data=dict()
       data['errore']='File non esistente o non ancora disponibile'
       data['utente'] = utente
-      return render(request,'welcome.error.html',data)
+      return render(request,'documento.error.html',data)
 
     mime_type, _ = mimetypes.guess_type(file_path)
     print('file',file_path,mime_type)

binární
documento/migrations/__pycache__/0001_initial.cpython-311.pyc


binární
documento/migrations/__pycache__/0002_remove_documento_utente.cpython-311.pyc


binární
documento/migrations/__pycache__/0003_remove_documento_dataupload.cpython-311.pyc


binární
documento/migrations/__pycache__/0004_documento_utente.cpython-311.pyc


binární
documento/migrations/__pycache__/0005_documento_azienda.cpython-311.pyc


binární
documento/migrations/__pycache__/0006_documento_documento_d_documen_a68d7b_idx_and_more.cpython-311.pyc


binární
documento/migrations/__pycache__/0007_remove_documento_azienda_documento_dataupload.cpython-311.pyc


binární
documento/migrations/__pycache__/0008_alter_documento_utente.cpython-311.pyc


binární
documento/migrations/__pycache__/0009_documento_descrizione_alter_documento_crc.cpython-311.pyc


binární
documento/migrations/__pycache__/0010_documento_azienda.cpython-311.pyc


binární
documento/migrations/__pycache__/0011_documento_pertutti.cpython-311.pyc


binární
documento/migrations/__pycache__/0012_remove_documento_pertutti.cpython-311.pyc


binární
documento/migrations/__pycache__/0013_remove_documento_documento_d_documen_a68d7b_idx.cpython-311.pyc


binární
documento/migrations/__pycache__/0014_remove_documento_azienda.cpython-311.pyc


binární
documento/migrations/__pycache__/__init__.cpython-311.pyc


+ 0 - 0
documento/templates/welcome.error.html → documento/templates/documento.error.html


+ 3 - 16
documento/templates/documento.welcome.html

@@ -11,19 +11,6 @@ function toggle(source) {
 </script>
 {% endblock %}
 
-{% block top %}
-    <div class='form-outline mb-3 text-center btn-primary h3'>
-           {{ HeaderTitle }}
-    </div>
-    <div clasS='form-outline mb-3 text-center btn-primary h3'>
-           {{ azienda.nome }}
-    </div>
-    <div clasS='form-outline mb-3 text-center btn-primary h3'>
-           {{ admin.nome }}
-    </div>
-
-{% endblock %}
-
 {% block body %}
   {% if upload_ok %}
     <div>
@@ -111,9 +98,9 @@ function toggle(source) {
             <div><br></div>
 
   	    <div class='form-group form-inline'>
-	      <input type='submit' class="btn btn-primary btn-sm" name="carica" value='Carica Nuovi Documenti'>
-              <button type='button' class='btn btn-primary btn-sm' data-bs-toggle='modal' data-bs-target='#ConfirmDocumentDeleteModal'>Elimina Vecchi Documenti</button></td>
-	      <input type='submit' class="btn btn-primary btn-sm" name='indietro' value='Indietro'>
+	      <input type='submit' class="btn btn-primary" name="carica" value='Carica Nuovi Documenti'>
+              <button type='button' class='btn btn-primary' data-bs-toggle='modal' data-bs-target='#ConfirmDocumentDeleteModal'>Elimina Vecchi Documenti</button></td>
+	      <input type='submit' class="btn btn-primary" name='indietro' value='Indietro'>
             </div>
           </form>
         </div>

+ 1 - 1
documento/templates/documento.welcome.lista.html

@@ -21,7 +21,7 @@
         {% for documento in ElencoDocumenti %}
         <tr>
           <td><input type='checkbox' class='form-check-input' value='{{ documento.id }}' name='selezione'></td>
-          <td> <button type='button' class='btn btn-primary btn-block btn-lg mb-2 active' onclick="window.open('{% url "documento:finalize" documento.id documento.utente.id%}')">Vedi</button></td>
+          <td> <button type='button' class='btn btn-primary' onclick="window.open('{% url "documento:finalize" documento.id documento.utente.id%}')">Vedi</button></td>
           <td>{{ documento.utente.nome }} </td>
 	  <td>{{ documento.documento }} </td>
           <td>{{ documento.descrizione }} </td>

+ 2 - 2
documento/views.py

@@ -303,14 +303,14 @@ def finalize_download(request,did,uid=None):
       data['errore']="File non esistente o non ancora disponibile"
       data['utente'] = utente
       data['documento'] = documento
-      return render(request,'welcome.error.html',data)
+      return render(request,'documento.error.html',data)
   else:
     print('il file non esiste in document,download')
     data=dict()
     data['errore']='File non esistente o non ancora disponibile'
     data['utente'] = utente
     data['documento'] = documento
-    return render(request,'welcome.error.html',data)
+    return render(request,'documento.error.html',data)
 
   mime_type, _ = mimetypes.guess_type(fl_completa)
   fl = fl_completa

+ 1 - 1
gd/settings.py

@@ -132,7 +132,7 @@ STATIC_URL = 'static/'
 
 DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
 
-FORCE_SCRIPT_NAME = '/gd'
+#FORCE_SCRIPT_NAME = '/gd'
 
 #la sessione comunque scade alla chiusura del browser
 SESSION_EXPIRE_AT_BROWSER_CLOSE=True

+ 12 - 23
utente/templates/utente.edit.html

@@ -13,23 +13,19 @@ function toggle(source) {
 
 {% block body %}
 <!-- Nav tabs -->
-<ul class="nav nav-tabs" id="myTab" role="tablist">
-  <li class="nav-item" role="presentation">
-    <button class="btn btn-primary active" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile-pane" type="button" role="tab" aria-controls="profile-pane" aria-selected="true">Profilo</button>
-  </li>
-  <li class="nav-item" role="presentation">
-    <button class="btn btn-primary" id="document-tab" data-bs-toggle="tab" data-bs-target="#document-pane" type="button" role="tab" aria-controls="document-pane" aria-selected="true">Documenti</button>
-  </li>
-  <li class="nav-item" role="presentation">
-    <button class="btn btn-primary" id="logger-tab" data-bs-toggle="tab" data-bs-target="#logger-pane" type="button" role="tab" aria-controls="logger-pane" aria-selected="true">attivita</button>
-  </li>
-  <li class="nav-item" role="presentation">
-	  <button class="btn btn-outline-primary" id="return-tab" data-bs-toggle="tab" data-bs-target="#return-pane" type="button" role="tab" aria-controls="return-pane" aria-selected="true"><a href="{% url 'utente:welcome' %}">Indietro</a></button>
-  </li>
-
-</ul>
+<div class="button-group">
+  <button class="btn btn-primary active" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile-pane" type="button" role="tab" aria-controls="profile-pane" aria-selected="true">Profilo</button>
+  <button class="btn btn-primary" id="document-tab" data-bs-toggle="tab" data-bs-target="#document-pane" type="button" role="tab" aria-controls="document-pane" aria-selected="true">Documenti</button>
+  <button class="btn btn-primary" id="logger-tab" data-bs-toggle="tab" data-bs-target="#logger-pane" type="button" role="tab" aria-controls="logger-pane" aria-selected="true">attivita</button>
+  <button class="btn btn-outline-primary" id="return-tab" data-bs-toggle="tab" data-bs-target="#return-pane" type="button" role="tab" aria-controls="return-pane" aria-selected="true"><a href="{% url 'utente:welcome' %}">Indietro</a></button>
+  {% if mailnonvalida %}
+    <div class='text-center h5'>
+      <b>Attenzione, la mail non risulta inserita/corretta.</b>
+    </div>
+  {% endif %}
+</div>
 <!-- end nav tabs -->
-
+<div>&nbsp;</div>
 <!-- Tab panes -->
 <div class="tab-content" id='mycontent'>
   {% include 'utente.edit.profile.html' %}
@@ -39,10 +35,3 @@ function toggle(source) {
 
 {% endblock %}
 
-{% block bodybottom %}
-  {% if mailnonvalida %}
-    <div class='text-center h5'>
-           <b>Attenzione, la mail non risulta inserita/corretta.</b>
-    </div>
-  {% endif %}
-{% endblock %}

+ 3 - 3
utente/templates/utente.edit.profile.html

@@ -101,9 +101,9 @@
 
     <br>
 
-    <div class="btn-group">
-      <input type='submit' class="btn btn-primary" value='Aggiorna'>
-      <input type='submit' class="btn btn-primary" name="indietro" value="Indietro">
+    <div class="button-group">
+      <button type='submit' class="btn btn-primary" value='Aggiorna'>Aggiorna</button>
+      <button type='submit' class="btn btn-outline-primary" name="indietro" value="Indietro">Indietro</button>
     </div>
   </form>
 

+ 4 - 4
utente/templates/utente.welcome.html

@@ -15,11 +15,11 @@ function toggle(source) {
   <form name="inputUtente" method="POST">
   <div class='form-control'>
     {% if "UTENTE.CREA" in permesso_sede or "UTENTE.CREA" in permesso_azienda %}
-      <input type='submit' class="btn btn-primary" name='scelta' value='Nuovo Dipendente'>
+    <button type='submit' class="btn btn-primary" name='scelta' value='Nuovo Dipendente'>Nuovo Dipendente</button>
       <button type='button' class="btn btn-primary" name='TastoCaricaIndici' data-bs-toggle='modal' data-bs-target='#CaricaIndiceModal'>Carica Lista Nuovi Dipendenti</button>
-      <input type='submit' class="btn btn-primary" name='ScaricaSelezionati' value="Scarica Selezionati"/>
+      <button type='submit' class="btn btn-primary" name='ScaricaSelezionati' value="Scarica Selezionati"/>Scarica Selezionati</button>
     {% endif %}
-    <input type='submit' class="btn btn-primary" name="indietro" value="Indietro">
+    <button type='submit' class="btn btn-primary" name="indietro" value="Indietro">Indietro</button>
   </div>
   <div class='form-control'>
     Numero di dipendenti selezionati {{ numeroRecordAttuali }} su un totale di {{ numeroRecordAzienda }}.
@@ -49,7 +49,7 @@ function toggle(source) {
       {% for uu in utenti %}
         <tr>
           {% if "UTENTE.EDIT" in permesso_sede or "UTENTE.EDIT" in permesso_azienda %}
-            <td> <button type='submit' class='btn btn-primary btn-block btn-lg mb-2 active' name='scelta' value='{{ uu.id }}'>Edit</button></td>
+            <td> <button type='submit' class='btn btn-primary ' name='scelta' value='{{ uu.id }}'>Edit</button></td>
           {% endif %}
           <td> {{ uu.nome }} </td>
 	  <td> {{ uu.codicefiscale }} </td>