Skip to content

Commit

Permalink
Merge pull request #263 from LL08-MathematicalModelling-dowell/fronte…
Browse files Browse the repository at this point in the history
…nd-Norah

nps scale changed to nps lite scale
  • Loading branch information
norahwinda authored Jun 4, 2024
2 parents a12645b + 9a1a712 commit b308d94
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 63 deletions.
6 changes: 3 additions & 3 deletions src/pages/scales/report/Booth.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { useState, useEffect} from 'react';
import { useSearchParams } from "react-router-dom";
import { Link, useSearchParams } from "react-router-dom";

const Booth = () => {

Expand All @@ -10,7 +10,7 @@ const Booth = () => {

useEffect(()=>{
setSearchParams({ scale_id: "665a8277d5d158ec8391aaf7" });
})
}, [])

const handleGoButton = () =>{
console.log(boothInput)
Expand All @@ -21,7 +21,7 @@ const Booth = () => {
<h3 className='mt-[140px]'>Please enter your booth number</h3>
<input name='boothInput' value={boothInput} onChange={(e) =>setBoothInput(e.target.value)} type='number' className='w-[150px] h-[30px] border-2 border-black mt-5' />
<button className='w-[70px] h-[30px] rounded-lg mt-[100px] bg-[#FEC39C]'
onClick={handleGoButton}>Go</button>
onClick={handleGoButton}><Link to="http://127.0.0.1:8000/nps-lite/api/v5/nps-lite-create-scale/?user=True&scale_type=nps_lite&workspace_id=65b8d6f13d801280ffe56d65&username=Paolo&scale_id=665ed61fa746caf0d6d407c9&channel_name=channel_1">Go</Link></button>
</div>
)
}
Expand Down
68 changes: 11 additions & 57 deletions src/pages/scales/report/NpsScaleTest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,73 +17,27 @@ const NpsScaleTest = () => {
</p>

<div className="flex border p-5 justify-center items-center mt-5">
<div className="flex justify-center items-center gap-6 md:gap-12 mt-5">
<button
className="bg-[#129561] mr-[2%] rounded-lg w-[30px] h-[30px] text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href ="https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=653637a4950d738c6249aa9a&username=CustomerSupport&scale_id=6656f055d57731003026715e&item=0"}
className="bg-[#ff4a4a] rounded-lg p-1 px-3 sm:p-2 sm:px-6 md:p-4 md:px-12 text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href ="https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=6385c0e68eca0fb652c9449a&username=CustomerSupport&scale_id=665ee1738c9b16f4f9967dd1&item=0"}
>
0
Bad 😞
</button>
<button
className="bg-[#129561] mr-[2%] rounded-lg w-[30px] h-[30px] text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href ="https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=653637a4950d738c6249aa9a&username=CustomerSupport&scale_id=6656f055d57731003026715e&item=1"}
className="bg-[#f3dd1f] rounded-lg p-1 px-3 sm:p-2 sm:px-6 md:p-4 md:px-12 text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href ="https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=6385c0e68eca0fb652c9449a&username=CustomerSupport&scale_id=665ee1738c9b16f4f9967dd1&item=1"}
>
1
Average 😐
</button>
<button
className="bg-[#129561] mr-[2%] rounded-lg w-[30px] h-[30px] text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href = "https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=653637a4950d738c6249aa9a&username=CustomerSupport&scale_id=6656f055d57731003026715e&item=2"}
className="bg-[#129561] rounded-lg p-1 px-3 sm:p-2 sm:px-6 md:p-4 md:px-12 text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href = "https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=6385c0e68eca0fb652c9449a&username=CustomerSupport&scale_id=665ee1738c9b16f4f9967dd1&item=2"}
>
2
</button>
<button
className="bg-[#129561] mr-[2%] rounded-lg w-[30px] h-[30px] text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href = "https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=653637a4950d738c6249aa9a&username=CustomerSupport&scale_id=6656f055d57731003026715e&item=2"}
>
3
</button>
<button
className="bg-[#129561] mr-[2%] rounded-lg w-[30px] h-[30px] text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href = "https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=653637a4950d738c6249aa9a&username=CustomerSupport&scale_id=6656f055d57731003026715e&item=2"}
>
4
</button>
<button
className="bg-[#129561] mr-[2%] rounded-lg w-[30px] h-[30px] text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href = "https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=653637a4950d738c6249aa9a&username=CustomerSupport&scale_id=6656f055d57731003026715e&item=2"}
>
5
</button>
<button
className="bg-[#129561] mr-[2%] rounded-lg w-[30px] h-[30px] text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href = "https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=653637a4950d738c6249aa9a&username=CustomerSupport&scale_id=6656f055d57731003026715e&item=2"}
>
6
</button>
<button
className="bg-[#129561] mr-[2%] rounded-lg w-[30px] h-[30px] text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href = "https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=653637a4950d738c6249aa9a&username=CustomerSupport&scale_id=6656f055d57731003026715e&item=2"}
>
7
</button>
<button
className="bg-[#129561] mr-[2%] rounded-lg w-[30px] h-[30px] text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href = "https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=653637a4950d738c6249aa9a&username=CustomerSupport&scale_id=6656f055d57731003026715e&item=2"}
>
8
</button>
<button
className="bg-[#129561] mr-[2%] rounded-lg w-[30px] h-[30px] text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href = "https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=653637a4950d738c6249aa9a&username=CustomerSupport&scale_id=6656f055d57731003026715e&item=2"}
>
9
</button>
<button
className="bg-[#129561] rounded-lg w-[30px] h-[30px] text-base sm:font-medium cursor-pointer"
onClick={() => window.location.href = "https://100035.pythonanywhere.com/addons/create-response/v3/?user=True&scale_type=nps_lite&channel=channel_1&instance=instances_1&workspace_id=653637a4950d738c6249aa9a&username=CustomerSupport&scale_id=6656f055d57731003026715e&item=2"}
>
10
Excellent 😄
</button>
</div>
</div>
</div>
)
}
Expand Down
9 changes: 6 additions & 3 deletions src/pages/scales/report/ReportAnalysis.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
Legend,
scales,
} from "chart.js";
import { useParams } from 'react-router-dom';
import { Line, Bar } from "react-chartjs-2";
import StackBarData from "./StackBarData";

