Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavoyoq committed Jun 6, 2024
2 parents 34840d4 + 7862c2c commit 52f424c
Show file tree
Hide file tree
Showing 15 changed files with 115 additions and 80 deletions.
4 changes: 2 additions & 2 deletions app_client/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class OrderRequest(models.Model):
STATUS_CHOICES = [
('EM_ANALISE', 'EM ANÁLISE'),
('AGENDADO', 'AGENDADO'),
('AGUARDANDO_ORCAMENTO', 'ORÇAMENTO PENDENTE'),
('AGUARDANDO_ORCAMENTO', 'AGUARDANDO ORÇAMENTO'),
('AGUARDANDO_CONFIRMACAO', 'AGUARDANDO CONFIRMAÇÃO'),
('ACEITO', 'ACEITO'),
('RECUSADO', 'RECUSADO'),
Expand Down Expand Up @@ -39,7 +39,7 @@ class OrderRequest(models.Model):

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

Expand Down
6 changes: 5 additions & 1 deletion app_client/static/css/app_client/delete-order.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,8 @@

.deleteContent .actions button:first-child{
background-color: var(--gray-600);
}
}

a {
color: inherit;
}
6 changes: 5 additions & 1 deletion app_client/static/css/app_client/reopen-order.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,8 @@

.reopenContent .actions button:first-child{
background-color: var(--gray-600);
}
}

a {
color: inherit;
}
18 changes: 18 additions & 0 deletions app_client/static/css/app_client/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,22 @@ tbody td:first-child div {
margin-top: 10px;
padding: 3px;
border-radius: 4px;
}

.view button, .delete button {
padding: 4px 8px;
border: none;
background-color: var(--blue-500);
color: var(--white);
font-weight: 600;
border-radius: 4px;
transition: all .3s;
}

.view, .delete button:hover {
filter: brightness(0.9);
}

.delete button {
background-color: var(--red-600);
}
13 changes: 12 additions & 1 deletion app_client/templates/RequestOrder/delete-service.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,18 @@ <h1>Solicitação N {{order.id}}°</h1><br>
<form action="{% url 'client:delete_service' order.id %}" method="POST">
{% csrf_token %}
<div class="actions">
<a href="{% url 'client:view_orders'%}" class="cancel" role="button">Cancelar</a>

<button id="cancel "type="button">
<a class="cancel" href="{% url 'client:view_orders'%}">Cancelar</a>
</button>

<script>
function disableButton() {
const button = document.getElementById("cancel");
button.disabled = true;
}
</script>

<button type="submit">Confirmar</button>
</div>
</form>
Expand Down
10 changes: 4 additions & 6 deletions app_client/templates/RequestOrder/orders.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ <h3>Suas solicitações</h3>
<td> - </td>
{% endif %}
<td>
<a href="{% url 'client:view_order' order.id %}">
<i data-lucide="eye" width="28" height="28" color="#155ec8"></i>
<a class="view" href="{% url 'client:view_order' order.id %}">
<button>Visualizar</button>
</a>
</td>

Expand All @@ -96,15 +96,13 @@ <h3>Suas solicitações</h3>
<i data-lucide="star" width="28" height="28" color="#d4c02a"></i>
</a>
</td>


{% endif %}


{% if order.closedAt or order.status == 'CANELADO'%}
<td>
<a href="{% url 'client:delete_service' order.id %}">
<i data-lucide="trash" width="28" height="28" color="#DC2626"></i>
<a class="delete" href="{% url 'client:delete_service' order.id %}">
<button>Remover</button>
</a>
</td>
{% endif %}
Expand Down
3 changes: 2 additions & 1 deletion app_client/templates/RequestOrder/reopen-service.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ <h1>Reabrir Solicitação N {{order.id}}°</h1><br>
<form action="{% url 'client:reopen_service' order.id %}" method="POST">
{% csrf_token %}
<div class="actions">
{% comment %} <a href="{% url 'client:view_orders'%}" class="cancel" role="button" >Cancelar</a> {% endcomment %}

<button id="cancel "type="button">
<a class="cancel" href="{% url 'client:view_orders'%}">Cancelar</a>
</button>

