Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #https://docs.universaldashboard.io/components/inputs
- #https://forums.universaldashboard.io/t/dynamically-update-new-udinputfield/2668/3
- $UD1_user_creation = New-UDPage -Name "Home" -Icon home -Content {
- New-UDCard -Title "Account Creation Page" -Text "You are going to create a new user, please input the information provided by HR."
- New-UDCard -Id "User information" -Content{
- New-UDCard -id "UDC_StudDept" -Content{
- New-UDRow -id "StudioDpt" {
- New-UDColumn -Size 6 {
- $StudioValue = Get-Content -Path 'D:\Scripts\UniversalDashboard\Studios.txt'
- New-UDParagraph -Text "Pick the Studio"
- New-UDSelect -Id "UD_Studio" -Option {
- foreach ($stud in $StudioValue){
- New-UDSelectOption -Name "$stud" -Value "$stud"
- }
- } -OnChange {
- $Session:studio = $EventData
- Sync-UDElement -Id "UD_Dpt"
- }
- }
- New-UDColumn -Size 6 -Id "UD_Dpt" -Endpoint {
- if ($session:studio -eq $null){ $session:studio = "Tokyo"}
- $path = "D:\Scripts\UniversalDashboard\"
- $fullpath = ($path + $session:studio)
- $DptValue = Get-Content -Path $fullpath
- New-UDParagraph -Text "Pick the correct department"
- New-UDSelect -Id "UD_Dpt" -Option {
- foreach ($depart in $DptValue){
- New-UDSelectOption -Name "$depart" -Value "$depart"
- }
- } -OnChange {
- $Session:department = $EventData
- }
- }
- }
- }
- New-UDInput -Title "Please fill the user information" -Content {
- New-UDInputField -Type 'textbox' -Name 'FirstName' -Placeholder 'First Name'
- New-UDInputField -Type 'textbox' -Name 'GivenName' -Placeholder 'Given Name'
- } -Endpoint {
- param($FirstName, $GivenName)
- $i = 1
- $Session:FirstName = $FirstName
- $Session:GivenName = $GivenName
- $Session:Username = $FirstName.Substring(0,$i).ToLower()+$GivenName.ToLower().replace(' ','')
- New-UDInputAction -Content @(
- Sync-UDElement -Id "User_Info"
- )
- }
- }
- New-UDCard -Id "User_Info" -Title "Summary of the information provided" -Endpoint {
- New-UDParagraph -Text "Studio = $Session:studio"
- New-UDParagraph -Text "Department = $Session:department"
- New-UDParagraph -Text "First Name = $SessionFirstName"
- New-UDParagraph -Text "Given Name = $SessionGivenName"
- New-UDParagraph -Text "Username = $Session:Username"
- }
- }
- $UD1 = New-UDDashboard -Title "User management" -Color "#252525" -Pages @(
- $UD1_user_creation
- )
- Start-UDDashboard -Dashboard $UD1 -port 10002
Add Comment
Please, Sign In to add comment