diff --git a/api/product/helmet.js b/api/product/helmet.js new file mode 100644 index 0000000..db7977e --- /dev/null +++ b/api/product/helmet.js @@ -0,0 +1,183 @@ +import apollo from "../../lib/apollo.js"; + +async function GetHelmetRConcepts(filter, token="") { + var res = await apollo.query( + ` + query { + helmets(where: { category: "RCONCEPTS" ${(filter!="")?`name: "${filter}"`:""}}) { + id + name + price + img { + url + } + } + }`, + token + ); + return res; +} + +async function GetHelmetMTX(filter, token="") { + var res = await apollo.query( + ` + query { + helmets(where: { category: "MTX" ${(filter!="")?`name: "${filter}"`:""}}) { + id + name + price + img { + url + } + } + }`, + token + ); + return res; +} + +async function GetHelmetExtreme(filter, token="") { + var res = await apollo.query( + ` + query { + helmets(where: { category: "EXTREME" ${(filter!="")?`name: "${filter}"`:""}}) { + id + name + price + img { + url + } + } + }`, + token + ); + return res; +} + +async function GetHelmetRanger(filter, token="") { + var res = await apollo.query( + ` + query { + helmets(where: { category: "RANGER" ${(filter!="")?`name: "${filter}"`:""}}) { + id + name + price + img { + url + } + } + }`, + token + ); + return res; +} + +async function GetHelmetFighter(filter, token="") { + var res = await apollo.query( + ` + query { + helmets(where: { category: "FIGHTER" ${(filter!="")?`name: "${filter}"`:""}}) { + id + name + price + img { + url + } + } + }`, + token + ); + return res; +} + +async function GetHelmetSwirl(filter, token="") { + var res = await apollo.query( + ` + query { + helmets(where: { category: "SWIRL" ${(filter!="")?`name: "${filter}"`:""}}) { + id + name + price + img { + url + } + } + }`, + token + ); + return res; +} + +async function GetHelmetClassic(filter, token="") { + var res = await apollo.query( + ` + query { + helmets(where: { category: "CLS" ${(filter!="")?`name: "${filter}"`:""}}) { + id + name + price + img { + url + } + } + }`, + token + ); + return res; +} + +async function GetHelmetUno(filter, token="") { + var res = await apollo.query( + ` + query { + helmets(where: { category: "UNO" ${(filter!="")?`name: "${filter}"`:""}}) { + id + name + price + img { + url + } + } + }`, + token + ); + return res; +} + + +async function GetDetailHelmet(id, token="") { + var res = await apollo.query( + ` + query($input: ID!){ + helmets(where:{id:$input}) + { + id + name + description + price + part_code + img { + url + } + stock + } + } `, + token, + { + "input": id + } + ); + return res; +} + +module.exports = { + GetHelmetRConcepts:GetHelmetRConcepts, + GetHelmetMTX:GetHelmetMTX, + GetHelmetExtreme:GetHelmetExtreme, + GetHelmetRanger:GetHelmetRanger, + GetHelmetFighter:GetHelmetFighter, + GetHelmetSwirl:GetHelmetSwirl, + GetHelmetClassic:GetHelmetClassic, + GetHelmetUno:GetHelmetUno, + GetDetailHelmet:GetDetailHelmet, +}; \ No newline at end of file diff --git a/pages-sections/product/helmet.js b/pages-sections/product/helmet.js index 9c1ea60..88b75a8 100644 --- a/pages-sections/product/helmet.js +++ b/pages-sections/product/helmet.js @@ -9,10 +9,12 @@ import styles from "assets/jss/nextjs-material-kit/pages/componentsSections/noti import Card from "components/Card/Card.js"; import CardBody from "components/Card/CardBody.js"; import GridContainer from "components/Grid/GridContainer.js"; +import SnackbarContent from "components/Snackbar/SnackbarContent.js"; +import { MoveToInboxOutlined } from "@material-ui/icons"; const useStyles = makeStyles(styles); -const DataHelmet = function ({ selected, handleName, backend, helmet, ...props }) { +const DataHelmet = function ({ selected, handleName, backend, helmet, mtx, extreme, ranger, fighter, swirl, classic, uno, ...props }) { const classes = useStyles(); const { ...rest } = props; const imageClasses = classNames( @@ -21,7 +23,7 @@ const DataHelmet = function ({ selected, handleName, backend, helmet, ...props } classes.imgFluid ); const navImageClasses = classNames(classes.imgRounded, classes.imgGallery); - const ProductHelmet = helmet.map((data) => { + const ProductHelmetRConcepts = helmet.map((data) => { return (
-

{data.name}

+

{data.name}

+

Rp.{data.price}

+ +
+
+ ); + }) + const ProductHelmetMTX = mtx.map((data) => { + return ( +
+ ... +
+

{data.name}

+

Rp.{data.price}

+ +
+
+ ); + }) + const ProductHelmetExtreme = extreme.map((data) => { + return ( +
+ ... +
+

{data.name}

+

Rp.{data.price}

+ +
+
+ ); + }) + const ProductHelmetRanger = ranger.map((data) => { + return ( +
+ ... +
+

{data.name}

+

Rp.{data.price}

+ +
+
+ ); + }) + const ProductHelmetFighter = fighter.map((data) => { + return ( +
+ ... +
+

{data.name}

+

Rp.{data.price}

+ +
+
+ ); + }) + const ProductHelmetSwirl = swirl.map((data) => { + return ( +
+ ... +
+

{data.name}

+

Rp.{data.price}

+ +
+
+ ); + }) + const ProductHelmetClassic = classic.map((data) => { + return ( +
+ ... +
+

{data.name}

+

Rp.{data.price}

+ +
+
+ ); + }) + const ProductHelmetUno = uno.map((data) => { + return ( +
+ ... +
+

{data.name}

Rp.{data.price}





diff --git a/pages-sections/product/helmet_details.js b/pages-sections/product/helmet_details.js index 93c32a0..fa72c1f 100644 --- a/pages-sections/product/helmet_details.js +++ b/pages-sections/product/helmet_details.js @@ -64,7 +64,7 @@ const DetailDataHelmet = function ({ backend, detailhelmet, ...props }) {
diff --git a/pages-sections/product/yamalube.js b/pages-sections/product/yamalube.js index 9cdc44c..a7274c3 100644 --- a/pages-sections/product/yamalube.js +++ b/pages-sections/product/yamalube.js @@ -32,7 +32,7 @@ const DataYamalube = function ({ selected, handleName, backend, yamalube, ...pro className={navImageClasses} />
-

{data.name}

+

{data.name}

Rp.{data.price}