Fix Laravel Pint formatting

This commit is contained in:
root
2026-06-09 00:03:03 -04:00
parent 8d4d610b82
commit b5fd4a4ca1
1414 changed files with 11317 additions and 10201 deletions
@@ -15,13 +15,16 @@ class SlipPrinterFormatterService
}
if (preg_match('/^\d{1,2}\/\d{1,2}\/\d{4}$/', $value)) {
$dt = \DateTime::createFromFormat('!m/d/Y', $value);
return $dt ? $dt->format('Y-m-d') : null;
}
if (preg_match('/^\d{1,2}-\d{1,2}-\d{4}$/', $value)) {
$dt = \DateTime::createFromFormat('!m-d-Y', $value);
return $dt ? $dt->format('Y-m-d') : null;
}
$ts = strtotime($value);
return $ts ? date('Y-m-d', $ts) : null;
}
@@ -32,6 +35,7 @@ class SlipPrinterFormatterService
return null;
}
$ts = strtotime($value);
return $ts ? date('H:i:s', $ts) : null;
}
@@ -42,6 +46,7 @@ class SlipPrinterFormatterService
return '';
}
$ts = strtotime($value);
return $ts ? date('m/d/Y', $ts) : '';
}
@@ -53,8 +58,9 @@ class SlipPrinterFormatterService
}
$ts = strtotime($value);
if ($ts === false) {
$ts = strtotime('today ' . $value);
$ts = strtotime('today '.$value);
}
return $ts ? date('h:i A', $ts) : '';
}
@@ -64,17 +70,19 @@ class SlipPrinterFormatterService
if (strlen($line) > $width) {
return substr($line, 0, $width);
}
return $line . str_repeat(' ', $width - strlen($line));
return $line.str_repeat(' ', $width - strlen($line));
}
public function buildSlipLines(array $data, int $width): array
{
$lines = [];
$lines[] = $this->fitLine('Student Name: ' . (string) ($data['student_name'] ?? ''), $width);
$lines[] = $this->fitLine('Date: ' . (string) ($data['date'] ?? '') . ' Time In: ' . (string) ($data['time_in'] ?? ''), $width);
$lines[] = $this->fitLine('Grade: ' . (string) ($data['grade'] ?? ''), $width);
$lines[] = $this->fitLine('Reason: ' . (string) ($data['reason'] ?? ''), $width);
$lines[] = $this->fitLine('Admin: ' . (string) ($data['admin_name'] ?? ''), $width);
$lines[] = $this->fitLine('Student Name: '.(string) ($data['student_name'] ?? ''), $width);
$lines[] = $this->fitLine('Date: '.(string) ($data['date'] ?? '').' Time In: '.(string) ($data['time_in'] ?? ''), $width);
$lines[] = $this->fitLine('Grade: '.(string) ($data['grade'] ?? ''), $width);
$lines[] = $this->fitLine('Reason: '.(string) ($data['reason'] ?? ''), $width);
$lines[] = $this->fitLine('Admin: '.(string) ($data['admin_name'] ?? ''), $width);
return $lines;
}
}