diff --git a/backend/app/controllers/acaos_controller.rb b/backend/app/controllers/acaos_controller.rb index 29dd309..e0007b2 100644 --- a/backend/app/controllers/acaos_controller.rb +++ b/backend/app/controllers/acaos_controller.rb @@ -1,14 +1,14 @@ class AcaosController < ApplicationController - before_action :set_acao, only: %i[ show edit update destroy ] + before_action :set_acao, only: %i[show edit update destroy] # GET /acaos or /acaos.json def index @acaos = Acao.all + render json: @acaos end # GET /acaos/1 or /acaos/1.json - def show - end + def show; end # GET /acaos/new def new @@ -16,8 +16,7 @@ def new end # GET /acaos/1/edit - def edit - end + def edit; end # POST /acaos or /acaos.json def create @@ -25,7 +24,7 @@ def create respond_to do |format| if @acao.save - format.html { redirect_to acao_url(@acao), notice: "Acao was successfully created." } + format.html { redirect_to acao_url(@acao), notice: 'Acao was successfully created.' } format.json { render :show, status: :created, location: @acao } else format.html { render :new, status: :unprocessable_entity } @@ -38,7 +37,7 @@ def create def update respond_to do |format| if @acao.update(acao_params) - format.html { redirect_to acao_url(@acao), notice: "Acao was successfully updated." } + format.html { redirect_to acao_url(@acao), notice: 'Acao was successfully updated.' } format.json { render :show, status: :ok, location: @acao } else format.html { render :edit, status: :unprocessable_entity } @@ -52,19 +51,20 @@ def destroy @acao.destroy! respond_to do |format| - format.html { redirect_to acaos_url, notice: "Acao was successfully destroyed." } + format.html { redirect_to acaos_url, notice: 'Acao was successfully destroyed.' } format.json { head :no_content } end end private - # Use callbacks to share common setup or constraints between actions. - def set_acao - @acao = Acao.find(params[:id]) - end - # Only allow a list of trusted parameters through. - def acao_params - params.fetch(:acao, {}) - end + # Use callbacks to share common setup or constraints between actions. + def set_acao + @acao = Acao.find(params[:id]) + end + + # Only allow a list of trusted parameters through. + def acao_params + params.require(:acao).permit(:titulo, :valor, :tipo, :mes, :ano) + end end diff --git a/backend/app/models/acao.rb b/backend/app/models/acao.rb index 16a7fa0..23ef734 100644 --- a/backend/app/models/acao.rb +++ b/backend/app/models/acao.rb @@ -1,3 +1,2 @@ class Acao < ApplicationRecord - belongs_to :user end diff --git a/backend/app/views/acaos/_acao.html.erb b/backend/app/views/acaos/_acao.html.erb new file mode 100644 index 0000000..d1ae5a1 --- /dev/null +++ b/backend/app/views/acaos/_acao.html.erb @@ -0,0 +1,27 @@ +
+

+ Titulo: + <%= acao.titulo %> +

+ +

+ Valor: + <%= acao.valor %> +

+ +

+ Tipo: + <%= acao.tipo %> +

+ +

+ Mes: + <%= acao.mes %> +

+ +

+ Ano: + <%= acao.ano %> +

+ +
diff --git a/backend/app/views/acaos/_acao.json.jbuilder b/backend/app/views/acaos/_acao.json.jbuilder new file mode 100644 index 0000000..d4999db --- /dev/null +++ b/backend/app/views/acaos/_acao.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! acao, :id, :titulo, :valor, :tipo, :mes, :ano, :created_at, :updated_at +json.url acao_url(acao, format: :json) diff --git a/backend/app/views/acaos/_form.html.erb b/backend/app/views/acaos/_form.html.erb new file mode 100644 index 0000000..ce560c2 --- /dev/null +++ b/backend/app/views/acaos/_form.html.erb @@ -0,0 +1,42 @@ +<%= form_with(model: acao) do |form| %> + <% if acao.errors.any? %> +
+

<%= pluralize(acao.errors.count, "error") %> prohibited this acao from being saved:

+ + +
+ <% end %> + +
+ <%= form.label :titulo, style: "display: block" %> + <%= form.text_field :titulo %> +
+ +
+ <%= form.label :valor, style: "display: block" %> + <%= form.text_field :valor %> +
+ +
+ <%= form.label :tipo, style: "display: block" %> + <%= form.check_box :tipo %> +
+ +
+ <%= form.label :mes, style: "display: block" %> + <%= form.text_field :mes %> +
+ +
+ <%= form.label :ano, style: "display: block" %> + <%= form.text_field :ano %> +
+ +
+ <%= form.submit %> +
+<% end %> diff --git a/backend/app/views/acaos/edit.html.erb b/backend/app/views/acaos/edit.html.erb new file mode 100644 index 0000000..adb4548 --- /dev/null +++ b/backend/app/views/acaos/edit.html.erb @@ -0,0 +1,10 @@ +

Editing acao

+ +<%= render "form", acao: @acao %> + +
+ +
+ <%= link_to "Show this acao", @acao %> | + <%= link_to "Back to acaos", acaos_path %> +
diff --git a/backend/app/views/acaos/index.html.erb b/backend/app/views/acaos/index.html.erb new file mode 100644 index 0000000..14250ad --- /dev/null +++ b/backend/app/views/acaos/index.html.erb @@ -0,0 +1,14 @@ +

<%= notice %>

+ +

Acaos

+ +
+ <% @acaos.each do |acao| %> + <%= render acao %> +

+ <%= link_to "Show this acao", acao %> +

+ <% end %> +
+ +<%= link_to "New acao", new_acao_path %> diff --git a/backend/app/views/acaos/index.json.jbuilder b/backend/app/views/acaos/index.json.jbuilder new file mode 100644 index 0000000..01e73d7d --- /dev/null +++ b/backend/app/views/acaos/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @acaos, partial: "acaos/acao", as: :acao diff --git a/backend/app/views/acaos/new.html.erb b/backend/app/views/acaos/new.html.erb new file mode 100644 index 0000000..a40374c --- /dev/null +++ b/backend/app/views/acaos/new.html.erb @@ -0,0 +1,9 @@ +

New acao

+ +<%= render "form", acao: @acao %> + +
+ +
+ <%= link_to "Back to acaos", acaos_path %> +
diff --git a/backend/app/views/acaos/show.html.erb b/backend/app/views/acaos/show.html.erb new file mode 100644 index 0000000..c336ce3 --- /dev/null +++ b/backend/app/views/acaos/show.html.erb @@ -0,0 +1,10 @@ +

<%= notice %>

