|
|
@@ -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
|
}
|