|
@@ -93,83 +93,83 @@ discard block |
|
|
block discarded – undo |
|
93
|
93
|
$currency = ['suffix' => config('app.currency_symbol')]; |
|
94
|
94
|
} |
|
95
|
95
|
|
|
96
|
|
- CRUD::addColumns([['name' => 'id', 'label' => 'ID', 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
|
96
|
+ CRUD::addColumns([['name' => 'id', 'label' => 'ID', 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
97
|
97
|
return $entry->status_id > 2 ? 'del' : 'span'; |
|
98
|
|
- },],], |
|
|
98
|
+ },], ], |
|
99
|
99
|
|
|
100
|
|
- ['label' => __('ID number'), 'type' => 'text', 'name' => 'student.idnumber', 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
|
100
|
+ ['label' => __('ID number'), 'type' => 'text', 'name' => 'student.idnumber', 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
101
|
101
|
return $entry->status_id > 2 ? 'del' : 'span'; |
|
102
|
|
- },],], |
|
|
102
|
+ },], ], |
|
103
|
103
|
|
|
104
|
|
- ['name' => 'user', 'key' => 'user_lastname', 'attribute' => 'lastname', 'label' => __('Last Name'), 'type' => 'relationship', 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
|
104
|
+ ['name' => 'user', 'key' => 'user_lastname', 'attribute' => 'lastname', 'label' => __('Last Name'), 'type' => 'relationship', 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
105
|
105
|
return $entry->status_id > 2 ? 'del' : 'span'; |
|
106
|
|
- },], 'searchLogic' => function ($query, $column, $searchTerm) { |
|
107
|
|
- $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
108
|
|
- $q->whereHas('user', function ($q) use ($searchTerm) { |
|
109
|
|
- $q->where('lastname', 'like', '%' . $searchTerm . '%'); |
|
|
106
|
+ },], 'searchLogic' => function($query, $column, $searchTerm) { |
|
|
107
|
+ $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
|
108
|
+ $q->whereHas('user', function($q) use ($searchTerm) { |
|
|
109
|
+ $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
|
110
|
110
|
}); |
|
111
|
111
|
}); |
|
112
|
112
|
},], |
|
113
|
113
|
|
|
114
|
|
- ['name' => 'user', 'key' => 'user_firstname', 'attribute' => 'firstname', 'label' => __('First Name'), 'type' => 'relationship', 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
|
114
|
+ ['name' => 'user', 'key' => 'user_firstname', 'attribute' => 'firstname', 'label' => __('First Name'), 'type' => 'relationship', 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
115
|
115
|
return $entry->status_id > 2 ? 'del' : 'span'; |
|
116
|
|
- },], 'searchLogic' => function ($query, $column, $searchTerm) { |
|
117
|
|
- $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
118
|
|
- $q->whereHas('user', function ($q) use ($searchTerm) { |
|
119
|
|
- $q->where('firstname', 'like', '%' . $searchTerm . '%'); |
|
|
116
|
+ },], 'searchLogic' => function($query, $column, $searchTerm) { |
|
|
117
|
+ $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
|
118
|
+ $q->whereHas('user', function($q) use ($searchTerm) { |
|
|
119
|
+ $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
|
120
|
120
|
}); |
|
121
|
121
|
}); |
|
122
|
122
|
},], |
|
123
|
123
|
|
|
124
|
|
- ['label' => __('Age'), 'name' => 'student_age',], |
|
|
124
|
+ ['label' => __('Age'), 'name' => 'student_age', ], |
|
125
|
125
|
|
|
126
|
|
- ['label' => __('Birthdate'), 'name' => 'student_birthdate',],]); |
|
|
126
|
+ ['label' => __('Birthdate'), 'name' => 'student_birthdate', ], ]); |
|
127
|
127
|
|
|
128
|
128
|
if ($this->mode === 'global') { |
|
129
|
|
- CRUD::addColumns([['label' => __('Course'), 'type' => 'select', 'name' => 'course_id', 'entity' => 'course', 'attribute' => 'name', 'model' => Course::class,], ['type' => 'relationship', 'name' => 'course.period', 'label' => __('Period'), 'attribute' => 'name',],]); |
|
|
129
|
+ CRUD::addColumns([['label' => __('Course'), 'type' => 'select', 'name' => 'course_id', 'entity' => 'course', 'attribute' => 'name', 'model' => Course::class, ], ['type' => 'relationship', 'name' => 'course.period', 'label' => __('Period'), 'attribute' => 'name', ], ]); |
|
130
|
130
|
} |
|
131
|
131
|
|
|
132
|
|
- CRUD::addColumns([['label' => __('Status'), 'type' => 'select', 'name' => 'status_id', 'entity' => 'enrollmentStatus', 'attribute' => 'name', 'model' => EnrollmentStatusType::class, 'wrapper' => ['element' => 'span', 'class' => function ($crud, $column, $entry) { |
|
133
|
|
- return 'badge badge-pill badge-' . $entry->enrollmentStatus->styling(); |
|
134
|
|
- },],],]); |
|
|
132
|
+ CRUD::addColumns([['label' => __('Status'), 'type' => 'select', 'name' => 'status_id', 'entity' => 'enrollmentStatus', 'attribute' => 'name', 'model' => EnrollmentStatusType::class, 'wrapper' => ['element' => 'span', 'class' => function($crud, $column, $entry) { |
|
|
133
|
+ return 'badge badge-pill badge-'.$entry->enrollmentStatus->styling(); |
|
|
134
|
+ },], ], ]); |
|
135
|
135
|
|
|
136
|
136
|
if (config('invoicing.allow_scheduled_payments')) { |
|
137
|
137
|
CRUD::addColumn(['name' => 'scheduledPayments', 'type' => 'relationship', 'label' => __('Scheduled Payments'), // OPTIONAL |
|
138
|
|
- 'attribute' => 'date', 'model' => ScheduledPayment::class,]); |
|
|
138
|
+ 'attribute' => 'date', 'model' => ScheduledPayment::class, ]); |
|
139
|
139
|
} |
|
140
|
140
|
|
|
141
|
141
|
CRUD::addColumn(array_merge(['name' => 'price', // The db column name |
|
142
|
|
- 'label' => __('Price'), 'type' => 'number',], $currency)); |
|
|
142
|
+ 'label' => __('Price'), 'type' => 'number', ], $currency)); |
|
143
|
143
|
|
|
144
|
144
|
|
|
145
|
145
|
if (config('invoicing.invoices_contain_enrollments_only')) { |
|
146
|
|
- CRUD::addColumn(array_merge(['name' => 'balance', 'label' => __('Balance'), 'type' => 'number',], $currency)); |
|
|
146
|
+ CRUD::addColumn(array_merge(['name' => 'balance', 'label' => __('Balance'), 'type' => 'number', ], $currency)); |
|
147
|
147
|
} |
|
148
|
148
|
|
|
149
|
149
|
CRUD::addColumns([ |
|
150
|
150
|
|
|
151
|
|
- ['name' => 'scholarships', 'type' => 'relationship', 'label' => __('Scholarship'), 'attribute' => 'name', 'model' => Scholarship::class,], |
|
|
151
|
+ ['name' => 'scholarships', 'type' => 'relationship', 'label' => __('Scholarship'), 'attribute' => 'name', 'model' => Scholarship::class, ], |
|
152
|
152
|
|
|
153
|
|
- ['label' => __('Email'), 'name' => 'user', 'attribute' => 'email', 'type' => 'relationship',], |
|
|
153
|
+ ['label' => __('Email'), 'name' => 'user', 'attribute' => 'email', 'type' => 'relationship', ], |
|
154
|
154
|
|
|
155
|
|
- ['label' => __('Phone Number'), 'type' => 'select_multiple', 'name' => 'student.phone', 'attribute' => 'phone_number', 'model' => PhoneNumber::class,],]); |
|
|
155
|
+ ['label' => __('Phone Number'), 'type' => 'select_multiple', 'name' => 'student.phone', 'attribute' => 'phone_number', 'model' => PhoneNumber::class, ], ]); |
|
156
|
156
|
|
|
157
|
157
|
if ($this->mode === 'global') { |
|
158
|
|
- CRUD::addFilter(['name' => 'status_id', 'type' => 'select2_multiple', 'label' => __('Status'),], fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), function ($values) { |
|
|
158
|
+ CRUD::addFilter(['name' => 'status_id', 'type' => 'select2_multiple', 'label' => __('Status'), ], fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), function($values) { |
|
159
|
159
|
foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
|
160
|
160
|
CRUD::addClause('orWhere', 'status_id', $value); |
|
161
|
161
|
} |
|
162
|
162
|
}); |
|
163
|
163
|
|
|
164
|
|
- CRUD::addFilter(['name' => 'period_id', 'type' => 'select2', 'label' => __('Period'),], fn() => Period::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
|
164
|
+ CRUD::addFilter(['name' => 'period_id', 'type' => 'select2', 'label' => __('Period'), ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { |
|
165
|
165
|
CRUD::addClause('period', $value); |
|
166
|
166
|
}); |
|
167
|
167
|
|
|
168
|
|
- CRUD::addFilter(['name' => 'scholarship', 'type' => 'select2', 'label' => __('Scholarship'),], fn() => Scholarship::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
|
168
|
+ CRUD::addFilter(['name' => 'scholarship', 'type' => 'select2', 'label' => __('Scholarship'), ], fn() => Scholarship::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
169
|
169
|
if ($value == 'all') { |
|
170
|
170
|
CRUD::addClause('whereHas', 'scholarships'); |
|
171
|
171
|
} else { |
|
172
|
|
- CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) { |
|
|
172
|
+ CRUD::addClause('whereHas', 'scholarships', function($q) use ($value) { |
|
173
|
173
|
$q->where('scholarships.id', $value); |
|
174
|
174
|
}); |
|
175
|
175
|
} |
|
@@ -214,7 +214,7 @@ discard block |
|
|
block discarded – undo |
|
214
|
214
|
'model' => Course::class, |
|
215
|
215
|
'attribute' => 'name', |
|
216
|
216
|
|
|
217
|
|
- 'options' => (fn ($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
|
217
|
+ 'options' => (fn($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
218
|
218
|
]); |
|
219
|
219
|
|
|
220
|
220
|
CRUD::addField(array_merge([ |