| @@ -1 +0,0 @@ | |||||
| {"code":"!function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){var i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={0:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}},o=!0;try{e[r].call(t.exports,t,t.exports,l),o=!1}finally{o&&delete n[r]}return t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){\"undefined\"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&\"object\"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,\"default\",{enumerable:!0,value:e}),2&r&&\"string\"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,\"a\",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p=\"\";var f=window.webpackJsonp=window.webpackJsonp||[],i=f.push.bind(f);f.push=r,f=f.slice();for(var a=0;a<f.length;a++)r(f[a]);var p=i;t()}([]);","extractedComments":[]} | |||||
| @@ -11,7 +11,7 @@ import Icon from "@material-ui/core/Icon"; | |||||
| import Chart from "@material-ui/icons/LocalGroceryStore"; | import Chart from "@material-ui/icons/LocalGroceryStore"; | ||||
| // @material-ui/icons | // @material-ui/icons | ||||
| import { Apps, ShareTwoTone } from "@material-ui/icons"; | |||||
| import { Apps, ShareTwoTone, Person } from "@material-ui/icons"; | |||||
| // core components | // core components | ||||
| import CustomDropdown from "components/CustomDropdown/CustomDropdown.js"; | import CustomDropdown from "components/CustomDropdown/CustomDropdown.js"; | ||||
| @@ -20,27 +20,32 @@ import styles from "assets/jss/nextjs-material-kit/components/headerLinksStyle.j | |||||
| const useStyles = makeStyles(styles); | const useStyles = makeStyles(styles); | ||||
| export default function HeaderLinks(props) { | |||||
| export default function HeaderLinks({ username, ...props }) { | |||||
| const classes = useStyles(); | const classes = useStyles(); | ||||
| return ( | return ( | ||||
| <List className={classes.list}> | <List className={classes.list}> | ||||
| <ListItem className={classes.listItem}> | <ListItem className={classes.listItem}> | ||||
| <Link href="/yamaha/home"> | |||||
| <Button color="transparent" className={classes.navLink}> | |||||
| <img | |||||
| src="https://1.bp.blogspot.com/-J9AsxdwrF-Y/Wn70KyBApaI/AAAAAAAACRo/LTy3zrALzhckryd9QPi_KuVyWvwFMZyMQCLcBGAs/s640/TG.png" width="180px" | |||||
| /> | |||||
| <Link href="/yamaha/home"> | |||||
| <Button color="transparent" className={classes.navLink}> | |||||
| <img | |||||
| src="https://1.bp.blogspot.com/-J9AsxdwrF-Y/Wn70KyBApaI/AAAAAAAACRo/LTy3zrALzhckryd9QPi_KuVyWvwFMZyMQCLcBGAs/s640/TG.png" | |||||
| width="180px" | |||||
| /> | |||||
| </Button> | </Button> | ||||
| </Link> | |||||
| </Link> | |||||
| </ListItem> | </ListItem> | ||||
| <ListItem className={classes.listItem}> | <ListItem className={classes.listItem}> | ||||
| <Link href="/yamaha/home"> | <Link href="/yamaha/home"> | ||||
| <Button color="transparent" className={classes.navLink} style={{marginTop:"10px"}}> | |||||
| <Button | |||||
| color="transparent" | |||||
| className={classes.navLink} | |||||
| style={{ marginTop: "10px" }} | |||||
| > | |||||
| <Icon className={classes.icons}>home</Icon> Home | <Icon className={classes.icons}>home</Icon> Home | ||||
| </Button> | </Button> | ||||
| </Link> | </Link> | ||||
| </ListItem> | </ListItem> | ||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <ListItem className={classes.listItem} style={{ marginTop: "10px" }}> | |||||
| <CustomDropdown | <CustomDropdown | ||||
| noLiPadding | noLiPadding | ||||
| navDropdown | navDropdown | ||||
| @@ -51,26 +56,52 @@ export default function HeaderLinks(props) { | |||||
| }} | }} | ||||
| buttonIcon={Apps} | buttonIcon={Apps} | ||||
| dropdownList={[ | dropdownList={[ | ||||
| <a href="/yamaha/product/product" className={classes.dropdownLink}>Motor</a>, | |||||
| <a href="/yamaha/product/ygp" className={classes.dropdownLink}>YGP</a>, | |||||
| <a href="/yamaha/product/yamalube" className={classes.dropdownLink}>Yamalube</a>, | |||||
| <a href="/yamaha/product/helmet" className={classes.dropdownLink}>Helmet</a>, | |||||
| <a href="/yamaha/product/apparel" className={classes.dropdownLink}>Apparel</a>, | |||||
| <a href="/yamaha/product/accessories" className={classes.dropdownLink}>Accessories</a>, | |||||
| <a href="https://booking.thamrin.co.id/" className={classes.dropdownLink}>Service</a>, | |||||
| <a href="/yamaha/dealer/dealers" className={classes.dropdownLink}>Dealers</a>, | |||||
| <a href="/yamaha/product/product" className={classes.dropdownLink}> | |||||
| Motor | |||||
| </a>, | |||||
| <a href="/yamaha/product/ygp" className={classes.dropdownLink}> | |||||
| YGP | |||||
| </a>, | |||||
| <a href="/yamaha/product/yamalube" className={classes.dropdownLink}> | |||||
| Yamalube | |||||
| </a>, | |||||
| <a href="/yamaha/product/helmet" className={classes.dropdownLink}> | |||||
| Helmet | |||||
| </a>, | |||||
| <a href="/yamaha/product/apparel" className={classes.dropdownLink}> | |||||
| Apparel | |||||
| </a>, | |||||
| <a | |||||
| href="/yamaha/product/accessories" | |||||
| className={classes.dropdownLink} | |||||
| > | |||||
| Accessories | |||||
| </a>, | |||||
| <a | |||||
| href="https://booking.thamrin.co.id/" | |||||
| className={classes.dropdownLink} | |||||
| > | |||||
| Service | |||||
| </a>, | |||||
| <a href="/yamaha/dealer/dealers" className={classes.dropdownLink}> | |||||
| Dealers | |||||
| </a>, | |||||
| ]} | ]} | ||||
| /> | /> | ||||
| </ListItem> | </ListItem> | ||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <ListItem className={classes.listItem} style={{ marginTop: "10px" }}> | |||||
| <Link href="/yamaha/latest_news/latestnews"> | <Link href="/yamaha/latest_news/latestnews"> | ||||
| <Button color="transparent" className={classes.navLink}> | <Button color="transparent" className={classes.navLink}> | ||||
| <Icon className={classes.icons}>event</Icon> Latest News | <Icon className={classes.icons}>event</Icon> Latest News | ||||
| </Button> | </Button> | ||||
| </Link> | </Link> | ||||
| </ListItem> | </ListItem> | ||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <Button href="/yamaha/carrer/carrer" color="transparent" className={classes.navLink}> | |||||
| <ListItem className={classes.listItem} style={{ marginTop: "10px" }}> | |||||
| <Button | |||||
| href="/yamaha/carrer/carrer" | |||||
| color="transparent" | |||||
| className={classes.navLink} | |||||
| > | |||||
| <Icon className={classes.icons}>wallet_travel</Icon> Career | <Icon className={classes.icons}>wallet_travel</Icon> Career | ||||
| </Button> | </Button> | ||||
| </ListItem> | </ListItem> | ||||
| @@ -98,7 +129,7 @@ export default function HeaderLinks(props) { | |||||
| ]} | ]} | ||||
| /> | /> | ||||
| </ListItem> */} | </ListItem> */} | ||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <ListItem className={classes.listItem} style={{ marginTop: "10px" }}> | |||||
| <Button | <Button | ||||
| href="/yamaha/abous_us/aboutus" | href="/yamaha/abous_us/aboutus" | ||||
| color="transparent" | color="transparent" | ||||
| @@ -107,7 +138,7 @@ export default function HeaderLinks(props) { | |||||
| <Icon className={classes.icons}>account_balance</Icon> About Us | <Icon className={classes.icons}>account_balance</Icon> About Us | ||||
| </Button> | </Button> | ||||
| </ListItem> | </ListItem> | ||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <ListItem className={classes.listItem} style={{ marginTop: "10px" }}> | |||||
| <Button | <Button | ||||
| href="/yamaha/profile/profile" | href="/yamaha/profile/profile" | ||||
| color="transparent" | color="transparent" | ||||
| @@ -116,21 +147,65 @@ export default function HeaderLinks(props) { | |||||
| <Icon className={classes.icons}>people</Icon> Profile | <Icon className={classes.icons}>people</Icon> Profile | ||||
| </Button> | </Button> | ||||
| </ListItem> | </ListItem> | ||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <Button href="/yamaha/cart/cart" color="transparent" className={classes.navLink}> | |||||
| <Chart className={classes.icons} /> | |||||
| </Button> | |||||
| </ListItem> | |||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <ListItem className={classes.listItem} style={{ marginTop: "10px" }}> | |||||
| <Button | <Button | ||||
| href="/yamaha/login" | |||||
| className={classes.registerNavLink} | |||||
| color="info" | |||||
| round | |||||
| href="/yamaha/cart/cart" | |||||
| color="transparent" | |||||
| className={classes.navLink} | |||||
| > | > | ||||
| <Icon className={classes.icons}>input</Icon> Login | |||||
| <Chart className={classes.icons} /> | |||||
| </Button> | </Button> | ||||
| </ListItem> | </ListItem> | ||||
| <ListItem className={classes.listItem} style={{ marginTop: "10px" }}> | |||||
| {!username || username == "" ? ( | |||||
| <Button | |||||
| href="/suzuki/login" | |||||
| className={classes.registerNavLink} | |||||
| color="info" | |||||
| round | |||||
| > | |||||
| <Icon className={classes.icons}>input</Icon> Login | |||||
| </Button> | |||||
| ) : ( | |||||
| <CustomDropdown | |||||
| noLiPadding | |||||
| navDropdown | |||||
| buttonText={ | |||||
| username.length > 12 ? username.substring(0, 9) + ".." : username | |||||
| } | |||||
| buttonProps={{ | |||||
| className: classes.navLink, | |||||
| color: "transparent", | |||||
| }} | |||||
| buttonIcon={Person} | |||||
| dropdownList={[ | |||||
| <div | |||||
| onClick={async (e) => { | |||||
| e.preventDefault(); | |||||
| fetch("/api/auth/logout", { | |||||
| method: "POST", | |||||
| headers: { | |||||
| "Content-Type": "application/json", | |||||
| }, | |||||
| body: JSON.stringify({ p: "YAMAHA" }), | |||||
| }).then((res) => { | |||||
| //if (res.ok) { | |||||
| window.location.href = "../yamaha/home"; | |||||
| /*} | |||||
| else{ | |||||
| }*/ | |||||
| }); | |||||
| }} | |||||
| > | |||||
| <a className={classes.dropdownLink}> | |||||
| <Icon className={classes.icons}>exit_to_app</Icon> Logout | |||||
| </a> | |||||
| </div>, | |||||
| ]} | |||||
| /> | |||||
| )} | |||||
| </ListItem> | |||||
| </List> | </List> | ||||
| ); | ); | ||||
| } | |||||
| } | |||||
| @@ -10,7 +10,7 @@ import Icon from "@material-ui/core/Icon"; | |||||
| import Chart from "@material-ui/icons/LocalGroceryStore"; | import Chart from "@material-ui/icons/LocalGroceryStore"; | ||||
| // @material-ui/icons | // @material-ui/icons | ||||
| import { Apps, ShareTwoTone } from "@material-ui/icons"; | |||||
| import { Apps, ShareTwoTone, Person } from "@material-ui/icons"; | |||||
| // core components | // core components | ||||
| import CustomDropdown from "components/CustomDropdown/CustomDropdown.js"; | import CustomDropdown from "components/CustomDropdown/CustomDropdown.js"; | ||||
| @@ -19,34 +19,43 @@ import styles from "assets/jss/nextjs-material-kit/components/headerLinksStyle.j | |||||
| const useStyles = makeStyles(styles); | const useStyles = makeStyles(styles); | ||||
| export default function HeaderLinks(props) { | |||||
| export default function HeaderLinks({ username, ...props }) { | |||||
| const classes = useStyles(); | const classes = useStyles(); | ||||
| return ( | return ( | ||||
| <List className={classes.list}> | <List className={classes.list}> | ||||
| <ListItem className={classes.listItem}> | |||||
| <Link href="/suzuki/home"> | |||||
| <Button color="transparent" className={classes.navLink}> | |||||
| <img | |||||
| src="https://1.bp.blogspot.com/-J9AsxdwrF-Y/Wn70KyBApaI/AAAAAAAACRo/LTy3zrALzhckryd9QPi_KuVyWvwFMZyMQCLcBGAs/s640/TG.png" width="180px" | |||||
| /> | |||||
| </Button> | |||||
| </Link> | |||||
| </ListItem> | |||||
| <ListItem className={classes.listItem}> | |||||
| <Link href="/suzuki/home"> | |||||
| <Button color="transparent" className={classes.navLink} style={{marginTop:"10px"}}> | |||||
| <Icon className={classes.icons}>home</Icon> Home | |||||
| </Button> | |||||
| </Link> | |||||
| </ListItem> | |||||
| <ListItem className={classes.listItem}> | |||||
| <Link href="/suzuki/product/product"> | |||||
| <Button color="transparent" className={classes.navLink} style={{marginTop:"10px"}}> | |||||
| <Icon className={classes.icons}>home</Icon> Product | |||||
| </Button> | |||||
| </Link> | |||||
| </ListItem> | |||||
| {/* <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <ListItem className={classes.listItem}> | |||||
| <Link href="/suzuki/home"> | |||||
| <Button color="transparent" className={classes.navLink}> | |||||
| <img | |||||
| src="https://1.bp.blogspot.com/-J9AsxdwrF-Y/Wn70KyBApaI/AAAAAAAACRo/LTy3zrALzhckryd9QPi_KuVyWvwFMZyMQCLcBGAs/s640/TG.png" | |||||
| width="180px" | |||||
| /> | |||||
| </Button> | |||||
| </Link> | |||||
| </ListItem> | |||||
| <ListItem className={classes.listItem}> | |||||
| <Link href="/suzuki/home"> | |||||
| <Button | |||||
| color="transparent" | |||||
| className={classes.navLink} | |||||
| style={{ marginTop: "10px" }} | |||||
| > | |||||
| <Icon className={classes.icons}>home</Icon> Home | |||||
| </Button> | |||||
| </Link> | |||||
| </ListItem> | |||||
| <ListItem className={classes.listItem}> | |||||
| <Link href="/suzuki/product/product"> | |||||
| <Button | |||||
| color="transparent" | |||||
| className={classes.navLink} | |||||
| style={{ marginTop: "10px" }} | |||||
| > | |||||
| <Icon className={classes.icons}>home</Icon> Product | |||||
| </Button> | |||||
| </Link> | |||||
| </ListItem> | |||||
| {/* <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <CustomDropdown | <CustomDropdown | ||||
| noLiPadding | noLiPadding | ||||
| navDropdown | navDropdown | ||||
| @@ -84,86 +93,164 @@ export default function HeaderLinks(props) { | |||||
| ]} | ]} | ||||
| /> | /> | ||||
| </ListItem> */} | </ListItem> */} | ||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <Link href="/suzuki/latest_news/latestnews"> | |||||
| <Button color="transparent" className={classes.navLink}> | |||||
| <Icon className={classes.icons}>event</Icon> Latest News | |||||
| </Button> | |||||
| </Link> | |||||
| </ListItem> | |||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <Button href="/suzuki/carrer/carrer" color="transparent" className={classes.navLink}> | |||||
| <Icon className={classes.icons}>wallet_travel</Icon> Career | |||||
| </Button> | |||||
| </ListItem> | |||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <CustomDropdown | |||||
| noLiPadding | |||||
| navDropdown | |||||
| buttonText="Partner" | |||||
| buttonProps={{ | |||||
| className: classes.navLink, | |||||
| color: "transparent", | |||||
| }} | |||||
| buttonIcon={ShareTwoTone} | |||||
| dropdownList={[ | |||||
| <Link href="https://www.suzuki-motor.co.id/"> | |||||
| <a className={classes.dropdownLink}>suzuki</a> | |||||
| </Link>, | |||||
| <Link href="https://www.suzuki.co.id/"> | |||||
| <a className={classes.dropdownLink}>Suzuki</a> | |||||
| </Link>, | |||||
| <Link href="https://www.honda-indonesia.com/"> | |||||
| <a className={classes.dropdownLink}>Honda</a> | |||||
| </Link>, | |||||
| <Link href="https://www.hino.co.id/"> | |||||
| <a className={classes.dropdownLink}>Hino</a> | |||||
| </Link>, | |||||
| <Link href="https://www.mercedes-benz.co.id/passengercars.html"> | |||||
| <a className={classes.dropdownLink}>Mercedes-Benz</a> | |||||
| </Link>, | |||||
| <Link href="http://bprberkatsejati.com/"> | |||||
| <a className={classes.dropdownLink}>BPR Berkat Sejati</a> | |||||
| </Link>, | |||||
| <Link href="https://www.hino.co.id/"> | |||||
| <a className={classes.dropdownLink}>Palembang Indah Mall</a> | |||||
| </Link>, | |||||
| <Link href="http://www.emilia-hotel.com/"> | |||||
| <a className={classes.dropdownLink}>Hotel Emilia</a> | |||||
| </Link>, | |||||
| <Link href="http://homes.thamrin.xyz/"> | |||||
| <a className={classes.dropdownLink}>Thamrin Home</a> | |||||
| </Link>, | |||||
| <Link href="https://www.hino.co.id/"> | |||||
| <a className={classes.dropdownLink}>Ketty Resto</a> | |||||
| </Link>, | |||||
| ]} | |||||
| /> | |||||
| </ListItem> | |||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <Button | |||||
| href="/suzuki/abous_us/aboutus" | |||||
| color="transparent" | |||||
| className={classes.navLink} | |||||
| <ListItem | |||||
| className={classes.listItem} | |||||
| style={{ marginTop: "10px" }} | |||||
| > | |||||
| <Link href="/suzuki/latest_news/latestnews"> | |||||
| <Button color="transparent" className={classes.navLink}> | |||||
| <Icon className={classes.icons}>event</Icon> Latest News | |||||
| </Button> | |||||
| </Link> | |||||
| </ListItem> | |||||
| <ListItem | |||||
| className={classes.listItem} | |||||
| style={{ marginTop: "10px" }} | |||||
| > | |||||
| <Button | |||||
| href="/suzuki/carrer/carrer" | |||||
| color="transparent" | |||||
| className={classes.navLink} | |||||
| > | |||||
| <Icon className={classes.icons}>wallet_travel</Icon> Career | |||||
| </Button> | |||||
| </ListItem> | |||||
| <ListItem | |||||
| className={classes.listItem} | |||||
| style={{ marginTop: "10px" }} | |||||
| > | > | ||||
| <Icon className={classes.icons}>account_balance</Icon> About Us | |||||
| </Button> | |||||
| </ListItem> | |||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <Button href="/chart" color="transparent" className={classes.navLink}> | |||||
| <Chart className={classes.icons} /> | |||||
| </Button> | |||||
| </ListItem> | |||||
| <ListItem className={classes.listItem} style={{marginTop:"10px"}}> | |||||
| <Button | |||||
| href="/suzuki/login" | |||||
| className={classes.registerNavLink} | |||||
| color="info" | |||||
| round | |||||
| <CustomDropdown | |||||
| noLiPadding | |||||
| navDropdown | |||||
| buttonText="Partner" | |||||
| buttonProps={{ | |||||
| className: classes.navLink, | |||||
| color: "transparent", | |||||
| }} | |||||
| buttonIcon={ShareTwoTone} | |||||
| dropdownList={[ | |||||
| <Link href="https://www.suzuki-motor.co.id/"> | |||||
| <a className={classes.dropdownLink}>suzuki</a> | |||||
| </Link>, | |||||
| <Link href="https://www.suzuki.co.id/"> | |||||
| <a className={classes.dropdownLink}>Suzuki</a> | |||||
| </Link>, | |||||
| <Link href="https://www.honda-indonesia.com/"> | |||||
| <a className={classes.dropdownLink}>Honda</a> | |||||
| </Link>, | |||||
| <Link href="https://www.hino.co.id/"> | |||||
| <a className={classes.dropdownLink}>Hino</a> | |||||
| </Link>, | |||||
| <Link href="https://www.mercedes-benz.co.id/passengercars.html"> | |||||
| <a className={classes.dropdownLink}> | |||||
| Mercedes-Benz | |||||
| </a> | |||||
| </Link>, | |||||
| <Link href="http://bprberkatsejati.com/"> | |||||
| <a className={classes.dropdownLink}> | |||||
| BPR Berkat Sejati | |||||
| </a> | |||||
| </Link>, | |||||
| <Link href="https://www.hino.co.id/"> | |||||
| <a className={classes.dropdownLink}> | |||||
| Palembang Indah Mall | |||||
| </a> | |||||
| </Link>, | |||||
| <Link href="http://www.emilia-hotel.com/"> | |||||
| <a className={classes.dropdownLink}>Hotel Emilia</a> | |||||
| </Link>, | |||||
| <Link href="http://homes.thamrin.xyz/"> | |||||
| <a className={classes.dropdownLink}>Thamrin Home</a> | |||||
| </Link>, | |||||
| <Link href="https://www.hino.co.id/"> | |||||
| <a className={classes.dropdownLink}>Ketty Resto</a> | |||||
| </Link>, | |||||
| ]} | |||||
| /> | |||||
| </ListItem> | |||||
| <ListItem | |||||
| className={classes.listItem} | |||||
| style={{ marginTop: "10px" }} | |||||
| > | > | ||||
| <Icon className={classes.icons}>input</Icon> Login | |||||
| </Button> | |||||
| </ListItem> | |||||
| <Button | |||||
| href="/suzuki/abous_us/aboutus" | |||||
| color="transparent" | |||||
| className={classes.navLink} | |||||
| > | |||||
| <Icon className={classes.icons}>account_balance</Icon> About | |||||
| Us | |||||
| </Button> | |||||
| </ListItem> | |||||
| <ListItem | |||||
| className={classes.listItem} | |||||
| style={{ marginTop: "10px" }} | |||||
| > | |||||
| <Button | |||||
| href="/chart" | |||||
| color="transparent" | |||||
| className={classes.navLink} | |||||
| > | |||||
| <Chart className={classes.icons} /> | |||||
| </Button> | |||||
| </ListItem> | |||||
| <ListItem | |||||
| className={classes.listItem} | |||||
| style={{ marginTop: "10px" }} | |||||
| > | |||||
| {!username || username == "" ? ( | |||||
| <Button | |||||
| href="/suzuki/login" | |||||
| className={classes.registerNavLink} | |||||
| color="info" | |||||
| round | |||||
| > | |||||
| <Icon className={classes.icons}>input</Icon> Login | |||||
| </Button> | |||||
| ) : ( | |||||
| <CustomDropdown | |||||
| noLiPadding | |||||
| navDropdown | |||||
| buttonText={ | |||||
| username.length > 12 | |||||
| ? username.substring(0, 9) + ".." | |||||
| : username | |||||
| } | |||||
| buttonProps={{ | |||||
| className: classes.navLink, | |||||
| color: "transparent", | |||||
| }} | |||||
| buttonIcon={Person} | |||||
| dropdownList={[ | |||||
| <div | |||||
| onClick={async (e) => { | |||||
| e.preventDefault(); | |||||
| fetch("/api/auth/logout", { | |||||
| method: "POST", | |||||
| headers: { | |||||
| "Content-Type": "application/json", | |||||
| }, | |||||
| body: JSON.stringify({ p: "SUZUKI" }), | |||||
| }).then((res) => { | |||||
| //if (res.ok) { | |||||
| window.location.href = "../suzuki/home"; | |||||
| /*} | |||||
| else{ | |||||
| }*/ | |||||
| }); | |||||
| }} | |||||
| > | |||||
| <a className={classes.dropdownLink}> | |||||
| <Icon className={classes.icons}> | |||||
| exit_to_app | |||||
| </Icon>{" "} | |||||
| Logout | |||||
| </a> | |||||
| </div>, | |||||
| ]} | |||||
| /> | |||||
| )} | |||||
| </ListItem> | |||||
| </List> | </List> | ||||
| ); | ); | ||||
| } | |||||
| } | |||||
| @@ -8,7 +8,6 @@ export default async function handler(req, res) { | |||||
| var user = await cookies.get("user"); | var user = await cookies.get("user"); | ||||
| var token = await cookies.get("myToken"); | var token = await cookies.get("myToken"); | ||||
| var userObj = user ? JSON.parse(user) : null; | var userObj = user ? JSON.parse(user) : null; | ||||
| // console.log("user", userObj); | |||||
| let sessionId = userObj["partners_login_states"].filter( | let sessionId = userObj["partners_login_states"].filter( | ||||
| (i) => | (i) => | ||||
| i.business_partner && | i.business_partner && | ||||
| @@ -22,6 +22,7 @@ const Home = function ({ | |||||
| businessPartners, | businessPartners, | ||||
| service, | service, | ||||
| carousels, | carousels, | ||||
| user, | |||||
| ...props | ...props | ||||
| }) { | }) { | ||||
| const classes = useStyles(); | const classes = useStyles(); | ||||
| @@ -30,7 +31,7 @@ const Home = function ({ | |||||
| return ( | return ( | ||||
| <div> | <div> | ||||
| <Header | <Header | ||||
| rightLinks={<HeaderSuzuki username={props.user} />} | |||||
| rightLinks={<HeaderSuzuki username={user} />} | |||||
| fixed | fixed | ||||
| color="info" | color="info" | ||||
| changeColorOnScroll={{ | changeColorOnScroll={{ | ||||
| @@ -26,6 +26,7 @@ const Home = function ({ | |||||
| businessPartners, | businessPartners, | ||||
| service, | service, | ||||
| carousel, | carousel, | ||||
| user, | |||||
| ...props | ...props | ||||
| }) { | }) { | ||||
| const classes = useStyles(); | const classes = useStyles(); | ||||
| @@ -35,7 +36,7 @@ const Home = function ({ | |||||
| return ( | return ( | ||||
| <div> | <div> | ||||
| <Header | <Header | ||||
| rightLinks={<HeaderLinks username={props.user} />} | |||||
| rightLinks={<HeaderLinks username={user} />} | |||||
| fixed | fixed | ||||
| color="info" | color="info" | ||||
| changeColorOnScroll={{ | changeColorOnScroll={{ | ||||
| @@ -80,7 +81,7 @@ export async function getServerSideProps(context) { | |||||
| if (userObj) { | if (userObj) { | ||||
| let sessionId = userObj["partners_login_states"].filter(function (i) { | let sessionId = userObj["partners_login_states"].filter(function (i) { | ||||
| return ( | return ( | ||||
| i.business_partner && i.business_partner.name.toUpperCase() == "SUZUKI" | |||||
| i.business_partner && i.business_partner.name.toUpperCase() == "YAMAHA" | |||||
| ); | ); | ||||
| }); | }); | ||||
| if (sessionId.length != 0) user = userObj["username"]; | if (sessionId.length != 0) user = userObj["username"]; | ||||
| @@ -14,7 +14,7 @@ app.prepare().then(() => { | |||||
| const parsedUrl = parse(req.url, true); | const parsedUrl = parse(req.url, true); | ||||
| const { pathname, query } = parsedUrl; | const { pathname, query } = parsedUrl; | ||||
| if (pathname === "/") { | if (pathname === "/") { | ||||
| app.render(req, res, "/yamaha/home", query); | |||||
| app.render(req, res, "/home", query); | |||||
| } else if (pathname === "/yamaha") { | } else if (pathname === "/yamaha") { | ||||
| app.render(req, res, "/yamaha/home", query); | app.render(req, res, "/yamaha/home", query); | ||||
| } else if (pathname === "/suzuki") { | } else if (pathname === "/suzuki") { | ||||