---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---

```{r setup, include=FALSE}

#TODO: Adjust correctly for the docker container
subfolder = "01_data/raw"

library("flexdashboard")
library("leaflet")
library("htmlwidgets")
library("lubridate")
library("jsonlite")
library("dplyr")
library("knitr")
library("kableExtra")

```

Column {data-width=500}
-----------------------------------------------------------------------

### Chart A

```{r}
# Here goes the code for the leaflet

source("/Users/alexanderunger/Desktop/AIDAHO_IDS_THAS/02_code/R/api/docker_script.R")
source("/Users/alexanderunger/Desktop/AIDAHO_IDS_THAS/02_code/R/api/4a.R")


coords= jobs_on_date %>% select(arbeitsort.koordinaten.lon,arbeitsort.koordinaten.lat)

themap = coords %>%
  as.matrix() %>%
  leaflet() %>%
  addTiles() %>%
  addCircles()
themap

```


Column {data-width=500}
-----------------------------------------------------------------------

### Table A

```{r}
# Here goes the code for the table
most_recent10 <- function(df) {
  # Sort the DataFrame by 'modifikationsTimestamp' in descending order and select the top 10
  recent_jobs <- df %>%
    arrange(desc(modifikationsTimestamp)) %>%
    slice_head(n = 10) %>%
    select(aktuelleVeroeffentlichungsdatum, beruf, titel, arbeitgeber)
  
  return(recent_jobs)
}


#use the function
recent_10_jobs <- most_recent10(jobs_on_date)
print(recent_10_jobs)
#print(recent_10_jobs)
```

