Roberto Santini 1 tydzień temu
rodzic
commit
59999a9de2
1 zmienionych plików z 11 dodań i 0 usunięć
  1. 11
    0
      app/Models/ContrattoServizioRiga.php

+ 11
- 0
app/Models/ContrattoServizioRiga.php Wyświetl plik

@@ -262,8 +262,19 @@ class ContrattoServizioRiga extends \App\Models\AbstractModels\AbstractContratto
262 262
         };
263 263
     }
264 264
 
265
+    public function needsPeriodo(): bool
266
+    {
267
+        $um = $this->unita_misura ?: optional($this->prodotto)->unita_misura;
268
+
269
+        return filled($um) && ! in_array($um, ['mese', 'anno', 'forfait'], true);
270
+    }
271
+
265 272
     public function getPeriodoLabelAttribute(): string
266 273
     {
274
+        if (! $this->needsPeriodo()) {
275
+            return '—';
276
+        }
277
+
267 278
         return Prodotto::PERIODI[$this->periodo] ?? ($this->periodo ?: '—');
268 279
     }
269 280
 }

Ładowanie…
Anuluj
Zapisz