feat: add role in create account
continuous-integration/drone/push Build encountered an error
Details
continuous-integration/drone/push Build encountered an error
Details
This commit is contained in:
parent
124b0cdfef
commit
c530639470
|
|
@ -551,7 +551,7 @@ export default function SignUp() {
|
||||||
{/* Radio Buttons */}
|
{/* Radio Buttons */}
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
defaultValue="umum"
|
defaultValue="umum"
|
||||||
className="grid grid-cols-2 sm:grid-cols-4 gap-2 mb-6"
|
className="flex justify-between gap-2 mb-6"
|
||||||
onValueChange={(val) => setRole(val)}
|
onValueChange={(val) => setRole(val)}
|
||||||
>
|
>
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
|
|
@ -562,10 +562,10 @@ export default function SignUp() {
|
||||||
<RadioGroupItem value="jurnalis" id="jurnalis" />
|
<RadioGroupItem value="jurnalis" id="jurnalis" />
|
||||||
<Label htmlFor="jurnalis">Jurnalis</Label>
|
<Label htmlFor="jurnalis">Jurnalis</Label>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center space-x-2">
|
{/* <div className="flex items-center space-x-2">
|
||||||
<RadioGroupItem value="kontributor" id="kontributor" />
|
<RadioGroupItem value="kontributor" id="kontributor" />
|
||||||
<Label htmlFor="kontributor">Kontributor</Label>
|
<Label htmlFor="kontributor">Kontributor</Label>
|
||||||
</div>
|
</div> */}
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<RadioGroupItem value="tenant" id="tenant" />
|
<RadioGroupItem value="tenant" id="tenant" />
|
||||||
<Label htmlFor="tenant">Tenant</Label>
|
<Label htmlFor="tenant">Tenant</Label>
|
||||||
|
|
@ -592,13 +592,13 @@ export default function SignUp() {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Email */}
|
{/* Email */}
|
||||||
{/* <Input
|
<Input
|
||||||
type="email"
|
type="email"
|
||||||
required
|
required
|
||||||
placeholder="Email"
|
placeholder="Email"
|
||||||
value={email}
|
value={email}
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
/> */}
|
/>
|
||||||
|
|
||||||
{/* Password */}
|
{/* Password */}
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ const createUserSchema = z.object({
|
||||||
.min(1, { message: "Phone Number wajib diisi" }),
|
.min(1, { message: "Phone Number wajib diisi" }),
|
||||||
userLevelId: z.number({ invalid_type_error: "User Level harus dipilih" }),
|
userLevelId: z.number({ invalid_type_error: "User Level harus dipilih" }),
|
||||||
username: z.string().trim().min(1, { message: "Username wajib diisi" }),
|
username: z.string().trim().min(1, { message: "Username wajib diisi" }),
|
||||||
|
role: z.enum(["approver", "contributor"]),
|
||||||
});
|
});
|
||||||
|
|
||||||
const editUserSchema = z.object({
|
const editUserSchema = z.object({
|
||||||
|
|
@ -114,6 +115,7 @@ export default function UserForm({
|
||||||
phoneNumber: "",
|
phoneNumber: "",
|
||||||
userLevelId: 0,
|
userLevelId: 0,
|
||||||
username: "",
|
username: "",
|
||||||
|
role: "contributor",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -419,6 +421,29 @@ export default function UserForm({
|
||||||
</p>
|
</p>
|
||||||
</div> */}
|
</div> */}
|
||||||
|
|
||||||
|
{/* Role */}
|
||||||
|
<div>
|
||||||
|
<Label>Role</Label>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="role"
|
||||||
|
render={({ field }) => (
|
||||||
|
<Select
|
||||||
|
onValueChange={(value) => field.onChange(value)}
|
||||||
|
value={field.value || ""}
|
||||||
|
>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue placeholder="Pilih role" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="approver">Approver</SelectItem>
|
||||||
|
<SelectItem value="contributor">Contributor</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* User Level */}
|
{/* User Level */}
|
||||||
<div>
|
<div>
|
||||||
<Label>User Level</Label>
|
<Label>User Level</Label>
|
||||||
|
|
|
||||||
|
|
@ -93,9 +93,11 @@ export default function VideoDetail({ id }: { id: number }) {
|
||||||
downloadCount: file.download_count,
|
downloadCount: file.download_count,
|
||||||
createdAt: file.created_at,
|
createdAt: file.created_at,
|
||||||
updatedAt: file.updated_at,
|
updatedAt: file.updated_at,
|
||||||
thumbnailFileUrl:
|
// thumbnailFileUrl:
|
||||||
file.file_thumbnail || articleData.thumbnailUrl,
|
// file.file_thumbnail || articleData.thumbnailUrl,
|
||||||
...file,
|
// ...file,
|
||||||
|
// })) || [],
|
||||||
|
thumbnailFileUrl: articleData.thumbnailUrl || "/notfound.png",
|
||||||
})) || [],
|
})) || [],
|
||||||
...articleData,
|
...articleData,
|
||||||
};
|
};
|
||||||
|
|
@ -167,8 +169,8 @@ export default function VideoDetail({ id }: { id: number }) {
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
src={
|
src={
|
||||||
file?.thumbnailFileUrl?.trim()
|
file?.thumbnailUrl?.trim()
|
||||||
? file.thumbnailFileUrl
|
? file.thumbnailUrl
|
||||||
: "/notfound.png"
|
: "/notfound.png"
|
||||||
}
|
}
|
||||||
alt={file?.fileName || "thumbnail"}
|
alt={file?.fileName || "thumbnail"}
|
||||||
|
|
@ -178,6 +180,7 @@ export default function VideoDetail({ id }: { id: number }) {
|
||||||
selectedVideo === index ? "ring-2 ring-red-600" : ""
|
selectedVideo === index ? "ring-2 ring-red-600" : ""
|
||||||
}`}
|
}`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
...(Number(userRoleId) === 3
|
...(Number(userRoleId) === 3 || Number(userRoleId) === 5
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
groupLabel: "",
|
groupLabel: "",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue