Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added changes for status and location #117

Merged
merged 5 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions frontend/src/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ interface Location {
address: string;
city: string;
country: string;
zipcode: string;
}

interface Application {
Expand Down Expand Up @@ -111,12 +112,13 @@ const Dashboard = () => {
const jobDetailsResponse = await axios.get(API_ROUTES.JOBS, {
params: { id: myApplications.job },
});
const locationDetailsResponse = await axios.get(`${API_ROUTES.USER.LOCATION}`);
const locationDetail = locationDetailsResponse.data;

//console.log("job details response", jobDetailsResponse.data);
const jobDetail = jobDetailsResponse.data;

const locationDetailsResponse = await axios.get(
`${API_ROUTES.USER.LOCATION}?location_id=${jobDetail.location}`
);
const locationDetail = locationDetailsResponse.data;

const petDetailsResponse = await axios.get(`${API_ROUTES.PETS}${jobDetail.pet}`);
const petDetail = petDetailsResponse.data;

Expand Down Expand Up @@ -208,7 +210,10 @@ const Dashboard = () => {
<div>
<p className="font-bold mb-2">Pet Name: {job.pet.name}</p>
<p>Job Status: {job.status}</p>
<p>Location: {job?.location?.address ?? ""}</p>
<p>
Location: {job?.location?.address ?? ""}, {job?.location?.city ?? ""},{" "}
{job?.location?.zipcode ?? ""}
</p>
<p>Pay: ${job.pay}</p>
<p>Start: {job.start}</p>
<p>End: {job.end}</p>
Expand Down Expand Up @@ -240,11 +245,19 @@ const Dashboard = () => {
className="border border-gray-300 mb-4 p-4 rounded-md"
>
<div>
<p>Application Status: {myApplications.status}</p>
<p>Pet:{myApplications.pet.name}</p>
<p>Start:{myApplications.job.start}</p>
<p>End:{myApplications.job.end}</p>
<p>Pay:{myApplications.job.pay}</p>
<p className="font-bold mb-2">Pet Name : {myApplications.pet.name}</p>
<p>
Location: {myApplications?.location?.address ?? ""},{" "}
{myApplications?.location?.city ?? ""},{" "}
{myApplications?.location?.zipcode ?? ""}
</p>
<p>Pay: ${myApplications.job.pay}</p>
<p>Start: {myApplications.job.start}</p>
<p>End: {myApplications.job.end}</p>
<p className="font-bold mb-2">
Application Status:{" "}
{!myApplications.status ? "No Decision" : myApplications.status}
</p>
</div>
</li>
))}
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/Jobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface Location {
address: string;
city: string;
country: string;
zipcode: string;
}

interface Pet {
Expand Down Expand Up @@ -207,15 +208,18 @@ const Jobs: React.FC = () => {
<div>
<p className="font-bold mb-2">Pet Name: {job.pet.name}</p>
<p>Status: {job.status}</p>
<p>Location: {job?.location?.address ?? ""}</p>
<p>
Location: {job?.location?.address ?? ""}, {job?.location?.city ?? ""},{" "}
{job?.location?.zipcode ?? ""}
</p>
<p>Pay: {job.pay}</p>
<p>Start: {job.start}</p>
<p>End: {job.end}</p>
</div>
<div className="mt-4 flex">
<button
onClick={() => handleDelete(job.id)}
className="bg-red-500 text-white px-4 py-2 rounded-md"
className="bg-red-500 text-white px-4 py-2 rounded-md mr-2"
>
Delete
</button>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/auth/AuthProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ const AuthProvider = ({ children }: React.PropsWithChildren<unknown>) => {
.then((response) => {
if (response.status === 201) {
toast.success(
`An account has been created for ${response.data?.data?.email ?? ""
`An account has been created for ${
response.data?.data?.email ?? ""
}. Redirecting to login page...`
);
navigate("/login");
Expand Down
7 changes: 3 additions & 4 deletions furbaby/api/migrations/0015_alter_applications_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@


class Migration(migrations.Migration):

dependencies = [
('api', '0014_merge_20231127_1811'),
("api", "0014_merge_20231127_1811"),
]

operations = [
migrations.AlterField(
model_name='applications',
name='status',
model_name="applications",
name="status",
field=models.TextField(null=True),
),
]
2 changes: 1 addition & 1 deletion furbaby/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ def post(self, request, *args, **kwargs):
application_data = {
"user": request.user.id,
"job": job_id,
"status": "rejected", # You can set an initial status here
"status": None, # You can set an initial status here
"details": {}, # You can add more details if needed
}
application_serializer = ApplicationSerializer(
Expand Down
Loading