+ +<%= render @acao %> + +
+ <%= link_to "Edit this acao", edit_acao_path(@acao) %> | + <%= link_to "Back to acaos", acaos_path %> + + <%= button_to "Destroy this acao", @acao, method: :delete %> +
diff --git a/backend/app/views/acaos/show.json.jbuilder b/backend/app/views/acaos/show.json.jbuilder new file mode 100644 index 0000000..c2a37b5 --- /dev/null +++ b/backend/app/views/acaos/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "acaos/acao", acao: @acao diff --git a/backend/config/routes.rb b/backend/config/routes.rb index b8caa1b..319253c 100644 --- a/backend/config/routes.rb +++ b/backend/config/routes.rb @@ -1,5 +1,6 @@ Rails.application.routes.draw do resources :acessos + resources :acaos resources :storages resources :eventos resources :reuniaos @@ -12,6 +13,7 @@ post '/documentos/delete', to: 'documentos#destroy' post '/storages/delete', to: 'storages#destroy' post '/storages/edit', to: 'storages#update' + post '/acaos/delete', to: 'acaos#destroy' resources :tarefas resources :acaos diff --git a/backend/db/migrate/20240524205418_create_acaos.rb b/backend/db/migrate/20240615164148_create_acaos.rb similarity index 63% rename from backend/db/migrate/20240524205418_create_acaos.rb rename to backend/db/migrate/20240615164148_create_acaos.rb index a4137f8..1375980 100644 --- a/backend/db/migrate/20240524205418_create_acaos.rb +++ b/backend/db/migrate/20240615164148_create_acaos.rb @@ -3,9 +3,9 @@ def change create_table :acaos do |t| t.string :titulo t.float :valor - t.boolean :type - t.string :data - t.references :user, null: false, foreign_key: true + t.boolean :tipo + t.string :mes + t.string :ano t.timestamps end diff --git a/backend/db/schema.rb b/backend/db/schema.rb index dfe0a6f..e334e7b 100644 --- a/backend/db/schema.rb +++ b/backend/db/schema.rb @@ -10,19 +10,22 @@ # # It's strongly recommended that you check this file into your version control system. +<<<<<<< HEAD ActiveRecord::Schema[7.1].define(version: 2024_06_15_232147) do +======= +ActiveRecord::Schema[7.1].define(version: 2024_06_15_164148) do +>>>>>>> e5212feec200c9d7dd7c62da240634e12332a30b # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" create_table "acaos", force: :cascade do |t| t.string "titulo" t.float "valor" - t.boolean "type" - t.string "data" - t.bigint "user_id", null: false + t.boolean "tipo" + t.string "mes" + t.string "ano" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["user_id"], name: "index_acaos_on_user_id" end create_table "acessos", force: :cascade do |t| diff --git a/backend/test/controllers/acaos_controller_test.rb b/backend/test/controllers/acaos_controller_test.rb index 932bd04..d62a139 100644 --- a/backend/test/controllers/acaos_controller_test.rb +++ b/backend/test/controllers/acaos_controller_test.rb @@ -17,7 +17,7 @@ class AcaosControllerTest < ActionDispatch::IntegrationTest test "should create acao" do assert_difference("Acao.count") do - post acaos_url, params: { acao: { } } + post acaos_url, params: { acao: { ano: @acao.ano, mes: @acao.mes, tipo: @acao.tipo, titulo: @acao.titulo, valor: @acao.valor } } end assert_redirected_to acao_url(Acao.last) @@ -34,7 +34,7 @@ class AcaosControllerTest < ActionDispatch::IntegrationTest end test "should update acao" do - patch acao_url(@acao), params: { acao: { } } + patch acao_url(@acao), params: { acao: { ano: @acao.ano, mes: @acao.mes, tipo: @acao.tipo, titulo: @acao.titulo, valor: @acao.valor } } assert_redirected_to acao_url(@acao) end diff --git a/backend/test/fixtures/acaos.yml b/backend/test/fixtures/acaos.yml index cb93145..3571fbe 100644 --- a/backend/test/fixtures/acaos.yml +++ b/backend/test/fixtures/acaos.yml @@ -3,13 +3,13 @@ one: titulo: MyString valor: 1.5 - type: false - data: MyString - user: one + tipo: false + mes: MyString + ano: MyString two: titulo: MyString valor: 1.5 - type: false - data: MyString - user: two + tipo: false + mes: MyString + ano: MyString diff --git a/backend/test/system/acaos_test.rb b/backend/test/system/acaos_test.rb index 320bb3b..f0df5ab 100644 --- a/backend/test/system/acaos_test.rb +++ b/backend/test/system/acaos_test.rb @@ -14,6 +14,11 @@ class AcaosTest < ApplicationSystemTestCase visit acaos_url click_on "New acao" + fill_in "Ano", with: @acao.ano + fill_in "Mes", with: @acao.mes + check "Tipo" if @acao.tipo + fill_in "Titulo", with: @acao.titulo + fill_in "Valor", with: @acao.valor click_on "Create Acao" assert_text "Acao was successfully created" @@ -24,6 +29,11 @@ class AcaosTest < ApplicationSystemTestCase visit acao_url(@acao) click_on "Edit this acao", match: :first + fill_in "Ano", with: @acao.ano + fill_in "Mes", with: @acao.mes + check "Tipo" if @acao.tipo + fill_in "Titulo", with: @acao.titulo + fill_in "Valor", with: @acao.valor click_on "Update Acao" assert_text "Acao was successfully updated" diff --git a/view/public/EDRA_logo_1 1 (2).svg b/view/public/edraB.svg similarity index 100% rename from view/public/EDRA_logo_1 1 (2).svg rename to view/public/edraB.svg diff --git a/view/src/components/Header/Header.css b/view/src/components/Header/Header.css index f8ca14f..dcb209f 100644 --- a/view/src/components/Header/Header.css +++ b/view/src/components/Header/Header.css @@ -18,7 +18,7 @@ header { .navHeader { display: flex; align-items: center; - + } .linksHeader { diff --git a/view/src/components/Kanban/Kanban.css b/view/src/components/Kanban/Kanban.css index ac0762b..7b0a4b3 100644 --- a/view/src/components/Kanban/Kanban.css +++ b/view/src/components/Kanban/Kanban.css @@ -1,14 +1,14 @@ .kanban { text-align: center; margin-left: 120px; - + } .bntTarefa { border: none; background-color: #414191; color: white; - font-size: 16px; + font-size: 15px; padding: 9px 22px; border-radius: 6px; cursor: pointer; @@ -42,6 +42,7 @@ text-align: center; border-radius: 5px; margin-bottom: 10px; + font-size: 13px; } .tarefaItem { @@ -59,6 +60,7 @@ .tarefaItem p { margin: 5px 0; color: black; + font-size: 13px; } .close { @@ -91,7 +93,9 @@ } .separador { - height: 1px; - background-color: black; /* Ou qualquer cor desejada */ - margin: 10px 0; /* Adapte conforme necessário */ - } \ No newline at end of file + height: 1px; + background-color: black; + /* Ou qualquer cor desejada */ + margin: 10px 0; + /* Adapte conforme necessário */ +} \ No newline at end of file diff --git a/view/src/components/Kanban/index.jsx b/view/src/components/Kanban/index.jsx index d3c2699..e8140ff 100644 --- a/view/src/components/Kanban/index.jsx +++ b/view/src/components/Kanban/index.jsx @@ -61,7 +61,7 @@ function Kanban() { setQuem(''); } }; - + const handleRemoveTarefa = (column, index) => { const updatedTarefas = [...tarefas[column]]; @@ -113,8 +113,8 @@ function Kanban() { setCurrentColumn(column); // Define a coluna atual para uso na edição setShowPopup(true); // Mostrar o popup de edição }; - - + + return (
diff --git a/view/src/components/SideBar/SideBar.css b/view/src/components/SideBar/SideBar.css index d9cb310..7e040f7 100644 --- a/view/src/components/SideBar/SideBar.css +++ b/view/src/components/SideBar/SideBar.css @@ -70,4 +70,4 @@ body { height: 35px; margin-bottom: 15px; } -} +} \ No newline at end of file diff --git a/view/src/components/SideBar/index.jsx b/view/src/components/SideBar/index.jsx index f7a9398..b2215f5 100644 --- a/view/src/components/SideBar/index.jsx +++ b/view/src/components/SideBar/index.jsx @@ -7,29 +7,29 @@ function SideBar() {
diff --git a/view/src/components/TablePS/TablePS.css b/view/src/components/TablePS/TablePS.css index 7243adb..66d6328 100644 --- a/view/src/components/TablePS/TablePS.css +++ b/view/src/components/TablePS/TablePS.css @@ -6,13 +6,14 @@ margin-top: 20px; } -.tabelaPS th{ +.tabelaPS th { border: 1px solid black; padding: 8px; text-align: left; width: 20%; } + .tabelaPS td { border: 1px solid black; padding: 8px; diff --git a/view/src/components/TableProx/TableProx.css b/view/src/components/TableProx/TableProx.css index 8d6e876..32a5fac 100644 --- a/view/src/components/TableProx/TableProx.css +++ b/view/src/components/TableProx/TableProx.css @@ -6,25 +6,26 @@ margin-top: 20px; } -.tabelaProx th{ +.tabelaProx th { border: 1px solid black; padding: 8px; text-align: left; } + .tabelaProx td { border: 1px solid black; padding: 8px; text-align: left; } -.tamanhoEvento{ +.tamanhoEvento { width: 45%; } -.tamanhoLocal{ +.tamanhoLocal { width: 25%; } -.tamanhoData{ - width: 30%; -} +.tamanhoData { + width: 30%; +} \ No newline at end of file diff --git a/view/src/pages/Admin/Admin.css b/view/src/pages/Admin/Admin.css index 333c241..c1567d3 100644 --- a/view/src/pages/Admin/Admin.css +++ b/view/src/pages/Admin/Admin.css @@ -3,7 +3,7 @@ top: 50%; left: 50%; transform: translate(-50%, -50%); - background-color: #d2d3e4fa; + background-color: #d2d3e4fa; padding: 20px; width: 550px; border-radius: 8%; @@ -29,7 +29,7 @@ body { left: 9rem; width: 80%; font-family: 'Poppins', monospace; - padding: 20px; + padding: 20px; } .img-text-container { @@ -38,7 +38,7 @@ body { } .fonte { - font-size: 40px; + font-size: 40px; display: flex; margin-left: 20px; margin-top: -2px; @@ -70,17 +70,17 @@ body { } .caixa label { - width: 100px; - margin-right: 10px; + width: 100px; + margin-right: 10px; font-size: 20px; } .caixa input { - flex: 1; + flex: 1; font-size: 20px; background-color: #d2d3e4fa; - border: none; - outline: none; + border: none; + outline: none; } .botao { @@ -156,4 +156,4 @@ body { .memberListContainer button:hover { text-decoration: underline; -} +} \ No newline at end of file diff --git a/view/src/pages/Admin/index.jsx b/view/src/pages/Admin/index.jsx index 20c387d..d7f764e 100644 --- a/view/src/pages/Admin/index.jsx +++ b/view/src/pages/Admin/index.jsx @@ -24,7 +24,7 @@ function Admin() { }; useEffect(() => { - get(); + get(); }, []); const handleRemoveMember = (memberId) => { @@ -52,7 +52,7 @@ function Admin() { {members.map((member) => (
  • setSelectedMember(member)}> - {member.nome} - {member.matricula} + {member.nome} - {member.matricula}
  • ))} - - - -
    + + + + {selectedMember && (
    @@ -120,43 +120,43 @@ function Admin() { type="checkbox" id="telaCalendario" name="checkboxEdiçãoTela" - value="calendario" - /> + value="calendario" + />
    @@ -170,45 +170,45 @@ function Admin() { name="checkboxEdiçãoTela" value="calendario" checked - /> + />
    diff --git a/view/src/pages/Calendar/Calendar.css b/view/src/pages/Calendar/Calendar.css index a4269fc..8be9340 100644 --- a/view/src/pages/Calendar/Calendar.css +++ b/view/src/pages/Calendar/Calendar.css @@ -6,7 +6,6 @@ body { } #paginaCalendar { - background-color: #fdfdfd; display: flex; flex-direction: column; align-items: center; @@ -17,11 +16,13 @@ body { .calendarTitulo { margin-top: 3rem; text-align: center; - font-size: 200%; + font-size: 180%; + margin-bottom: 30px; + margin-left: 80px; } -.calendarSubTitulo{ - margin-top: 3rem; +.calendarSubTitulo { + margin-top: 2rem; text-align: center; font-size: 130%; margin-left: 120px; @@ -30,10 +31,9 @@ body { .calendarCorpo { width: 80%; - background-color: #d2d3e4fa; + background-color: #2683b5a1; padding: 20px; border-radius: 8px; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.336); margin-bottom: 2rem; color: #070606; margin-left: 120px; @@ -49,10 +49,15 @@ body { justify-content: space-between; } -.left, .right { +.left, +.right { width: 48%; } +.day.today.active.event { + background-color: #cbcbda; +} + .calendar { background-color: white; border-radius: 10px; @@ -66,6 +71,7 @@ body { align-items: center; font-size: 1.5rem; margin-bottom: 10px; + cursor: pointer; } .weekdays { @@ -94,17 +100,13 @@ body { cursor: pointer; } -.prev-date, .next-date { +.prev-date, +.next-date { color: #d3d3d3; } .today { - background-color: #ffd700; - border-radius: 50%; -} - -.event { - background-color: #ff6347; + background-color: #414191; border-radius: 50%; } @@ -131,7 +133,8 @@ body { margin-right: 10px; } -.goto-btn, .today-btn { +.goto-btn, +.today-btn { padding: 5px 10px; border: none; background-color: #4caf50; @@ -141,7 +144,7 @@ body { } .today-btn { - background-color: #2196f3; + background-color: #4caf50; } .today-date { @@ -152,11 +155,13 @@ body { } .event-day { - font-size: 1.5rem; + font-size: 20px; + font-weight: bold; } .event-date { - font-size: 1rem; + font-size: 20px; + font-weight: bold; } .events { @@ -167,7 +172,7 @@ body { display: flex; justify-content: space-between; align-items: center; - background-color: #e0e0e0; + background-color: white; padding: 10px; border-radius: 5px; margin-bottom: 10px; @@ -255,33 +260,41 @@ body { cursor: pointer; border-radius: 50%; padding: 5px; + margin-left: 20px; } -.delete-event{ +.delete-event { width: 20px; cursor: pointer; } + .container img { margin-left: 10px; height: 20px; } -.date{ +.date { text-align: center; - font-size: 1.2rem + font-size: 15px; } -.event-month-title{ +.event-month-title { text-align: center; margin-top: 20px; - font-size: 1.5rem + font-size: 20px; +} + +.no-event h3 { + font-weight: normal; + font-size: 15px; + margin-top: 10px; } .events-month .event { display: flex; justify-content: space-between; align-items: center; - background-color: #e0e0e0; + background-color: white; padding: 10px; border-radius: 5px; margin-bottom: 10px; @@ -302,5 +315,5 @@ body { .events-month .no-event { text-align: center; - font-size: 1.2rem; + font-size: 10px; } \ No newline at end of file diff --git a/view/src/pages/Calendar/index.jsx b/view/src/pages/Calendar/index.jsx index b48bd90..6b63210 100644 --- a/view/src/pages/Calendar/index.jsx +++ b/view/src/pages/Calendar/index.jsx @@ -12,7 +12,7 @@ const Calendar = () => { const listMonthEvents = () => { const monthEvents = eventsArr.filter(event => event.month === month + 1 && event.year === year); - + // Ordenar os eventos pela data e hora monthEvents.sort((a, b) => a.day - b.day); monthEvents.forEach(eventObj => { @@ -277,7 +277,6 @@ const Calendar = () => {

    Calendário

    -

    Bem-vindo ao calendário

    diff --git a/view/src/pages/Detail/Detail.css b/view/src/pages/Detail/Detail.css index 0d9d0fc..90a48a0 100644 --- a/view/src/pages/Detail/Detail.css +++ b/view/src/pages/Detail/Detail.css @@ -1,9 +1,9 @@ -.containerDetail{ +.containerDetail { display: flex; flex-direction: column; text-align: left; margin-left: 160px; - gap:190px; + gap: 190px; margin-top: 40px; font-size: 20px; } @@ -15,8 +15,10 @@ transform: translateY(-50%); width: 200px; height: auto; - z-index: -1; /* Define um z-index menor para ficar atrás dos outros elementos */ - opacity: 0.2; /* Opacidade para torná-la transparente */ + z-index: -1; + /* Define um z-index menor para ficar atrás dos outros elementos */ + opacity: 0.2; + /* Opacidade para torná-la transparente */ } @@ -39,7 +41,8 @@ box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); max-width: 300px; width: 100%; - position: relative; /* Para que o posicionamento absoluto do fecharPopup funcione corretamente */ + position: relative; + /* Para que o posicionamento absoluto do fecharPopup funcione corretamente */ } .fecharPopup { @@ -57,7 +60,7 @@ } .conteudo3 button { - background-color: #4CAF50; + background-color: #4CAF50; font-size: 1em; color: white; padding: 10px 20px; @@ -68,6 +71,5 @@ } .conteudo3 button:hover { - background-color: #45a049; -} - + background-color: #45a049; +} \ No newline at end of file diff --git a/view/src/pages/Detail/index.jsx b/view/src/pages/Detail/index.jsx index de2063c..f8e65db 100644 --- a/view/src/pages/Detail/index.jsx +++ b/view/src/pages/Detail/index.jsx @@ -3,24 +3,24 @@ import { useParams } from 'react-router-dom'; import './Detail.css'; import SideBar from '../../components/SideBar'; import { editPassword } from '../../queries/user'; -// import Cookies from 'universal-cookie'; +import Cookies from 'universal-cookie'; import axios from 'axios' function Detail() { - const { usuario, matricula, nome} = useParams(); + const { usuario, matricula, nome, email } = useParams(); const [mostrarPopup, setMostrarPopup] = useState(false); const [novaSenha, setNovaSenha] = useState(''); const [confirmarSenha, setConfirmarSenha] = useState(''); const [senhaMatch, setSenhaMatch] = useState(true); - //const cookies = new Cookies(); - - //const token = cookies.get('jwtToken'); - axios.post("http://localhost:3000/users/token",{ - // token: token - }).then(function (response){ - console.log(response.data); - }); - + const cookies = new Cookies(); + + const token = cookies.get('jwtToken'); + axios.post("http://localhost:3000/users/token", { + token: token + }).then(function (response) { + console.log(response.data); + }); + const handleAlterarSenha = () => { setMostrarPopup(true); @@ -33,7 +33,7 @@ function Detail() { setSenhaMatch(true); // Reinicia o estado para que a mensagem de erro desapareça quando o popup for fechado }; - const alterarSenha = async (userId,newData)=> { + const alterarSenha = async (userId, newData) => { try { await editPassword(userId, newData) alert("Senha alterada com sucesso!") @@ -54,9 +54,9 @@ function Detail() { setMostrarPopup(false); setSenhaMatch(true); // Reinicia o estado para que a mensagem de erro desapareça*/ const IdUsuario = 2 //IMPORTANTE !! É preciso definir o id do usuário logado e mandar pra requisição - await alterarSenha(IdUsuario,{ //Precisa arrumar pra mandar o ID de usuário para alterar o cadastro + await alterarSenha(IdUsuario, { //Precisa arrumar pra mandar o ID de usuário para alterar o cadastro "senha": novaSenha, - }) + }) } else { setSenhaMatch(false); // Exibe mensagem de erro } @@ -79,6 +79,7 @@ function Detail() {
    Matrícula: {matricula}
    + E-mail: {email}

    diff --git a/view/src/pages/Divulgation/Divulgation.css b/view/src/pages/Divulgation/Divulgation.css index ac4f9bb..f2c3a48 100644 --- a/view/src/pages/Divulgation/Divulgation.css +++ b/view/src/pages/Divulgation/Divulgation.css @@ -42,11 +42,13 @@ } .circular-imagem { - width: 100px; - height: 100px; - border-radius: 50%; - object-fit: cover; /* Garante que a imagem cubra completamente o elemento */ - overflow: hidden; /* Garante que a imagem não transborde dos limites */ + width: 100px; + height: 100px; + border-radius: 50%; + object-fit: cover; + /* Garante que a imagem cubra completamente o elemento */ + overflow: hidden; + /* Garante que a imagem não transborde dos limites */ margin-left: 60px; margin: 0 auto; } @@ -160,13 +162,11 @@ margin-top: 20px; } -.paragrafo { - -} +.paragrafo {} -.fotosIntegrantes{ +.fotosIntegrantes { margin-top: 10px; - text-align: center; + text-align: center; display: flex; gap: 60px; margin-bottom: 20px; @@ -174,7 +174,8 @@ } .legendaFotos { - margin-top: 20px; - font-size: 12px; /* Tamanho da fonte (ajuste conforme necessário) */ + margin-top: 20px; + font-size: 12px; + /* Tamanho da fonte (ajuste conforme necessário) */ text-align: center; -} +} \ No newline at end of file diff --git a/view/src/pages/Divulgation/index.jsx b/view/src/pages/Divulgation/index.jsx index 4c8ac67..0f1b2f4 100644 --- a/view/src/pages/Divulgation/index.jsx +++ b/view/src/pages/Divulgation/index.jsx @@ -87,121 +87,121 @@ function Divulgation() {

    Lucas Mateus

    - fotoIntegrante -

    Luis Eduardo

    + fotoIntegrante +

    Luis Eduardo

    fotoIntegrante

    Matheus Rodrigues

    - -
    - fotoIntegrante -

    Nathan Henrique

    -
    -
    - fotoIntegrante -

    Pedro Araujo

    -
    -
    -
    -
    - -

    - Nossos drones -

    - iconDrone -
    -
    - iconDroneX -
    -

    - DRONE X -

    -

    - Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. -

    -
    -
    -
    - iconDroneY -
    -

    - DRONE Y -

    -

    - Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. -

    -
    -
    -
    -
    -

    - Processo seletivo -

    - iconLupa -
    -

    - Porque entrar para a EDRA? -

    -

    - Ao ingressar na EDRA, você tem a oportunidade de entender como funcionam os relacionamentos empresariais. Além disso, você cria conexões profissionais que podem moldar seu futuro, estabelecendo uma rede de contatos valiosa. Participar de uma equipe multidisciplinar permite que você faça amizades com pessoas de diversos cursos, enriquecendo ainda mais sua experiência e proporcionando um ambiente de aprendizado colaborativo e dinâmico. Essa vivência prática complementa a formação acadêmica, preparando você para os desafios do mercado de trabalho e ampliando suas perspectivas profissionais. -

    -
    - - +
    + fotoIntegrante +

    Nathan Henrique

    +
    +
    + fotoIntegrante +

    Pedro Araujo

    +
    +
    +
    +
    + +

    + Nossos drones +

    + iconDrone +
    +
    + iconDroneX +
    +

    + DRONE X +

    +

    + Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. +

    +
    -

    - Cronograma do PS -

    - -

    - (*) Atualizado em: 26/06/2024; Caso tenha alterações, mais informações no instagram -

    -
    -
    - -

    - Eventos e competições -

    - iconAgenda +
    + iconDroneY +
    +

    + DRONE Y +

    +

    + Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. +

    -
    - campeonatoX -
    -

    - Campeonato X -

    -

    - Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. -

    -
    +
    +
    +
    +

    + Processo seletivo +

    + iconLupa +
    +

    + Porque entrar para a EDRA? +

    +

    + Ao ingressar na EDRA, você tem a oportunidade de entender como funcionam os relacionamentos empresariais. Além disso, você cria conexões profissionais que podem moldar seu futuro, estabelecendo uma rede de contatos valiosa. Participar de uma equipe multidisciplinar permite que você faça amizades com pessoas de diversos cursos, enriquecendo ainda mais sua experiência e proporcionando um ambiente de aprendizado colaborativo e dinâmico. Essa vivência prática complementa a formação acadêmica, preparando você para os desafios do mercado de trabalho e ampliando suas perspectivas profissionais. +

    +
    + + +
    + +

    + Cronograma do PS +

    + +

    + (*) Atualizado em: 26/06/2024; Caso tenha alterações, mais informações no instagram. +

    +
    +
    + +

    + Eventos e competições +

    + iconAgenda +
    +
    + campeonatoX +
    +

    + Campeonato X +

    +

    + Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. +

    +
    -
    - campeonatoY -
    -

    - CampeonatoY -

    -

    - Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. -

    -
    +
    + campeonatoY +
    +

    + CampeonatoY +

    +

    + Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. +

    +
    -

    - Próximos eventos e competições -

    - -

    - (*) Atualizado em: 26/06/2024. Mais informações no instagram -

    +

    + Próximos eventos e competições +

    + +

    + (*) Atualizado em: 26/06/2024. Mais informações no instagram. +

    -
    +
    ) } diff --git a/view/src/pages/Documents/index.jsx b/view/src/pages/Documents/index.jsx index a22a0fe..ceb3767 100644 --- a/view/src/pages/Documents/index.jsx +++ b/view/src/pages/Documents/index.jsx @@ -6,7 +6,7 @@ import axios from 'axios'; function deletarDoc(id) { console.log(id); - axios.post('http://localhost:3000/documentos/delete',{ + axios.post('http://localhost:3000/documentos/delete', { id: id }); } @@ -42,12 +42,12 @@ function Documents() { const [links, setLinks] = useState([]); const [documentos, setDocs] = useState([]); - useEffect(()=>{ - axios.get("http://localhost:3000/documentos").then(function (response){ - setDocs(response.data); - console.log(documentos); - }); - },[]); + useEffect(() => { + axios.get("http://localhost:3000/documentos").then(function (response) { + setDocs(response.data); + console.log(documentos); + }); + }, []); const handleImageClick = () => { setShowPopup(true); @@ -74,7 +74,7 @@ function Documents() { setLink(''); setDescricao(''); }; - + const handleRemoveLink = (index) => { const updatedLinks = [...links]; @@ -120,7 +120,7 @@ function Documents() { required /> - +
    diff --git a/view/src/pages/Finance/Finance.css b/view/src/pages/Finance/Finance.css index fb8d554..6c03ddb 100644 --- a/view/src/pages/Finance/Finance.css +++ b/view/src/pages/Finance/Finance.css @@ -1,12 +1,4 @@ -body { - font-family: 'Poppins', monospace; - margin: 0; - padding: 0; - box-sizing: border-box; -} - #paginaFinance { - background-color: #fdfdfd; display: flex; flex-direction: column; align-items: center; @@ -17,7 +9,9 @@ body { .financeTitulo { margin-top: 3rem; text-align: center; - font-size: 200%; + font-size: 180%; + margin-bottom: 30px; + margin-left: 80px; } .img-text-container2 { @@ -34,7 +28,8 @@ body { align-items: flex-start; font-size: 1rem; margin: 0 10px; - color: #070606; /* Altere a cor do texto dentro das caixas para preto */ + color: #070606; + /* Altere a cor do texto dentro das caixas para preto */ } .caixa label { @@ -60,7 +55,8 @@ body { margin-left: 120px; } -.financeCorpo h2, .financeCorpo h3 { +.financeCorpo h2, +.financeCorpo h3 { margin: 0 0 1rem 0; } @@ -124,7 +120,9 @@ body { align-self: flex-end; } -.caixa input[type="text"], .caixa input[type="number"], .caixa select { +.caixa input[type="text"], +.caixa input[type="number"], +.caixa select { width: calc(100% - 10px); background-color: #fdfdfd; padding: 10px; @@ -146,7 +144,8 @@ body { } .popup label { - color: black; /* Ensure labels inside popup are black */ + color: black; + /* Ensure labels inside popup are black */ } @@ -159,11 +158,11 @@ body { .financeCorpo li img { cursor: pointer; - height: 20px; - width: 20px; - margin-right: 25px; - margin-top: 15px; - margin-left: 150px; + height: 20px; + width: 20px; + margin-right: 25px; + margin-top: 15px; + margin-left: 150px; } @@ -173,4 +172,4 @@ body { .saida { color: red; -} +} \ No newline at end of file diff --git a/view/src/pages/Finance/index.jsx b/view/src/pages/Finance/index.jsx index 2ec88b1..6ce953a 100644 --- a/view/src/pages/Finance/index.jsx +++ b/view/src/pages/Finance/index.jsx @@ -1,6 +1,30 @@ import React, { useState, useEffect } from "react"; import './Finance.css'; import SideBar from "../../components/SideBar"; +import axios from 'axios'; + +function criarItem(titulo, valor, tipo, mes, ano) { + let bool; + if (tipo === 'Entrada') { + bool = true; + } else { + bool = false; + } + axios.post("http://localhost:3000/acaos", { + titulo: titulo, + valor: valor, + tipo: bool, + mes: mes, + ano: ano, + user_id: 1 + }); +} + +function deletaItem(id) { + axios.post("http://localhost:3000/acaos/delete", { + id: id + }); +} function Finance() { const [showPopup, setShowPopup] = useState(false); @@ -11,10 +35,14 @@ function Finance() { const [tipo, setTipo] = useState('Entrada'); const [acoes, setAcoes] = useState([]); const [saldo, setSaldo] = useState(0); + const [item, setItem] = useState([]); useEffect(() => { - calcularSaldo(); - }, [acoes]); + axios.get("http://localhost:3000/acaos").then(function (response) { + setItem(response.data); + }); + saldoTotal(item); + }, []); const handleAnoChange = (e) => { setAno(e.target.value); @@ -71,12 +99,24 @@ function Finance() { setSaldo(total); }; + const saldoTotal = (item) => { + let total = 0; + item.forEach(acao => { + if (acao.tipo) { + total += acao.valor; + } else { + total -= acao.valor; + } + }); + setSaldo(total); + }; + const handleDelete = (index) => { const novaListaAcoes = [...acoes]; const acaoRemovida = novaListaAcoes.splice(index, 1)[0]; - + setAcoes(novaListaAcoes); - + // Atualizar o saldo após a remoção do registro let novoSaldo = saldo; if (acaoRemovida.tipo === 'Entrada') { @@ -96,15 +136,15 @@ function Finance() {
    - +
    - +
    - +
    @@ -157,5 +197,4 @@ function Finance() { ); } -export default Finance; - +export default Finance; \ No newline at end of file diff --git a/view/src/pages/Login/index.jsx b/view/src/pages/Login/index.jsx index ca5cb6a..c873319 100644 --- a/view/src/pages/Login/index.jsx +++ b/view/src/pages/Login/index.jsx @@ -28,19 +28,19 @@ function Login() { console.log("Senha:", senha); axios.post("http://localhost:3000/users/login", { - matricula: matricula, - senha: senha - }).then(function (response) { - console.log(response.data); - /* cookies.set('jwtToken', response.data, { - path: '/', - secure: true, - sameSite: 'None' - }); */ - - }).catch(function (error) { - console.log(error); + matricula: matricula, + senha: senha + }).then(function (response) { + console.log(response.data); + cookies.set('jwtToken', response.data, { + path: '/', + secure: true, + sameSite: 'None' }); + + }).catch(function (error) { + console.log(error); + }); //window.location.href = '/detail'; diff --git a/view/src/pages/Meeting/Meeting.css b/view/src/pages/Meeting/Meeting.css index 7e9f32e..4557e69 100644 --- a/view/src/pages/Meeting/Meeting.css +++ b/view/src/pages/Meeting/Meeting.css @@ -10,18 +10,36 @@ body { font-size: 200%; } -.documentosTitulo .botao{ +.documentosTitulo .botao { margin-top: 10px; margin-left: 200px; } -.documentosCorpo { +.reunioesCorpo { text-align: left; margin-left: 180px; left: 9rem; width: 80%; font-family: 'Poppins', monospace; - padding: 20px; + padding: 20px; +} + +.presence-table th, td{ + font-size: 12px; +} + +.meeting h2{ +font-size: 20px; +} + +.bntMeeting{ + width: 25px; + height: auto; + margin-right: 10px; +} + +.fonteMeeting{ +font-size: 15px; } .img-text-container { @@ -31,7 +49,7 @@ body { } .fonte { - font-size: 40px; + font-size: 40px; margin-left: 20px; margin-top: -2px; } @@ -54,7 +72,7 @@ body { top: 50%; left: 50%; transform: translate(-50%, -50%); - background-color: #d2d3e4fa; + background-color: #d2d3e4fa; padding: 20px; width: 550px; border-radius: 8%; @@ -84,15 +102,15 @@ body { } .caixa label { - width: 100%; - margin-bottom: 10px; + width: 100%; + margin-bottom: 10px; } .caixa input { font-size: 20px; background-color: #d2d3e4fa; - border: none; - outline: none; + border: none; + outline: none; padding: 10px; } @@ -106,7 +124,8 @@ body { margin-top: 20px; } -.presence-table th, .presence-table td { +.presence-table th, +.presence-table td { border: 1px solid #ddd; padding: 8px; text-align: left; @@ -131,4 +150,6 @@ body { padding: 20px; margin-bottom: 20px; border-radius: 8px; + margin-right: 60px; } + diff --git a/view/src/pages/Meeting/index.jsx b/view/src/pages/Meeting/index.jsx index 2cf9b09..5cbad7e 100644 --- a/view/src/pages/Meeting/index.jsx +++ b/view/src/pages/Meeting/index.jsx @@ -1,10 +1,10 @@ -import React, { useState,useEffect } from "react"; +import React, { useState, useEffect } from "react"; import './Meeting.css'; import SideBar from "../../components/SideBar"; import axios from "axios"; -function criarReuniao(titulo){ - axios.post("http://localhost:3000/reuniaos",{ +function criarReuniao(titulo) { + axios.post("http://localhost:3000/reuniaos", { nome: titulo }); } @@ -22,12 +22,12 @@ function Meeting() { const [reunioes, setMeet] = useState([]); - useEffect(()=>{ - axios.get("http://localhost:3000/reuniaos").then(function (response){ - setMeet(response.data); - }); -},[]); - + useEffect(() => { + axios.get("http://localhost:3000/reuniaos").then(function (response) { + setMeet(response.data); + }); + }, []); + const handleAddMeetingClick = () => { setShowPopup2(true); }; @@ -121,127 +121,127 @@ function Meeting() { <>
    -
    -

    Reuniões

    - - - {showPopup2 && ( -
    -
    - - × - -
    -1 ? handleUpdateMeetingTitle : handleAddMeeting}> - - -
    -
    -
    - )} -
    -
    - {meetings.map((meeting, meetingIndex) => ( -
    -

    handleDoubleClick(meetingIndex)}>{meeting.nome}

    -
    - img-plus handleImageClick(meetingIndex)} /> -

    Adicionar Arquivo

    +
    +

    Reuniões

    + + + {showPopup2 && ( +
    +
    + + × + +
    -1 ? handleUpdateMeetingTitle : handleAddMeeting}> + + +
    +
    -
    - {meeting.files.map((item, fileIndex) => ( -
    -
    - img-trash handleRemoveFile(meetingIndex, fileIndex)} /> -

    - {item.fileName} (Adicionado em: {item.dateAdded}) + )} +

    +
    + {meetings.map((meeting, meetingIndex) => ( +
    +

    handleDoubleClick(meetingIndex)}>{meeting.nome}

    +
    + img-plus handleImageClick(meetingIndex)} /> +

    Adicionar Arquivo

    +
    +
    + {meeting.files.map((item, fileIndex) => ( +
    +
    + img-trash handleRemoveFile(meetingIndex, fileIndex)} /> +

    + {item.fileName} (Adicionado em: {item.dateAdded}) +

    +
    +
    + ))} +
    +
    + {links[meetingIndex] && links[meetingIndex].map((link, index) => ( +
    +

    + img-trash handleRemoveLink(meetingIndex, index)} + /> + {link.descricao}

    -
    - ))} + ))} +
    + + + + + + + + + + {meeting.members.map((member, memberIndex) => ( + + + + + + ))} + +
    NomeMatrículaPresença
    {member.nome}{member.matricula} + handlePresenceChange(meetingIndex, memberIndex)} + /> +
    -
    - {links[meetingIndex] && links[meetingIndex].map((link, index) => ( -
    -

    - img-trash handleRemoveLink(meetingIndex, index)} + ))} + {showPopup && ( +

    +
    + + × + +
    +
    - ))} -
    - - - - - - - - - - {meeting.members.map((member, memberIndex) => ( - - - - - - ))} - -
    NomeMatrículaPresença
    {member.nome}{member.matricula} - handlePresenceChange(meetingIndex, memberIndex)} - /> -
    -
    - ))} - {showPopup && ( -
    -
    - - × - - - - - - + + + + +
    -
    - )} -
    + )} +
    ); diff --git a/view/src/pages/PasswordRecovery/PasswordRecovery.css b/view/src/pages/PasswordRecovery/PasswordRecovery.css index 1306e6d..9198bbc 100644 --- a/view/src/pages/PasswordRecovery/PasswordRecovery.css +++ b/view/src/pages/PasswordRecovery/PasswordRecovery.css @@ -1,98 +1,97 @@ * { - margin: 0; - padding: 0; - box-sizing: border-box; - } - - body { - font-family: 'Poppins', monospace; - } - - .divC { - display: flex; - flex-direction: column; - background-color: #fafafa; - padding: 32px; - border-radius: 32px; - height: auto; - text-align: end; - width: 500px; - } - - form { - display: flex; - flex-direction: column; - gap: 20px; - } - - form input { - border: none; - outline: none; - padding: 13px; - border-bottom: 1px solid black; - background-color: #fdfdfd; - } - - form input::placeholder { - color: gray; - } - - form button { - padding: 16px; - border: none; - background-color: #2683b5; - font-weight: 400; - color: #fdfdfd; - font-size: 16px; - border-radius: 13px; - cursor: pointer; - } - - form button:hover { - text-decoration: underline; - } - - .p { - margin-top: 16px; - font-size: 13px; - color: black; - } - - .title { - font-size: 32px; - color: black; - font-weight: bold; - } - - .sub-title { - font-size: 13px; - padding: 0 0 24px 0; - color: black; - } - - a { - cursor: pointer; - text-decoration: none; - } - - a:hover { - text-decoration: underline; - } - - #paginaPasswordRecovery { - background-color: #007600; - height: 100vh; - display: flex; - justify-content: center; - align-items: center; - } - - .img-setaRecovery { - width: 40px; - display: flex; - margin-top: -40px; - align-items: start; - position: relative; - top: 50px; - } - \ No newline at end of file + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: 'Poppins', monospace; +} + +.divC { + display: flex; + flex-direction: column; + background-color: #fafafa; + padding: 32px; + border-radius: 32px; + height: auto; + text-align: end; + width: 500px; +} + +form { + display: flex; + flex-direction: column; + gap: 20px; +} + +form input { + border: none; + outline: none; + padding: 13px; + border-bottom: 1px solid black; + background-color: #fdfdfd; +} + +form input::placeholder { + color: gray; +} + +form button { + padding: 16px; + border: none; + background-color: #2683b5; + font-weight: 400; + color: #fdfdfd; + font-size: 16px; + border-radius: 13px; + cursor: pointer; +} + +form button:hover { + text-decoration: underline; +} + +.p { + margin-top: 16px; + font-size: 13px; + color: black; +} + +.title { + font-size: 32px; + color: black; + font-weight: bold; +} + +.sub-title { + font-size: 13px; + padding: 0 0 24px 0; + color: black; +} + +a { + cursor: pointer; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +#paginaPasswordRecovery { + background-color: #007600; + height: 100vh; + display: flex; + justify-content: center; + align-items: center; +} + +.img-setaRecovery { + width: 40px; + display: flex; + margin-top: -40px; + align-items: start; + position: relative; + top: 50px; +} \ No newline at end of file diff --git a/view/src/pages/PasswordRecovery/index.jsx b/view/src/pages/PasswordRecovery/index.jsx index 9a017f8..ec85b86 100644 --- a/view/src/pages/PasswordRecovery/index.jsx +++ b/view/src/pages/PasswordRecovery/index.jsx @@ -4,41 +4,41 @@ import { Link } from 'react-router-dom'; function PasswordRecovery() { -const [email, setEmail] = useState(''); + const [email, setEmail] = useState(''); -const handleEmailChange = (event) => { - setEmail(event.target.value); -} + const handleEmailChange = (event) => { + setEmail(event.target.value); + } -const handleSubmit = (event) =>{ - event.preventDefault(); - console.log("email:", email) + const handleSubmit = (event) => { + event.preventDefault(); + console.log("email:", email) - setEmail(''); + setEmail(''); - alert("email : "+email); -} + alert("email : " + email); + } return (
    - - seta + + seta Esqueceu a senha? Coloque seu e-mail
    -); + ); } export default PasswordRecovery; diff --git a/view/src/pages/Storage/index.jsx b/view/src/pages/Storage/index.jsx index d09e5e8..8352373 100644 --- a/view/src/pages/Storage/index.jsx +++ b/view/src/pages/Storage/index.jsx @@ -1,4 +1,4 @@ -import { useState,useEffect } from 'react'; +import { useState, useEffect } from 'react'; import SideBar from "../../components/SideBar"; import './Storage.css'; import axios from 'axios'; @@ -10,43 +10,43 @@ function editQuantidade(id, qtd) { // Captura a resposta HTML em um elemento temporário let tempElement = document.createElement('div'); tempElement.innerHTML = response.data; - + // Encontra o elemento que contém a quantidade let pQuantidade = tempElement.querySelector('#storage_' + id + ' p:nth-child(2)'); - + // Obtém o texto dentro do elemento

    que contém a quantidade let textoQuantidade = pQuantidade.textContent.trim(); - + // Extrai o número da quantidade let quantidade = parseInt(textoQuantidade.split(':')[1].trim()); - + console.log("Quantidade obtida:", quantidade); - + // Calcula a quantidade final que será enviada na requisição POST let quantity = qtd + quantidade; - if(quantity<0){ + if (quantity < 0) { quantity = 0; } - + // Realiza a requisição POST para editar a quantidade axios.post("http://localhost:3000/storages/edit", { id: id, quantidade: quantity }) - .then(function (response) { - console.log("Quantidade editada com sucesso:", response.data); - }) - .catch(function (error) { - console.error("Erro ao editar quantidade:", error); - }); + .then(function (response) { + console.log("Quantidade editada com sucesso:", response.data); + }) + .catch(function (error) { + console.error("Erro ao editar quantidade:", error); + }); }) .catch(function (error) { console.error("Erro ao obter dados do storage:", error); }); - } +} -function editaItem(id,nome,quantidade,status,user_id){ - axios.post("http://localhost:3000/storages/edit",{ +function editaItem(id, nome, quantidade, status, user_id) { + axios.post("http://localhost:3000/storages/edit", { id: id, nome: nome, quantidade: quantidade, @@ -55,22 +55,22 @@ function editaItem(id,nome,quantidade,status,user_id){ }); } -function deletaItem(id){ - axios.post("http://localhost:3000/storages/delete",{ +function deletaItem(id) { + axios.post("http://localhost:3000/storages/delete", { id: id }); } -function criarEstoque(nome,quantidade,status,user_id){//adicionar o token no userID - axios.post("http://localhost:3000/storages",{ +function criarEstoque(nome, quantidade, status, user_id) {//adicionar o token no userID + axios.post("http://localhost:3000/storages", { nome: nome, quantidade: quantidade, status: status, user_id: user_id - }).catch(function (error){ + }).catch(function (error) { console.log(error); - }).then(function (response){ - console.log("@@@@@@@@@@@@@@@@@@"+response.data); + }).then(function (response) { + console.log("@@@@@@@@@@@@@@@@@@" + response.data); }); } @@ -83,12 +83,13 @@ function Storage() { const [editIndex, setEditIndex] = useState(-1); // Estado para rastrear o índice do item em edição const [itemEstoque, setItem] = useState([]); - useEffect(()=>{ - axios.get("http://localhost:3000/storages").then(function (response){ - setItem(response.data); - }).catch(function (error){ - console.log(error); - });},[]); + useEffect(() => { + axios.get("http://localhost:3000/storages").then(function (response) { + setItem(response.data); + }).catch(function (error) { + console.log(error); + }); + }, []); const handleImageClick = () => { @@ -159,7 +160,7 @@ function Storage() { setLinks(updatedLinks); }; - const handleDoubleClick = (item,index) => { + const handleDoubleClick = (item, index) => { setNome(item.nome); setQuantidade(item.quantidade); setImagemSelecionada(item.status); @@ -232,12 +233,12 @@ function Storage() { type="submit" className='botao' onClick={() => { - if (editIndex > -1) { - editaItem(editIndex, nome, quantidade, imagemSelecionada, 1); - setShowPopup(false); // Chamando outra função junto com editaItem - } else { - criarEstoque(nome, quantidade, imagemSelecionada, 1); - } + if (editIndex > -1) { + editaItem(editIndex, nome, quantidade, imagemSelecionada, 1); + setShowPopup(false); // Chamando outra função junto com editaItem + } else { + criarEstoque(nome, quantidade, imagemSelecionada, 1); + } }}> {editIndex > -1 ? 'Salvar' : 'Adicionar'} @@ -251,15 +252,15 @@ function Storage() {

    - +

    {item.quantidade}

    - +

    handleDoubleClick(item,item.id)}//AXIOS EDIT + onDoubleClick={() => handleDoubleClick(item, item.id)}//AXIOS EDIT style={{ cursor: 'pointer' }} > {item.nome} diff --git a/view/src/queries/documents.js b/view/src/queries/documents.js index ec0cb54..84bf7b8 100644 --- a/view/src/queries/documents.js +++ b/view/src/queries/documents.js @@ -22,31 +22,31 @@ export const getSingleDocument = async (documentId) => { }; export const createDocument = async (data) => { - try { - const document = await server.post(endpoints.document.base, data); - return document; - } catch (error) { - console.log(error); - throw error; - } - }; + try { + const document = await server.post(endpoints.document.base, data); + return document; + } catch (error) { + console.log(error); + throw error; + } +}; - export const editDocument = async (documentId, data) => { - try { - const document = await server.put(endpoints.document.single(documentId), data); - return document; - } catch (error) { - console.log(error); - throw error; - } - }; +export const editDocument = async (documentId, data) => { + try { + const document = await server.put(endpoints.document.single(documentId), data); + return document; + } catch (error) { + console.log(error); + throw error; + } +}; - export const deleteDocument = async (documentId) => { - try { - const document = await server.delete(endpoints.document.single(documentId)); - return document; - } catch (error) { - console.log(error); - throw error; - } - }; \ No newline at end of file +export const deleteDocument = async (documentId) => { + try { + const document = await server.delete(endpoints.document.single(documentId)); + return document; + } catch (error) { + console.log(error); + throw error; + } +}; \ No newline at end of file diff --git a/view/src/queries/events.js b/view/src/queries/events.js index 033ebd3..24de575 100644 --- a/view/src/queries/events.js +++ b/view/src/queries/events.js @@ -22,31 +22,31 @@ export const getSingleEvent = async (eventId) => { }; export const createEvent = async (data) => { - try { - const event = await server.post(endpoints.event.base, data); - return event; - } catch (error) { - console.log(error); - throw error; - } - }; + try { + const event = await server.post(endpoints.event.base, data); + return event; + } catch (error) { + console.log(error); + throw error; + } +}; - export const editEvent = async (eventId, data) => { - try { - const event = await server.put(endpoints.event.single(eventId), data); - return event; - } catch (error) { - console.log(error); - throw error; - } - }; +export const editEvent = async (eventId, data) => { + try { + const event = await server.put(endpoints.event.single(eventId), data); + return event; + } catch (error) { + console.log(error); + throw error; + } +}; - export const deleteEvent = async (eventId) => { - try { - const event = await server.delete(endpoints.event.single(eventId)); - return event; - } catch (error) { - console.log(error); - throw error; - } - }; \ No newline at end of file +export const deleteEvent = async (eventId) => { + try { + const event = await server.delete(endpoints.event.single(eventId)); + return event; + } catch (error) { + console.log(error); + throw error; + } +}; \ No newline at end of file diff --git a/view/src/queries/storages.js b/view/src/queries/storages.js index ef3c381..972f47c 100644 --- a/view/src/queries/storages.js +++ b/view/src/queries/storages.js @@ -22,31 +22,31 @@ export const getSingleStorage = async (storageId) => { }; export const createStorage = async (data) => { - try { - const storage = await server.post(endpoints.storage.base, data); - return storage; - } catch (error) { - console.log(error); - throw error; - } - }; + try { + const storage = await server.post(endpoints.storage.base, data); + return storage; + } catch (error) { + console.log(error); + throw error; + } +}; - export const editStorage = async (storageId, data) => { - try { - const storage = await server.put(endpoints.storage.single(storageId), data); - return storage; - } catch (error) { - console.log(error); - throw error; - } - }; +export const editStorage = async (storageId, data) => { + try { + const storage = await server.put(endpoints.storage.single(storageId), data); + return storage; + } catch (error) { + console.log(error); + throw error; + } +}; - export const deleteStorage = async (storageId) => { - try { - const storage = await server.delete(endpoints.storage.single(storageId)); - return storage; - } catch (error) { - console.log(error); - throw error; - } - }; \ No newline at end of file +export const deleteStorage = async (storageId) => { + try { + const storage = await server.delete(endpoints.storage.single(storageId)); + return storage; + } catch (error) { + console.log(error); + throw error; + } +}; \ No newline at end of file diff --git a/view/src/queries/user.js b/view/src/queries/user.js index a97299a..c867f01 100644 --- a/view/src/queries/user.js +++ b/view/src/queries/user.js @@ -22,41 +22,41 @@ export const getSingleUser = async (userId) => { }; export const createUser = async (data) => { - try { - const user = await server.post(endpoints.user.base, data); - return user; - } catch (error) { - console.log(error); - throw error; - } - }; + try { + const user = await server.post(endpoints.user.base, data); + return user; + } catch (error) { + console.log(error); + throw error; + } +}; - export const editUser = async (userId, data) => { - try { - const user = await server.put(endpoints.user.single(userId), data); - return user; - } catch (error) { - console.log(error); - throw error; - } - }; +export const editUser = async (userId, data) => { + try { + const user = await server.put(endpoints.user.single(userId), data); + return user; + } catch (error) { + console.log(error); + throw error; + } +}; - export const editPassword = async (userId, newPassword) => { - try { - const user = await server.patch(endpoints.user.password(userId), newPassword); - return user; - } catch (error) { - console.log(error); - throw error; - } - }; +export const editPassword = async (userId, newPassword) => { + try { + const user = await server.patch(endpoints.user.password(userId), newPassword); + return user; + } catch (error) { + console.log(error); + throw error; + } +}; - export const deleteUser = async (userId) => { - try { - const user = await server.delete(endpoints.user.single(userId)); - return user; - } catch (error) { - console.log(error); - throw error; - } - }; +export const deleteUser = async (userId) => { + try { + const user = await server.delete(endpoints.user.single(userId)); + return user; + } catch (error) { + console.log(error); + throw error; + } +}; diff --git a/view/src/utils/parseFormData.js b/view/src/utils/parseFormData.js index 445d6b3..8d9f7a4 100644 --- a/view/src/utils/parseFormData.js +++ b/view/src/utils/parseFormData.js @@ -1,4 +1,4 @@ -export const parseFormData = (dados) =>{ +export const parseFormData = (dados) => { const object = {}; dados.forEach((value, key) => object[key] = value); return object