Compare commits

..

No commits in common. "1fe2b301569e315cdd7101a310a9d9dc0348c1a5" and "71439aab4d10d6a1991798540c2bdd922304e1ec" have entirely different histories.

12 changed files with 35 additions and 69 deletions

View File

@ -10,7 +10,7 @@ class DepartmentService
{
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

View File

@ -11,21 +11,21 @@ public function run(): void
{
Department::insert([
[
'code' => 'SI-S1',
'code' => 'SI',
'name' => 'Sistem Informasi',
'degree_level' => 'S1',
'created_at' => now(),
'updated_at' => now(),
],
[
'code' => 'TI-S1',
'code' => 'TI',
'name' => 'Teknik Industri',
'degree_level' => 'S1',
'created_at' => now(),
'updated_at' => now(),
],
[
'code' => 'BD-S1',
'code' => 'BD',
'name' => 'Bisnis Digital',
'degree_level' => 'S1',
'created_at' => now(),

View File

@ -31,7 +31,6 @@ import type {
Announcement,
AnnouncementDepartment,
} from '@/types/announcement';
import { formatDepartmentLabel } from '@/types/department';
import { createAnnouncementColumns } from './columns';
type Props = {
@ -65,7 +64,7 @@ export default function AnnouncementIndex({
label: 'Jurusan',
options: departments.map((department) => ({
value: String(department.id),
label: formatDepartmentLabel(department),
label: department.name,
})),
},
];
@ -256,7 +255,7 @@ function AnnouncementFields({
key={department.id}
value={String(department.id)}
>
{formatDepartmentLabel(department)}
{department.name}
</SelectItem>
))}
</SelectContent>

View File

@ -27,10 +27,9 @@ import {
update,
} from '@/routes/admin/manage/courses';
import type { Course } from '@/types/course';
import { formatDepartmentLabel } from '@/types/department';
import { createCourseColumns } from './columns';
type Department = { id: number; name: string; degree_level: string | null };
type Department = { id: number; name: string };
type Props = {
courses: {
@ -63,7 +62,7 @@ export default function CourseIndex({
label: 'Jurusan',
options: departments.map((department) => ({
value: String(department.id),
label: formatDepartmentLabel(department),
label: department.name,
})),
},
];
@ -257,7 +256,7 @@ function CreateForm({
key={dept.id}
value={String(dept.id)}
>
{formatDepartmentLabel(dept)}
{dept.name}
</SelectItem>
))}
</SelectContent>
@ -363,7 +362,7 @@ function EditForm({
key={dept.id}
value={String(dept.id)}
>
{formatDepartmentLabel(dept)}
{dept.name}
</SelectItem>
))}
</SelectContent>

View File

@ -24,9 +24,8 @@ import { PhoneInput } from '@/components/ui/phone-input';
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
import { Textarea } from '@/components/ui/textarea';
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 = {
departments: Department[];
@ -284,8 +283,8 @@ export default function LecturerCreate({ departments }: Props) {
onValueChange={
setSelectedDepartments
}
itemToStringLabel={
formatDepartmentLabel
itemToStringLabel={(dept) =>
dept.name
}
isItemEqualToValue={(a, b) =>
a.id === b.id
@ -298,13 +297,11 @@ export default function LecturerCreate({ departments }: Props) {
(dept) => (
<ComboboxChip
key={dept.id}
aria-label={formatDepartmentLabel(
dept,
)}
aria-label={
dept.name
}
>
{formatDepartmentLabel(
dept,
)}
{dept.name}
</ComboboxChip>
),
)}
@ -329,9 +326,7 @@ export default function LecturerCreate({ departments }: Props) {
key={dept.id}
value={dept}
>
{formatDepartmentLabel(
dept,
)}
{dept.name}
</ComboboxItem>
))}
</ComboboxList>

View File

@ -24,9 +24,8 @@ import { PhoneInput } from '@/components/ui/phone-input';
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
import { Textarea } from '@/components/ui/textarea';
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 = {
id: number;
@ -42,11 +41,7 @@ type User = {
} | null;
lecturer: {
lecturer_number: string;
departments: {
id: number;
name: string;
degree_level: string | null;
}[];
departments: { id: number; name: string }[];
} | null;
};
@ -323,8 +318,8 @@ export default function LecturerEdit({ user, departments }: Props) {
onValueChange={
setSelectedDepartments
}
itemToStringLabel={
formatDepartmentLabel
itemToStringLabel={(dept) =>
dept.name
}
isItemEqualToValue={(a, b) =>
a.id === b.id
@ -337,13 +332,11 @@ export default function LecturerEdit({ user, departments }: Props) {
(dept) => (
<ComboboxChip
key={dept.id}
aria-label={formatDepartmentLabel(
dept,
)}
aria-label={
dept.name
}
>
{formatDepartmentLabel(
dept,
)}
{dept.name}
</ComboboxChip>
),
)}
@ -368,9 +361,7 @@ export default function LecturerEdit({ user, departments }: Props) {
key={dept.id}
value={dept}
>
{formatDepartmentLabel(
dept,
)}
{dept.name}
</ComboboxItem>
))}
</ComboboxList>

View File

@ -19,11 +19,10 @@ import {
update_user_status,
exportMethod as exportLecturers,
} from '@/routes/admin/users/lecturers';
import { formatDepartmentLabel } from '@/types/department';
import type { Lecturer } from './columns';
import { createLecturerColumns } from './columns';
type Department = { id: number; name: string; degree_level: string | null };
type Department = { id: number; name: string };
type Props = {
lecturers: {
@ -62,7 +61,7 @@ export default function LecturerIndex({
label: 'Jurusan',
options: departments.map((department) => ({
value: String(department.id),
label: formatDepartmentLabel(department),
label: department.name,
})),
},
];

View File

@ -28,9 +28,8 @@ import {
} from '@/components/ui/select';
import { Textarea } from '@/components/ui/textarea';
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 = {
id: number;
lecturer_number: string;
@ -290,9 +289,7 @@ export default function StudentCreate({ departments, lecturers }: Props) {
key={dept.id}
value={String(dept.id)}
>
{formatDepartmentLabel(
dept,
)}
{dept.name}
</SelectItem>
))}
</SelectContent>

View File

@ -28,9 +28,8 @@ import {
} from '@/components/ui/select';
import { Textarea } from '@/components/ui/textarea';
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 = {
id: number;
lecturer_number: string;
@ -337,9 +336,7 @@ export default function StudentEdit({ user, departments, lecturers }: Props) {
key={dept.id}
value={String(dept.id)}
>
{formatDepartmentLabel(
dept,
)}
{dept.name}
</SelectItem>
))}
</SelectContent>

View File

@ -21,11 +21,10 @@ import {
exportMethod as exportStudents,
index as studentsIndex,
} from '@/routes/admin/users/students';
import { formatDepartmentLabel } from '@/types/department';
import { createStudentColumns } 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 Props = {
@ -71,7 +70,7 @@ export default function StudentIndex({
label: 'Jurusan',
options: departments.map((department) => ({
value: String(department.id),
label: formatDepartmentLabel(department),
label: department.name,
})),
},
{

View File

@ -2,7 +2,6 @@ export type AnnouncementDepartment = {
id: number;
code: string;
name: string;
degree_level: string | null;
};
export type AnnouncementCreator = {

View File

@ -10,12 +10,3 @@ export type Department = {
created_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;
}