Select theme:
In this final part of the CRM tutorial we will add a few final features that will make the CRM application more polished.
We will rearrange the navigation, create a hierarchy, and add icons.
The application navigation typically lives in the Main layout. Layouts are special pages that define common UI components that are shared between multiple pages.
Dashboard
and Icon to home
.
perm_contact_calendar
.work
.shopping_cart
.Settings
and Icon: settings
. Set the Visible property to ${Security.IsInRole("Sales Manager")}
.
This makes this item visible only to members of the Sales Manager
role.
Opportunity Statuses
and pick the Opportunity Statuses
page from the Path dropdown.
Task Types
and pick the Task Types
page from the Path dropdown.Task Statuses
page.Now when a member of the Sales Manager
role logs in she would see this navigation.
Members of the
Sales Representative
role will see this (note that the Settings menu item is not present).
By default the Main layout has a ProfileMenu component which allows users to logout or update their profile. Let's customize the ProfileMenu to show the current user name and profile picture.
${Security.User.FirstName}
.${Security.User.LastName}
.${Security.User.Picture}
. Set Width and Height to 32px
and BorderRadius to 16px
.If you run the application from Radzen you will see the current user picture and name in the top right corner.
When you enable security for a Radzen application one of the scaffolded pages is Profile (also accessible from the ProfileMenu component in the top right corner).
By default it allows the current user to change their password. In the CRM application we have extended the AspNetUsers table with three new columns - FirstName
, LastName
, Picture
and we want the
user to be able to change them.
Now let's create the UI.
Personal
and Password
.Password
tab and move the TemplateForm there.Personal
tab and drag and drop a new TemplateForm inside. Set its Data property to ${user}
.First Name
. Set the Value of the TextBox to ${user.FirstName}
. Set the Text of the validator to First Name is required
.
Last Name
. Set Component to textBox0
. Set the Value of the TextBox to ${user.LastName}
. Set the Text of the validator to Last Name is required
. Set Component to textbox0
.
Picture
. Set Component to fileInput0
. Set the Value of the FileInput to ${user.Picture}
and its Display style property to block
.
Set the Text of the validator to Picture is required
. Set Component to fileInput0
.
The final step is to update the personal data when the user submits the form.
Security.updateUser
custom method. Set the Id
parameter${Security.User.Id}
${user}
Finally let's create a custom login page by editing both the Login layout and page.
We will add a background image that will cover the whole page. Also we will add the CRM application logo.
Radzen allows you to use images seamlessly. For this demo we will use a background and logo. Download those files and add them as assets in the application.
100%
. Set Position to absolute
. Set Top and Left to 0
. This will make the image cover the whole page.
We now want to center the login form in the page (both horizontally and vertically).
Center
.absolute
, Top, Right, Bottom and Left to 0
.
Set Margin to 0
.3
units, LG to 4
, MD to 5
and SM to 8
.None
.0px
.0
.logo.png
.128px
. Set BorderRadius to 64px
. This will make the logo a circle.block
. Set Right and Left Margin to auto
.-72px
.
Let's now customize the Login page by using a TemplateForm instead of the Login component.
Username
and Width to 100%
.Username
and pick Username
from the Component dropdown.
Set Display to block
so the TextBox starts on the next line.
Set top Margin to 16px
.
Password
and Width to 100%
.Password
. Set Display to block
.
Set top Margin to 16px
.
Login
, ButtonType to submit
, Width to 100%
and top Margin to 16px
.
Now to actually perform the login.
/Account/Login
.post
.That is all!
The complete source of this application (with a few additional changes that are mostly cosmetic) is available for server-side Blazor and for client-side WebAssembly Blazor in the Radzen github repository.
Radzen is free to use. You can also test the premium features for 15 days.
Download NowSelect theme: