add api implementation

This commit is contained in:
Siddharth Jain 2025-05-23 12:27:58 -04:00
parent e3dd39b5df
commit 5606f7fa69
114 changed files with 3202 additions and 0 deletions

View file

@ -0,0 +1,38 @@
<%= form_with url: root_path, method: :get, local: true do |f| %>
<div>
<%= label_tag :org_type, "Report Type" %>
<%= select_tag :org_type, options_for_select(@filters[:org_types], @selected[:org_type]) %>
<%= label_tag :sy, "School Year" %>
<%= select_tag :sy, options_for_select(@filters[:school_years], @selected[:sy]) %>
<%= label_tag :grad_rate_type, "Graduation Rate Type" %>
<%= select_tag :grad_rate_type, options_for_select(@filters[:rate_types], @selected[:grad_rate_type]) %>
<%= label_tag :stu_grp, "Student Group" %>
<%= select_tag :stu_grp, options_for_select(@filters[:student_groups], @selected[:stu_grp]) %>
<%= submit_tag "Filter" %>
</div>
<% end %>
<% if @data.present? %>
<table>
<thead>
<tr><% @data.first.keys.each do |key| %><th><%= key %></th><% end %></tr>
</thead>
<tbody>
<% @data.each do |row| %>
<tr><% row.each { |_, value| %><td><%= value %></td><% } %></tr>
<% end %>
</tbody>
</table>
<%= link_to "Download CSV", download_csv_path(request.query_parameters), class: "button" %>
<%= link_to "Download PDF", download_pdf_path(request.query_parameters), class: "button" %>
<% else %>
<% if @selected.present? %>
<p>No data found for the selected combination.</p>
<% end %>
<% end %>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<title><%= content_for(:title) || "Myapp" %></title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= yield :head %>
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
<link rel="icon" href="/icon.png" type="image/png">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/icon.png">
<%# Includes all stylesheet files in app/assets/stylesheets %>
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
</head>
<body>
<%= yield %>
</body>
</html>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
/* Email styles need to be inline */
</style>
</head>
<body>
<%= yield %>
</body>
</html>

View file

@ -0,0 +1 @@
<%= yield %>

View file

@ -0,0 +1,22 @@
{
"name": "Myapp",
"icons": [
{
"src": "/icon.png",
"type": "image/png",
"sizes": "512x512"
},
{
"src": "/icon.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
}
],
"start_url": "/",
"display": "standalone",
"scope": "/",
"description": "Myapp.",
"theme_color": "red",
"background_color": "red"
}

View file

@ -0,0 +1,26 @@
// Add a service worker for processing Web Push notifications:
//
// self.addEventListener("push", async (event) => {
// const { title, options } = await event.data.json()
// event.waitUntil(self.registration.showNotification(title, options))
// })
//
// self.addEventListener("notificationclick", function(event) {
// event.notification.close()
// event.waitUntil(
// clients.matchAll({ type: "window" }).then((clientList) => {
// for (let i = 0; i < clientList.length; i++) {
// let client = clientList[i]
// let clientPath = (new URL(client.url)).pathname
//
// if (clientPath == event.notification.data.path && "focus" in client) {
// return client.focus()
// }
// }
//
// if (clients.openWindow) {
// return clients.openWindow(event.notification.data.path)
// }
// })
// )
// })