You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.7 KiB
66 lines
2.7 KiB
<?php
|
|
|
|
namespace App\Domains\Finance\Schemas\Invoice;
|
|
|
|
use App\Domains\Academic\Queries\Selection\SelectFacultyQuery;
|
|
use App\Domains\Academic\Queries\Selection\SelectStudyProgramQuery;
|
|
use App\Domains\Academic\Queries\Selection\SelectTermQuery;
|
|
use App\Domains\Finance\Support\Schema\InvoiceSchema;
|
|
use App\UI\Enums\InputType;
|
|
use App\UI\Support\Settings\SettingSchema;
|
|
|
|
class StudentInvoiceSchema
|
|
{
|
|
public static function make(): InvoiceSchema
|
|
{
|
|
return InvoiceSchema::make()
|
|
->addSchema(
|
|
key: 'student_id',
|
|
label: __('domains/finance/field.invoice.detail.student_id'),
|
|
schema: SettingSchema::make(InputType::TEXTLINE)
|
|
->rules(['required'])
|
|
)->addSchema(
|
|
key: 'student_name',
|
|
label: __('domains/finance/field.invoice.detail.student_name'),
|
|
schema: SettingSchema::make(InputType::TEXTLINE)
|
|
->rules(['required', 'string'])
|
|
)->addSchema(
|
|
key: 'faculty',
|
|
label: __('domains/finance/field.invoice.detail.faculty'),
|
|
schema: SettingSchema::make(InputType::SELECT)
|
|
->rules(['required', 'string'])
|
|
->select2()
|
|
->live()
|
|
->options(fn() => SelectFacultyQuery::fetch())
|
|
)->addSchema(
|
|
key: 'study_program',
|
|
label: __('domains/finance/field.invoice.detail.study_program'),
|
|
schema: SettingSchema::make(InputType::SELECT)
|
|
->rules(['required', 'string'])
|
|
->select2()
|
|
->dependsOn('faculty')
|
|
->setContextKey('faculty')
|
|
->options(fn ($context) => SelectStudyProgramQuery::fetch($context))
|
|
)->addSchema(
|
|
key: 'term',
|
|
label: __('domains/finance/field.invoice.detail.term'),
|
|
schema: SettingSchema::make(InputType::SELECT)
|
|
->rules(['required'])
|
|
->options(fn() => SelectTermQuery::fetch())
|
|
->select2()
|
|
)->addSchema(
|
|
key: 'semester',
|
|
label: __('domains/finance/field.invoice.detail.semester'),
|
|
schema: SettingSchema::make(InputType::SELECT)
|
|
->rules(['required'])
|
|
->options(range(1, 13))
|
|
->select2()
|
|
)->addSchema(
|
|
key: 'fee_type',
|
|
label: __('domains/finance/field.invoice.detail.fee_type'),
|
|
schema: SettingSchema::make(InputType::SELECT)
|
|
->rules(['required'])
|
|
->select2()
|
|
);
|
|
}
|
|
}
|
|
|