-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(organizational-chart): show empty state when no data is available #4024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import "./hierarchy_chart/hierarchy_chart_desktop.js"; | ||
| import "./hierarchy_chart/hierarchy_chart_mobile.js"; | ||
| import "./templates/node_card.html"; | ||
| import "./templates/hierarchy_empty_state.html"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
|
|
||
| <div id="hierarchy-empty-root" class="text-muted flex flex-1 items-center justify-center align-center text-center"> | ||
| <div class=""> | ||
| <div class="empty-apps-state"> | ||
| <svg class="icon icon-xl" style="stroke: var(--text-light);"> | ||
| <use href="#icon-small-file"></use> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or pass a template variable to reuse this someplace else
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like Team Updates 😁 |
||
| </svg> | ||
| <div class="mt-4 mb-2"> | ||
| {{ __("You haven't created a {0} for {1} yet.", [__(doctype), __(company)]) }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep user messages short and human, something like "You haven't created any Employee for <company_name>" |
||
| </div> | ||
|
|
||
| {% if can_create %} | ||
| {% if device_type == "desktop" %} | ||
| <button | ||
| class="btn btn-default btn-sm btn-new-doc hidden-xs" | ||
| id="add-doc-btn" | ||
| > | ||
| {{ __("Create a new {0}", [__(doctype)]) }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep the labels short too, "Create New" or simply "Add Employee" should suffice |
||
| </button> | ||
| {% else %} | ||
| <button | ||
| class="btn btn-primary btn-new-doc visible-xs" | ||
| id="add-doc-btn" | ||
| > | ||
| {{ __("Create {0}", [__(doctype)]) }} | ||
| </button> | ||
| {% endif %} | ||
| {% endif %} | ||
|
|
||
| </div> | ||
| </div> | ||
| </div> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these calculations aren't required here.
Just do a count call at the beginning in
organization_chart.jsand render the empty state html there if the employee count is 0.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need setting up the company filter outside the chart object.