diff --git a/Gemfile.lock b/Gemfile.lock index 867fffd..8ae3b86 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -302,6 +302,7 @@ GEM zeitwerk (2.6.7) PLATFORMS + x86_64-linux x86_64-linux-musl DEPENDENCIES diff --git a/app/controllers/admin/admin_controller.rb b/app/controllers/admin/admin_controller.rb index 6bb9848..321e676 100644 --- a/app/controllers/admin/admin_controller.rb +++ b/app/controllers/admin/admin_controller.rb @@ -1,4 +1,6 @@ class Admin::AdminController < ApplicationController load_and_authorize_resource - def index; end + def index + redirect_to(admin_users_path) + end end diff --git a/app/controllers/admin/building_controller.rb b/app/controllers/admin/building_controller.rb new file mode 100644 index 0000000..ab90369 --- /dev/null +++ b/app/controllers/admin/building_controller.rb @@ -0,0 +1,30 @@ +class Admin::BuildingController < ApplicationController + include BuildingConcern + + load_and_authorize_resource + before_action :set_building, only: [:show, :edit, :update, :destroy] + + def index + building_index + end + + def new + authorize!(:new, :building_admin) + @building = Building.new + end + + def create + authorize!(:create, :building_admin) + building_create + end + + def update + authorize!(:update, :building_admin) + building_update + end + + def destroy + authorize!(:destroy, :building_admin) + building_destroy + end +end diff --git a/app/controllers/admin/control_point_controller.rb b/app/controllers/admin/control_point_controller.rb new file mode 100644 index 0000000..2ea2021 --- /dev/null +++ b/app/controllers/admin/control_point_controller.rb @@ -0,0 +1,60 @@ +class Admin::ControlPointController < ApplicationController + include ControlPointConcern + load_and_authorize_resource + before_action :set_control_point, only: [:show, :edit, :update, :destroy] + + def index + @query = ControlPoint.ransack(params[:q]) + @pagy, @control_points = pagy(@query.result. + order(:name)) + end + + def new + authorize!(:new, :control_point_admin) + @control_point = ControlPoint.new + end + + def create + authorize!(:create, :control_point_admin) + control_point_create + end + + def update + if @control_point.update(control_point_params) + redirect_back(fallback_location: root_path) + else + render(:edit, status: :unprocessable_entity) + end + end + + def destroy + assigned_models_count = + Room.where(control_point_id: params[:id]).count + + Device.where(control_point_id: params[:id]).count + + Channel.where(control_point_id: params[:id]).count + + if assigned_models_count.zero? + @control_point.destroy + else + flash[:error] = t('message.control_point.delete.error') + end + redirect_to(admin_control_point_index_path) + end + + private + + def set_control_point + @control_point = ControlPoint.find(params[:id]) + end + + def control_point_params + params.require(:control_point).permit( + :name, + :room_id, + :device_id, + :channel_id, + :description, + :service_id, + ) + end +end diff --git a/app/controllers/admin/division_controller.rb b/app/controllers/admin/division_controller.rb new file mode 100644 index 0000000..2dd1459 --- /dev/null +++ b/app/controllers/admin/division_controller.rb @@ -0,0 +1,29 @@ +class Admin::DivisionController < ApplicationController + include DivisionConcern + load_and_authorize_resource + before_action :set_division, only: [:show, :edit, :update, :destroy] + + def index + division_index + end + + def new + authorize!(:new, :division_admin) + @division = Division.new + end + + def create + authorize!(:create, :division_admin) + division_create + end + + def update + authorize!(:update, :division_admin) + division_update + end + + def destroy + authorize!(:destroy, :division_admin) + division_destroy + end +end diff --git a/app/controllers/admin/organization_controller.rb b/app/controllers/admin/organization_controller.rb new file mode 100644 index 0000000..a6e21fa --- /dev/null +++ b/app/controllers/admin/organization_controller.rb @@ -0,0 +1,30 @@ +class Admin::OrganizationController < ApplicationController + include OrganizationConcern + + load_and_authorize_resource + before_action :set_organization, only: [:show, :edit, :update, :destroy] + + def index + organization_index + end + + def new + authorize!(:new, :organization_admin) + @organization = Organization.new + end + + def create + authorize!(:create, :organization_admin) + organization_create + end + + def update + authorize!(:update, :organization_admin) + organization_update + end + + def destroy + authorize!(:destroy, :organization_admin) + organization_destroy + end +end diff --git a/app/controllers/admin/room_controller.rb b/app/controllers/admin/room_controller.rb new file mode 100644 index 0000000..80d39eb --- /dev/null +++ b/app/controllers/admin/room_controller.rb @@ -0,0 +1,30 @@ +class Admin::RoomController < ApplicationController + include RoomConsern + + load_and_authorize_resource + before_action :set_room, only: [:show, :edit, :update, :destroy] + + def index + room_index + end + + def new + authorize!(:new, :room_admin) + @room = Room.new + end + + def create + authorize!(:create, :room_admin) + room_create + end + + def update + authorize!(:update, :room_admin) + room_update + end + + def destroy + authorize!(:destroy, :room_admin) + room_destroy + end +end diff --git a/app/controllers/admin/service_controller.rb b/app/controllers/admin/service_controller.rb new file mode 100644 index 0000000..2f18ec7 --- /dev/null +++ b/app/controllers/admin/service_controller.rb @@ -0,0 +1,63 @@ +class Admin::ServiceController < ApplicationController + include ServiceConcern + + load_and_authorize_resource + before_action :set_service, only: [:show, :edit, :update, :destroy] + + def index + @query = Service.ransack(params[:q]) + @pagy, @services = pagy(@query.result.order(:name)) + end + + def new + authorize!(:new, :service_admin) + @service = Service.new + end + + def create + authorize!(:create, :service_admin) + service_create + end + + def update + authorize!(:update, :service_admin) + + if @service.update(service_params) + redirect_back(fallback_location: root_path) + else + render(:edit, status: :unprocessable_entity) + end + end + + def destroy + authorize!(:destroy, :service_admin) + + assigned_models_count = + Device.where(service_id: params[:id]).count + + User.where(service_id: params[:id]).count + + Server.where(service_id: params[:id]).count + + ControlPoint.where(service_id: params[:id]).count + + if assigned_models_count.zero? + @service.destroy + else + flash[:error] = t('message.service.delete.error') + end + redirect_to(admin_service_index_path) + end + + private + + def set_service + @service = Service.find(params[:id]) + end + + def service_params + params.require(:service).permit( + :name, + :division_id, + :organization_id, + :building_id, + ) + end +end diff --git a/app/controllers/api/v1/armstrong_controller.rb b/app/controllers/api/v1/armstrong_controller.rb index e0dcc39..1aeb466 100644 --- a/app/controllers/api/v1/armstrong_controller.rb +++ b/app/controllers/api/v1/armstrong_controller.rb @@ -3,13 +3,19 @@ class V1::ArmstrongController < ApplicationController after_action :set_csp_header def index - channels = Channel.all + channels = Channel.joins(:control_point, :server, :service) result = channels.sort { |a, b| a[:server_id] <=> b[:server_id] } render(json: result, include: [ - device: { include: [device_model: { only: [:name] }] }, - room: { only: [:name] }, + :server, + :service, + { control_point: { + include: [ + :room, + { device: { include: :device_model } }, + ], + } }, ]) end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 67f7da5..b0cb009 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -27,7 +27,7 @@ def set_time_zone(&block) protected def configure_permitted_parameters - attributes_sign_up = [:first_name, :last_name, :tabel_id, :role, :email,:service_id, :timezone] + attributes_sign_up = [:first_name, :last_name, :tabel_id, :role, :email, :service_id, :timezone] attributes_update = [*attributes_sign_up.excluding(:service_id), :second_name, :email, :phone] devise_parameter_sanitizer.permit(:sign_up, keys: attributes_sign_up) devise_parameter_sanitizer.permit(:account_update, keys: attributes_update) diff --git a/app/controllers/concerns/building_concern.rb b/app/controllers/concerns/building_concern.rb new file mode 100644 index 0000000..2a1b1ec --- /dev/null +++ b/app/controllers/concerns/building_concern.rb @@ -0,0 +1,55 @@ +module BuildingConcern + extend ActiveSupport::Concern + + included do # rubocop:disable Metrics/BlockLength + def building_index + @query = Building.ransack(params[:q]) + @pagy, @buildings = pagy(@query.result.order(:name)) + end + + def building_create + @building = Building.new(building_params) + + if @building.save + redirect_back(fallback_location: root_path) + else + render(:new, status: :unprocessable_entity) + end + end + + def building_update + if @building.update(building_params) + redirect_back(fallback_location: root_path) + else + render(:edit, status: :unprocessable_entity) + end + end + + def building_destroy + assigned_models_count = + Room.where(building_id: params[:id]).count + + Service.where(building_id: params[:id]).count + + if assigned_models_count.zero? + @building.destroy + else + flash[:error] = t('message.admin.building.delete.error') + end + redirect_to(admin_building_index_path) + end + + private + + def set_building + @building = Building.find(params[:id]) + end + + def building_params + params.require(:building).permit( + :name, + :organization_id, + :description, + ) + end + end +end diff --git a/app/controllers/concerns/control_point_concern.rb b/app/controllers/concerns/control_point_concern.rb new file mode 100644 index 0000000..17d551f --- /dev/null +++ b/app/controllers/concerns/control_point_concern.rb @@ -0,0 +1,26 @@ +module ControlPointConcern + extend ActiveSupport::Concern + + included do + def control_point_create + @control_point = ControlPoint.new(control_point_params) + + if @control_point.save + redirect_back(fallback_location: root_path) + else + render(:new, status: :unprocessable_entity) + end + end + + def control_point_params + params.require(:control_point).permit( + :name, + :device_id, + :room_id, + :channel_id, + :description, + :service_id, + ) + end + end +end diff --git a/app/controllers/concerns/device_concern.rb b/app/controllers/concerns/device_concern.rb index fc2bfce..b0fdb72 100644 --- a/app/controllers/concerns/device_concern.rb +++ b/app/controllers/concerns/device_concern.rb @@ -2,7 +2,7 @@ module DeviceConcern extend ActiveSupport::Concern include DeviceHelper - included do + included do # rubocop:disable Metrics/BlockLength def device_index params[:q] ||= {} @query = Device.ransack(params[:q]) @@ -43,9 +43,8 @@ def device_update(device) def device_destroy(device, path_success, path_failure) assigned_inspections_count = Inspection.where(device_id: device.id).count - assigned_channels_count = Channel.where(device_id: device.id).count - if assigned_inspections_count.zero? && assigned_channels_count.zero? + if assigned_inspections_count.zero? && device.control_point_id? device.destroy redirect_to(path_success) else @@ -55,17 +54,16 @@ def device_destroy(device, path_success, path_failure) end def create_inspection_for_device(device) - if inspection_params[:is_admin] - inspection = device.inspections.build(creator_id: current_user.id, + inspection = if inspection_params[:is_admin] + device.inspections.build(creator_id: current_user.id, performer_id: current_user.id, type_target: inspection_params[:type_target], conclusion_date: inspection_params[:conclusion_date].to_datetime + 12.hours, conclusion: t('message.inspection.create_from_device.generated'), - state: Inspection::STATES[:verification_successful] - ) - else - inspection = device.inspections.build(creator_id: current_user.id, type_target: inspection_params[:type_target]) - end + state: Inspection::STATES[:verification_successful]) + else + device.inspections.build(creator_id: current_user.id, type_target: inspection_params[:type_target]) + end if inspection.save set_inspection_status(device) flash[:success] = t('message.inspection.create_from_device.success') diff --git a/app/controllers/concerns/division_concern.rb b/app/controllers/concerns/division_concern.rb new file mode 100644 index 0000000..fa08c4f --- /dev/null +++ b/app/controllers/concerns/division_concern.rb @@ -0,0 +1,52 @@ +module DivisionConcern + extend ActiveSupport::Concern + + included do + def division_index + @query = Division.ransack(params[:q]) + @pagy, @divisions = pagy(@query.result.order(:name)) + end + + def division_create + @division = Division.new(division_params) + + if @division.save + redirect_back(fallback_location: root_path) + else + render(:new, status: :unprocessable_entity) + end + end + + def division_update + if @division.update(division_params) + redirect_back(fallback_location: root_path) + else + render(:edit, status: :unprocessable_entity) + end + end + + def division_destroy + assigned_models_count = Service.where(division_id: params[:id]).count + + if assigned_models_count.zero? + @division.destroy + else + flash[:error] = t('message.admin.division.delete.error') + end + redirect_to(admin_division_index_path) + end + + private + + def set_division + @division = Division.find(params[:id]) + end + + def division_params + params.require(:division).permit( + :name, + :organization_id, + ) + end + end +end diff --git a/app/controllers/concerns/organization_concern.rb b/app/controllers/concerns/organization_concern.rb new file mode 100644 index 0000000..68b0b22 --- /dev/null +++ b/app/controllers/concerns/organization_concern.rb @@ -0,0 +1,60 @@ +module OrganizationConcern + extend ActiveSupport::Concern + + included do + def organization_index + @query = Organization.ransack(params[:q]) + @pagy, @organizations = pagy(@query.result.order(:name)) + end + + def organization_create + @organization = Organization.new(organization_params) + + if @organization.save + redirect_back(fallback_location: root_path) + else + render(:new, status: :unprocessable_entity) + end + end + + def organization_update + if @organization.update(organization_params) + redirect_back(fallback_location: root_path) + else + render(:edit, status: :unprocessable_entity) + end + end + + def organization_destroy + assigned_models_count = + Division.where(organization_id: params[:id]).count + + Service.where(organization_id: params[:id]).count + + Building.where(organization_id: params[:id]).count + + if assigned_models_count.zero? + @organization.destroy + else + flash[:error] = t('message.admin.organization.delete.error') + end + + redirect_to(admin_organization_index_path) + end + + private + + def set_organization + @organization = Organization.find(params[:id]) + end + + def organization_params + params.require(:organization).permit( + :name, + :full_address, + :zip_code, + :phone, + :fax, + :email + ) + end + end +end diff --git a/app/controllers/concerns/room_consern.rb b/app/controllers/concerns/room_consern.rb new file mode 100644 index 0000000..8636930 --- /dev/null +++ b/app/controllers/concerns/room_consern.rb @@ -0,0 +1,54 @@ +module RoomConsern + extend ActiveSupport::Concern + + included do # rubocop:disable Metrics/BlockLength + def room_index + @query = Room.ransack(params[:q]) + @pagy, @rooms = pagy(@query.result.order(:name)) + end + + def room_create + @room = Room.new(room_params) + + if @room.save + redirect_back(fallback_location: root_path) + else + render(:new, status: :unprocessable_entity) + end + end + + def room_update + if @room.update(room_params) + redirect_back(fallback_location: root_path) + else + render(:edit, status: :unprocessable_entity) + end + end + + def room_destroy + assigned_models_count = ControlPoint.where(room_id: params[:id]).count + + if assigned_models_count.zero? + @room.destroy + else + flash[:error] = t('message.admin.room.delete.error') + end + redirect_to(admin_room_index_path) + end + + private + + def set_room + @room = Room.find(params[:id]) + end + + def room_params + params.require(:room).permit( + :name, + :building_id, + :level, + :description, + ) + end + end +end diff --git a/app/controllers/concerns/service_concern.rb b/app/controllers/concerns/service_concern.rb new file mode 100644 index 0000000..42c5528 --- /dev/null +++ b/app/controllers/concerns/service_concern.rb @@ -0,0 +1,24 @@ +module ServiceConcern + extend ActiveSupport::Concern + + included do + def service_create + @service = Service.new(service_params) + + if @service.save + redirect_back(fallback_location: root_path) + else + render(:new, status: :unprocessable_entity) + end + end + + def service_params + params.require(:service).permit( + :name, + :division_id, + :organization_id, + :building_id, + ) + end + end +end diff --git a/app/controllers/control_point_controller.rb b/app/controllers/control_point_controller.rb new file mode 100644 index 0000000..861cf6d --- /dev/null +++ b/app/controllers/control_point_controller.rb @@ -0,0 +1,19 @@ +class ControlPointController < ApplicationController + include ControlPointConcern + + load_and_authorize_resource + + def index + @query = ControlPoint.ransack(params[:q]) + @query.sorts = ['name asc'] + @pagy, @control_points = pagy(@query.result) + end + + def new + @control_point = ControlPoint.new + end + + def create + control_point_create + end +end diff --git a/app/helpers/device_helper.rb b/app/helpers/device_helper.rb index 4d8d90f..63fcea7 100644 --- a/app/helpers/device_helper.rb +++ b/app/helpers/device_helper.rb @@ -6,17 +6,17 @@ def set_inspection_status(device) unless device.last_successful_inspection_raw.nil? next_inspection_date = device.last_successful_inspection_raw + 1.year status = if next_inspection_date > separator - Device::INSPECTION_EXPIRATION_STATUS[:verified] - elsif next_inspection_date <= separator && next_inspection_date > current_date - Device::INSPECTION_EXPIRATION_STATUS[:prepare_to_inspection] - else - Device::INSPECTION_EXPIRATION_STATUS[:expired] - end + Device::INSPECTION_EXPIRATION_STATUS[:verified] + elsif next_inspection_date <= separator && next_inspection_date > current_date + Device::INSPECTION_EXPIRATION_STATUS[:prepare_to_inspection] + else + Device::INSPECTION_EXPIRATION_STATUS[:expired] + end begin device.update(inspection_expiration_status: status) - rescue ActiveRecord::ActiveRecordError => error - puts error.to_s + rescue ActiveRecord::ActiveRecordError => e + puts(e.to_s) end end end diff --git a/app/javascript/Components/Armstrong/Armstrong.jsx b/app/javascript/Components/Armstrong/Armstrong.jsx index 846eb02..1fc6287 100644 --- a/app/javascript/Components/Armstrong/Armstrong.jsx +++ b/app/javascript/Components/Armstrong/Armstrong.jsx @@ -42,12 +42,12 @@ export default function Armstrong() { state: setChannelColor(channel.state), specialControl: , id: channel.id, - serverId: channel.server_id, + serverId: channel.server.id, channelId: channel.channel_id, - name: channel.name, - deviceModel: channel.device.device_model.name, - location: channel.room.name, - locationDescription: channel.location_description, + name: channel.control_point.name, + deviceModel: channel.control_point.device ? channel.control_point.device.device_model.name : '——', + location: channel.control_point.room.name, + locationDescription: channel.control_point.description, eventSystemValue: channel.event_system_value.toExponential(3), eventNotSystemValue: channel.event_not_system_value.toExponential(3), eventDatetime: moment.tz(channel.event_datetime, timeZone).format('HH:mm:SS'), diff --git a/app/models/building.rb b/app/models/building.rb index 5cc3a87..6cd5c8b 100644 --- a/app/models/building.rb +++ b/app/models/building.rb @@ -6,4 +6,8 @@ class Building < ApplicationRecord has_many :servers validates :name, presence: true + + def self.ransackable_attributes(_auth_object = nil) + ['created_at', 'description', 'id', 'name', 'organization_id', 'updated_at'] + end end diff --git a/app/models/channel.rb b/app/models/channel.rb index fb89b7e..4f57cc2 100644 --- a/app/models/channel.rb +++ b/app/models/channel.rb @@ -1,7 +1,7 @@ class Channel < ApplicationRecord - belongs_to :device - belongs_to :room belongs_to :server belongs_to :service + has_many :history + belongs_to :control_point end diff --git a/app/models/control_point.rb b/app/models/control_point.rb new file mode 100644 index 0000000..d091bae --- /dev/null +++ b/app/models/control_point.rb @@ -0,0 +1,17 @@ +class ControlPoint < ApplicationRecord + belongs_to :room, optional: true + belongs_to :service + + has_one :channel + has_one :device + + validates :name, presence: true + + def self.ransackable_attributes(_auth_object = nil) + ['channel_id', 'created_at', 'description', 'device_id', 'id', 'name', 'room_id', 'service_id', 'updated_at'] + end + + def self.ransackable_associations(_auth_object = nil) + ['channel', 'device', 'room', 'service'] + end +end diff --git a/app/models/device.rb b/app/models/device.rb index 52d9e39..e4bddfd 100644 --- a/app/models/device.rb +++ b/app/models/device.rb @@ -11,9 +11,9 @@ class Device < ApplicationRecord belongs_to :supplementary_kit, optional: true belongs_to :room, optional: true belongs_to :service + belongs_to :control_point, optional: true has_many :inspections - has_one :channel validates :inventory_id, numericality: { less_than_or_equal_to: 2147483647 }, uniqueness: true, allow_nil: true validates :serial_id, :tabel_id, presence: true, uniqueness: true diff --git a/app/models/division.rb b/app/models/division.rb index 336c209..abcf7cd 100644 --- a/app/models/division.rb +++ b/app/models/division.rb @@ -4,4 +4,8 @@ class Division < ApplicationRecord has_many :services validates :name, presence: true + + def self.ransackable_attributes(_auth_object = nil) + ['created_at', 'id', 'name', 'organization_id', 'updated_at'] + end end diff --git a/app/models/organization.rb b/app/models/organization.rb index 666c369..304b1c8 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -4,4 +4,8 @@ class Organization < ApplicationRecord has_many :services validates :name, presence: true + + def self.ransackable_attributes(auth_object = nil) + ["created_at", "email", "fax", "full_address", "id", "name", "phone", "updated_at", "zip_code"] + end end diff --git a/app/models/room.rb b/app/models/room.rb index 4c36553..a15cea3 100644 --- a/app/models/room.rb +++ b/app/models/room.rb @@ -1,8 +1,12 @@ class Room < ApplicationRecord belongs_to :building - has_many :channels has_many :devices + has_many :control_point - validates :name, presence: true + validates :name, :building, presence: true + + def self.ransackable_attributes(_auth_object = nil) + ['building_id', 'created_at', 'description', 'id', 'level', 'name', 'updated_at'] + end end diff --git a/app/models/service.rb b/app/models/service.rb index 6a3daf8..b58df8c 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -6,4 +6,16 @@ class Service < ApplicationRecord has_many :devices has_many :users has_many :servers + has_many :control_points + + validates :name, :organization, :division, :building, presence: true + validates :name, uniqueness: true + + def self.ransackable_attributes(_auth_object = nil) + ['building_id', 'created_at', 'division_id', 'id', 'name', 'organization_id', 'updated_at'] + end + + def self.ransackable_associations(_auth_object = nil) + ['building', 'control_points', 'devices', 'division', 'organization', 'servers', 'users'] + end end diff --git a/app/models/user.rb b/app/models/user.rb index 522dbe2..676bea8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -45,7 +45,8 @@ def self.ransackable_attributes(_auth_object = nil) 'second_name', 'tabel_id', 'updated_at', - 'service_id'] + 'service_id', + ] end def self.ransackable_associations(_auth_object = nil) diff --git a/app/views/admin/building/create.turbo_stream.erb b/app/views/admin/building/create.turbo_stream.erb new file mode 100644 index 0000000..3ba4d15 --- /dev/null +++ b/app/views/admin/building/create.turbo_stream.erb @@ -0,0 +1 @@ +<%= turbo_stream.dispatch_event "modalClose" %> diff --git a/app/views/admin/building/edit.turbo_stream.erb b/app/views/admin/building/edit.turbo_stream.erb new file mode 100644 index 0000000..d662b90 --- /dev/null +++ b/app/views/admin/building/edit.turbo_stream.erb @@ -0,0 +1,3 @@ +<%= turbo_stream.update "modal-title", t('admin.building.edit') %> +<%= turbo_stream.update "modal-body", partial: "shared/admin/form/building", + locals: { path: admin_building_path(@building), building: @building } %> diff --git a/app/views/admin/building/index.html.erb b/app/views/admin/building/index.html.erb new file mode 100644 index 0000000..ee80518 --- /dev/null +++ b/app/views/admin/building/index.html.erb @@ -0,0 +1,103 @@ +<% provide :page_title, "Здания" %> +<%= render 'shared/admin/navbar/admin', selected: "location" %> +<%= render 'shared/flash_alert' %> +
<%= t('activerecord.attributes.building.id') %> | +<%= t('activerecord.attributes.building.name') %> | +<%= t('activerecord.attributes.building.organization') %> | +<%= t('activerecord.attributes.building.description') %> | +<%= t('action') %> | +||
---|---|---|---|---|---|---|
<%= building.id %> | +<%= building.name %> | + <% if building.organization.nil? %> +<%= "——" %> | + <% else %> +<%= building.organization.name %> | + <% end %> + <% if building.description.nil? %> +<%= "——" %> | + <% else %> +<%= building.description %> | + <% end %> +
+
+ <%= link_to edit_admin_building_path(building.id), class: "btn", data: { action: "click->modal#open", turbo_stream: "" } do %>
+
+ <% end %>
+ <%= button_to admin_building_path(building.id), method: :delete, class: "btn" do %>
+
+ <% end %>
+
+ |
+
<%= t('activerecord.attributes.control_point.name') %> | +<%= t('activerecord.attributes.control_point.room') %> | +<%= t('activerecord.attributes.control_point.device') %> | +<%= t('activerecord.attributes.control_point.description') %> | +<%= t('action') %> | +|||
---|---|---|---|---|---|---|---|
<%= control_point.name %> | + <% if control_point.room.nil? %> +<%= "——" %> | + <% else %> +<%= control_point.room.name %> | + <% end %> + <% if control_point.device.nil? %> +<%= "——" %> | + <% else %> ++ <%= button_to "(#{sprintf("%05d", control_point.device.tabel_id)}) #{control_point.device.device_model.name}", admin_device_path(control_point.device.id), method: :get, class: "btn btn-light btn-sm" %> + | + <% end %> + <% if control_point.description.nil? %> +<%= "——" %> | + <% else %> +<%= control_point.description %> | + <% end %> +
+
+ <%= link_to edit_admin_control_point_path(control_point.id), class: "btn", data: { action: "click->modal#open", turbo_stream: "" } do %>
+
+ <% end %>
+ <%= button_to admin_control_point_path(control_point.id), method: :delete, class: "btn" do %>
+
+ <% end %>
+
+ |
+
<%= t('activerecord.attributes.device_component.serial_id')%> | <%= t('activerecord.attributes.device_component.name')%> | <%= t('activerecord.attributes.device_component.supplementary_kit')%> | <%= t('activerecord.attributes.device_component.measurement_min')%> | <%= t('activerecord.attributes.device_component.measurement_max')%> | -<%= t('activerecord.attributes.device_component.measurement_unit')%> | +<%= t('activerecord.attributes.device_component.measuring_unit')%> | <%= t('activerecord.attributes.device_component.description')%> | <%= t('action')%> |
---|
<%= t('activerecord.attributes.device_model.name')%> | -<%= t('activerecord.attributes.device_model.manufacturer')%> | -<%= t('activerecord.attributes.device_model.measurement_group')%> | -<%= t('activerecord.attributes.device_model.measurement_class')%> | -<%= t('activerecord.attributes.device_model.measuring_unit')%> | -<%= t('activerecord.attributes.device_model.measurement_sensitivity')%>. | -<%= t('activerecord.attributes.device_model.measurement_min')%> | -<%= t('activerecord.attributes.device_model.measurement_max')%> | -<%= t('activerecord.attributes.device_model.calibration_min')%> | -<%= t('activerecord.attributes.device_model.calibration_max')%> | -<%= t('activerecord.attributes.device_model.safety_class')%> | -<%= t('activerecord.attributes.device_model.accuracy_class')%> | -||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
<%= device_model.name %> | -<%= device_model.manufacturer.name %> | -<%= device_model.measurement_group.name %> | -<%= device_model.measurement_class.name %> | -<%= device_model.measuring_unit %> | -<%= device_model.measurement_sensitivity %> | -<%= device_model.measurement_min %> | -<%= device_model.measurement_max %> | -<%= device_model.calibration_min %> | -<%= device_model.calibration_max %> | -<%= device_model.safety_class %> | -<%= device_model.accuracy_class %> | +
<%= t('activerecord.attributes.device_model.name')%> | +<%= t('activerecord.attributes.device_model.manufacturer')%> | +<%= t('activerecord.attributes.device_model.measurement_group')%> | +<%= t('activerecord.attributes.device_model.measurement_class')%> | +<%= t('activerecord.attributes.device_model.measuring_unit')%> | +<%= t('activerecord.attributes.device_model.measurement_sensitivity')%>. | +<%= t('activerecord.attributes.device_model.measurement_min')%> | +<%= t('activerecord.attributes.device_model.measurement_max')%> | +<%= t('activerecord.attributes.device_model.calibration_min')%> | +<%= t('activerecord.attributes.device_model.calibration_max')%> | +<%= t('activerecord.attributes.device_model.safety_class')%> | +<%= t('activerecord.attributes.device_model.accuracy_class')%> |
---|
<%= t('activerecord.attributes.division.id') %> | +<%= t('activerecord.attributes.division.name') %> | +<%= t('activerecord.attributes.division.organization') %> | +<%= t('action') %> | +|
---|---|---|---|---|
<%= division.id %> | +<%= division.name %> | + <% if division.organization.nil? %> +<%= "——" %> | + <% else %> +<%= division.organization.name %> | + <% end %> +
+
+ <%= link_to edit_admin_division_path(division.id), class: "btn", data: { action: "click->modal#open", turbo_stream: "" } do %>
+
+ <% end %>
+ <%= button_to admin_division_path(division.id), method: :delete, class: "btn" do %>
+
+ <% end %>
+
+ |
+
<%= manufacturer.name %> | <%= manufacturer.adress %> | -<%= manufacturer.phone %> | -<%= manufacturer.email %> | +<%= manufacturer.phone %> | +<%= manufacturer.email %> | <%= manufacturer.site_url %> |
diff --git a/app/views/admin/measurement_class/index.html.erb b/app/views/admin/measurement_class/index.html.erb
index a7ec6ab..6364567 100644
--- a/app/views/admin/measurement_class/index.html.erb
+++ b/app/views/admin/measurement_class/index.html.erb
@@ -1,9 +1,9 @@
<% provide :page_title, "Классы измерения" %>
<%= render 'shared/admin/navbar/admin', selected: "device" %>
-<%= render 'shared/admin/navbar/device_bread', selected: "measurement_class" %>
<%= render 'shared/flash_alert' %>
-
+
+ <%= render 'shared/admin/navbar/device_bread', selected: "measurement_class" %>
@@ -14,13 +14,13 @@
- <%= f.label :name, class: "mb-2" %>
- <%= f.search_field :name_cont, class:"form-control", placeholder:"Название" %>
- <%= f.label :measurement_group_id, class:"mb-1" %>
- <%= f.collection_select(:measurement_group_id_eq, MeasurementGroup.all,
- :id, :name, {:include_blank => t('combobox_blank')}, {:class=>'form-select form-select'}) %>
- <%= f.label :arms_device_type, class: "my-2" %>
- <%= f.search_field :arms_device_type_eq, class:"form-control", placeholder:"1" %>
+ <%= f.label :name %>
+ <%= f.search_field :name_cont, class:"form-control mb-2", placeholder:"Название" %>
+ <%= f.label :measurement_group_id %>
+ <%= f.collection_select(:measurement_group_id_eq, MeasurementGroup.all,
+ :id, :name, {:include_blank => t('combobox_blank')}, {:class=>'form-select mb-2'}) %>
+ <%= f.label :arms_device_type %>
+ <%= f.search_field :arms_device_type_eq, class:"form-control mb-2", placeholder:"1" %>
<%= f.submit t('b_accept'), class: 'btn btn-primary w-100 my-2'%>
@@ -32,14 +32,14 @@
<%= render 'shared/modal_button_add', path: new_admin_measurement_class_path, classes: "btn btn-primary w-100", text: t("b_add") %>
+
+
diff --git a/app/views/admin/organization/new.turbo_stream.erb b/app/views/admin/organization/new.turbo_stream.erb
new file mode 100644
index 0000000..3ee8927
--- /dev/null
+++ b/app/views/admin/organization/new.turbo_stream.erb
@@ -0,0 +1,3 @@
+<%= turbo_stream.update "modal-title", t('admin.organization.new') %>
+<%= turbo_stream.update "modal-body", partial: "shared/admin/form/organization",
+ locals: { path: admin_organization_index_path, organization: @organization } %>
diff --git a/app/views/admin/organization/update.turbo_stream.erb b/app/views/admin/organization/update.turbo_stream.erb
new file mode 100644
index 0000000..3ba4d15
--- /dev/null
+++ b/app/views/admin/organization/update.turbo_stream.erb
@@ -0,0 +1 @@
+<%= turbo_stream.dispatch_event "modalClose" %>
diff --git a/app/views/admin/room/create.turbo_stream.erb b/app/views/admin/room/create.turbo_stream.erb
new file mode 100644
index 0000000..3ba4d15
--- /dev/null
+++ b/app/views/admin/room/create.turbo_stream.erb
@@ -0,0 +1 @@
+<%= turbo_stream.dispatch_event "modalClose" %>
diff --git a/app/views/admin/room/edit.turbo_stream.erb b/app/views/admin/room/edit.turbo_stream.erb
new file mode 100644
index 0000000..aec72af
--- /dev/null
+++ b/app/views/admin/room/edit.turbo_stream.erb
@@ -0,0 +1,3 @@
+<%= turbo_stream.update "modal-title", t('admin.room.edit') %>
+<%= turbo_stream.update "modal-body", partial: "shared/admin/form/room",
+ locals: { path: admin_room_path(@room), room: @room } %>
diff --git a/app/views/admin/room/index.html.erb b/app/views/admin/room/index.html.erb
new file mode 100644
index 0000000..351440e
--- /dev/null
+++ b/app/views/admin/room/index.html.erb
@@ -0,0 +1,107 @@
+<% provide :page_title, "Помещения" %>
+<%= render 'shared/admin/navbar/admin', selected: "location" %>
+<%= render 'shared/flash_alert' %>
+
+
+
+
+
+
+
+
+ <%= pagination @pagy %>
+
+
+
+
+
+
+ <%= render 'shared/admin/navbar/location_navbar', selected: "room" %>
+
+
+
+ <%= render 'shared/modal_button_add', path: new_admin_room_path, classes: "btn btn-primary w-100", text: t("b_add") %>
+
+
+ + ++
+ <%= search_form_for(@query, url: admin_room_index_path, method: :get, class: "rounded accordion-body") do |f| %>
+
+
+ <%= f.label :name, class: "mb-1" %>
+ <%= f.search_field :name_cont, class:"form-control mb-2", placeholder:"Название" %>
+ <%= f.label :building_id, class: "mb-1" %>
+ <%= f.collection_select(:building_id_eq, Building.all,
+ :id, :name, {:include_blank => t('combobox_blank')}, {:class=>'form-select mb-2'}) %>
+ <%= f.label :level, class: "mb-1" %>
+ <%= f.search_field :level_cont, class: "form-control mb-2", placeholder:"Уровень"%>
+
+ <%= f.submit t('b_accept'), class: 'btn btn-primary w-100 my-2'%>
+
+ <%= t("b_clear")%>
+
+ <% end %>
+
+
+
+
+
+
+
diff --git a/app/views/admin/room/new.turbo_stream.erb b/app/views/admin/room/new.turbo_stream.erb
new file mode 100644
index 0000000..e993dcc
--- /dev/null
+++ b/app/views/admin/room/new.turbo_stream.erb
@@ -0,0 +1,3 @@
+<%= turbo_stream.update "modal-title", t('admin.room.new') %>
+<%= turbo_stream.update "modal-body", partial: "shared/admin/form/room",
+ locals: {path: admin_room_index_path, room: @room } %>
diff --git a/app/views/admin/room/update.turbo_stream.erb b/app/views/admin/room/update.turbo_stream.erb
new file mode 100644
index 0000000..3ba4d15
--- /dev/null
+++ b/app/views/admin/room/update.turbo_stream.erb
@@ -0,0 +1 @@
+<%= turbo_stream.dispatch_event "modalClose" %>
diff --git a/app/views/admin/service/create.turbo_stream.erb b/app/views/admin/service/create.turbo_stream.erb
new file mode 100644
index 0000000..3ba4d15
--- /dev/null
+++ b/app/views/admin/service/create.turbo_stream.erb
@@ -0,0 +1 @@
+<%= turbo_stream.dispatch_event "modalClose" %>
diff --git a/app/views/admin/service/edit.turbo_stream.erb b/app/views/admin/service/edit.turbo_stream.erb
new file mode 100644
index 0000000..4ebae7e
--- /dev/null
+++ b/app/views/admin/service/edit.turbo_stream.erb
@@ -0,0 +1,3 @@
+<%= turbo_stream.update "modal-title", t('.edit_service') %>
+<%= turbo_stream.update "modal-body", partial: "shared/admin/form/service",
+ locals: {path: admin_service_path(@service), service: @service } %>
diff --git a/app/views/admin/service/index.html.erb b/app/views/admin/service/index.html.erb
new file mode 100644
index 0000000..7c2cc5d
--- /dev/null
+++ b/app/views/admin/service/index.html.erb
@@ -0,0 +1,117 @@
+<% provide :page_title, "Службы" %>
+<%= render 'shared/admin/navbar/admin', selected: "user" %>
+<%= render 'shared/flash_alert' %>
+
+
+
+
+
+
+
+
+ <%= pagination @pagy %>
+
+
+
+
+
+
+ <%= render 'shared/admin/navbar/user_navbar', selected: "service" %>
+
+
+
+ <%= render 'shared/modal_button_add', path: new_admin_service_path, classes: "btn btn-primary w-100", text: t("b_add") %>
+
+
+ + ++
+ <%= search_form_for(@query, url: admin_service_index_path, method: :get, class: "rounded accordion-body") do |f| %>
+
+
+ <%= f.label :name, class: "mb-1" %>
+ <%= f.search_field :name_cont, class:"form-control mb-2", placeholder:"Название" %>
+ <%= f.label :division_id %>
+ <%= f.search_field :division_name_cont, class:"form-control mb-2", placeholder:"Подразделение" %>
+ <%= f.label :organization_id %>
+ <%= f.collection_select(:organization_id_eq, Organization.all,
+ :id, :name, {:include_blank => t('combobox_blank')}, {:class =>'form-select mb-2'}) %>
+ <%= f.label :building_id %>
+ <%= f.search_field :building_name_cont, class:"form-control mb-2", placeholder:"Здание" %>
+
+ <%= f.submit t('b_accept'), class: 'btn btn-primary w-100 my-2'%>
+
+ <%= t("b_clear")%>
+
+ <% end %>
+
+
+
+
+
+
+
diff --git a/app/views/admin/service/new.turbo_stream.erb b/app/views/admin/service/new.turbo_stream.erb
new file mode 100644
index 0000000..ec98616
--- /dev/null
+++ b/app/views/admin/service/new.turbo_stream.erb
@@ -0,0 +1,3 @@
+<%= turbo_stream.update "modal-title", t('.add_service') %>
+<%= turbo_stream.update "modal-body", partial: "shared/admin/form/service",
+ locals: {path: admin_service_index_path, service: @service } %>
diff --git a/app/views/admin/service/update.turbo_stream.erb b/app/views/admin/service/update.turbo_stream.erb
new file mode 100644
index 0000000..3ba4d15
--- /dev/null
+++ b/app/views/admin/service/update.turbo_stream.erb
@@ -0,0 +1 @@
+<%= turbo_stream.dispatch_event "modalClose" %>
diff --git a/app/views/admin/supplementary_kit/index.html.erb b/app/views/admin/supplementary_kit/index.html.erb
index c9a8434..f3dd2df 100644
--- a/app/views/admin/supplementary_kit/index.html.erb
+++ b/app/views/admin/supplementary_kit/index.html.erb
@@ -1,9 +1,9 @@
<% provide :page_title, "Наборы" %>
<%= render 'shared/admin/navbar/admin', selected: "device" %>
-<%= render 'shared/admin/navbar/device_bread', selected: "supplementary_kit" %>
<%= render 'shared/flash_alert' %>
-
+
+
+
+
+
+
+
+ <%= pagination @pagy %>
+
+
+
-
+
+
+ <%= render 'shared/admin/navbar/device_bread', selected: "supplementary_kit" %>
@@ -14,28 +14,16 @@
-
@@ -43,8 +31,9 @@
-
<% end %>
- <%= f.label :name %>
- <%= f.search_field :name_cont, class:"form-control", placeholder:"БДЗБ" %>
-
-
- <%= f.label :serial_id %>
- <%= f.search_field :serial_id_cont, class:"form-control", placeholder:"0-123-N" %>
-
-
- <%= f.label :description %>
- <%= f.search_field :description_cont, class:"form-control", placeholder:"Набор для..." %>
-
+ <%= f.label :name %>
+ <%= f.search_field :name_cont, class:"form-control mb-2", placeholder:"БДЗБ" %>
+ <%= f.label :serial_id %>
+ <%= f.search_field :serial_id_cont, class:"form-control mb-2", placeholder:"0-123-N" %>
+ <%= f.label :description %>
+ <%= f.search_field :description_cont, class:"form-control mb-2", placeholder:"Набор для..." %>
+ <%= f.submit t('b_accept'), class: 'my-2 btn btn-primary w-100'%>
+
+ <%= t("b_clear")%>
-
-
- <%= f.submit t('b_accept'), class: 'col btn btn-primary w-100'%>
-
- <%= t("b_clear")%>
-
-
- |
<%=t('activerecord.attributes.user.tabel_id')%> | <%=t('activerecord.attributes.user.last_name')%> | <%=t('activerecord.attributes.user.first_name')%> | @@ -120,9 +88,9 @@<%= user.first_name %> | <%= user.second_name %> | <%= user.role %> | -<%= user.email %> | -<%= user.phone %> | -<%= user.service.name %> | +<%= user.email %> | +<%= user.phone %> | +<%= user.service.name %> | <%= formatted_date(user.created_at, :short_full) %> | <%= formatted_date(user.updated_at, :short_full) %> |
@@ -158,3 +126,16 @@
+
diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb
index 1bdecb3..5408152 100644
--- a/app/views/devise/sessions/new.html.erb
+++ b/app/views/devise/sessions/new.html.erb
@@ -1,4 +1,14 @@
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 397b2c0..ce2fb7b 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -1,5 +1,5 @@
-
+
<%= image_tag "atom-logo.svg", class: "mx-1", width: "32", height: "32", alt: "avatar" %>
diff --git a/app/views/shared/_about.html.erb b/app/views/shared/_about.html.erb
index c6efe8a..4c3a2cb 100644
--- a/app/views/shared/_about.html.erb
+++ b/app/views/shared/_about.html.erb
@@ -15,17 +15,26 @@
diff --git a/app/views/shared/_modal.html.erb b/app/views/shared/_modal.html.erb
index 9cd0d27..db536a6 100644
--- a/app/views/shared/_modal.html.erb
+++ b/app/views/shared/_modal.html.erb
@@ -1,6 +1,6 @@
- Вся платформа и её компоненты распространяется по лицензии <%= link_to "GNU GPLv3", license_path(:ru) %>, являеются open-source продуктом и разрабатывается силами сообщества. + Наши репозитории: внешний, локальное зеркало - Наш репозиторий digital-armstrong + Баги и преложения сюда: + внешний, + локальное зеркало. Разработчики:
+
+ Вся платформа и её компоненты распространяется по лицензии <%= link_to "GNU GPLv3", license_path(:ru) %>, являеются open-source продуктом и разрабатывается силами сообщества. + +
+ class="d-none position-fixed top-50 start-50 overflow-auto translate-middle align-items-center justify-content-center"
+ style="z-index: 9999; " id="modal">
diff --git a/app/views/shared/admin/form/_building.html.erb b/app/views/shared/admin/form/_building.html.erb
new file mode 100644
index 0000000..e3158bf
--- /dev/null
+++ b/app/views/shared/admin/form/_building.html.erb
@@ -0,0 +1,10 @@
+<%= simple_form_for building, as: :building, url: path,
+ class: "form-group row" do |f| %>
+
+ <%= f.input :name, placeholder: t('.placeholders.name'), input_html: { :tabindex => 1 }%>
+ <%= f.input :description, placeholder: t('.placeholders.description'), input_html: { :tabindex => 2 } %>
+ <%= f.association :organization, input_html: { :tabindex => 3 } %>
+
+
+ <%= render 'shared/form/actions', f:f %>
+<% end %>
diff --git a/app/views/shared/admin/form/_control_point.html.erb b/app/views/shared/admin/form/_control_point.html.erb
new file mode 100644
index 0000000..2c41434
--- /dev/null
+++ b/app/views/shared/admin/form/_control_point.html.erb
@@ -0,0 +1,38 @@
+<%= simple_form_for control_point, as: :control_point, url: path,
+ class: "form-group row" do |f| %>
+
+
+
+ <%= render 'shared/form/actions', f:f %>
+<% end %>
diff --git a/app/views/shared/admin/form/_division.html.erb b/app/views/shared/admin/form/_division.html.erb
new file mode 100644
index 0000000..f0fb911
--- /dev/null
+++ b/app/views/shared/admin/form/_division.html.erb
@@ -0,0 +1,9 @@
+<%= simple_form_for division, as: :division, url: path,
+ class: "form-group row" do |f| %>
+
+ <%= f.input :name, placeholder: 'Название точки контроля', input_html: {:tabindex => 1}%>
+ <%= f.label :room, class: "mb-2" %>
+
+
+
+ <%= f.label :device, class: "mb-2" %>
+
+ <%= f.association :room, label: false, input_html: {:tabindex => 2} %>
+
+
+ <%= render 'shared/modal_button_add', path: new_admin_control_point_path, classes: "btn btn-ligth", text: nil %>
+
+
+
+ <%= f.input :description, placeholder: 'Описание точки контроля', input_html: {:tabindex => 4}%>
+ <% if current_user.admin? %>
+
+ <%= f.association :device, label: false, input_html: {:tabindex => 3},
+ label_method: ->(device) { "#{device.tabel_id}\t-\t#{device.device_model.name}" } %>
+
+
+ <%= render 'shared/modal_button_add', path: new_admin_control_point_path, classes: "btn btn-ligth", text: nil %>
+
+
+ <%= f.association :service, input_html: {:tabindex => 9}, include_blank: false %>
+
+ <% else %>
+ <%= f.input :service_id, label: false, input_html: {hidden: true, value: current_user.service_id} %>
+ <% end %>
+
+
+ <%= f.input :name, placeholder: 'Название подразделения', input_html: {:tabindex => 1}%>
+ <%= f.association :organization, input_html: {:tabindex => 2}, include_blank: false %>
+
+
+ <%= render 'shared/form/actions', f:f %>
+<% end %>
diff --git a/app/views/shared/admin/form/_organization.html.erb b/app/views/shared/admin/form/_organization.html.erb
new file mode 100644
index 0000000..e5dd220
--- /dev/null
+++ b/app/views/shared/admin/form/_organization.html.erb
@@ -0,0 +1,13 @@
+<%= simple_form_for organization, as: :organization, url: path,
+ class: "form-group row" do |f| %>
+
+ <%= f.input :name, label: t('.labels.name'), placeholder: t('.placeholders.name'), input_html: {:tabindex => 1}%>
+ <%= f.input :full_address, label: t('.labels.full_address'), placeholder: t('.placeholders.full_address'), input_html: {:tabindex => 1}%>
+ <%= f.input :zip_code, label: t('.labels.zip_code'), placeholder: t('.placeholders.zip_code'), input_html: {:tabindex => 1}%>
+ <%= f.input :phone, label: t('.labels.phone'), placeholder: t('.placeholders.phone'), input_html: {:tabindex => 1}%>
+ <%= f.input :fax, label: t('.labels.fax'), placeholder: t('.placeholders.fax'), input_html: {:tabindex => 1}%>
+ <%= f.input :email, label: t('.labels.email'), placeholder: t('.placeholders.email'), input_html: {:tabindex => 1}%>
+
+
+ <%= render 'shared/form/actions', f:f %>
+<% end %>
diff --git a/app/views/shared/admin/form/_room.html.erb b/app/views/shared/admin/form/_room.html.erb
new file mode 100644
index 0000000..a8f9eb7
--- /dev/null
+++ b/app/views/shared/admin/form/_room.html.erb
@@ -0,0 +1,11 @@
+<%= simple_form_for room, as: :room, url: path,
+ class: "form-group row" do |f| %>
+
+ <%= f.input :name, placeholder: t('.placeholders.name'), input_html: { :tabindex => 1 }%>
+ <%= f.input :level, placeholder: t('.placeholders.level'), input_html: { :tabindex => 2} %>
+ <%= f.input :description, placeholder: t('.placeholders.description'), input_html: { :tabindex => 3 } %>
+ <%= f.association :building, input_html: { :tabindex => 4 } %>
+
+
+ <%= render 'shared/form/actions', f:f %>
+<% end %>
diff --git a/app/views/shared/admin/form/_service.html.erb b/app/views/shared/admin/form/_service.html.erb
new file mode 100644
index 0000000..a1cb3fa
--- /dev/null
+++ b/app/views/shared/admin/form/_service.html.erb
@@ -0,0 +1,12 @@
+<%= simple_form_for service, as: :service, url: path,
+ class: "form-group row" do |f| %>
+
+ <%= f.input :name, placeholder: 'Название службы', input_html: {:tabindex => 1}%>
+ <%= f.association :organization, input_html: { :tabindex => 2}, include_blank: false %>
+ <%= f.association :division, input_html: { :tabindex => 3 }, include_blank: false %>
+ <%= f.association :building, input_html: { :tabindex => 4}, include_blank: false %>
+
+
+
+ <%= render 'shared/form/actions', f:f %>
+<% end %>
diff --git a/app/views/shared/admin/navbar/_admin.html.erb b/app/views/shared/admin/navbar/_admin.html.erb
index 91e624a..c4b4588 100644
--- a/app/views/shared/admin/navbar/_admin.html.erb
+++ b/app/views/shared/admin/navbar/_admin.html.erb
@@ -6,4 +6,7 @@
+
<% selected = local_assigns[:selected] %>
- <%= link_to 'Приборы', admin_device_index_path, class: "px-0 col btn #{ 'btn-primary' if selected == 'device' }" %>
- <%= link_to 'Модели', admin_device_model_index_path, class: "px-0 col btn #{ 'btn-primary' if selected == 'device_model' }" %>
- <%= link_to 'Компоненты', admin_device_component_index_path, class: "px-0 col btn #{ 'btn-primary' if selected == 'device_component' }" %>
- <%= link_to 'Наборы', admin_supplementary_kit_index_path, class: "px-0 col btn #{ 'btn-primary' if selected == 'supplementary_kit' }" %>
- <%= link_to 'Рег.группы', admin_device_reg_group_index_path, class: "px-0 col btn #{ 'btn-primary' if selected == 'device_reg_group' }" %>
- <%= link_to 'Производители', admin_manufacturer_index_path, class: "px-0 col btn #{ 'btn-primary' if selected == 'manufacturer' }" %>
- <%= link_to 'Классы измерений', admin_measurement_class_index_path, class: "px-0 col btn #{ 'btn-primary' if selected == 'measurement_class' }" %>
- <%= link_to 'Группы измерений', admin_measurement_group_index_path, class: "px-0 col btn #{ 'btn-primary' if selected == 'measurement_group' }" %>
+
diff --git a/app/views/shared/admin/navbar/_location_navbar.html.erb b/app/views/shared/admin/navbar/_location_navbar.html.erb
new file mode 100644
index 0000000..1a9db7d
--- /dev/null
+++ b/app/views/shared/admin/navbar/_location_navbar.html.erb
@@ -0,0 +1,18 @@
+
+ <%= link_to admin_device_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'device' } text-start" do %>
+ <%= 'Приборы' %>
+ <% end %>
+
+
+ <%= link_to admin_device_model_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'device_model' } text-start" do %>
+ <%= 'Модели' %>
+ <% end %>
+
+
+ <%= link_to admin_device_component_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'device_component' } text-start" do %>
+ <%= 'Компоненты' %>
+ <% end %>
+
+
+ <%= link_to admin_supplementary_kit_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'supplementary_kit' } text-start" do %>
+ <%= 'Наборы' %>
+ <% end %>
+
+
+ <%= link_to admin_device_reg_group_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'device_reg_group' } text-start" do %>
+ <%= 'Рег.группы' %>
+ <% end %>
+
+
+ <%= link_to admin_manufacturer_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'manufacturer' } text-start" do %>
+ <%= 'Производители' %>
+ <% end %>
+
+
+ <%= link_to admin_measurement_class_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'measurement_class' } text-start" do %>
+ <%= 'Классы измерений' %>
+ <% end %>
+
+
+ <%= link_to admin_measurement_group_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'measurement_group' } text-start" do %>
+ <%= 'Группы измерений' %>
+ <% end %>
+
+ <% selected = local_assigns[:selected] %>
+
diff --git a/app/views/shared/admin/navbar/_user_navbar.html.erb b/app/views/shared/admin/navbar/_user_navbar.html.erb
new file mode 100644
index 0000000..4252d7b
--- /dev/null
+++ b/app/views/shared/admin/navbar/_user_navbar.html.erb
@@ -0,0 +1,23 @@
+
+ <%= link_to admin_control_point_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'control_point' } text-start" do %>
+ <%= 'Точки контроля' %>
+ <% end %>
+
+
+ <%= link_to admin_room_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'room' } text-start" do %>
+ <%= 'Помещения' %>
+ <% end %>
+
+
+ <%= link_to admin_building_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'building' } text-start" do %>
+ <%= 'Здания' %>
+ <% end %>
+
+
+ <% selected = local_assigns[:selected] %>
+
diff --git a/app/views/shared/index/_device.html.erb b/app/views/shared/index/_device.html.erb
index 9013d35..d9af8d5 100644
--- a/app/views/shared/index/_device.html.erb
+++ b/app/views/shared/index/_device.html.erb
@@ -1,7 +1,10 @@
<% provide :page_title, "Приборы" %>
<% show_path = show_path.from(0).to(show_path.length-2) %>
+ <%= link_to admin_users_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'user' } text-start" do %>
+ <%= 'Пользователи' %>
+ <% end %>
+
+
+ <%= link_to admin_service_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'service' } text-start" do %>
+ <%= 'Службы' %>
+ <% end %>
+
+
+ <%= link_to admin_division_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'division' } text-start" do %>
+ <%= 'Подразделения' %>
+ <% end %>
+
+
+ <%= link_to admin_organization_index_path, class: "btn btn-sm w-100 #{ 'btn-primary' if selected == 'organization' } text-start" do %>
+ <%= 'Организации' %>
+ <% end %>
+
+
-
+
+ <% if current_page?(admin_device_index_path) %>
+ <%= render 'shared/admin/navbar/device_bread', selected: "device" %>
+ <% end %>
@@ -70,7 +73,7 @@ <%=t('b_download_pdf')%> <% end %>
+ |
---|