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 */}
|
||||
<RadioGroup
|
||||
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)}
|
||||
>
|
||||
<div className="flex items-center space-x-2">
|
||||
|
|
@ -562,10 +562,10 @@ export default function SignUp() {
|
|||
<RadioGroupItem value="jurnalis" id="jurnalis" />
|
||||
<Label htmlFor="jurnalis">Jurnalis</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
{/* <div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="kontributor" id="kontributor" />
|
||||
<Label htmlFor="kontributor">Kontributor</Label>
|
||||
</div>
|
||||
</div> */}
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="tenant" id="tenant" />
|
||||
<Label htmlFor="tenant">Tenant</Label>
|
||||
|
|
@ -592,13 +592,13 @@ export default function SignUp() {
|
|||
/>
|
||||
|
||||
{/* Email */}
|
||||
{/* <Input
|
||||
<Input
|
||||
type="email"
|
||||
required
|
||||
placeholder="Email"
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
/> */}
|
||||
/>
|
||||
|
||||
{/* Password */}
|
||||
<div className="relative">
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ const createUserSchema = z.object({
|
|||
.min(1, { message: "Phone Number wajib diisi" }),
|
||||
userLevelId: z.number({ invalid_type_error: "User Level harus dipilih" }),
|
||||
username: z.string().trim().min(1, { message: "Username wajib diisi" }),
|
||||
role: z.enum(["approver", "contributor"]),
|
||||
});
|
||||
|
||||
const editUserSchema = z.object({
|
||||
|
|
@ -114,6 +115,7 @@ export default function UserForm({
|
|||
phoneNumber: "",
|
||||
userLevelId: 0,
|
||||
username: "",
|
||||
role: "contributor",
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -192,7 +194,7 @@ export default function UserForm({
|
|||
password: data.password || "",
|
||||
phoneNumber: data.phoneNumber,
|
||||
userLevelId: data.userLevelId,
|
||||
userRoleId: 3,
|
||||
userRoleId: 3,
|
||||
username: data.username,
|
||||
};
|
||||
|
||||
|
|
@ -419,6 +421,29 @@ export default function UserForm({
|
|||
</p>
|
||||
</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 */}
|
||||
<div>
|
||||
<Label>User Level</Label>
|
||||
|
|
|
|||
|
|
@ -93,9 +93,11 @@ export default function VideoDetail({ id }: { id: number }) {
|
|||
downloadCount: file.download_count,
|
||||
createdAt: file.created_at,
|
||||
updatedAt: file.updated_at,
|
||||
thumbnailFileUrl:
|
||||
file.file_thumbnail || articleData.thumbnailUrl,
|
||||
...file,
|
||||
// thumbnailFileUrl:
|
||||
// file.file_thumbnail || articleData.thumbnailUrl,
|
||||
// ...file,
|
||||
// })) || [],
|
||||
thumbnailFileUrl: articleData.thumbnailUrl || "/notfound.png",
|
||||
})) || [],
|
||||
...articleData,
|
||||
};
|
||||
|
|
@ -167,8 +169,8 @@ export default function VideoDetail({ id }: { id: number }) {
|
|||
>
|
||||
<Image
|
||||
src={
|
||||
file?.thumbnailFileUrl?.trim()
|
||||
? file.thumbnailFileUrl
|
||||
file?.thumbnailUrl?.trim()
|
||||
? file.thumbnailUrl
|
||||
: "/notfound.png"
|
||||
}
|
||||
alt={file?.fileName || "thumbnail"}
|
||||
|
|
@ -178,6 +180,7 @@ export default function VideoDetail({ id }: { id: number }) {
|
|||
selectedVideo === index ? "ring-2 ring-red-600" : ""
|
||||
}`}
|
||||
/>
|
||||
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
|
|||
},
|
||||
],
|
||||
},
|
||||
...(Number(userRoleId) === 3
|
||||
...(Number(userRoleId) === 3 || Number(userRoleId) === 5
|
||||
? [
|
||||
{
|
||||
groupLabel: "",
|
||||
|
|
|
|||
Loading…
Reference in New Issue