Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
paulorosadodev committed Jun 6, 2024
2 parents 4924fa6 + a874466 commit 8a45811
Show file tree
Hide file tree
Showing 16 changed files with 855 additions and 162 deletions.
24 changes: 9 additions & 15 deletions app_client/models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.db import models
from django.contrib.auth.models import User,AbstractUser
from app_company.models import Users

from datetime import datetime, timedelta

class OrderRequest(models.Model):
STATUS_CHOICES = [
('EM_ANALISE', 'EM ANÁLISE'),
Expand All @@ -15,7 +15,7 @@ class OrderRequest(models.Model):
('EM_REPARO', 'EM REPARO'),
('AGUARDANDO_PECAS', 'AGUARDANDO PEÇAS'),
('CONSERTO_FINALIZADO', 'CONSERTO FINALIZADO'),
('CANCELADO', 'CANCELDO'),
('CANCELADO', 'CANCELADO'),
]
productType = models.CharField(max_length=75)
productbrand = models.CharField(max_length=75)
Expand All @@ -39,24 +39,18 @@ class OrderRequest(models.Model):

def reopen_time(self):
actual_time = datetime.now().date()
days_difference = (actual_time - self.closedAt).days
days_difference = (actual_time - self.closedAt.date()).days
if days_difference > 30:
self.isReopen = True

class ServiceRating(models.Model):
RATINGS = [
(0, '0'),
(1, '1'),
(2, '2'),
(3, '3'),
(4, '4'),
(5, '5'),
(6, '6'),
(7, '7'),
(8, '8'),
(9, '9'),
(10, '10'),
]
(1, '1'),
(2, '2'),
(3, '3'),
(4, '4'),
(5, '5'),
]
attendance = models.IntegerField(choices=RATINGS)
service = models.IntegerField(choices=RATINGS)
time = models.IntegerField(choices=RATINGS)
Expand Down
128 changes: 128 additions & 0 deletions app_client/static/css/app_client/rating.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
:root {
--red-100: #fee2e2;
--red-600: #DC2626;
--red-700: #b91c1c;
--green-100: #dcfce7;
--green-500: #22c55e;
--green-700: #108519;
--white: #f7f7f7;
--gray-50: #f9fafb;
--gray-200: #e5e7eb;
--gray-300: #d1d5db;
--gray-400: #9ca3af;
--gray-500: #6b7280;
--gray-600: #4b5563;
--gray-700: #374151;
--gray-800: #1f2937;
--blue-500: #155ec8;
--blue-200: #bfdbfe;
--yellow-700: #a16207;
--yellow-100: #fef9c3;
--yellow-300: #fde047;
--yellow-400: #facc15;
}

* {
padding: 0;
margin: 0;
box-sizing: border-box;
}

.mainRating {
position: fixed;
z-index: 999;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.4);
display: flex;
align-items: center;
justify-content: center;
}

.rating {
background-color: var(--white);
display: flex;
flex-direction: column;
margin: 10% auto 15% auto;
padding: 24px 20px;
border: 1px solid #888;
width: 800px;
height: fit-content;
position: relative;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
justify-content: center;
border-radius: 4px;
}

.rating h1 {
text-align: center;
font-size: 28px;
}

.rating label {
color: var(--gray-700);
font-weight: 500;
font-size: 18px;
}

.rating svg {
fill: transparent;
}

.ratingContent button {
background-color: transparent;
border: none;
padding-right: 8px;
}

.rating button svg {
color: transparent;
fill: var(--gray-300);
width: 40px;
height: 40px;
transition: all .2s;
}

.rating button.active svg {
fill: var(--yellow-400);
}


.rating button.hover svg {
fill: var(--yellow-400);
}

.ratingContent {
margin-top: 32px;
}

.inputContainer {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;
}

.ratingContent textarea {
width: 100%;
height: 200px;
resize: none;
border-radius: 8px;
border: 1px solid var(--gray-200);
margin-top: 8px;
padding: 16px;
}

.rating-submit {
padding: 8px 16px;
background-color: var(--green-700);
color: var(--white);
font-weight: 600;
border-radius: 4px;
border: none;
float: right;
margin-top: 24px;
}
16 changes: 8 additions & 8 deletions app_client/static/css/app_client/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,23 @@ tbody td:first-child div {
}

