trying to create authentication based on the type of account logged in but getting nowhere - authentication

i have two types of users.
organization
normal users
guest not authenticated
I am trying to change the body links to only appear based on the authenticated user.
if the authenticate user is an organization or if the authenticated user has an organization then certain links will only appear.
if normal user that has no organization then certain links will appear.
if its a guest user and not authenticated then certain links will appear.
{{-- Check if the user is an organization --}}
#auth
#if (auth()->guard('organization')->check() ||
(auth()->user() && auth()->user()->is_organization))
{{-- Show organization links --}}
<li>
<a href="/listings/manage" class="hover:text-laravel organization-theme"><i
class="fa-solid fa-gear"></i> Manage Listing</a>
</li>
<li>
<a href="/users/manage-account" class="hover:text-laravel"><i class="fa-solid fa-user-circle"></i>
Manage Account</a>
</li>
<li>
<form class="inline" method="POST" action="/logout">
#csrf
<button type="submit"><i class="fa-solid fa-door-closed"></i> Logout</button>
</form>
</li>
#elseif (auth()->user() &&
!auth()->user()->is_organization &&
!auth()->guard('organization')->check())
{{-- Show regular user links --}}
<li>
<form class="inline" method="POST" action="/logout">
#csrf
<button type="submit"><i class="fa-solid fa-door-closed"></i> Logout</button>
</form>
</li>
<li>
<a href="/users/manage-account" class="hover:text-laravel"><i class="fa-solid fa-user-circle"></i>
Manage Account</a>
</li>
<li>
<a href="/portal/login" class="hover:text-laravel"><i class="fa-solid fa-store"
style="color: Orange; font-size: 24px;"></i> Service Provider Portal</a>
</li>
#endif
#endauth
#guest
{{-- Show guest links --}}
<li>
<a href="/login" class="hover:text-laravel"><i class="fa-solid fa-arrow-right-to-bracket"></i>
Login</a>
</li>
<li>
<i class="fa-solid fa-user-plus"></i> Register
</li>
<li>
<a href="/portal/login" class="hover:text-laravel"><i class="fa-solid fa-store"
style="color: Orange; font-size: 24px;"></i> Service Provider Portal</a>
</li>
#endguest
</ul>
I tried many things but cant get it to work. modified the if statements did dd($session) to show the authentication but still shows me the register / login / service provider links

Related

Multiple link dropdown issue in materializecss

I am using materialize css 1.0.0-rc.2. I am having issues in dropdown. Same dropdown is linked to navbar and sidenav but only one of them working and next thing is it should come below the navbar or link when hovered or clicked.What should I do please help?
I think it won't work for same dropdown structure in both Navbar and Sidebar. Making two dropdown structure can solve your problem.
<nav>
<div class="nav-wrapper">
Logo
<a href="#" data-target="mobile-demo" class="sidenav-trigger">
<i class="material-icons">menu</i>
</a>
<ul class="right hide-on-med-and-down">
<li>
Sass
</li>
<li>
Components
</li>
<li>
<a class="dropdown-trigger" href="#!" data-target="dropdown1">Dropdown
<i class="material-icons right">arrow_drop_down</i>
</a>
</li>
</ul>
</div>
</nav>
<ul id="dropdown1" class="dropdown-content">
<li>
one
</li>
<li>
two
</li>
<li>
three
</li>
</ul>
<ul id="dropdown2" class="dropdown-content">
<li>
one
</li>
<li>
two
</li>
<li>
three
</li>
</ul>
<ul class="sidenav" id="mobile-demo">
<li>
Sass
</li>
<li>
Components
</li>
<li>
<a class="dropdown-trigger2" href="#" data-target="dropdown2">Dropdown
<i class="material-icons right">arrow_drop_down</i>
</a>
</li>
</ul>
<script>
$(document).ready(function () {
$(".dropdown-trigger").dropdown({
hover: true
});
$(".dropdown-trigger2").dropdown();
$('.sidenav').sidenav();
});
</script>

Java EE - Set class to "active"

