add colors plannings

This commit is contained in:
amazuecos
2025-04-15 09:53:50 +02:00
parent a52745fe09
commit 0fe2470477
7 changed files with 98 additions and 33 deletions

View File

@ -87,12 +87,12 @@ class OrdenTrabajoEntity extends Entity
public function dates(): ?OrdenTrabajoDateEntity
{
$m = model(OrdenTrabajoDate::class);
return $m->where('orden_trabajo_id',$this->attributes["id"])->first();
return $m->where('orden_trabajo_id', $this->attributes["id"])->first();
}
public function users(): ?OrdenTrabajoUserEntity
{
$m = model(OrdenTrabajoUser::class);
return $m->where('orden_trabajo_id',$this->attributes["id"])->first();
return $m->where('orden_trabajo_id', $this->attributes["id"])->first();
}
/**
@ -109,24 +109,24 @@ class OrdenTrabajoEntity extends Entity
$this->attributes["dates"] = $ot_dates->fill($data);
return $this;
}
public function getBarCode() : string
public function getBarCode(): string
{
$barcode = new TypeCode128();
$renderer = new PngRenderer();
$barcodeData = $barcode->getBarcode($this->pedido()->presupuesto()->id);
return base64_encode($renderer->render($barcodeData,200, 50));
return base64_encode($renderer->render($barcodeData, 200, 50));
}
public function files() : array
public function files(): array
{
$m = model(OrdenTrabajoFileModel::class);
return $m->where('orden_trabajo_id',$this->attributes['id'])->findAll() ?? [];
return $m->where('orden_trabajo_id', $this->attributes['id'])->findAll() ?? [];
}
public function pedidoEsperaBy() : ?UserEntity
public function pedidoEsperaBy(): ?UserEntity
{
$m = model(UserModel::class);
if($this->attributes['pedido_espera_by']){
if ($this->attributes['pedido_espera_by']) {
return $m->findById($this->attributes['pedido_espera_by']);
}else{
} else {
return null;
}
}
@ -139,10 +139,10 @@ class OrdenTrabajoEntity extends Entity
helper('filesystem');
$path = WRITEPATH . 'uploads/' . $this->attributes["portada_path"];
$portada_path = null;
if($path){
if(file_exists($path)){
if ($path) {
if (file_exists($path)) {
$portada_path = $path;
}else{
} else {
$portada_path = null;
}
}