Skip to content

Commit

Permalink
Merge pull request #273 from babyfeed/feat/new_external_resources_pag…
Browse files Browse the repository at this point in the history
…e_with_events

Feat/new external resources page with events
  • Loading branch information
TomasPabloFerreira authored Jun 19, 2024
2 parents 883cd25 + 3b2895d commit 7c9ca69
Show file tree
Hide file tree
Showing 20 changed files with 496 additions and 1,077 deletions.
12 changes: 3 additions & 9 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ import { GrowthPageComponent } from './pages/growth/growth-page.component';
import { HomePageComponent } from './pages/home-page/home-page.component';
import { ResearchParentalChartComponent } from './pages/research-parental-chart/research-parental-chart.component';
import {AdminresultsComponent} from './pages/admin-results/adminresults.component';
import { EducationalResourcesENComponent } from './pages/educational-resources-en/educational-resources-en.component';
import { EducationalResourcesESComponent } from './pages/educational-resources-es/educational-resources-es.component';
import { AdminExternalResourcesComponent } from './pages/admin-resources/admin-resources.component';
import { ClinicGrowthPage } from './pages/clinic-growth/clinic-growth-page.component';
import { EducationalResourcesPage } from './pages/educational-resources/educational-resources-page.component';


const routes: Routes = [
Expand Down Expand Up @@ -287,20 +286,15 @@ const routes: Routes = [
component: QuestionnairePageComponent
},
{
path: 'parent/educational-resources-en',
component: EducationalResourcesENComponent,
path: 'parent/educational-resources',
component: EducationalResourcesPage,
canActivate: [AuthGuard]
},
{
path: 'admin/resources',
component: AdminExternalResourcesComponent,
canActivate: [AuthGuard]
},
{
path: 'parent/educational-resources-es',
component: EducationalResourcesESComponent,
canActivate: [AuthGuard]
},
{
path: 'participant/research-parental-chart',
component: ResearchParentalChartComponent,
Expand Down
6 changes: 2 additions & 4 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,11 @@ import { GrowthChartComponent } from "./components/growth/growth-chart/growth-ch
import { GrowthTableComponent } from "./components/growth/growth-table/growth-table.component";
import { GrowthMessageComponent } from "./components/growth/growth-message/growth-message.component";
import { ClinicGrowthPage } from "./pages/clinic-growth/clinic-growth-page.component";
import { EducationalResourcesPage } from "./pages/educational-resources/educational-resources-page.component";

import { NgApexchartsModule } from "ng-apexcharts";
// possibly to be deleted below
import { AdminresultsComponent } from "./pages/admin-results/adminresults.component";
import { EducationalResourcesENComponent } from "./pages/educational-resources-en/educational-resources-en.component";
import { EducationalResourcesESComponent } from "./pages/educational-resources-es/educational-resources-es.component";
import { AdminExternalResourcesComponent } from "./pages/admin-resources/admin-resources.component";

// possibly to be deleted above
Expand Down Expand Up @@ -205,13 +204,12 @@ import { AdminExternalResourcesComponent } from "./pages/admin-resources/admin-r
GrowthChartsHelpComponent,
HomePageComponent,
AdminresultsComponent,
EducationalResourcesENComponent,
EducationalResourcesESComponent,
AdminExternalResourcesComponent,
GrowthNewRecordFormComponent,
GrowthTableComponent,
GrowthMessageComponent,
ClinicGrowthPage,
EducationalResourcesPage,
],
imports: [
BrowserModule,
Expand Down
107 changes: 60 additions & 47 deletions src/app/pages/admin-resources/admin-resources.component.css
Original file line number Diff line number Diff line change
@@ -1,47 +1,60 @@
.container{
padding-top: 20px;
margin-bottom: 20px;
}
.container_page{
padding-top: 200px;
margin-bottom: 50px;
}
.container-choices{
padding-top: 30px;
margin-bottom: 20px;
margin-left:40px;
}

.quest-results-card {
width: 60%;
display: inline-flex;
justify-content: center;
align-content: center;
padding: 50px;
height: 200px;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}

td, th {
border: 1px solid #000000;
text-align: left;
padding: 8px;
}

tr:nth-child(even) {
background-color: #dddddd;
}

.tableDiv {
padding: 35px;
}

.mat-raised-button{
background-color: #6573C3;
color: white;
}

.page-container {
width: 100%;
max-width: 1200px;
min-height: 100vh;
margin: 0 auto;
padding: 16px;
padding-top: 182px;
@media (min-width: 693px) {
padding-top: 164px;
}
}
.page-content {
width: 100%;
display: flex;
flex-direction: column;
gap: 24px;
}
.header {
margin-top: 32px;
display: flex;
justify-content: space-between;
}
.header-title {
font-size: 24px;
}

table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
margin-top: 16px;
margin-bottom: 32px;
}

td,
th {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}

tr:nth-child(even) {
background-color: #eee;
}

th {
background-color: #f4f4f4;
}

.empty-table-message {
width: 100%;
padding: 8px;
background-color: white;
border: 1px solid #ddd;
text-align: center;
color: #888
}
.export-button {
margin-right: 8px;
}
43 changes: 37 additions & 6 deletions src/app/pages/admin-resources/admin-resources.component.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,40 @@
<admin-header></admin-header>
<div class="container_page">
<div align="center">
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<button type="button" (click)="exportToExcel()" class="btn btn-danger">
Export Data

<div class="page-container">
<section class="header">
<h1 class="header-title">{{ "External Resources Events" | translate }}</h1>
<div>
<button (click)="exportEvents()" mat-raised-button class="export-button">
{{ "Export Data" | translate }}
</button>
</div>
<button (click)="toggleLanguage()" mat-raised-button class="lang-button">
{{ "For English" | translate }}
</button>
</div>
</section>
<section class="page-content">
<table>
<thead>
<tr>
<th>{{ "Date" | translate }}</th>
<th>{{ "Parent" | translate }}</th>
<th>{{ "Category" | translate }}</th>
<th>{{ "Resource" | translate }}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let event of events">
<td>{{ event.timestamp | date : "medium" }}</td>
<td>{{ event.parentUsername }}</td>
<td>{{ event.category }}</td>
<td><a target="_blank" href={{event.properties.url}}>{{ event.title }}</a></td>
</tr>
<tr *ngIf="events.length === 0">
<td colspan="4" class="empty-table-message">
{{ "No data available" | translate }}
</td>
</tr>
</tbody>
</table>
</section>
</div>
Loading

0 comments on commit 7c9ca69

Please sign in to comment.