TAK-76 firms
This commit is contained in:
parent
cd76c43a09
commit
183c98b283
@ -5,6 +5,7 @@ library(ggplot2)
|
||||
library(plotly)
|
||||
library(DT)
|
||||
library(shinyjs)
|
||||
library(leaflet)
|
||||
|
||||
#source(".R/home_module.R",encoding="utf-8")
|
||||
#source(".R/about_module.R",encoding="utf-8")
|
||||
|
@ -27,18 +27,20 @@ firmyUI <- function(id) {
|
||||
|
||||
fluidRow(
|
||||
column(12, align="center",
|
||||
h1('Firmy')
|
||||
)
|
||||
),
|
||||
|
||||
fluidRow(column(4,
|
||||
div(div("GlaxoSmithKline"),img(src="gsk.png", a("GlaxoSmithKline" ,href= "https://pl.gsk.com/pl/"),height = 150, width = 150)))%>% tagAppendAttributes(class = 'column-tile'),
|
||||
column(4,
|
||||
div(div("Bayer"),img(src="bayer.png", a("Bayer",href="https://www.bayer.com/pl/pl/poland-home"), height = 150, width = 150)))%>% tagAppendAttributes(class = 'column-tile'),
|
||||
column(4,
|
||||
div(div("BioFarm"),img(src="biofarm.png", a("BioFarm",href= "https://www.biofarm.pl"),height = 150, width = 150)))%>% tagAppendAttributes(class = 'column-tile')
|
||||
)),
|
||||
uiOutput("firms"),
|
||||
|
||||
) %>% tagAppendAttributes(id = 'row-tiles'),
|
||||
|
||||
|
||||
# fluidRow(column(4,
|
||||
# div(div("GlaxoSmithKline"),img(src="gsk.png", a("GlaxoSmithKline" ,href= "https://pl.gsk.com/pl/"),height = 150, width = 150)))%>% tagAppendAttributes(class = 'column-tile'),
|
||||
# column(4,
|
||||
# div(div("Bayer"),img(src="bayer.png", a("Bayer",href="https://www.bayer.com/pl/pl/poland-home"), height = 150, width = 150)))%>% tagAppendAttributes(class = 'column-tile'),
|
||||
# column(4,
|
||||
# div(div("BioFarm"),img(src="biofarm.png", a("BioFarm",href= "https://www.biofarm.pl"),height = 150, width = 150)))%>% tagAppendAttributes(class = 'column-tile')
|
||||
#
|
||||
# ) %>% tagAppendAttributes(id = 'row-tiles'),
|
||||
|
||||
|
||||
|
||||
@ -52,8 +54,81 @@ firmyUI <- function(id) {
|
||||
)
|
||||
}
|
||||
|
||||
firmyServer <- function(input, output) {
|
||||
firmyServer <- function(input, output,session) {
|
||||
|
||||
observe({
|
||||
|
||||
if(get_page()=="firms"){
|
||||
run = paste('Shiny.onInputChange("pageFIRMS","',timestamp(),'");',sep="")
|
||||
shinyjs::runjs(run)
|
||||
|
||||
}})
|
||||
|
||||
componentFirms<-eventReactive(input$pageFIRMS,{
|
||||
|
||||
|
||||
r<-httr::GET("http://localhost:8080/api/firms/all",encode = 'json')
|
||||
|
||||
r
|
||||
|
||||
})
|
||||
|
||||
output$firms<-renderUI({
|
||||
r<-componentFirms()
|
||||
# if(length(input$currentPage)!=0 && input$currentPage=="firms"){
|
||||
# r<-httr::GET("http://localhost:8080/api/companies/all",add_headers(Authorization=paste("Bearer",input$token,sep=" ")),encode = 'json')
|
||||
companies = content(r)$companies
|
||||
# print(content(r))
|
||||
for(i in companies){
|
||||
print(i)
|
||||
}
|
||||
|
||||
exampleMap1 = leaflet() %>%
|
||||
setView(companies[[1]]$companyData$latitude, companies[[1]]$companyData$longitude, zoom = 16) %>%
|
||||
addTiles() %>%
|
||||
addMarkers(companies[[1]]$companyData$latitude, companies[[1]]$companyData$longitude, popup = "Poznań")
|
||||
|
||||
exampleMap2 = leaflet() %>%
|
||||
setView(companies[[2]]$companyData$latitude, companies[[2]]$companyData$longitude, zoom = 16) %>%
|
||||
addTiles() %>%
|
||||
addMarkers(companies[[2]]$companyData$latitude, companies[[2]]$companyData$longitude, popup = "Poznań")
|
||||
#
|
||||
exampleMap3 = leaflet() %>%
|
||||
setView(companies[[3]]$companyData$latitude, companies[[3]]$companyData$longitude, zoom = 16) %>%
|
||||
addTiles() %>%
|
||||
addMarkers(companies[[3]]$companyData$latitude, companies[[3]]$companyData$longitude, popup = "Poznań")
|
||||
|
||||
fluidRow(
|
||||
column(12,
|
||||
|
||||
wellPanel(column(2,img(src="gsk.png", height = 150, width = 150)),
|
||||
column(6,
|
||||
h2(companies[[1]]$companyData$name),
|
||||
h3(companies[[1]]$companyData$email),
|
||||
h3(companies[[1]]$companyData$address)),
|
||||
column(4,exampleMap1)),
|
||||
wellPanel(column(2,img(src="bayer.png", height = 150, width = 150)),
|
||||
column(6,
|
||||
h2(companies[[2]]$companyData$name),
|
||||
h3(companies[[2]]$companyData$email),
|
||||
h3(companies[[2]]$companyData$address)),
|
||||
column(4,exampleMap2)),
|
||||
wellPanel(column(2,img(src="biofarm.png", height = 150, width = 150)),
|
||||
column(6,
|
||||
h2(companies[[3]]$companyData$name),
|
||||
h3(companies[[3]]$companyData$email),
|
||||
h3(companies[[3]]$companyData$address)),
|
||||
column(4,exampleMap3)),
|
||||
|
||||
|
||||
|
||||
)%>% tagAppendAttributes(id = 'column-firms')
|
||||
|
||||
) %>% tagAppendAttributes(id = 'row-firms')
|
||||
# actionButton("asdasdasd","asd")
|
||||
|
||||
# }
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ klasyserver <- function(input, output,session) {
|
||||
|
||||
g=ggplot(d, aes(x,y,fill=x))+
|
||||
geom_col()+
|
||||
labs(x="",y="Prawdopodobieñstwo [%]")
|
||||
labs(x="",y="Prawdopodobieństwo [%]")
|
||||
ggplotly(g)
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ router <- make_router(
|
||||
route("register", register_page,registerServer),
|
||||
route("calculator", calculator_page, calculatorServer),
|
||||
route("iota", calculatorView_page, calculatorViewServer),
|
||||
route("firms", firmy_page, firmyServer)
|
||||
route("firms", firmy_page, firmyServer),
|
||||
route("klasyfikator",klas_page,klasyserver)
|
||||
|
||||
)
|
||||
|
@ -408,6 +408,37 @@ table.dataTable th{
|
||||
display:none!important;
|
||||
}
|
||||
|
||||
#firms{
|
||||
background-color: #C7F9CC;
|
||||
}
|
||||
|
||||
#column-firms > .well{
|
||||
|
||||
display:flex;
|
||||
flex-direction:row;
|
||||
|
||||
flex-wrap:wrap;
|
||||
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.25), -2px -2px 4px rgba(0, 0, 0, 0.25);
|
||||
#background-color:#00A896!important;
|
||||
}
|
||||
|
||||
#column-firms > .well >div:nth-child(2){
|
||||
#height:100%;
|
||||
border-right:1.5px dashed #00A896;
|
||||
border-left:1.5px dashed #00A896;
|
||||
}
|
||||
#column-firms > .well >div{
|
||||
padding-left:15px;
|
||||
padding-right:15px;
|
||||
}
|
||||
#column-firms > .well div{
|
||||
|
||||
display:flex!important;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 767px) {
|
||||
body >.container-fluid{
|
||||
|
@ -60,6 +60,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers("/profile**").hasAnyAuthority("COMP","IND")
|
||||
.antMatchers("/login").anonymous()
|
||||
.antMatchers("/register").anonymous()
|
||||
.antMatchers("/firms/all").anonymous()
|
||||
.and()
|
||||
.formLogin()
|
||||
.loginPage("/login")
|
||||
|
@ -6,7 +6,9 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import project.DTO.CompanyProfileDTO;
|
||||
import project.DTO.PredictionDTO;
|
||||
import project.model.CompanyProfile;
|
||||
import project.services.CompanyProfileService;
|
||||
import project.services.GeneratorDTO;
|
||||
|
||||
@ -14,7 +16,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@ -27,15 +31,22 @@ public class CompanyProfileController {
|
||||
private GeneratorDTO generatorDTO;
|
||||
|
||||
|
||||
|
||||
@PreAuthorize("isAnonymous()")
|
||||
@RequestMapping(value = "/all",method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<Map<String,Object>> getAllCompanies(HttpServletRequest request,
|
||||
HttpServletResponse httpServletResponse){
|
||||
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
// map.put("companies",new Integer(1));
|
||||
// return new ResponseEntity<>(map, HttpStatus.OK);
|
||||
try{
|
||||
map.put("companies",companyProfileService.getAllCompanies());
|
||||
List<CompanyProfileDTO> companyProfileDTOS = new ArrayList<>();
|
||||
for (CompanyProfile cp:companyProfileService.getAllCompanies()) {
|
||||
companyProfileDTOS.add(generatorDTO.generateCompanyProfileDTO(cp));
|
||||
|
||||
}
|
||||
map.put("companies",companyProfileDTOS);
|
||||
return new ResponseEntity<>(map, HttpStatus.OK);
|
||||
}catch(Exception e){
|
||||
map.put("companies",null);
|
||||
|
@ -44,6 +44,7 @@ public class CompanyProfileServiceImpl implements CompanyProfileService {
|
||||
|
||||
@Override
|
||||
public List<CompanyProfile> getAllCompanies() {
|
||||
System.out.println(companyProfileRepository.findAll().size());
|
||||
return companyProfileRepository.findAll();
|
||||
}
|
||||
// @Override
|
||||
|
Loading…
Reference in New Issue
Block a user