Expand Down Expand Up @@ -156,6 +157,7 @@ const ReportAnalysis = () => {
const [displayDataForAllSelection, setDisplayDataForAllSelection] = useState(
[]
);
const { slug } = useParams();
const [stackBarData, setStackBarData] = useState({
labels: [],
datasets: [],
Expand Down Expand Up @@ -325,17 +327,17 @@ const ReportAnalysis = () => {
const fetchData = async () => {
try {
const response = await axios.get(
"https://100035.pythonanywhere.com/addons/get-response/?scale_id=66556a7ff11edcfcfb8b0d54"
`https://100035.pythonanywhere.com/addons/get-response/?scale_id=${slug}`
);
const data = response.data.data;
console.log(data)
console.log(data, "BBBBBBBBBBBBBBB")
const uniqueChannels = Array.from(
new Set(data.map((item) => item.channel_name))
);
const uniqueInstances = Array.from(
new Set(data.map((item) => item.instance_name.trim()))
);

console.log("Channel", uniqueChannels)
setChannels([allChannelsNameTag, ...uniqueChannels]);
setInstances(uniqueInstances);
setData(data);
Expand All @@ -356,6 +358,7 @@ console.log(data)
setTotalCount(0);
}
};
console.log(channels, "ChannelsGGGGG")

const handleInstanceSelect = (event) => {
setSelectedInstance(event.target.value);
Expand Down

0 comments on commit b308d94

Please sign in to comment.