From 93cf18a6d7b8fb4db59dd08a506a1089df937a58 Mon Sep 17 00:00:00 2001 From: Gabriel Albuquerque Date: Mon, 3 Jun 2024 22:12:07 -0300 Subject: [PATCH 1/7] starting test scripts --- cypress/e2e/test.cy.js | 60 +++++++++++++++++++++++++++++++++++------- test_initiate.py | 26 ++++++++++++++++++ 2 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 test_initiate.py diff --git a/cypress/e2e/test.cy.js b/cypress/e2e/test.cy.js index 4a1a0f6..2c3594b 100644 --- a/cypress/e2e/test.cy.js +++ b/cypress/e2e/test.cy.js @@ -1,10 +1,40 @@ +Cypress.Commands.add('DeleteAndCreateAdm', () => { + cy.exec('python test_initiate.py', { failOnNonZeroExit: false }) +}); + +Cypress.Commands.add('CreateClient', ()=> { + cy.get('#client > a').click() + cy.get('a').click() + cy.get('#toggleAddress').click() + cy.get('#name').type('Gabriel Albuquerque') + cy.get('#phone').type('81900028922') + cy.get('#email').type('gael@gmail.com') + cy.get('#password').type('GatoLindo') + cy.get('#cep').type('31980-230') + cy.get('#number').type('356') + cy.get('button').click() + cy.get('#email').type('gael@gmail.com') + cy.get('#password').type('GatoLindo') + cy.get('button').click() +}) + +Cypress.Commands.add('ClientLogout', () => { + cy.visit('/'); + cy.get('#employee > a').click() + cy.get('#logout').click() +}) + +Cypress.Commands.add('CreateEmployee', () => { + +}) describe('home page', () => { it('passes', () => { - + cy.exec('python manage.py migrate') + cy.DeleteAndCreateAdm() cy.visit('/'); - + //menuHamburger not defined!? cy.on("uncaught:exception", (e, runnable) => { console.log("error", e); @@ -13,12 +43,24 @@ describe('home page', () => { return false; }); - - cy.get('#employee > a').click() - - // cy.get('#email').type('admin') - // cy.get('#password').type('admin') - // cy.get('button').click() + // cy.get('#employee > a').click() + // cy.get('#email').type('eceel-Tec@eceeltec.com') + // cy.get('#password').type('obGWjpaTayKJWpBiFSMm') + // cy.get('button').click() - }) + // cy.get('#password').type('obGWjpaTayKJWpBiFSMm') + // cy.get('#new_password').type('obGWjpaTayKJWpBiFSMm') + // cy.get('.form-card > form > button').click() + // cy.get('.employees > a').click() + // cy.get('.new-employee-button').click() + // cy.get('#username').type('Gabriel Albuquerque') + // cy.get('#phone').type('81900028922') + // cy.get('#email').type('gael@gmail.com') + // cy.get('#password').type('GatoLindo') + // cy.get('#cep').type('31980-230') + // cy.get('#identity_number').type('861.776.720-00') + // cy.get('#position').type('funcionario') + // cy.get('#dob').click() + // cy.get('#dob').type('11') + }) }) diff --git a/test_initiate.py b/test_initiate.py new file mode 100644 index 0000000..b07bc15 --- /dev/null +++ b/test_initiate.py @@ -0,0 +1,26 @@ +import os +import django + +# Configurar o Django +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'eceeltec.settings') +django.setup() + +from app_company.models import Users + +Users.objects.all().delete() +print("Todos os usuários foram deletados.") + +def create_admin(username, email, password): + if not Users.objects.filter(username=username).exists(): + user = Users.objects.create_user(username=username, email=email, password=password, role='A') + user.save() + + + +username = "eceel-Tec@eceeltec.com" +email = "eceel-Tec@eceeltec.com" +password = "obGWjpaTayKJWpBiFSMm" + + +create_admin(username, email, password) + From f53b9294d48eab05dadceffad2350a18dab08fde Mon Sep 17 00:00:00 2001 From: sophia Date: Mon, 3 Jun 2024 22:13:38 -0300 Subject: [PATCH 2/7] fixing modal styles --- app_client/static/css/app_client/styles.css | 8 - .../static/css/app_client/view_order.css | 185 +++++++++++++----- app_client/templates/RequestOrder/orders.html | 23 ++- .../templates/RequestOrder/vieworder.html | 93 ++++++--- app_company/views.py | 5 +- 5 files changed, 219 insertions(+), 95 deletions(-) diff --git a/app_client/static/css/app_client/styles.css b/app_client/static/css/app_client/styles.css index d1c325b..1b4441a 100644 --- a/app_client/static/css/app_client/styles.css +++ b/app_client/static/css/app_client/styles.css @@ -113,14 +113,6 @@ thead th { padding: 12px 24px; } -thead th:nth-child(3) { - color: var(--blue-500); -} - -thead th:nth-child(3) { - color: var(--red-600); -} - table tbody tr:last-child { border-bottom: none; } diff --git a/app_client/static/css/app_client/view_order.css b/app_client/static/css/app_client/view_order.css index 309889b..401dd25 100644 --- a/app_client/static/css/app_client/view_order.css +++ b/app_client/static/css/app_client/view_order.css @@ -1,5 +1,28 @@ +:root { + --red-100: #fee2e2; + --red-600: #DC2626; + --red-700: #b91c1c; + --red-900: #7f1d1d; + --green-100: #dcfce7; + --green-500: #22c55e; + --green-600: #16a34a; + --green-900: #14532d; + --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; +} + .modal { - display: block; position: fixed; z-index: 999; left: 0; @@ -8,112 +31,172 @@ height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4); - text-align: center; + display: flex; + align-items: center; justify-content: center; } .modal-content { - background-color: #fefefe; + background-color: var(--white); display: flex; flex-direction: column; margin: 10% auto 15% auto; - padding: 25px 20px; + padding: 24px 20px; border: 1px solid #888; - width: 80%; + 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); - text-align: center; justify-content: center; } .close { - color: #aaa; - float: right; - font-size: 28px; - font-weight: bold; + color: var(--gray-500); position: absolute; - top: 0; - right: 0; + top: 8px; + right: 8px; } .close:hover, .close:focus { - color: black; + color: var(--gray-800); text-decoration: none; cursor: pointer; } -.modal h1 { - margin-right: 20px; -} -#head { +.modal .modal-content .product { display: flex; - text-align: center; - justify-content: center; + justify-content: space-between; + gap: 16px; + width: 100%; + margin-top: 24px; } -.modal span { - padding: 5px; - border-radius: 8px; +.modal .modal-content .product .productInfo { + background-color: #fff; + padding: 16px 12px 8px; + border: 4px; + width: 100%; } -.modal h1 { +.modal .modal-content .product .productInfo .attention { + color: var(--red-700); +} + +.modal .modal-content .product p { + font-weight: 600; + color: var(--gray-700); + margin-bottom: 24px; + text-align: justify; +} + +.modal .modal-content .product p span { + font-weight: 500; color: var(--gray-500); } -.modal h1 span { - color: var(--gray-800); +.status { + padding: 8px 12px; + border-radius: 999999999px; font-weight: 700; } -#headiscription { - margin-top: 20px; +.price { + display: flex; + align-items: center; + gap: 16px; + + width: 100%; + height: fit-content; + padding: 8px; + background-color: #fff; +} + +.price div { display: flex; - text-align: center; + align-items: center; justify-content: center; - margin-bottom: 20px; + + width: 48px; + height: 48px; + border-radius: 50%; + + background-color: var(--green-100); + color: var(--green-600); +} + +.price span { + color: var(--green-900); + font-weight: 600; + font-size: 18px; } .waitingForm { - margin-top: 20px; + margin-top: 24px; +} + +.waitingForm > p { + font-weight: 600; + color: var(--gray-700); + margin-bottom: 16px; } -.waitingForm h1, h2, h3, p { - margin-top: 10px; + +.waitingForm label { + font-weight: 500; } -.waitingForm form { - margin-top: 10px; +.waitingForm .options { display: flex; - flex-direction: column; - justify-content: center; - text-align: center; align-items: center; + gap: 16px; } -.waitingForm form #yes, #no { - margin-right: 10px; +.waitingForm .radioOption { + padding: 8px; + background-color: white; + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; } -.waitingForm div { +.waitingForm .radioOption div { + width: 40px; + height: 40px; + border-radius: 50%; + display: flex; + align-items: center; justify-content: center; - margin-bottom: 10px; } -#no { - margin-left: 10px; +.waitingForm .yes div { + background-color: var(--green-100); + color: var(--green-600); } -#confirm { - width: min-content; - border: none; - padding: 5px; - border-radius: 6px; +.waitingForm .yes label { + color: var(--green-900); +} + +.waitingForm .no div { + background-color: var(--red-100); + color: var(--red-600); +} + +.waitingForm .no label { + color: var(--red-900); +} + +.waitingForm button { + float: right; + margin-top: 32px; + padding: 8px 12px; + background-color: var(--green-600); + border-radius: 4px; + color: var(--white); + font-weight: 600; } -#confirm:hover { - cursor: pointer; -} \ No newline at end of file diff --git a/app_client/templates/RequestOrder/orders.html b/app_client/templates/RequestOrder/orders.html index 76f4e82..c4f5abc 100644 --- a/app_client/templates/RequestOrder/orders.html +++ b/app_client/templates/RequestOrder/orders.html @@ -28,6 +28,8 @@

Suas solicitações

Status Identificação + Data de agendamento + @@ -39,11 +41,26 @@

Suas solicitações

{{order.get_status_display}}
{{order.productType}} | {{order.productModel}} - + {% if order.scheduled_date and order.status == 'AGENDADO' %} + {{ order.scheduled_date }} + {% else %} + - + {% endif %} + + + + + {% if order.status == 'CONSERTO_FINALIZADO' %} - + + + + + {% endif %} - + + + {% endfor %} diff --git a/app_client/templates/RequestOrder/vieworder.html b/app_client/templates/RequestOrder/vieworder.html index eb8ba33..ba21ad7 100644 --- a/app_client/templates/RequestOrder/vieworder.html +++ b/app_client/templates/RequestOrder/vieworder.html @@ -7,53 +7,82 @@