Compare commits

..

15 Commits

Author SHA1 Message Date
bcd7fee2e1 wip
All checks were successful
Docker Image CI / build-and-push (push) Successful in 1m47s
Docker Image CI / deploy (push) Successful in 43s
Docker Image CI / notify-failure (push) Has been skipped
2025-04-17 21:30:23 +02:00
14c4049d7c Update .github/workflows/deploy-docker-to-ont.yml
All checks were successful
Docker Image CI / build-and-push (push) Successful in 52s
Docker Image CI / deploy (push) Successful in 23s
Docker Image CI / notify-failure (push) Has been skipped
2025-04-16 10:24:56 +00:00
aca0d286aa Update .github/workflows/deploy-docker-to-ont.yml
Some checks failed
Docker Image CI / build-and-push (push) Failing after 15s
Docker Image CI / deploy (push) Has been skipped
Docker Image CI / notify-failure (push) Successful in 12s
2025-04-15 23:05:07 +00:00
9e2487ea5a Update .github/workflows/deploy-docker-to-ont.yml
Some checks failed
Docker Image CI / build-and-push (push) Failing after 11s
Docker Image CI / deploy (push) Has been skipped
Docker Image CI / notify-failure (push) Successful in 12s
2025-04-15 23:01:48 +00:00
d28d789213 do it pls poging 2 xoxo
All checks were successful
Docker Image CI / build-and-push (push) Successful in 50s
Docker Image CI / deploy (push) Successful in 27s
Docker Image CI / notify-failure (push) Has been skipped
2025-04-16 00:29:56 +02:00
8c6846954a do it pls
Some checks failed
Docker Image CI / build-and-push (push) Successful in 47s
Docker Image CI / deploy (push) Failing after 28s
Docker Image CI / notify-failure (push) Successful in 13s
2025-04-16 00:25:59 +02:00
b0660a3db2 init ontwikkel pipeline
Some checks failed
Docker Image CI / build-and-push (push) Successful in 43s
Docker Image CI / deploy (push) Failing after 23s
Docker Image CI / notify-failure (push) Successful in 8s
2025-04-16 00:06:27 +02:00
aaa712c37c aftrap pipeline + unused import + toevoeging company
All checks were successful
Docker Image CI / build-and-push (push) Successful in 1m10s
Docker Image CI / deploy (push) Successful in 28s
Docker Image CI / notify-failure (push) Has been skipped
2025-04-15 20:55:24 +02:00
9fbb61fef4 -een gebruiker kan meerdere bedrijven hebben
Some checks failed
Docker Image CI / build-and-push (push) Failing after 1m21s
Docker Image CI / deploy (push) Has been skipped
Docker Image CI / notify-failure (push) Successful in 10s
-manier van afspraken maken veranderd in de backend ivm meerdere bedrijven gebruiker
 -email is aangepast op bedrijf en gebruiker
 -dropdown voor instellingen toegevoegd
2025-04-15 20:45:56 +02:00
ddabbc62d1 commit messages toegevoegd aan pipeline fix 2
All checks were successful
Docker Image CI / build-and-push (push) Successful in 41s
Docker Image CI / deploy (push) Successful in 28s
2025-03-16 22:45:25 +01:00
33aa00a4db commit messages toegevoegd aan pipeline
Some checks failed
Docker Image CI / build-and-push (push) Successful in 53s
Docker Image CI / deploy (push) Failing after 23s
2025-03-16 22:33:45 +01:00
08ca500570 component gemaakt van nieuwe klant toevoegen + correcte validatie email
All checks were successful
Docker Image CI / build-and-push (push) Successful in 1m17s
Docker Image CI / deploy (push) Successful in 33s
2025-03-16 22:24:39 +01:00
cd0f18705c fix in pipeline 2025-03-16 22:23:41 +01:00
838faae96b chevron toegevoegd bij datum 2025-03-16 22:01:26 +01:00
1dda26b35f fix teveel klanten 2025-03-16 21:51:32 +01:00
26 changed files with 605 additions and 331 deletions

View File

