Compare commits
No commits in common. "1fe2b301569e315cdd7101a310a9d9dc0348c1a5" and "71439aab4d10d6a1991798540c2bdd922304e1ec" have entirely different histories.
1fe2b30156
...
71439aab4d
@ -10,7 +10,7 @@ class DepartmentService
|
|||||||
{
|
{
|
||||||
public function getAllForSelect(): Collection
|
public function getAllForSelect(): Collection
|
||||||
{
|
{
|
||||||
return Department::select(['id', 'code', 'name', 'degree_level'])->get();
|
return Department::select(['id', 'code', 'name'])->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function paginated(int $perPage = 25, string $search = ''): LengthAwarePaginator
|
public function paginated(int $perPage = 25, string $search = ''): LengthAwarePaginator
|
||||||
|
|||||||
@ -11,21 +11,21 @@ public function run(): void
|
|||||||
{
|
{
|
||||||
Department::insert([
|
Department::insert([
|
||||||
[
|
[
|
||||||
'code' => 'SI-S1',
|
'code' => 'SI',
|
||||||
'name' => 'Sistem Informasi',
|
'name' => 'Sistem Informasi',
|
||||||
'degree_level' => 'S1',
|
'degree_level' => 'S1',
|
||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'code' => 'TI-S1',
|
'code' => 'TI',
|
||||||
'name' => 'Teknik Industri',
|
'name' => 'Teknik Industri',
|
||||||
'degree_level' => 'S1',
|
'degree_level' => 'S1',
|
||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'code' => 'BD-S1',
|
'code' => 'BD',
|
||||||
'name' => 'Bisnis Digital',
|
'name' => 'Bisnis Digital',
|
||||||
'degree_level' => 'S1',
|
'degree_level' => 'S1',
|
||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
|
|||||||
@ -31,7 +31,6 @@ import type {
|
|||||||
Announcement,
|
Announcement,
|
||||||
AnnouncementDepartment,
|
AnnouncementDepartment,
|
||||||
} from '@/types/announcement';
|
} from '@/types/announcement';
|
||||||
import { formatDepartmentLabel } from '@/types/department';
|
|
||||||
import { createAnnouncementColumns } from './columns';
|
import { createAnnouncementColumns } from './columns';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@ -65,7 +64,7 @@ export default function AnnouncementIndex({
|
|||||||
label: 'Jurusan',
|
label: 'Jurusan',
|
||||||
options: departments.map((department) => ({
|
options: departments.map((department) => ({
|
||||||
value: String(department.id),
|
value: String(department.id),
|
||||||
label: formatDepartmentLabel(department),
|
label: department.name,
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -256,7 +255,7 @@ function AnnouncementFields({
|
|||||||
key={department.id}
|
key={department.id}
|
||||||
value={String(department.id)}
|
value={String(department.id)}
|
||||||
>
|
>
|
||||||
{formatDepartmentLabel(department)}
|
{department.name}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
|
|||||||
@ -27,10 +27,9 @@ import {
|
|||||||
update,
|
update,
|
||||||
} from '@/routes/admin/manage/courses';
|
} from '@/routes/admin/manage/courses';
|
||||||
import type { Course } from '@/types/course';
|
import type { Course } from '@/types/course';
|
||||||
import { formatDepartmentLabel } from '@/types/department';
|
|
||||||
import { createCourseColumns } from './columns';
|
import { createCourseColumns } from './columns';
|
||||||
|
|
||||||
type Department = { id: number; name: string; degree_level: string | null };
|
type Department = { id: number; name: string };
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
courses: {
|
courses: {
|
||||||
@ -63,7 +62,7 @@ export default function CourseIndex({
|
|||||||
label: 'Jurusan',
|
label: 'Jurusan',
|
||||||
options: departments.map((department) => ({
|
options: departments.map((department) => ({
|
||||||
value: String(department.id),
|
value: String(department.id),
|
||||||
label: formatDepartmentLabel(department),
|
label: department.name,
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -257,7 +256,7 @@ function CreateForm({
|
|||||||
key={dept.id}
|
key={dept.id}
|
||||||
value={String(dept.id)}
|
value={String(dept.id)}
|
||||||
>
|
>
|
||||||
{formatDepartmentLabel(dept)}
|
{dept.name}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
@ -363,7 +362,7 @@ function EditForm({
|
|||||||
key={dept.id}
|
key={dept.id}
|
||||||
value={String(dept.id)}
|
value={String(dept.id)}
|
||||||
>
|
>
|
||||||
{formatDepartmentLabel(dept)}
|
{dept.name}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
|
|||||||
@ -24,9 +24,8 @@ import { PhoneInput } from '@/components/ui/phone-input';
|
|||||||
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
|
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
|
||||||
import { Textarea } from '@/components/ui/textarea';
|
import { Textarea } from '@/components/ui/textarea';
|
||||||
import { index, store } from '@/routes/admin/users/lecturers';
|
import { index, store } from '@/routes/admin/users/lecturers';
|
||||||
import { formatDepartmentLabel } from '@/types/department';
|
|
||||||
|
|
||||||
type Department = { id: number; name: string; degree_level: string | null };
|
type Department = { id: number; name: string };
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
departments: Department[];
|
departments: Department[];
|
||||||
@ -284,8 +283,8 @@ export default function LecturerCreate({ departments }: Props) {
|
|||||||
onValueChange={
|
onValueChange={
|
||||||
setSelectedDepartments
|
setSelectedDepartments
|
||||||
}
|
}
|
||||||
itemToStringLabel={
|
itemToStringLabel={(dept) =>
|
||||||
formatDepartmentLabel
|
dept.name
|
||||||
}
|
}
|
||||||
isItemEqualToValue={(a, b) =>
|
isItemEqualToValue={(a, b) =>
|
||||||
a.id === b.id
|
a.id === b.id
|
||||||
@ -298,13 +297,11 @@ export default function LecturerCreate({ departments }: Props) {
|
|||||||
(dept) => (
|
(dept) => (
|
||||||
<ComboboxChip
|
<ComboboxChip
|
||||||
key={dept.id}
|
key={dept.id}
|
||||||
aria-label={formatDepartmentLabel(
|
aria-label={
|
||||||
dept,
|
dept.name
|
||||||
)}
|
}
|
||||||
>
|
>
|
||||||
{formatDepartmentLabel(
|
{dept.name}
|
||||||
dept,
|
|
||||||
)}
|
|
||||||
</ComboboxChip>
|
</ComboboxChip>
|
||||||
),
|
),
|
||||||
)}
|
)}
|
||||||
@ -329,9 +326,7 @@ export default function LecturerCreate({ departments }: Props) {
|
|||||||
key={dept.id}
|
key={dept.id}
|
||||||
value={dept}
|
value={dept}
|
||||||
>
|
>
|
||||||
{formatDepartmentLabel(
|
{dept.name}
|
||||||
dept,
|
|
||||||
)}
|
|
||||||
</ComboboxItem>
|
</ComboboxItem>
|
||||||
))}
|
))}
|
||||||
</ComboboxList>
|
</ComboboxList>
|
||||||
|
|||||||
@ -24,9 +24,8 @@ import { PhoneInput } from '@/components/ui/phone-input';
|
|||||||
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
|
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
|
||||||
import { Textarea } from '@/components/ui/textarea';
|
import { Textarea } from '@/components/ui/textarea';
|
||||||
import { index, update } from '@/routes/admin/users/lecturers';
|
import { index, update } from '@/routes/admin/users/lecturers';
|
||||||
import { formatDepartmentLabel } from '@/types/department';
|
|
||||||
|
|
||||||
type Department = { id: number; name: string; degree_level: string | null };
|
type Department = { id: number; name: string };
|
||||||
|
|
||||||
type User = {
|
type User = {
|
||||||
id: number;
|
id: number;
|
||||||
@ -42,11 +41,7 @@ type User = {
|
|||||||
} | null;
|
} | null;
|
||||||
lecturer: {
|
lecturer: {
|
||||||
lecturer_number: string;
|
lecturer_number: string;
|
||||||
departments: {
|
departments: { id: number; name: string }[];
|
||||||
id: number;
|
|
||||||
name: string;
|
|
||||||
degree_level: string | null;
|
|
||||||
}[];
|
|
||||||
} | null;
|
} | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -323,8 +318,8 @@ export default function LecturerEdit({ user, departments }: Props) {
|
|||||||
onValueChange={
|
onValueChange={
|
||||||
setSelectedDepartments
|
setSelectedDepartments
|
||||||
}
|
}
|
||||||
itemToStringLabel={
|
itemToStringLabel={(dept) =>
|
||||||
formatDepartmentLabel
|
dept.name
|
||||||
}
|
}
|
||||||
isItemEqualToValue={(a, b) =>
|
isItemEqualToValue={(a, b) =>
|
||||||
a.id === b.id
|
a.id === b.id
|
||||||
@ -337,13 +332,11 @@ export default function LecturerEdit({ user, departments }: Props) {
|
|||||||
(dept) => (
|
(dept) => (
|
||||||
<ComboboxChip
|
<ComboboxChip
|
||||||
key={dept.id}
|
key={dept.id}
|
||||||
aria-label={formatDepartmentLabel(
|
aria-label={
|
||||||
dept,
|
dept.name
|
||||||
)}
|
}
|
||||||
>
|
>
|
||||||
{formatDepartmentLabel(
|
{dept.name}
|
||||||
dept,
|
|
||||||
)}
|
|
||||||
</ComboboxChip>
|
</ComboboxChip>
|
||||||
),
|
),
|
||||||
)}
|
)}
|
||||||
@ -368,9 +361,7 @@ export default function LecturerEdit({ user, departments }: Props) {
|
|||||||
key={dept.id}
|
key={dept.id}
|
||||||
value={dept}
|
value={dept}
|
||||||
>
|
>
|
||||||
{formatDepartmentLabel(
|
{dept.name}
|
||||||
dept,
|
|
||||||
)}
|
|
||||||
</ComboboxItem>
|
</ComboboxItem>
|
||||||
))}
|
))}
|
||||||
</ComboboxList>
|
</ComboboxList>
|
||||||
|
|||||||
@ -19,11 +19,10 @@ import {
|
|||||||
update_user_status,
|
update_user_status,
|
||||||
exportMethod as exportLecturers,
|
exportMethod as exportLecturers,
|
||||||
} from '@/routes/admin/users/lecturers';
|
} from '@/routes/admin/users/lecturers';
|
||||||
import { formatDepartmentLabel } from '@/types/department';
|
|
||||||
import type { Lecturer } from './columns';
|
import type { Lecturer } from './columns';
|
||||||
import { createLecturerColumns } from './columns';
|
import { createLecturerColumns } from './columns';
|
||||||
|
|
||||||
type Department = { id: number; name: string; degree_level: string | null };
|
type Department = { id: number; name: string };
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
lecturers: {
|
lecturers: {
|
||||||
@ -62,7 +61,7 @@ export default function LecturerIndex({
|
|||||||
label: 'Jurusan',
|
label: 'Jurusan',
|
||||||
options: departments.map((department) => ({
|
options: departments.map((department) => ({
|
||||||
value: String(department.id),
|
value: String(department.id),
|
||||||
label: formatDepartmentLabel(department),
|
label: department.name,
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@ -28,9 +28,8 @@ import {
|
|||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { Textarea } from '@/components/ui/textarea';
|
import { Textarea } from '@/components/ui/textarea';
|
||||||
import { index, store } from '@/routes/admin/users/students';
|
import { index, store } from '@/routes/admin/users/students';
|
||||||
import { formatDepartmentLabel } from '@/types/department';
|
|
||||||
|
|
||||||
type Department = { id: number; name: string; degree_level: string | null };
|
type Department = { id: number; name: string };
|
||||||
type Lecturer = {
|
type Lecturer = {
|
||||||
id: number;
|
id: number;
|
||||||
lecturer_number: string;
|
lecturer_number: string;
|
||||||
@ -290,9 +289,7 @@ export default function StudentCreate({ departments, lecturers }: Props) {
|
|||||||
key={dept.id}
|
key={dept.id}
|
||||||
value={String(dept.id)}
|
value={String(dept.id)}
|
||||||
>
|
>
|
||||||
{formatDepartmentLabel(
|
{dept.name}
|
||||||
dept,
|
|
||||||
)}
|
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
|
|||||||
@ -28,9 +28,8 @@ import {
|
|||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { Textarea } from '@/components/ui/textarea';
|
import { Textarea } from '@/components/ui/textarea';
|
||||||
import { index, update } from '@/routes/admin/users/students';
|
import { index, update } from '@/routes/admin/users/students';
|
||||||
import { formatDepartmentLabel } from '@/types/department';
|
|
||||||
|
|
||||||
type Department = { id: number; name: string; degree_level: string | null };
|
type Department = { id: number; name: string };
|
||||||
type Lecturer = {
|
type Lecturer = {
|
||||||
id: number;
|
id: number;
|
||||||
lecturer_number: string;
|
lecturer_number: string;
|
||||||
@ -337,9 +336,7 @@ export default function StudentEdit({ user, departments, lecturers }: Props) {
|
|||||||
key={dept.id}
|
key={dept.id}
|
||||||
value={String(dept.id)}
|
value={String(dept.id)}
|
||||||
>
|
>
|
||||||
{formatDepartmentLabel(
|
{dept.name}
|
||||||
dept,
|
|
||||||
)}
|
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
|
|||||||
@ -21,11 +21,10 @@ import {
|
|||||||
exportMethod as exportStudents,
|
exportMethod as exportStudents,
|
||||||
index as studentsIndex,
|
index as studentsIndex,
|
||||||
} from '@/routes/admin/users/students';
|
} from '@/routes/admin/users/students';
|
||||||
import { formatDepartmentLabel } from '@/types/department';
|
|
||||||
import { createStudentColumns } from './columns';
|
import { createStudentColumns } from './columns';
|
||||||
import type { Student } from './columns';
|
import type { Student } from './columns';
|
||||||
|
|
||||||
type Department = { id: number; name: string; degree_level: string | null };
|
type Department = { id: number; name: string };
|
||||||
type StatusOption = { value: string; label: string };
|
type StatusOption = { value: string; label: string };
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@ -71,7 +70,7 @@ export default function StudentIndex({
|
|||||||
label: 'Jurusan',
|
label: 'Jurusan',
|
||||||
options: departments.map((department) => ({
|
options: departments.map((department) => ({
|
||||||
value: String(department.id),
|
value: String(department.id),
|
||||||
label: formatDepartmentLabel(department),
|
label: department.name,
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,6 @@ export type AnnouncementDepartment = {
|
|||||||
id: number;
|
id: number;
|
||||||
code: string;
|
code: string;
|
||||||
name: string;
|
name: string;
|
||||||
degree_level: string | null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type AnnouncementCreator = {
|
export type AnnouncementCreator = {
|
||||||
|
|||||||
@ -10,12 +10,3 @@ export type Department = {
|
|||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function formatDepartmentLabel(department: {
|
|
||||||
name: string;
|
|
||||||
degree_level?: string | null;
|
|
||||||
}): string {
|
|
||||||
return department.degree_level
|
|
||||||
? `${department.name} (${department.degree_level})`
|
|
||||||
: department.name;
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user