Dispensary Map The Maryland Cannabis Administration has issued licenses for the Adult-Use and Medical Marketplace to the dispensaries shown on this page. A full listing can be viewed at: https://cannabis.maryland.gov/Pages/Dispensaries.aspx

Column

Dispensary Map

Dispensary Table

---
title: "MCA Approved Dispensary Locations"
output:
  flexdashboard::flex_dashboard:
    social: menu
    orientation: columns
    vertical_layout: fill
    logo: MCA_White_Logo.png
    source: embed
    theme: paper
runtime: shiny
---
<script>
$('.navbar-logo').wrap('<a href="https://cannabis." target=blank>');
</script>

<style>
.dataTables_scrollBody {
    height:400px !important;
    max-height:400px !important;
}
.chart-stage-flex {
    overflow:auto !important;
}
</style>


```{r setup, include=FALSE}
library(readr) # read in csv files
library(tidyverse) # many useful syntax and QOL functions
library(janitor) # cleans up column names
library(knitr) # for RMarkdown to HTML
library(rmarkdown) # to generate Rmd final document
library(flexdashboard) # to generate Rmd dashboard
library(sf) # simple features for mapping
library(leaflet) # creates interactive maps
library(readxl)
library(DT)

output <- readRDS("output_file.RDS")
disp.tbl <- readRDS("disp_table.RDS")
```

**Dispensary Map**
The Maryland Cannabis Administration has issued licenses for the Adult-Use and Medical Marketplace to the dispensaries shown on this page. A full listing can be viewed at: <https://cannabis.maryland.gov/Pages/Dispensaries.aspx>

Column {data-width=350 .tabset .tabset-fade}
-----------------------------------------------------------------------

### Dispensary Map

```{r}
library(leaflet)
library(leaflet.extras)
marketIcons <- awesomeIconList(
  "Medical & Adult Use" = makeAwesomeIcon(text = fa("cannabis"), markerColor = "red"),
  "Medical Only" = makeAwesomeIcon(text = fa("circle-plus"), markerColor = "blue")
)

popup <- paste0(output$name, "<br>", "DBA: ", output$dba, "<br>", "License #: ",
                output$license_number, "<br>", output$Address, " ",
                output$Address_2, "<br>", output$City,  ", ", output$State, " ",
                output$Zip, "-", output$Zip_4, "<br>", "Market: ", output$au_med, "<br>",
                '<img src="', output$logo_url, '" alt="Dispensary Logo" width="75"><br>', 
                '<a href="', output$url, '">Website</a>')
leaflet(data = output) %>% addProviderTiles("CartoDB.Positron") %>% 
  addAwesomeMarkers(~long, ~lat, popup = popup, label = ~as.character(dba), icon = ~marketIcons[au_med],
                    group = "markers") %>%
  addSearchFeatures(
    targetGroups = "markers", # group should match addMarkers() group
    options = searchFeaturesOptions(
      zoom=12, openPopup = TRUE, firstTipSubmit = TRUE, autoCollapse = TRUE,
      hideMarkerOnCollapse = TRUE
    )
  )


```

### Dispensary Table
```{r}
datatable(disp.tbl, rownames = FALSE, extensions = 'Buttons', caption = htmltools::tags$caption('Approved Dispensary Licensees', style="font-size:150%"), options = list(pageLength = 100, dom = 'Bfrtip', fillContainer = FALSE, scrollCollapse = FALSE, buttons = c('copy', 'csv', 'excel', 'pdf', 'print'), columnDefs = list(list(className = 'dt-center', targets = "_all"))), colnames = c("Business Name", "DBA", "Website", "Address", "Market"))
```