Skip to content

Commit

Permalink
Merge pull request #8 from giacomocolle-ittbuonarroti/7-allineare-ora…
Browse files Browse the repository at this point in the history
…rio-con-giorni

7 allineare orario con giorni
  • Loading branch information
giacomocolle-ittbuonarroti authored Sep 22, 2023
2 parents f74b5cb + f54f11c commit 6c69892
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 44 deletions.
5 changes: 2 additions & 3 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!--The content below is only a placeholder and can be replaced.-->
<h1 class="text-center">Orario Docenti - Classi - Aule</h1>
<div class="row">
<div class="col-sm-8 col-xs-12" >
Expand Down Expand Up @@ -70,9 +69,9 @@ <h3>{{selitem}}</h3>
</tr>
</thead>
<tbody>
<tr *ngFor="let ora of objectKeys(orariotable$)">
<tr *ngFor="let ora of hours">
<td>{{ora}}</td>
<td *ngFor="let giorno of objectKeys(orariotable$[ora])" [attr.id]="ora + ' ' + giorno" [attr.rowspan]="orariotable$[ora][giorno]['DURATA']" style="vertical-align:middle;">
<td *ngFor="let giorno of objectKeys(orariotable$[ora])" [attr.id]="ora + ' ' + giorno" [attr.rowspan]="orariotable$[ora][giorno]['DURATA']" style="vertical-align:middle;" [attr.class]="giorno">
<div class="materia">{{orariotable$[ora][giorno]['MAT_COD']}}</div>
<br>
<button class="btn btn-primary btn-md btnDocente" (click)="buttonDocenteClick(orariotable$[ora][giorno]['DOC_COGN_NOME1'])" *ngIf="orariotable$[ora][giorno]['DOC_COGN_NOME1']">{{orariotable$[ora][giorno]["DOC_COGN1"]}}</button>
Expand Down
66 changes: 25 additions & 41 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ export class AppComponent implements OnInit {

term:any;

days = ['lunedì','martedì','mercoledì','giovedì','venerdì'];
hours = ['07h50','08h40','09h30','10h30','11h20','12h10','13h00','13h50','14h40','15h30'];

constructor(private http:HttpClient) {
this.courses$ = new Observable();
var tdocentes = new Array<Docente>();
Expand Down Expand Up @@ -221,14 +224,13 @@ export class AppComponent implements OnInit {
}
this.aulas$ = distinctAulas;

var days = ['lunedì','martedì','mercoledì','giovedì','venerdì'];
var hours = ['07h50','08h40','09h30','10h30','11h20','12h10','13h00','13h50','14h40','15h30'];


var orariotable = new Array();

hours.forEach(hour => {
this.hours.forEach(hour => {
var orariorow = new Array();
days.forEach(day => {
this.days.forEach(day => {
orariorow[day] = ""
});
orariotable[hour] = orariorow;
Expand All @@ -247,18 +249,12 @@ export class AppComponent implements OnInit {

var fleziones = this.leziones$.filter((element)=>{return element.DOC_COGN_NOME1 === cogn_nome || element.DOC_COGN_NOME2 === cogn_nome});

//var days = {'lunedì':"",'martedì':"",'mercoledì':"",'giovedì':"",'venerdì':"",'sabato':""};
//var orariotable = {'07h50':days,'08h40':days,'09h30':days,'10h30':days,'11h20':days,'12h10':days,'13h30':days,'14h20':days,'15h20':days,'16h10':days};

var days = ['lunedì','martedì','mercoledì','giovedì','venerdì'];
var hours = ['07h50','08h40','09h30','10h30','11h20','12h10','13h00','13h50','14h40','15h30'];

var orariotable = new Array();

hours.forEach(hour => {
this.hours.forEach(hour => {
var orariorow = new Array();
days.forEach(day => {
orariorow[day] = {DURATA:"0"};
this.days.forEach(day => {
orariorow[day] = {DURATA:"1"};
});
orariotable[hour] = orariorow;
});
Expand All @@ -269,11 +265,11 @@ export class AppComponent implements OnInit {
orariotable[element.O_INIZIO][element.GIORNO]["DURATA"]= element.DURATA.charAt(0);
switch (element.DURATA.charAt(0)){
case "2":
delete orariotable[hours[hours.indexOf(element.O_INIZIO)+1]][element.GIORNO];
delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+1]][element.GIORNO];
break;
case "3":
delete orariotable[hours[hours.indexOf(element.O_INIZIO)+1]][element.GIORNO];
delete orariotable[hours[hours.indexOf(element.O_INIZIO)+2]][element.GIORNO];
delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+1]][element.GIORNO];
delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+2]][element.GIORNO];
break;
}
}catch(e){
Expand All @@ -290,18 +286,12 @@ export class AppComponent implements OnInit {

var fleziones = this.leziones$.filter((element)=>{return element.CLASSE1 === classe || element.CLASSE2 === classe});

//var days = {'lunedì':"",'martedì':"",'mercoledì':"",'giovedì':"",'venerdì':"",'sabato':""};
//var orariotable = {'07h50':days,'08h40':days,'09h30':days,'10h30':days,'11h20':days,'12h10':days,'13h30':days,'14h20':days,'15h20':days,'16h10':days};

var days = ['lunedì','martedì','mercoledì','giovedì','venerdì'];
var hours = ['07h50','08h40','09h30','10h30','11h20','12h10','13h00','13h50','14h40','15h30'];

var orariotable = new Array();

hours.forEach(hour => {
this.hours.forEach(hour => {
var orariorow = new Array();
days.forEach(day => {
orariorow[day] = {DURATA:"0"};
this.days.forEach(day => {
orariorow[day] = {DURATA:"1"};
});
orariotable[hour] = orariorow;
});
Expand All @@ -311,11 +301,11 @@ export class AppComponent implements OnInit {
orariotable[element.O_INIZIO][element.GIORNO]["DURATA"]= element.DURATA.charAt(0);
switch (element.DURATA.charAt(0)){
case "2":
delete orariotable[hours[hours.indexOf(element.O_INIZIO)+1]][element.GIORNO];
delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+1]][element.GIORNO];
break;
case "3":
delete orariotable[hours[hours.indexOf(element.O_INIZIO)+1]][element.GIORNO];
delete orariotable[hours[hours.indexOf(element.O_INIZIO)+2]][element.GIORNO];
delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+1]][element.GIORNO];
delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+2]][element.GIORNO];
break;
}
});
Expand All @@ -329,19 +319,13 @@ export class AppComponent implements OnInit {
this.selitem = aula;

var fleziones = this.leziones$.filter((element)=>{return element.AULA1 === aula || element.AULA2 === aula || element.AULA3 === aula });

//var days = {'lunedì':"",'martedì':"",'mercoledì':"",'giovedì':"",'venerdì':"",'sabato':""};
//var orariotable = {'07h50':days,'08h40':days,'09h30':days,'10h30':days,'11h20':days,'12h10':days,'13h30':days,'14h20':days,'15h20':days,'16h10':days};

var days = ['lunedì','martedì','mercoledì','giovedì','venerdì'];
var hours = ['07h50','08h40','09h30','10h30','11h20','12h10','13h00','13h50','14h40','15h30'];


var orariotable = new Array();

hours.forEach(hour => {
this.hours.forEach(hour => {
var orariorow = new Array();
days.forEach(day => {
orariorow[day] = {DURATA:"0"};
this.days.forEach(day => {
orariorow[day] = {DURATA:"1"};
});
orariotable[hour] = orariorow;
});
Expand All @@ -351,11 +335,11 @@ export class AppComponent implements OnInit {
orariotable[element.O_INIZIO][element.GIORNO]["DURATA"]= element.DURATA.charAt(0);
switch (element.DURATA.charAt(0)){
case "2":
delete orariotable[hours[hours.indexOf(element.O_INIZIO)+1]][element.GIORNO];
delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+1]][element.GIORNO];
break;
case "3":
delete orariotable[hours[hours.indexOf(element.O_INIZIO)+1]][element.GIORNO];
delete orariotable[hours[hours.indexOf(element.O_INIZIO)+2]][element.GIORNO];
delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+1]][element.GIORNO];
delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+2]][element.GIORNO];
break;
}
});
Expand Down
5 changes: 5 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<div class="header" style="background-image:url('assets/div.png');">
<div class="logo">
<img src="assets/logoNEW.png">
</div>
</div>
<app-root></app-root>
</body>
</html>

0 comments on commit 6c69892

Please sign in to comment.