|
|
|
@ -36,33 +36,33 @@ const config = {
|
|
|
|
|
}; |
|
|
|
|
class DefaultLayout extends Component { |
|
|
|
|
|
|
|
|
|
constructor(props) { |
|
|
|
|
super(props); |
|
|
|
|
|
|
|
|
|
let role_id = '', token = '', company_id = 0, menu='' |
|
|
|
|
if (props.location.state && props.location.state.role_id) { |
|
|
|
|
role_id = props.location.state.role_id; |
|
|
|
|
token = props.location.state.token; |
|
|
|
|
company_id = props.location.state.company_id; |
|
|
|
|
menu = props.location.state.menu_login; |
|
|
|
|
} else { |
|
|
|
|
role_id = localStorage.getItem("role_id"); |
|
|
|
|
token = localStorage.getItem("token"); |
|
|
|
|
company_id = localStorage.getItem('company_id'); |
|
|
|
|
menu = localStorage.getItem("menu_login"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.state = { |
|
|
|
|
role_id: role_id, |
|
|
|
|
token: token, |
|
|
|
|
menu: { items: [] }, |
|
|
|
|
routes2: routes, |
|
|
|
|
finalRoutes: [], |
|
|
|
|
breadrCrumbReady: false, |
|
|
|
|
minimized: true, |
|
|
|
|
company_id: company_id |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
constructor(props) { |
|
|
|
|
super(props); |
|
|
|
|
|
|
|
|
|
let role_id = '', token = '', company_id = 0, menu = '' |
|
|
|
|
if (props.location.state && props.location.state.role_id) { |
|
|
|
|
role_id = props.location.state.role_id; |
|
|
|
|
token = props.location.state.token; |
|
|
|
|
company_id = props.location.state.company_id; |
|
|
|
|
menu = props.location.state.menu_login; |
|
|
|
|
} else { |
|
|
|
|
role_id = localStorage.getItem("role_id"); |
|
|
|
|
token = localStorage.getItem("token"); |
|
|
|
|
company_id = localStorage.getItem('company_id'); |
|
|
|
|
menu = localStorage.getItem("menu_login"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.state = { |
|
|
|
|
role_id: role_id, |
|
|
|
|
token: token, |
|
|
|
|
menu: { items: [] }, |
|
|
|
|
routes2: routes, |
|
|
|
|
finalRoutes: [], |
|
|
|
|
breadrCrumbReady: false, |
|
|
|
|
minimized: true, |
|
|
|
|
company_id: company_id |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async componentDidMount() { |
|
|
|
@ -267,15 +267,13 @@ class DefaultLayout extends Component {
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div className="app"> |
|
|
|
|
<AppHeader fixed> |
|
|
|
|
<DefaultHeader /> |
|
|
|
|
</AppHeader> |
|
|
|
|
<div className="app-body"> |
|
|
|
|
{!window.location.href.includes("dashboard-project") || renderSidebar ? ( |
|
|
|
|
<AppSidebar minimized={this.state.minimized} fixed display="lg"> |
|
|
|
|
{/* <div class="sidebar-header"> |
|
|
|
|
<Suspense fallback={this.loading()}> |
|
|
|
|
<DefaultHeader history={this.props.history} onLogout={e => this.signOut(e)} /> |
|
|
|
|
</Suspense> |
|
|
|
|
</div> */} |
|
|
|
|
<hr /> |
|
|
|
|
|
|
|
|
|
<AppSidebarHeader /> |
|
|
|
|
<AppSidebarForm /> |
|
|
|
|
<Suspense> |
|
|
|
@ -312,19 +310,19 @@ class DefaultLayout extends Component {
|
|
|
|
|
name={route.name} |
|
|
|
|
render={props => ( |
|
|
|
|
<route.component |
|
|
|
|
params={{ name: route.name }} |
|
|
|
|
hierarchy={props.location.state ? props.location.state.hierarchy : localStorage.getItem("hierarchy")} |
|
|
|
|
user_id={props.location.state ? props.location.state.user_id : localStorage.getItem("user_id")} |
|
|
|
|
role_id={props.location.state ? props.location.state.role_id : localStorage.getItem("role_id")} |
|
|
|
|
isLogin={props.location.state ? props.location.state.isLogin : localStorage.getItem("isLogin")} |
|
|
|
|
company_id={props.location.state ? props.location.state.company_id : localStorage.getItem("company_id")} |
|
|
|
|
role_name={props.location.state ? props.location.state.role_name : localStorage.getItem("role_name")} |
|
|
|
|
all_project={props.location.state ? props.location.state.all_project : localStorage.getItem("all_project")} |
|
|
|
|
token={props.location.state ? props.location.state.token : localStorage.getItem("token")} |
|
|
|
|
menu_login={props.location.state ? props.location.state.menu_login : localStorage.getItem("menu_login")} |
|
|
|
|
user_name={props.location.state ? props.location.state.user_name : localStorage.getItem("user_name")} |
|
|
|
|
{...props} |
|
|
|
|
/> |
|
|
|
|
params={{ name: route.name }} |
|
|
|
|
hierarchy={props.location.state ? props.location.state.hierarchy : localStorage.getItem("hierarchy")} |
|
|
|
|
user_id={props.location.state ? props.location.state.user_id : localStorage.getItem("user_id")} |
|
|
|
|
role_id={props.location.state ? props.location.state.role_id : localStorage.getItem("role_id")} |
|
|
|
|
isLogin={props.location.state ? props.location.state.isLogin : localStorage.getItem("isLogin")} |
|
|
|
|
company_id={props.location.state ? props.location.state.company_id : localStorage.getItem("company_id")} |
|
|
|
|
role_name={props.location.state ? props.location.state.role_name : localStorage.getItem("role_name")} |
|
|
|
|
all_project={props.location.state ? props.location.state.all_project : localStorage.getItem("all_project")} |
|
|
|
|
token={props.location.state ? props.location.state.token : localStorage.getItem("token")} |
|
|
|
|
menu_login={props.location.state ? props.location.state.menu_login : localStorage.getItem("menu_login")} |
|
|
|
|
user_name={props.location.state ? props.location.state.user_name : localStorage.getItem("user_name")} |
|
|
|
|
{...props} |
|
|
|
|
/> |
|
|
|
|
)} /> |
|
|
|
|
) : (null); |
|
|
|
|
})} |
|
|
|
|