i am new in Java EE development.
My problem is to set the bootstrap navbar class to active, if the user will go to another side.
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-user"></span>
Sign Up</a></li>
<li id="login" class="active"><a href="/login.do">
<span class="glyphicon glyphicon-log-in">
</span> Login</a>
</li>
</ul>
Actual i have set the "Login" Button in the "navbar" to active.
Now i would like to make it possible, that the active Button in the navbar will switch if the user goes to another site. I tried it with javascript but it does not work in my java-ee project.
You did not specify which UI framework you are using. For JSF you can do something like the followin:
You can check the current view id with the EL expression #{view.viewId} and add the styleClass if it matches your expectations:
<ul class="nav navbar-nav navbar-right">
<li styleClass="#{view.viewId == 'login' ? 'active' : ''">
<a href="#">
<span class="glyphicon glyphicon-user"></span>Sign Up
</a>
</li>
<li id="login" styleClass="#{view.viewId == 'login' ? 'active' : ''">
<a href="/login.do">
<span class="glyphicon glyphicon-log-in"></span> Login
</a>
</li>
</ul>

Bootstrap 3 nav menu is showing first 2 list items when responsive

I have searched high and low for the answer but to no avail. I have a sandbox website www.bluestackbrewing.com
When you resize it to mobile, the first two lists in the menu item are showing. Does anyone know how to fix this? Thank you for any response.
<div class="row nav-menu">
<div class="col-sm-3 col-md-2 columns">
</div>
<div class="col-sm-9 col-md-10 columns">
<ul class="menu navbar-collapse">
<li>Home
</li>
<li class="has-dropdown">Pronorm German Kitchens
<ul class="subnav">
<li>Y-LINE</li>
<li>X-LINE</li>
<li>PROLINE</li>
<li>CLASSICLINE</li>
</ul>
</li>
<li>BESPOKE KITCHENS
</li>
<li>STORAGE SOLUTIONS & ACCESSORIES
</li>
<li>Contact
</li>
</ul>
<ul class="social-icons text-right">
<li>
<a href="#">
<i class="icon social_twitter"></i>
</a>
</li>
<li>
<a href="#">
<i class="icon social_facebook"></i>
</a>
</li>
<li>
<a href="#">
<i class="icon social_instagram"></i>
</a>
</li>
</ul>
</div>

Selenium IDE `select` command fails to locate element - whose ID was filled automatically by the IDE

