feat: Implement invoice creation functionality and integrate DataTables for invoice listing with dynamic column rendering.

This commit is contained in:
pbao9
2026-02-15 00:55:17 +07:00
parent 691c7e3765
commit a7614c91cd
18 changed files with 404 additions and 324 deletions
@@ -12,10 +12,13 @@ class InvoiceRepository extends BaseRepository implements InvoiceRepositoryInter
{
return Invoice::class;
}
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'])
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'], bool $returnQuery = false)
{
$model = $this->model->with($relationships)->select($select);
if (isset($data['client']) && ! empty($data['client'])) {
$model = $model->where("customer_id", $data['client']);
}
if (isset($data['invoice_type'])) {
$model = $model->where("invoice_type", $data['invoice_type']);
}
@@ -86,6 +89,11 @@ class InvoiceRepository extends BaseRepository implements InvoiceRepositoryInter
if (count($withCount) > 0) {
$model = $model->withCount($withCount);
}
if ($returnQuery) {
return $model;
}
if (isset($data['limit']) && $data['limit']) {
return $model->latest('id')->take($data['limit'])->get();
}