Show one month at a time, and change month with calendar and buttons

This commit is contained in:
2022-03-18 17:50:21 -03:00
parent e5cf3cfa07
commit 2b3b475d91
8 changed files with 309 additions and 29 deletions

View File

@ -16,11 +16,11 @@ class Moneda extends Model {
protected static $fields = ['denominacion', 'codigo'];
public function format($valor) {
return implode('', [
return trim(implode('', [
$this->prefijo,
number_format($valor, $this->decimales, ',', '.'),
$this->sufijo
]);
]));
}
public function cambio(\DateTime $fecha) {
$cambio = $this->factory->find(TipoCambio::class)
@ -43,4 +43,14 @@ class Moneda extends Model {
}
return $cambio->transform($valor);
}
public function toArray(): array {
$arr = parent::toArray();
$arr['format'] = [
'prefijo' => $this->prefijo,
'sufijo' => $this->sufijo,
'decimales' => $this->decimales
];
return $arr;
}
}