Roberto Santini 1週間前
コミット
59999a9de2
1個のファイルの変更11行の追加0行の削除
  1. 11
    0
      app/Models/ContrattoServizioRiga.php

+ 11
- 0
app/Models/ContrattoServizioRiga.php ファイルの表示

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
     public function getPeriodoLabelAttribute(): string
272
     public function getPeriodoLabelAttribute(): string
266
     {
273
     {
274
+        if (! $this->needsPeriodo()) {
275
+            return '—';
276
+        }
277
+
267
         return Prodotto::PERIODI[$this->periodo] ?? ($this->periodo ?: '—');
278
         return Prodotto::PERIODI[$this->periodo] ?? ($this->periodo ?: '—');
268
     }
279
     }
269
 }
280
 }

読み込み中…
キャンセル
保存