<script>
function disableButton() {
const button = document.getElementById("cancel");
Expand Down
1 change: 0 additions & 1 deletion app_client/templates/RequestOrder/vieworder.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
<div class="finished">

<a href="{% url 'client:rate_service' order.id %}">
{% comment %} <i data-lucide="star" width="28" height="28" color="#d4c02a"></i> {% endcomment %}
<p>Avaliar o serviço prestado</p>
</a>

Expand Down
2 changes: 1 addition & 1 deletion app_company/static/app_company/js/filter-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function handleLoadFilteredHtml(order) {
${order.fields.isOs ? "Ordem de Serviço" : "Solicitação"}
</td>
<td>
<a href="${order.fields.isOs ? `/empresa/os/${order.pk}` : `/empresa/os/${order.pk}`}">
<a href="${order.fields.isOs ? `/empresa/os/${order.pk}` : `/empresa/solicitacao/${order.pk}`}">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28" fill="none" stroke="#155ec8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-eye"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>
</a>
</td>
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/ConvertOrderRequest.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('HomePage', () => {
cy.get('.content > form > button').click()
cy.get('.logout > button').click()
cy.GoToClient("kato@gmail.com")
cy.get(':nth-child(4) > a').click()
cy.get('.view > button').click()
cy.get('.yes')
cy.get('.waitingForm > form > button').click()
cy.ClientLogout()
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('HomePage', () => {
cy.get('.content > form > button').click()
cy.get('.logout > button').click()
cy.GoToClient("kato@gmail.com")
cy.get(':nth-child(4) > a').click()
cy.get('.view > button').click()
cy.get('.waitingForm > form > button').click()
cy.get('.logout').click()
cy.get('#employee > a').click()
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('HomePage', () => {
cy.get('.content > form > button').click()
cy.get('.logout > button').click()
cy.GoToClient("kato@gmail.com")
cy.get(':nth-child(4) > a').click()
cy.get('.view > button').click()
cy.get('.yes')
cy.get('.waitingForm > form > button').click()
cy.ClientLogout()
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/ManagingMyServices.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('HomePage', () => {
cy.get('.content > form > button').click()
cy.get('.logout > button').click()
cy.GoToClient()
cy.get(':nth-child(4) > a').click()
cy.get('.view > button').click()
cy.get('.yes > label').click()
cy.get('.waitingForm > form > button').click()
cy.ClientLogout()
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/ManagingOrder.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('HomePage', () => {
cy.get('.content > form > button').click()
cy.get('.logout > button').click()
cy.GoToClient()
cy.get(':nth-child(4) > a').click()
cy.get('.view > button').click()
cy.get('.yes > label').click()
cy.get('.waitingForm > form > button').click()
cy.ClientLogout()
Expand Down Expand Up @@ -61,7 +61,7 @@ describe('HomePage', () => {
cy.get('.content > form > button').click()
cy.get('.logout > button').click()
cy.GoToClient()
cy.get(':nth-child(4) > a').click()
cy.get('.view > button').click()
cy.get('.yes > label').click()
cy.get('.waitingForm > form > button').click()
cy.ClientLogout()
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('HomePage', () => {
cy.get('.content > form > button').click()
cy.get('.logout > button').click()
cy.GoToClient()
cy.get(':nth-child(4) > a').click()
cy.get('.view > button').click()
cy.get('.yes > label').click()
cy.get('.waitingForm > form > button').click()
cy.ClientLogout()
Expand Down
112 changes: 56 additions & 56 deletions cypress/e2e/ReopeningService.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Reopening Service Tests', () => {
cy.Logout()

cy.GoToClient()
cy.get(':nth-child(4) > a').click()
cy.get('.view > button').click()
cy.get('.waitingForm > form > button').click()
cy.Logout()

Expand All @@ -49,7 +49,7 @@ describe('Reopening Service Tests', () => {
cy.Logout()

cy.GoToClient()
cy.get(':nth-child(4) > a').click()
cy.get('.view > button').click()
cy.get('#reopen > p').invoke('text').should('have.string', 'Reabrir solicitação')
cy.get('#reopen > p').click()
cy.get('.actions > [type="submit"]').click()
Expand All @@ -58,61 +58,61 @@ describe('Reopening Service Tests', () => {

})

it('insurance expired', () => {
// it('insurance expired', () => {

cy.exec('python manage.py migrate')
cy.DeleteAndCreateAdm()
cy.visit('/')
cy.on("uncaught:exception", (e, runnable) => {
console.log("error", e);
console.log("runnable", runnable);
console.log("error", e.message);
return false;
});

cy.CreateClient()
cy.CreateSolicitation()
// cy.clock()
cy.visit('/')
cy.ClientLogout()
cy.CreateAdmin()

cy.get('ul > :nth-child(1)').click()
cy.get(':nth-child(6) > a').click()
cy.get('#status').select('Aguardando orçamento')
cy.get('.content > form > button').click()
// cy.exec('python manage.py migrate')
// cy.DeleteAndCreateAdm()
// cy.visit('/')
// cy.on("uncaught:exception", (e, runnable) => {
// console.log("error", e);
// console.log("runnable", runnable);
// console.log("error", e.message);
// return false;
// });

// cy.CreateClient()
// cy.CreateSolicitation()
// // cy.clock()
// cy.visit('/')
// cy.ClientLogout()
// cy.CreateAdmin()

// cy.get('ul > :nth-child(1)').click()
// cy.get(':nth-child(6) > a').click()
// cy.get('#status').select('Aguardando orçamento')
// cy.get('.content > form > button').click()

cy.get('.budgetContainer > input').type('90')
cy.get('.content > form > button').click()
cy.Logout()

cy.GoToClient()
cy.get(':nth-child(4) > a').click()
cy.get('.waitingForm > form > button').click()
cy.Logout()

cy.ChangeToAdmin()
cy.get('ul > :nth-child(1)').click()
cy.get(':nth-child(6) > a').click()
cy.get('.works > button').click()

cy.get('#detailed_problem_description').type('A')
cy.get('#necessary_parts').type('B')
cy.get('.works > button').click()

cy.get(':nth-child(6) > a').click()
cy.get('#status').select('Conserto finalizado')
cy.get('.update').click()

cy.Logout()
// cy.clock()

cy.GoToClient()
cy.get(':nth-child(4) > a').click()
// cy.get('#reopen > p').should('not.exist')
// cy.get('#reopen > p').click()
// cy.get('.actions > [type="submit"]').click()
// cy.get('.EM_ANALISE').invoke('text').should('have.string', 'EM ANÁLISE')
// cy.get('.budgetContainer > input').type('90')
// cy.get('.content > form > button').click()
// cy.Logout()

// cy.GoToClient()
// cy.get('.view > button').click()
// cy.get('.waitingForm > form > button').click()
// cy.Logout()

// cy.ChangeToAdmin()
// cy.get('ul > :nth-child(1)').click()
// cy.get(':nth-child(6) > a').click()
// cy.get('.works > button').click()

// cy.get('#detailed_problem_description').type('A')
// cy.get('#necessary_parts').type('B')
// cy.get('.works > button').click()

// cy.get(':nth-child(6) > a').click()
// cy.get('#status').select('Conserto finalizado')
// cy.get('.update').click()

// cy.Logout()
// // cy.clock()

// cy.GoToClient()
// cy.get('.view > button').click()
// // cy.get('#reopen > p').should('not.exist')
// // cy.get('#reopen > p').click()
// // cy.get('.actions > [type="submit"]').click()
// // cy.get('.EM_ANALISE').invoke('text').should('have.string', 'EM ANÁLISE')

})
// })
})
4 changes: 2 additions & 2 deletions cypress/e2e/StatusMonitoring.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('test suite status monitoring', () => {
cy.get('.content > form > button').click();
cy.get('.logout > button').click();
cy.GoToClient();
cy.get(':nth-child(4) > a').click();
cy.get('.view > button').click();
cy.get('.AGENDADO').invoke('text').should('have.string', 'AGENDADO')
});
it('Alterar o status de “Aceito” para “Em reparo”', () => {
Expand Down Expand Up @@ -48,7 +48,7 @@ describe('test suite status monitoring', () => {
cy.get('.content > form > button').click()
cy.get('.logout > button').click();
cy.GoToClient();
cy.get(':nth-child(4) > a').click();
cy.get('.view > button').click();
cy.get('.waitingForm > form > button').click()
cy.ClientLogout();
cy.get('#employee > a').click()
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/solicitationManagement.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const oneMonthFromToday = formatDate(new Date(today.getFullYear(), today.getMont
cy.get('.content > form > button').click()
cy.get('.logout > button').click()
cy.GoToClient()
cy.get(':nth-child(4) > a').click()
cy.get('.view > button').click()
cy.get('.price > span').invoke('text').should('have.string', "50,00")
cy.get('.waitingForm > p').invoke('text').should('have.string', "Você deseja prosseguir com o serviço?")
})
Expand Down

0 comments on commit 52f424c

Please sign in to comment.