.EM_ANALISE, .AGUARDANDO_ORCAMENTO, .AGUARDANDO_PECAS {
background-color: #FFF59F;
color: #978217 !important;
background-color: var(--gray-500);
color: var(--white) !important;
}

.ACEITO, .CONSERTO_FINALIZADO {
background-color: #E9FFDF;
color: #15803D !important;
background-color: #15803D;
color: #E9FFDF !important;
}

.RECUSADO, .CANCELADA, .CANCELADO {
background-color: #FFEBEB;
color: #C92A2A !important;
background-color: #C92A2A;
color: #FFEBEB !important;
}

.AGENDADO, .AGUARDANDO_CONFIRMACAO, .EM_REPARO {
background-color: #E8EDFF;
color: #1971C2 !important;
background-color: #1971C2;
color: #E8EDFF !important;
}

.rating-label{
Expand Down
119 changes: 119 additions & 0 deletions app_client/static/js/rating.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
const attendanceStars = document.querySelectorAll(".attendance");
const serviceStars = document.querySelectorAll(".service");
const timeStars = document.querySelectorAll(".time");

const attendanceInput = document.querySelector("#attendance")
const serviceInput = document.querySelector("#service")
const timeInput = document.querySelector("#time")

// Attendance
attendanceStars.forEach((star, firstIndex) => {
star.addEventListener("click", () => {
attendanceStars.forEach((star, secondIndex) => {

if (firstIndex >= secondIndex) {
attendanceInput.value = secondIndex + 1;
star.classList.add("active");
} else {
star.classList.remove("active");
}
});
})
});

attendanceStars.forEach((star, firstIndex) => {
star.addEventListener("mouseover", () => {
attendanceStars.forEach((star, secondIndex) => {

if (firstIndex >= secondIndex) {
star.classList.add("hover");
}
});
})
});

attendanceStars.forEach((star, firstIndex) => {
star.addEventListener("mouseout", () => {
attendanceStars.forEach((star, secondIndex) => {

if (firstIndex >= secondIndex) {
star.classList.remove("hover");
}
});
})
});


// Service
serviceStars.forEach((star, firstIndex) => {
star.addEventListener("click", () => {
serviceStars.forEach((star, secondIndex) => {
if (firstIndex >= secondIndex) {
serviceInput.value = secondIndex + 1;
star.classList.add("active");
} else {
star.classList.remove("active");
}
});
})
});

serviceStars.forEach((star, firstIndex) => {
star.addEventListener("mouseover", () => {
serviceStars.forEach((star, secondIndex) => {

if (firstIndex >= secondIndex) {
star.classList.add("hover");
}
});
})
});

serviceStars.forEach((star, firstIndex) => {
star.addEventListener("mouseout", () => {
serviceStars.forEach((star, secondIndex) => {

if (firstIndex >= secondIndex) {
star.classList.remove("hover");
}
});
})
});


// Time
timeStars.forEach((star, firstIndex) => {
star.addEventListener("click", () => {
timeStars.forEach((star, secondIndex) => {
if (firstIndex >= secondIndex) {
timeInput.value = secondIndex + 1;
star.classList.add("active");
} else {
star.classList.remove("active");
}
});
})
});

timeStars.forEach((star, firstIndex) => {
star.addEventListener("mouseover", () => {
timeStars.forEach((star, secondIndex) => {

if (firstIndex >= secondIndex) {
star.classList.add("hover");
}
});
})
});

timeStars.forEach((star, firstIndex) => {
star.addEventListener("mouseout", () => {
timeStars.forEach((star, secondIndex) => {

if (firstIndex >= secondIndex) {
star.classList.remove("hover");
}
});
})
});

4 changes: 1 addition & 3 deletions app_client/templates/RequestOrder/orders.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ <h3>Suas solicitações</h3>
</a>
</td>

{% comment %}
{% if order.status == 'CONSERTO_FINALIZADO' %}
{% if order.status == 'EM_ANALISE' %}
<td>
<a href="{% url 'client:rate_service' order.id %}">
<i data-lucide="star" width="28" height="28" color="#d4c02a"></i>
Expand All @@ -100,7 +99,6 @@ <h3>Suas solicitações</h3>


{% endif %}
{% endcomment %}

{% if order.closedAt or order.status == 'CANELADO'%}
<td>
Expand Down
Loading

0 comments on commit 8a45811

Please sign in to comment.