@@ -0,0 +1,135 @@
name: Docker Image CI
on:
push:
branches:
- feature/**
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
# Stap 1: Code ophalen
- uses: actions/checkout@v4
# Stap 2: Versienummer ophalen uit package.json en opslaan als artifact
- name: Extract Angular version
run: |
echo "$(cat package.json | jq -r '.version')" > version.txt
- name: Save version as artifact
uses: actions/upload-artifact@v3
with:
name: version
path: version.txt
- name: Notify Mattermost via Bot
env:
REPO: ${{ gitea.repository }}
BRANCH: ${{ gitea.ref }}
MATTERMOST_BOT_TOKEN: ${{ secrets.MATTERMOST_BOT_TOKEN }}
run: |
curl --fail -X POST -H "Authorization: Bearer $MATTERMOST_BOT_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"channel_id": "wgcfotx7x3bipcwchzn45tuxxr",
"message": "🚀 *Build gestart!* Een nieuwe build is begonnen voor de repository *'"$REPO"'* op branch *'"$BRANCH"'*."
}' \
https://mattermost.melvanveen.nl/api/v4/posts
# Stap 3: Inloggen bij Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Stap 4: Docker-image bouwen en taggen met Angular-versie
- name: Build the Docker image
run: |
VERSION=$(cat version.txt)
docker buildx build . --file Dockerfile-tst --tag veenm/paypoint:$VERSION-SNAPSHOT --platform linux/amd64
# Stap 5: Docker-image pushen naar Docker Hub (huidige versie tag)
- name: Push the Docker image (version-snapshot)
run: |
VERSION=$(cat version.txt)
docker push veenm/paypoint:$VERSION-SNAPSHOT
deploy:
needs: build-and-push
runs-on: ubuntu-latest
steps:
# Stap 1: Artifact ophalen
- name: Download version artifact
uses: actions/download-artifact@v3
with:
name: version
# Stap 2: Lees versie uit het artifact
- name: Read version
id: read_version
run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
# Stap 3: Maak verbinding via SSH naar de Alpine server en update de container
- name: SSH into Alpine and update Docker container
uses: appleboy/ssh-action@v0.1.10
with:
host: ${{ secrets.ALPINE_HOST_ONT }}
username: root
key: ${{ secrets.ALPINE_SSH_KEY }}
script: |
VERSION=${{ env.VERSION }}
echo "Gekozen versie: $VERSION-SNAPSHOT"
# Stop en verwijder de huidige container
docker stop paypoint-frontend || true
docker rm paypoint-frontend || true
# Haal de nieuwste image binnen
docker pull veenm/paypoint:$VERSION-SNAPSHOT
# Start een nieuwe container
docker run -d --name paypoint-frontend --restart unless-stopped -p 15000:80 veenm/paypoint:$VERSION-SNAPSHOT
# Opruimen oude images
docker image prune -f
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Notify Mattermost via Bot
env:
VERSION: ${{ env.VERSION }}
run: |
COMMITS=$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"- %s")
curl --fail -X POST -H "Authorization: Bearer tspcwdn5rbdk8kkmnex6h1nfha" \
-H 'Content-Type: application/json' \
-d '{
"channel_id": "wgcfotx7x3bipcwchzn45tuxxr",
"message": "✅ *Build is geslaagd!* Versie '"$VERSION"'-SNAPSHOT staat klaar op ontwikkel."
}' \
https://mattermost.melvanveen.nl/api/v4/posts
notify-failure:
needs: [ build-and-push, deploy ]
runs-on: ubuntu-latest
if: failure()
steps:
- name: Notify Mattermost via Bot on failure
env:
MATTERMOST_BOT_TOKEN: ${{ secrets.MATTERMOST_BOT_TOKEN }}
REPO: ${{ gitea.repository }}
BRANCH: ${{ gitea.ref }}
run: |
curl --fail -X POST -H "Authorization: Bearer $MATTERMOST_BOT_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"channel_id": "9a8obynkd7rctk6qf8rfe6oppy",
"message": "@all ❌ *Build gefaald!* De pipeline is stukgelopen voor *'"$REPO"'* op branch *'"$BRANCH"'*."
}' \
https://mattermost.melvanveen.nl/api/v4/posts

View File

@@ -26,7 +26,6 @@ jobs:
path: version.txt
- name: Notify Mattermost via Bot
env:
VERSION: ${{ VERSION }}
REPO: ${{ gitea.repository }}
BRANCH: ${{ gitea.ref }}
MATTERMOST_BOT_TOKEN: ${{ secrets.MATTERMOST_BOT_TOKEN }}
@@ -35,7 +34,7 @@ jobs:
-H 'Content-Type: application/json' \
-d '{
"channel_id": "9a8obynkd7rctk6qf8rfe6oppy",
"message": "@all 🚀 *Build gestart!* Een nieuwe build ['"$VERSION"'-SNAPSHOT] is begonnen voor de repository *'"$REPO"'* op branch *'"$BRANCH"'*."
"message": "@all 🚀 *Build gestart!* Een nieuwe build is begonnen voor de repository *'"$REPO"'* op branch *'"$BRANCH"'*."
}' \
https://mattermost.melvanveen.nl/api/v4/posts
@@ -99,14 +98,40 @@ jobs:
# Opruimen oude images
docker image prune -f
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Notify Mattermost via Bot
env:
VERSION: ${{ VERSION }}
VERSION: ${{ env.VERSION }}
run: |
COMMITS=$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"- %s")
curl --fail -X POST -H "Authorization: Bearer tspcwdn5rbdk8kkmnex6h1nfha" \
-H 'Content-Type: application/json' \
-d '{
"channel_id": "9a8obynkd7rctk6qf8rfe6oppy",
"message": "@all ✅ *Build is geslaagd!* Versie '"$VERSION"'-SNAPSHOT staat klaar op https://test-paypoint.melvanveen.nl"
"message": "@all ✅ *Build is geslaagd!* Versie '"$VERSION"'-SNAPSHOT staat klaar op https://test-paypoint.melvanveen.nl\n\n*Changelog:*\n'"${COMMITS}"'"
}' \
https://mattermost.melvanveen.nl/api/v4/posts
notify-failure:
needs: [ build-and-push, deploy ]
runs-on: ubuntu-latest
if: failure()
steps:
- name: Notify Mattermost via Bot on failure
env:
MATTERMOST_BOT_TOKEN: ${{ secrets.MATTERMOST_BOT_TOKEN }}
REPO: ${{ gitea.repository }}
BRANCH: ${{ gitea.ref }}
run: |
curl --fail -X POST -H "Authorization: Bearer $MATTERMOST_BOT_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"channel_id": "9a8obynkd7rctk6qf8rfe6oppy",
"message": "@all ❌ *Build gefaald!* De pipeline is stukgelopen voor *'"$REPO"'* op branch *'"$BRANCH"'*."
}' \
https://mattermost.melvanveen.nl/api/v4/posts

View File

@@ -4,10 +4,8 @@ on:
push:
branches:
- main
tags:
- "docker-build-*"
jobs:
jobs:
build-and-push:
runs-on: ubuntu-latest

View File

@@ -10,6 +10,13 @@
[style.color]="'var(--tui-background-accent-1)'"/>
{{ customer.email }}
</h2>
<h2>
<tui-icon
icon="@tui.phone"
[style.color]="'var(--tui-background-accent-1)'"/>
<span *ngIf="customer.phone"> {{ customer.phone }}</span>
<span *ngIf="!customer.phone"> -</span>
</h2>
<ng-template *ngIf="appointment">
<br>
<h2>

View File

@@ -99,56 +99,5 @@
</button>
<app-modal title="Nieuwe klant" *ngIf="showNewCustomer" (close)="toggleCustomerModal()">
<form [formGroup]="customerForm">
<tui-input
formControlName="firstName"
tuiTextfieldSize="m"
id="voornaam-nieuwe-klant"
[tuiTextfieldCleaner]="true">
Voornaam
<input
tuiTextfieldLegacy
type="text"
formControlName="firstName"/>
</tui-input>
<br>
<tui-input
formControlName="lastName"
tuiTextfieldSize="m"
id="achternaam-nieuwe-klant"
[tuiTextfieldCleaner]="true">
Achternaam
<input
tuiTextfieldLegacy
type="text"
formControlName="lastName"/>
</tui-input>
<br>
<tui-input
formControlName="email"
tuiTextfieldSize="m"
id="email-nieuwe-klant"
[tuiTextfieldCleaner]="true">
Email
<input
tuiTextfieldLegacy
autocomplete="email"
type="email"
formControlName="email"/>
</tui-input>
<br>
<button
appearance="secondary"
size="m"
tuiButton
id="klant-toevoegen"
[loading]=waiting
(click)="saveCustomer()"
type="button">
<tui-icon
icon="@tui.plus"
[style.height.rem]="1"/>
Klant toevoegen
</button>
</form>
<app-new-customer (customerAdded)="saveCustomer()"></app-new-customer>
</app-modal>

View File

@@ -1,7 +1,7 @@
import {Component, EventEmitter, inject, Input, OnInit, Output} from '@angular/core';
import {NgForOf, NgIf} from "@angular/common";
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
import {TuiAlertService, TuiButton, TuiGroup, TuiIcon} from "@taiga-ui/core";
import {TuiAlertService, TuiButton, TuiGroup} from "@taiga-ui/core";
import {
TuiComboBoxModule,
TuiInputDateModule,
@@ -13,15 +13,11 @@ import {
import {Appointment} from '../../models/appointment';
import {TuiDay, TuiTime} from '@taiga-ui/cdk';
import {AppointmentService} from '../../services/appointment.service';
import {
TuiButtonLoading,
TuiDataListWrapperComponent,
TuiFilterByInputPipe,
TuiStringifyContentPipe
} from '@taiga-ui/kit';
import {TuiDataListWrapperComponent, TuiFilterByInputPipe, TuiStringifyContentPipe} from '@taiga-ui/kit';
import {Customer} from '../../models/customer';
import {CustomerService} from '../../services/customer.service';
import {ModalComponent} from '../modal/modal.component';
import {NewCustomerComponent} from '../new-customer/new-customer.component';
@Component({
selector: 'app-edit-item',
@@ -41,8 +37,7 @@ import {ModalComponent} from '../modal/modal.component';
TuiStringifyContentPipe,
TuiFilterByInputPipe,
ModalComponent,
TuiIcon,
TuiButtonLoading
NewCustomerComponent
],
templateUrl: './edit-item.component.html',
styleUrl: './edit-item.component.scss'
@@ -132,15 +127,8 @@ export class EditItemComponent implements OnInit {
`${item.firstName} ${item.lastName}`;
saveCustomer() {
const firstName = this.customerForm.get('firstName').value
const lastName = this.customerForm.get('lastName').value
const email = this.customerForm.get('email').value
const customer = new Customer(firstName, lastName, email);
this.customerService.addCustomer(customer).subscribe(() => {
this.showNewCustomer = false;
this.getCustomers()
})
this.showNewCustomer = false;
this.getCustomers()
}
getCustomers() {

View File

@@ -0,0 +1,66 @@
<form [formGroup]="customerForm">
<tui-input
formControlName="firstName"
tuiTextfieldSize="m"
id="voornaam-nieuwe-klant"
[tuiTextfieldCleaner]="true">
Voornaam
<input
tuiTextfieldLegacy
type="text"
formControlName="firstName"/>
</tui-input>
<br>
<tui-input
formControlName="lastName"
tuiTextfieldSize="m"
id="achternaam-nieuwe-klant"
[tuiTextfieldCleaner]="true">
Achternaam
<input
tuiTextfieldLegacy
type="text"
formControlName="lastName"/>
</tui-input>
<br>
<tui-input
formControlName="email"
tuiTextfieldSize="m"
id="email-nieuwe-klant"
[tuiTextfieldCleaner]="true">
Email
<input
tuiTextfieldLegacy
autocomplete="email"
type="email"
formControlName="email"/>
</tui-input>
<br>
<tui-input
formControlName="phone"
tuiTextfieldSize="m"
id="telefoon-nieuwe-klant"
[tuiTextfieldCleaner]="true">
Telefoonnummer
<input
tuiTextfieldLegacy
autocomplete=""
type="tel"
formControlName="phone"/>
</tui-input>
<br>
<button
appearance="secondary"
size="m"
tuiButton
id="klant-toevoegen"
[disabled]="customerForm.invalid"
[loading]=waiting
(click)="saveCustomer()"
type="button">
<tui-icon
icon="@tui.plus"
[style.height.rem]="1"/>
Klant toevoegen
</button>
</form>

View File

@@ -0,0 +1,50 @@
import {Component, EventEmitter, Output} from '@angular/core';
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
import {TuiInputModule} from '@taiga-ui/legacy';
import {TuiButton, TuiIcon, TuiTextfieldOptionsDirective} from '@taiga-ui/core';
import {TuiButtonLoading} from '@taiga-ui/kit';
import {Customer} from '../../models/customer';
import {CustomerService} from '../../services/customer.service';
@Component({
selector: 'app-new-customer',
imports: [
ReactiveFormsModule,
TuiInputModule,
TuiTextfieldOptionsDirective,
TuiButton,
TuiIcon,
TuiButtonLoading
],
templateUrl: './new-customer.component.html',
styleUrl: './new-customer.component.scss'
})
export class NewCustomerComponent {
waiting: boolean = false;
customerForm: FormGroup;
@Output() customerAdded: EventEmitter<any> = new EventEmitter();
emailRegex: RegExp = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
constructor(private customerService: CustomerService) {
this.customerForm = new FormGroup({
firstName: new FormControl('', [Validators.required]),
lastName: new FormControl('', [Validators.required]),
email: new FormControl('', [Validators.required, Validators.pattern(this.emailRegex)]),
phone: new FormControl('', [Validators.required]),
})
}
saveCustomer() {
const firstName = this.customerForm.get('firstName').value
const lastName = this.customerForm.get('lastName').value
const email = this.customerForm.get('email').value
const phone = this.customerForm.get('phone').value
const customer = new Customer(firstName, lastName, email, phone);
this.customerService.addCustomer(customer).subscribe(() => {
this.customerAdded.emit(customer);
})
}
}

View File

@@ -33,6 +33,7 @@
tuiTextfieldSize="m">
Klant
<tui-data-list-wrapper
id="klant-input"
*tuiDataList
[itemContent]="stringify | tuiStringifyContent"
[items]="items | tuiFilterByInput"
@@ -90,7 +91,7 @@
<ng-container *ngIf="appointments.length > 0">
<h3>Geplande afspraken die dag:</h3>
<div class="appointments-container">
<div *ngFor="let appointment of appointments" class="appointment-object" [attr.id]="appointment.title + '-' + appointment.customer">
<div *ngFor="let appointment of appointments" class="appointment-object" [attr.id]="appointment.title.toLowerCase() + '-' + appointment.startDate + '-' + appointment.startHour + appointment.startMinute">
<span class="title" id="titel-afspraak">{{ appointment.title }}</span>
<span class="name" id="titel-naam">
<tui-icon
@@ -110,7 +111,7 @@
</div>
</ng-container>
<br>
<tui-textarea formControlName="notes">Notities</tui-textarea>
<tui-textarea formControlName="notes" id="notities">Notities</tui-textarea>
</form>
<br>
<button
@@ -123,56 +124,5 @@
</button>
<app-modal title="Nieuwe klant" *ngIf="showNewCustomer" (close)="toggleCustomerModal()">
<form [formGroup]="customerForm">
<tui-input
formControlName="firstName"
tuiTextfieldSize="m"
id="voornaam-nieuwe-klant"
[tuiTextfieldCleaner]="true">
Voornaam
<input
tuiTextfieldLegacy
type="text"
formControlName="firstName"/>
</tui-input>
<br>
<tui-input
formControlName="lastName"
tuiTextfieldSize="m"
id="achternaam-nieuwe-klant"
[tuiTextfieldCleaner]="true">
Achternaam
<input
tuiTextfieldLegacy
type="text"
formControlName="lastName"/>
</tui-input>
<br>
<tui-input
formControlName="email"
tuiTextfieldSize="m"
id="email-nieuwe-klant"
[tuiTextfieldCleaner]="true">
Email
<input
tuiTextfieldLegacy
autocomplete="email"
type="email"
formControlName="email"/>
</tui-input>
<br>
<button
appearance="secondary"
size="m"
tuiButton
id="klant-toevoegen"
[loading]=waiting
(click)="saveCustomer()"
type="button">
<tui-icon
icon="@tui.plus"
[style.height.rem]="1"/>
Klant toevoegen
</button>
</form>
<app-new-customer (customerAdded)="saveCustomer()"></app-new-customer>
</app-modal>

View File

@@ -11,18 +11,14 @@ import {
TuiTextfieldControllerModule
} from "@taiga-ui/legacy";
import {Appointment} from '../../models/appointment';
import {TuiDay, TuiTime, TuiValidationError} from '@taiga-ui/cdk';
import {TuiDay, TuiValidationError} from '@taiga-ui/cdk';
import {AppointmentService} from '../../services/appointment.service';
import {
TuiButtonLoading,
TuiDataListWrapperComponent,
TuiFilterByInputPipe,
TuiStringifyContentPipe
} from '@taiga-ui/kit';
import {TuiDataListWrapperComponent, TuiFilterByInputPipe, TuiStringifyContentPipe} from '@taiga-ui/kit';
import {Customer} from '../../models/customer';
import {CustomerService} from '../../services/customer.service';
import {ModalComponent} from '../modal/modal.component';
import {timeAfterStartValidator} from '../../models/validators/time-after-start-validator';
import {NewCustomerComponent} from '../new-customer/new-customer.component';
@Component({
selector: 'app-new-item',
@@ -43,8 +39,8 @@ import {timeAfterStartValidator} from '../../models/validators/time-after-start-
TuiFilterByInputPipe,
ModalComponent,
TuiIcon,
TuiButtonLoading,
TuiError
TuiError,
NewCustomerComponent
],
templateUrl: './new-item.component.html',
styleUrl: './new-item.component.scss'
@@ -72,27 +68,15 @@ export class NewItemComponent implements OnInit {
this.customerForm = new FormGroup({
firstName: new FormControl('', Validators.required),
lastName: new FormControl('', Validators.required),
email: new FormControl('', Validators.required),
email: new FormControl('', [Validators.required, Validators.email]),
})
this.appointmentForm.get('startTime').setValue(new TuiTime(this.today.getHours(), this.today.getMinutes()), Validators.required)
this.appointmentForm.get('endTime').setValue(new TuiTime(this.getEndTime().getHours(), this.getEndTime().getMinutes()), [Validators.required, timeAfterStartValidator('startTime')])
this.appointmentForm.get('startTime').setValue('', Validators.required)
this.appointmentForm.get('endTime').setValue('', [Validators.required, timeAfterStartValidator('startTime')])
this.appointments.sort((a, b) => {
return a.startHour - b.startHour || a.startMinute - b.startMinute;
});
}
getEndTime(): Date {
const endTime = new Date(this.today); // Kopieer startTime
endTime.setMinutes(endTime.getMinutes() + 30); // 30 minuten toevoegen
// Controleer of de dag nog steeds hetzelfde is
if (endTime.getDate() !== this.today.getDate()) {
endTime.setHours(23, 59, 59, 999); // Zet naar 23:59:59 als het overloopt
}
return endTime;
}
registerAppointment() {
const title = this.appointmentForm.get('title').value
const description = this.appointmentForm.get('notes').value
@@ -133,15 +117,8 @@ export class NewItemComponent implements OnInit {
`${item.firstName} ${item.lastName}`;
saveCustomer() {
const firstName = this.customerForm.get('firstName').value
const lastName = this.customerForm.get('lastName').value
const email = this.customerForm.get('email').value
const customer = new Customer(firstName, lastName, email);
this.customerService.addCustomer(customer).subscribe(() => {
this.showNewCustomer = false;
this.getCustomers()
})
this.showNewCustomer = false;
this.getCustomers()
}
getCustomers() {

View File

@@ -0,0 +1,9 @@
export class Company {
id: number;
name: string;
email: string;
img_href: string;
address: string;
postal_code: string;
city: string;
}

View File

@@ -3,11 +3,13 @@ export class Customer {
firstName: string;
lastName: string;
email: string;
phone: string;
constructor(firstName: string, lastName: string, email: string) {
constructor(firstName: string, lastName: string, email: string, phone: string) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.phone = phone
}
}

View File

@@ -9,7 +9,16 @@
(click)="previousDay()"
type="button">
</button>
<h1 class="date" id="geselecteerdeDatum" (click)="toggleCalendar()">{{ getDate() }}</h1>
<h1 class="date" id="geselecteerdeDatum" (click)="toggleCalendar()">{{ getDate() }}
<tui-icon
*ngIf="!showCalendar"
icon="@tui.chevron-down"
[style.color]="'var(--tui-background-accent-1)'"/>
<tui-icon
*ngIf="showCalendar"
icon="@tui.chevron-up"
[style.color]="'var(--tui-background-accent-1)'"/>
</h1>
<button
appearance="primary"
iconStart="@tui.chevron-right"
@@ -43,7 +52,7 @@
size="m"
tuiButton
id="afspraakMaken"
(click)="isModalOpen = true"
(click)="showNewItem = true"
type="button">
<tui-icon
icon="@tui.plus"
@@ -51,6 +60,23 @@
/>
Afspraak maken
</button>
<button
appearance="secondary"
size="m"
tuiButton
id="instellingen"
(click)="openSettings()"
[tuiDropdown]="dropdownContent"
[tuiDropdownManual]="open"
type="button">
<tui-icon
icon="@tui.settings"
[style.height.rem]="1">
</tui-icon>
</button>
<ng-template #dropdownContent>
<div class="dropdown">But there is nothing to choose...</div>
</ng-template>
</div>
<div class="content">
<div class="agenda-container">
@@ -79,7 +105,7 @@
</div>
</div>
<app-modal title="Nieuwe afspraak" (close)="closeNewItemModal()" *ngIf="isModalOpen">
<app-modal title="Nieuwe afspraak" (close)="closeNewItemModal()" *ngIf="showNewItem">
<app-new-item [appointments]="appointments" [appointmentForm]="appointmentForm"
(appointmentAddedEvent)="registerAppointment($event)"></app-new-item>
</app-modal>

View File

@@ -11,7 +11,7 @@ import {
TuiTextareaModule,
TuiTextfieldControllerModule
} from '@taiga-ui/legacy';
import {TuiDay, TuiTime} from '@taiga-ui/cdk';
import {TuiDay, TuiMonth, TuiTime} from '@taiga-ui/cdk';
import {AppointmentService} from '../../services/appointment.service';
import {DetailsComponent} from '../../components/details/details.component';
import {DateFormatter} from '../../utils/date-formatter';
@@ -40,13 +40,14 @@ export class AgendaComponent implements OnInit {
timeSlots: number[] = Array.from({length: 24}, (_, i) => i); // 24 uren
appointments: Appointment[] = [];
isModalOpen = false
showNewItem = false
today = new Date()
selectedDate = new Date()
waiting: boolean = false;
selectedAppointment: Appointment;
protected value: TuiDay | null = null;
showCalendar: boolean = false;
open = false
private readonly alerts = inject(TuiAlertService);
protected appointmentForm = new FormGroup({
@@ -60,7 +61,7 @@ export class AgendaComponent implements OnInit {
registerAppointment(title: string): void {
this.getAppointmentsByDate(this.selectedDate);
this.waiting = false
this.isModalOpen = false
this.showNewItem = false
this.showNotification(title)
this.resetForms()
}
@@ -187,7 +188,7 @@ export class AgendaComponent implements OnInit {
}
closeNewItemModal() {
this.isModalOpen = false
this.showNewItem = false
this.resetForms()
}
@@ -202,5 +203,35 @@ export class AgendaComponent implements OnInit {
appointmentIsEdited($event: Appointment) {
this.getAppointmentsByDate(this.selectedDate);
}
protected firstMonth = TuiMonth.currentLocal().append({month: -1});
protected middleMonth = TuiMonth.currentLocal();
protected lastMonth = TuiMonth.currentLocal().append({month: 2});
protected hoveredItem: TuiDay | null = null;
protected onMonthChangeFirst(month: TuiMonth): void {
this.firstMonth = month.append({month: -1});
this.middleMonth = month
this.lastMonth = month.append({month: 2});
}
protected onMonthChangeMiddle(month: TuiMonth): void {
this.firstMonth = month.append({month: -1});
this.middleMonth = month;
this.lastMonth = month.append({month: 1});
}
protected onMonthChangeLast(month: TuiMonth): void {
this.firstMonth = month.append({month: -2});
this.middleMonth = month.append({month: -1});
this.lastMonth = month;
}
openSettings() {
this.open = !this.open
}
}

View File

@@ -19,24 +19,27 @@
[tuiObscuredEnabled]="open"
(click)="onClick()"
(tuiActiveZoneChange)="onActiveZone($event)"
(tuiObscured)="onObscured($event)"
>
(tuiObscured)="onObscured($event)">
<tui-avatar src="{{getInitials()}}"/>
<ng-template #dropdownContent>
<div class="dropdown">
<h3>{{ fullName }}</h3>
<button
size="m"
tuiButton
type="button"
id="uitloggen"
(click)="logout()"
>
Uitloggen
</button>
</div>
</ng-template>
</button>
<ng-template #dropdownContent>
<div class="dropdown">
<h3>{{ fullName }}</h3>
<h4>{{ currentCompany.name }}</h4>
<button
size="m"
tuiButton
type="button"
id="uitloggen"
(click)="logout()">
Uitloggen
</button>
</div>
</ng-template>
</div>
</header>

View File

@@ -1,6 +1,7 @@
.navbar {
background-color: #f8f9fa;
display: flex
display: flex;
align-items: center;
}
ul {
@@ -48,11 +49,12 @@ tui-avatar {
line-height: 1.25rem;
padding: 0.25rem 0.75rem;
margin-left: 4px;
margin-right: 4px;
margin-right: 20px;
margin-bottom: 8px;
min-width: 200px;
}
.t-content {
ui-scrollbar.t-scroll.ng-tns-c452864359-10._native-hidden {
margin-right: 24px;
}

View File

@@ -1,21 +1,26 @@
import {Component, OnInit} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {Router, RouterLink, RouterLinkActive, RouterModule} from '@angular/router';
import {TuiAvatar, TuiChevron,} from '@taiga-ui/kit';
import {AuthService} from '../../services/auth.service';
import {User} from '../../models/user';
import {TuiButton, TuiDropdown} from '@taiga-ui/core';
import {TuiActiveZone, TuiObscured} from '@taiga-ui/cdk';
import {environment} from '../../../environments/environment';
import {Company} from '../../models/company';
import {CompanyService} from '../../services/company.service';
import {TuiSelectModule} from '@taiga-ui/legacy';
@Component({
selector: 'app-home',
imports: [TuiAvatar, RouterModule, FormsModule, RouterLink, RouterLinkActive, TuiDropdown, TuiObscured, TuiActiveZone, TuiButton, TuiChevron],
imports: [TuiAvatar, RouterModule, FormsModule, RouterLink, RouterLinkActive, TuiDropdown, TuiObscured, TuiActiveZone, TuiButton, TuiChevron, TuiSelectModule, ReactiveFormsModule],
templateUrl: './home.component.html',
styleUrl: './home.component.scss'
})
export class HomeComponent implements OnInit {
user: User
fullName: string
companies: Company[]
getInitials(): string {
this.user = this.authService.getUserInfo();
@@ -39,17 +44,29 @@ export class HomeComponent implements OnInit {
this.open = active && this.open;
}
constructor(private authService: AuthService, private router: Router) {
constructor(private authService: AuthService, private router: Router, private companyService: CompanyService) {
}
ngOnInit(): void {
if (!this.authService.isAuthenticated()) {
this.router.navigate(['login']);
} else {
this.companyService.getCompanies().subscribe(
response => {
this.companies = response
this.authService.setCurrentCompany(response[0])
console.log(this.companies)
}
)
}
}
logout() {
this.authService.logout();
this.router.navigate(['login']);
}
protected readonly environment = environment;
currentCompany: Company;
}

View File

@@ -19,85 +19,27 @@
Klant toevoegen
</button>
</div>
<table class="styled-table">
<thead>
<tr>
<th>Naam</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let customer of customers" (click)="selectCustomer(customer)" [id]="customer.id">
<td>{{ customer.firstName }} {{ customer.lastName }}</td>
<td>{{ customer.email }}</td>
</tr>
</tbody>
</table>
<div class="results">
<table class="styled-table">
<thead>
<tr>
<th>Naam</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let customer of customers" (click)="selectCustomer(customer)" [id]="customer.id">
<td>{{ customer.firstName }} {{ customer.lastName }}</td>
<td>{{ customer.email }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<app-modal title="Nieuwe klant toevoegen" *ngIf="showNewCustomer" (close)="toggleCustomerModal()">
<form [formGroup]="customerForm">
<tui-input
formControlName="firstName"
tuiTextfieldSize="m"
[tuiTextfieldCleaner]="true"
>
Voornaam
<input
tuiTextfieldLegacy
type="text"
id="input-voornaam"
formControlName="firstName"
/>
</tui-input>
<br>
<tui-input
formControlName="lastName"
tuiTextfieldSize="m"
[tuiTextfieldCleaner]="true"
>
Achternaam
<input
tuiTextfieldLegacy
type="text"
id="input-achternaam"
formControlName="lastName"
/>
</tui-input>
<br>
<tui-input
formControlName="email"
tuiTextfieldSize="m"
[tuiTextfieldCleaner]="true"
>
Email
<input
tuiTextfieldLegacy
autocomplete="email"
id="input-email"
type="email"
formControlName="email"
/>
</tui-input>
<br>
<button
appearance="secondary"
size="m"
tuiButton
id="opslaanKlant"
(click)="saveCustomer()"
[disabled]="customerForm.invalid"
type="button">
<tui-icon
icon="@tui.save"
[style.height.rem]="1"
/>
Opslaan
</button>
</form>
<app-new-customer (customerAdded)="saveCustomer()"></app-new-customer>
</app-modal>
<app-modal title="Klant bekijken" *ngIf="selectedCustomer != undefined" (close)="selectedCustomer = undefined">

View File

@@ -15,6 +15,7 @@ h2 {
display: flex;
flex-direction: column;
justify-content: center;
overflow-y: unset;
}
.styled-table {
@@ -25,7 +26,7 @@ h2 {
text-align: left; /* Tekst uitlijning */
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); /* Zachte schaduw */
border-radius: 10px; /* Afgeronde hoeken */
overflow: hidden; /* Hoeken correct afronden */
overflow: scroll; /* Hoeken correct afronden */
}
.styled-table thead {
@@ -39,6 +40,12 @@ h2 {
padding: 12px 15px; /* Ruimte binnen de cellen */
}
.styled-table thead {
position: sticky;
top: 0;
z-index: 2;
}
.styled-table tbody tr {
border-bottom: 1px solid #dddddd; /* Lichte scheidingslijn */
}
@@ -60,6 +67,7 @@ h2 {
.toolbar {
button {
margin-left: 8px;
position: sticky;
}
margin-bottom: 12px;
@@ -69,4 +77,7 @@ h2 {
}
.results{
overflow-y: scroll;
}

View File

@@ -7,6 +7,7 @@ import {ModalComponent} from '../../components/modal/modal.component';
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
import {TuiInputCopyModule, TuiInputModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy';
import {CustomerDetailsComponent} from '../../components/customer-details/customer-details.component';
import {NewCustomerComponent} from '../../components/new-customer/new-customer.component';
@Component({
selector: 'app-klanten',
@@ -20,7 +21,8 @@ import {CustomerDetailsComponent} from '../../components/customer-details/custom
TuiInputCopyModule,
TuiInputModule,
TuiTextfieldControllerModule,
CustomerDetailsComponent
CustomerDetailsComponent,
NewCustomerComponent
],
templateUrl: './klanten.component.html',
styleUrl: './klanten.component.scss'
@@ -48,15 +50,8 @@ export class KlantenComponent implements OnInit {
}
saveCustomer() {
const firstName = this.customerForm.get('firstName').value
const lastName = this.customerForm.get('lastName').value
const email = this.customerForm.get('email').value
const customer = new Customer(firstName, lastName, email);
this.customerService.addCustomer(customer).subscribe(() => {
this.showNewCustomer = false;
this.getCustomers()
})
this.showNewCustomer = false;
this.getCustomers()
}
getCustomers() {

View File

@@ -1,53 +1,109 @@
/* Algemene layout */
.container {
max-width: 100%;
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: repeating-conic-gradient(
from 30deg,
#0000 0 120deg,
#3c3c3c 0 180deg
) calc(0.5 * 200px) calc(0.5 * 200px * 0.577),
repeating-conic-gradient(
from 30deg,
#1d1d1d 0 60deg,
#4e4f51 0 120deg,
#3c3c3c 0 180deg
);
background-size: 200px calc(200px * 0.577);
padding: 1rem;
box-sizing: border-box;
}
/* Centraal form container */
.center-container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
/* Adjust as needed */
}
tui-error {
text-align: center;
}
p{
text-align: center;
}
.header {
text-align: center;
margin-bottom: 28px;
max-width: 300px;
max-height: 300px;
}
::ng-deep button.custom-button {
background-color: #222222 !important;
/* Pas kleur aan */
color: white !important;
/* Tekstkleur aanpassen */
width: 300px;
}
.container {
max-width: 100%;
width: 100%;
height: 100%;
--s: 200px; /* control the size */
--c1: #1d1d1d;
--c2: #4e4f51;
--c3: #3c3c3c;
background: repeating-conic-gradient(
from 30deg,
#0000 0 120deg,
var(--c3) 0 180deg
) calc(0.5 * var(--s)) calc(0.5 * var(--s) * 0.577),
repeating-conic-gradient(
from 30deg,
var(--c1) 0 60deg,
var(--c2) 0 120deg,
var(--c3) 0 180deg
);
background-size: var(--s) calc(var(--s) * 0.577);
max-width: 100%;
}
/* Het formulier zelf */
form[tuiForm] {
background: white;
border-radius: 24px;
padding: 2rem;
max-width: 32rem; /* 512px */
width: 100%;
box-sizing: border-box;
text-align: center;
box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
/* Logo */
.header {
display: block;
margin: 0 auto 1.75rem auto;
max-width: 100%;
width: 200px;
height: auto;
}
/* Invoervelden */
tui-textfield {
display: block;
margin-bottom: 1rem;
text-align: left;
}
/* Foutmelding */
tui-error {
display: block;
margin-top: 0.5rem;
color: #ff3b30;
font-size: 0.9rem;
}
/* Inlogknop */
button.custom-button {
background-color: #222222 !important;
color: white !important;
width: 100%;
padding: 0.75rem;
font-size: 1rem;
border-radius: 12px;
margin-top: 1rem;
}
/* Versie info */
p {
text-align: center;
font-size: 0.9rem;
color: #333;
margin-top: 1.25rem;
}
/* Responsiveness */
@media (max-width: 600px) {
form[tuiForm] {
padding: 1.5rem 1rem;
max-width: 100%;
}
.header {
width: 150px;
margin-bottom: 1.25rem;
}
button.custom-button {
font-size: 0.95rem;
}
.container {
background-size: 150px calc(150px * 0.577);
opacity: 0.9; /* minder druk op mobiel */
}
}

View File

@@ -2,6 +2,7 @@ import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Appointment} from '../models/appointment';
import {environment} from '../../environments/environment';
import {AuthService} from './auth.service';
@Injectable({
providedIn: 'root',
@@ -9,7 +10,7 @@ import {environment} from '../../environments/environment';
export class AppointmentService {
baseApi = `${environment.baseApi}/appointments`;
constructor(private http: HttpClient) {
constructor(private http: HttpClient, private authService: AuthService) {
}
getAllAppointments() {
@@ -24,7 +25,8 @@ export class AppointmentService {
}
addAppointment(appointment: Appointment) {
return this.http.post(`${this.baseApi}`, appointment);
let companyId = this.authService.getCurrentCompany().id
return this.http.post(`${this.baseApi}/${companyId}`, appointment);
}
deleteAppointment(appointment: Appointment) {

View File

@@ -4,6 +4,7 @@ import {JwtHelperService} from '@auth0/angular-jwt';
import {Observable} from 'rxjs';
import {jwtDecode} from 'jwt-decode';
import {environment} from '../../environments/environment';
import {Company} from '../models/company';
@Injectable({
providedIn: 'root',
@@ -11,6 +12,7 @@ import {environment} from '../../environments/environment';
export class AuthService {
baseApi = `${environment.baseApi}/auth/login`;
jwtHelper = new JwtHelperService();
currentCompany: Company;
constructor(private http: HttpClient) {
}
@@ -39,5 +41,15 @@ export class AuthService {
}
return null;
}
setCurrentCompany(company: Company): void {
this.currentCompany = company;
console.log(this.currentCompany);
}
getCurrentCompany(): Company {
console.log(this.currentCompany);
return this.currentCompany;
}
}

View File

@@ -0,0 +1,19 @@
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';
import {environment} from '../../environments/environment';
import {Company} from '../models/company';
@Injectable({
providedIn: 'root',
})
export class CompanyService {
baseApi = `${environment.baseApi}/company`;
constructor(private http: HttpClient) {
}
getCompanies(): Observable<Company[]> {
return this.http.get<Company[]>(`${this.baseApi}`);
}
}

View File

@@ -1,8 +1,7 @@
/* You can add global styles to this file, and also import other style files */
.container {
max-width: 70vw;
margin: 0 auto;
padding: 20px;
//margin: 0 auto;
}
.heading {
@@ -16,3 +15,6 @@
overflow-y: scroll;
max-height: 70vh;
}
html, body{
}