Merge branch 'features/layout' of DAAntipenko/finreport-analyzer into develop

This commit is contained in:
Дмитрий Антипенко
2026-03-26 09:03:49 +03:00
committed by Gogs
23 changed files with 288 additions and 46 deletions
+2
View File
@@ -21,3 +21,5 @@
@use "base"; @use "base";
@use "application_settings"; @use "application_settings";
@use "main"; @use "main";
@use "header";
@use "nav";
@@ -31,3 +31,12 @@ body {
width: 90vw; width: 90vw;
margin: 0 auto; margin: 0 auto;
} }
.welcome__container__laptop {
margin-top: 15%;
text-align: center;
font-size: 36px;
font-family: "Ubuntu sans";
font-weight: 600;
}
+13
View File
@@ -0,0 +1,13 @@
.main-header {
width: 100%;
font-size: 2.5rem;
font-weight: var(--bold);
text-align: center;
position: relative;
}
.exit {
position: absolute;
top: 0;
right: 5px;
}
+40 -17
View File
@@ -1,18 +1,3 @@
.main-header {
width: 100%;
text-align: center;
font-size: 2.5rem;
font-weight: var(--bold);
}
.nav-container {
width: 20%;
margin: 0 auto;
display: flex;
justify-content: space-around;
}
.add-new { .add-new {
text-align: center; text-align: center;
width: 100%; width: 100%;
@@ -24,13 +9,11 @@ a.link {
border-radius: 20px 20px; border-radius: 20px 20px;
padding: 10px; padding: 10px;
font-size: 1.5rem; font-size: 1.5rem;
} }
a.link:hover { a.link:hover {
background-color: black; background-color: black;
color: var(--white-color) color: var(--white-color)
} }
.header{ .header{
@@ -56,6 +39,11 @@ a.link:hover {
margin: 0 auto 10px; margin: 0 auto 10px;
} }
.informations-data h2 {
font-weight: 700;
font-size: 2.5em;
}
.information-data { .information-data {
border: 2px solid black; border: 2px solid black;
display: flex; display: flex;
@@ -75,3 +63,38 @@ a.link:hover {
padding: 10px; padding: 10px;
margin: 10px 0; margin: 10px 0;
} }
.information-button {
align-self: center;
margin-block: 8px;
}
.information-table table {
border-collapse: collapse;
text-align: center;
}
.information-table td, th {
padding: 5px;
border: 3px solid black;
}
.type_doc_header#tabs {
width: 75%;
margin: 0 auto;
}
.type__doc__list__type__container {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(2, 1fr);
place-items: center;
gap: 15px;
a.link {
font-size: 1.35rem;
}
}
a.link:has(.active__button) {
background-color: gray;
}
+6
View File
@@ -0,0 +1,6 @@
.nav-container {
width: 25%;
margin: 0 auto;
display: flex;
justify-content: space-around;
}
+7 -1
View File
@@ -2,11 +2,13 @@ module Authorization
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
before_action :set_paper_trail_whodunnit
before_action :load_current_user # load user from database before_action :load_current_user # load user from database
before_action :set_paper_trail_whodunnit
before_action :check_authentication # check if user authenticated before_action :check_authentication # check if user authenticated
before_action :check_current_user # check if user authorized before_action :check_current_user # check if user authorized
helper_method :logged_in?, :current_user
rescue_from ActionController::UnknownFormat do rescue_from ActionController::UnknownFormat do
request.format = :html request.format = :html
render_error render_error
@@ -16,6 +18,10 @@ module Authorization
session['zombie'] || cas_login session['zombie'] || cas_login
end end
def logged_in?
current_login.present?
end
private private
def cas_login def cas_login
@@ -0,0 +1,54 @@
class OrganisationsController < ApplicationController
def index
organizations = Organization.all
@info_about_organisations = organizations.each_with_object({}) do |org, hash|
hash[org.id] = {
"ИНН" => org.inn,
"Полное наименование юридического лица" => org.full_name,
# "КПП" => org.kpp,
# "Код по ОКПО" => org.okpo,
# "Форма собственности (по ОКФС)" => org.okfs,
# "Организационно-правовая форма (по ОКОПФ)" => org.okopf,
# "Вид экономической деятельности по ОКВЭД 2" => org.okved2,
# "Местонахождение (адрес)" => org.address
}
end
end
def show
org = Organization.find(params[:id])
@org_id = org.id
doc_types = {
0 => 'Бухгалтерский баланс',
1 => 'Отчёт о финансовых результатах',
2 => 'Отчёт об изменении капитала',
3 => 'Отчет о движении денежных средств'
}
@type_doc = params[:type_doc].present? ? params[:type_doc].to_i : 0
@info_about_organisation = {
"Сведения об организации" => {
"ИНН" => org.inn,
"Полное наименование юридического лица" => org.full_name,
"КПП" => org.kpp,
"Код по ОКПО" => org.okpo,
"Форма собственности (по ОКФС)" => org.okfs,
"Организационно-правовая форма (по ОКОПФ)" => org.okopf,
"Вид экономической деятельности по ОКВЭД 2" => org.okved2,
"Местонахождение (адрес)" => org.address
},
"Бухгалтерский баланс" => [["Наименование показателя", "На 31 декабря 2024 г.", "На 31 декабря 2023 г."], \
["Нематериальные активы", 10457, 9925], \
["Результаты исследований и разработок", 6969, 428571]],
"Отчёт о финансовых результатах" => [["Наименование показателя", "За 2024 г.", "За 2023 г."], \
["Выручка", 301837283, 238834307], \
["Себестоимость продаж", -228706983, -178449438]]
}
@doc_name = doc_types[@type_doc]
@current_doc_info = @info_about_organisation[@doc_name]
end
end
+7 -15
View File
@@ -1,19 +1,11 @@
class WelcomeController < ApplicationController class WelcomeController < ApplicationController
def home
def index if logged_in?
organizations = Organization.all if @current_user.present?
redirect_to '/organisations/index'
@info_about_organisations = organizations.each_with_object({}) do |org, hash| else
hash[org.id] = { render_error
"ИНН" => org.inn, end
"Полное наименование юридического лица" => org.full_name,
"КПП" => org.kpp,
"Код по ОКПО" => org.okpo,
"Форма собственности (по ОКФС)" => org.okfs,
"Организационно-правовая форма (по ОКОПФ)" => org.okopf,
"Вид экономической деятельности по ОКВЭД 2" => org.okved2,
"Местонахождение (адрес)" => org.address
}
end end
end end
end end
+2
View File
@@ -0,0 +1,2 @@
module OrganisationsHelper
end
+1
View File
@@ -4,4 +4,5 @@ import "controllers"
import "jquery" import "jquery"
import "jquery_ujs" import "jquery_ujs"
import "toastr" import "toastr"
import "tabs_select"
window.toastr = toastr window.toastr = toastr
+18
View File
@@ -0,0 +1,18 @@
let tabs_select = () => {
const tabsContainer = document.getElementById("tabs")
if (!tabsContainer) {
return;
}
const buttons = tabsContainer.getElementsByClassName("switch__button")
for (const button of buttons) {
const value = button.getAttribute("data-value");
const id = button.getAttribute("id");
button.classList.toggle("active__button", value === id);
}
}
document.addEventListener('turbo:load', tabs_select)
console.log('Hi')
+5
View File
@@ -1,2 +1,7 @@
.main-header .main-header
= 'Отчетность за 2026 год' = 'Отчетность за 2026 год'
.exit
- if logged_in?
a.link[href="/logout"]
span.text-large
= 'Выйти'
+6 -5
View File
@@ -1,5 +1,6 @@
.nav-container - if @current_user.present?
a.link[href="/"] .nav-container
= 'Организации' a.link[href="/"]
a.link[href="/auditors/index"] = 'Организации'
= 'Аудиторы' a.link[href="/auditors/index"]
= 'Аудиторы'
@@ -14,3 +14,6 @@
- params.keys.each do |key| - params.keys.each do |key|
.information-elem .information-elem
= "#{key}: #{params[key]}" = "#{key}: #{params[key]}"
.information-button
a.link[href="/organisations/#{organisation}"]
= "Подробнее"
+31
View File
@@ -0,0 +1,31 @@
.header
.header-title
= "Организация"
.main-container
- unless @info_about_organisation.any?
= 'У данной организации пока не загружена отчетность'
- else
.informations-data
h2
= "Сведения об организации"
.information-data
- @info_about_organisation["Сведения об организации"].each do |key, value|
.information-elem
= "#{key}: #{value}"
= render 'organisations/templates/type_doc', target: "type_doc_#{@type_doc}", org_id: "#{@org_id}"
h2
= "#{@doc_name}"
.information-table
table
thead
tr
- @current_doc_info[0].each do |value|
th
= value
tbody
- @current_doc_info[1..-1].each do |values|
tr
- values.each do |value|
td
= value
@@ -0,0 +1,16 @@
.main__container
.type_doc_header#tabs
.type__doc__list__type__container
a.link[href="/organisations/#{org_id}?type_doc=0"]
.switch__button.text-large#type_doc_0 data-value=target
= 'Бухгалтерский баланс'
a.link[href="/organisations/#{org_id}?type_doc=1"]
.switch__button.text-large#type_doc_1 data-value=target
= 'Отчёт о финансовых результатах'
/ - if not_simplified
a.link[href="/organisations/#{org_id}?type_doc=2"]
.switch__button.text-large#type_doc_2 data-value=target
= 'Отчёт об изменении капитала'
a.link[href="/organisations/#{org_id}?type_doc=3"]
.switch__button.text-large#type_doc_3 data-value=target
= 'Отчёт о движении денежных средств'
+13
View File
@@ -0,0 +1,13 @@
.welcome__container__laptop
div
= 'Информационная система'
div
= '«Электронный дневник»'
- unless logged_in?
a.link[href="/auth/login"]
.welcome-login__container
span
= image_tag('auth.svg', class: 'icon')
span.text-login
= 'Войти'
+1
View File
@@ -12,3 +12,4 @@ pin "jquery_ujs", to: "jquery_ujs.js", preload: true
pin "jquery-ui", to: "jquery-ui.js", preload: true pin "jquery-ui", to: "jquery-ui.js", preload: true
pin "inputmask", to: "jquery.inputmask.bundle.min.js", preload: true pin "inputmask", to: "jquery.inputmask.bundle.min.js", preload: true
pin 'slimselect', to: 'slimselect.min.js', preload: true pin 'slimselect', to: 'slimselect.min.js', preload: true
pin "tabs_select", to: 'tabs_select.js', preload: true
+7 -4
View File
@@ -1,14 +1,17 @@
# require 'sidekiq/web' # require 'sidekiq/web'
Rails.application.routes.draw do Rails.application.routes.draw do
get 'auditors/index'
get 'reports/create' get '/auth/login', to: 'auth#login', as: :login
get '/organisations/index'
get '/organisations/:id', to: 'organisations#show'
get '/auditors/index'
get '/reports/create'
get '/reports', to: 'reports#index' get '/reports', to: 'reports#index'
post '/reports', to: 'reports#create' post '/reports', to: 'reports#create'
# mount Sidekiq::Web => '/sidekiq' # Для проверки работы Sidekiq через веб-интерфейс # mount Sidekiq::Web => '/sidekiq' # Для проверки работы Sidekiq через веб-интерфейс
# Defines the root path route ("/") # Defines the root path route ("/")
root "welcome#index" root "welcome#home"
end end
+15
View File
@@ -0,0 +1,15 @@
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the OrganisationsHelper. For example:
#
# describe OrganisationsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe OrganisationsHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
+18
View File
@@ -0,0 +1,18 @@
require 'rails_helper'
RSpec.describe "Organisations", type: :request do
describe "GET /index" do
it "returns http success" do
get "/organisations/index"
expect(response).to have_http_status(:success)
end
end
describe "GET /show" do
it "returns http success" do
get "/organisations/show"
expect(response).to have_http_status(:success)
end
end
end
@@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe "organisations/index.html.tailwindcss", type: :view do
pending "add some examples to (or delete) #{__FILE__}"
end
@@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe "organisations/show.html.tailwindcss", type: :view do
pending "add some examples to (or delete) #{__FILE__}"
end