My problem: I'm failing to select an element in Selenium IDE, even though the target ID is filled automatically by the IDE.
Problem description:
In http://instantsearchplus.myshopify.com/, I want to type in the search field (top right).
This is the HTML code for the search field:
<input name="q" value="" aria-label="Search our store"
class="header-bar__search-input ui-autocomplete-input"
autocomplete="OfF" autocorrect="off" autocapitalize="off"
id="input_id_0_suggestor_007" isp_ac="OfF" type="search">
So, I enter the select Command, and after clicking on the search field, Selenium IDE automatically fills the Target with id=input_id_0_suggestor_007.
All is well, right?
Wrong!
When I try to run the script, I get the error
[info] Playing test case Untitled 2
[info] Executing: |open | / | |
[info] Executing: |select | id=input_id_0_suggestor_007 | |
[error] Element id=input_id_0_suggestor_007 not found
[info] Test case failed
What am I doing wrong?
Note: I tried various select related commands (select, selectFrame, selectWindow, etc. ) with a variety of possible targets (id, name, css, etc. ) - but did not find any combination that works. Click also didn't work.
The HTML code around the search field:
<div class="header-bar">
<div class="wrapper medium-down--hide">
<div class="large--display-table">
<div class="header-bar__left large--display-table-cell">
</div>
<div class="header-bar__right large--display-table-cell">
<div class="header-bar__module">
<a href="/cart" class="cart-toggle">
<span class="icon icon-cart header-bar__cart-icon" aria-hidden="true"></span>
Cart
<span class="cart-count header-bar__cart-count">2</span>
</a>
</div>
<div class="header-bar__module header-bar__search">
<form action="/pages/search-results" method="get" role="search">
<span role="status" aria-live="polite" class="isp_polite_powered_by_id ui-helper-hidden-accessible">Powered by InstantSearch+ Site Search Autocomplete</span><input name="q" value="" aria-label="Search our store" class="header-bar__search-input ui-autocomplete-input" autocomplete="OfF" autocorrect="off" autocapitalize="off" id="input_id_0_suggestor_007" isp_ac="OfF" type="search">
<button type="submit" class="btn icon-fallback-text header-bar__search-submit">
<span class="icon icon-search" aria-hidden="true"></span>
<span class="fallback-text">Search</span>
</button>
</form>
</div>
</div>
</div>
</div>
<div class="wrapper large--hide">
<button type="button" class="mobile-nav-trigger" id="MobileNavTrigger">
<span class="icon icon-hamburger" aria-hidden="true"></span>
Menu
</button>
<a href="/cart" class="cart-toggle mobile-cart-toggle">
<span class="icon icon-cart header-bar__cart-icon" aria-hidden="true"></span>
Cart <span class="cart-count">2</span>
</a>
</div>
<ul id="MobileNav" class="mobile-nav large--hide">
<li class="mobile-nav__link" aria-haspopup="true">
<a href="/" class="mobile-nav">
Home
</a>
</li>
<li class="mobile-nav__link" aria-haspopup="true">
<a href="/search" class="mobile-nav">
Search page
</a>
</li>
<li class="mobile-nav__link" aria-haspopup="true">
<a href="http://instantsearchplus.myshopify.com/pages/search-results/collections-accessories" class="mobile-nav">
Accessories
</a>
</li>
<li class="mobile-nav__link" aria-haspopup="true">
<a href="http://instantsearchplus.myshopify.com/pages/search-results/collections-best-seller" class="mobile-nav">
Best Seller
</a>
</li>
<li class="mobile-nav__link" aria-haspopup="true">
<a href="http://instantsearchplus.myshopify.com/pages/search-results/collections-gloves" class="mobile-nav">
Gloves
</a>
</li>
<li class="mobile-nav__link" aria-haspopup="true">
<a href="/pages/about-us" class="mobile-nav">
About us
</a>
</li>
</ul>
</div>
ClickAt //input works
Indeed, select command is usually meant for selecting options from a select tag.
Here's a quote from the documentation
Constructor. A check is made that the given element is, indeed, a SELECT tag. If it is not, then an UnexpectedTagNameException is thrown.

Bootstrap 3 dropdown toggle menu not working when using with AngularJS UI Bootstrap

I am using bootstrap 3 dropdown toggle menu in my angularjs project and everything seems to be working fine but after using angular ui bootstrap (angular-ui-bootstrap.min.js) the bootstrap 3 dropdown toggle menu is not working (meaning its not opening). Does anyone had the same issue? Please help me on how to solve this.
Index.html
<ul class="nav nav-list">
<li>
<a href="index.html">
<i class="icon-dashboard"></i>
<span class="menu-text"> Dashboard </span>
</a>
</li>
<li>
<a href="#" class="dropdown-toggle">
<i class="icon-building"></i>
<span class="menu-text"> Projects </span>
<b class="arrow icon-angle-down"></b>
</a>
<ul class="submenu">
<li>
<a href="#">
<i class="icon-double-angle-right"></i>
Find Project
</a>
</li>
<li>
<a href="#">
<i class="icon-double-angle-right"></i>
Create Project
</a>
</li>
<li>
<a href="#">
<i class="icon-double-angle-right"></i>
Update Project
</a>
</li>
</ul>
</li>
<ul>
You need to do it the Angularjs way:
Make sure to include:
Index:
<ul class="nav nav-list">
<li>
<a href="index.html">
<i class="icon-dashboard"></i>
<span class="menu-text"> Dashboard </span>
</a>
</li>
<li class="dropdown" ng-controller="DropdownCtrl">
<a class="dropdown-toggle">
<i class="icon-building"></i>
<span class="menu-text"> Projects </span>
<b class="arrow icon-angle-down"></b>
</a>
<ul class="dropdown-menu">
<li ng-repeat="choice in items">
<i class="icon-double-angle-right"></i>
<a>{{choice}}</a>
</li>
</ul>
</li>
<ul>
JS:
angular.module('plunker', ['ui.bootstrap']);
function DropdownCtrl($scope) {
$scope.items = [
"Find Project",
"Create Project",
"Update Project"
];
}