Compare commits
No commits in common. 'master' and 'develop' have entirely different histories.
@ -0,0 +1,17 @@ |
||||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. |
||||
# For additional information regarding the format and rule options, please see: |
||||
# https://github.com/browserslist/browserslist#queries |
||||
|
||||
# For the full list of supported browsers by the Angular framework, please see: |
||||
# https://angular.io/guide/browser-support |
||||
|
||||
# You can see what browsers were selected by your queries by running: |
||||
# npx browserslist |
||||
|
||||
last 1 Chrome version |
||||
last 1 Firefox version |
||||
last 2 Edge major versions |
||||
last 2 Safari major versions |
||||
last 2 iOS major versions |
||||
Firefox ESR |
||||
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. |
@ -0,0 +1,16 @@ |
||||
# Editor configuration, see https://editorconfig.org |
||||
root = true |
||||
|
||||
[*] |
||||
charset = utf-8 |
||||
indent_style = space |
||||
indent_size = 2 |
||||
insert_final_newline = true |
||||
trim_trailing_whitespace = true |
||||
|
||||
[*.ts] |
||||
quote_type = single |
||||
|
||||
[*.md] |
||||
max_line_length = off |
||||
trim_trailing_whitespace = false |
@ -1,477 +1,45 @@ |
||||
# ---> JetBrains |
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider |
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 |
||||
|
||||
# User-specific stuff |
||||
.idea/**/workspace.xml |
||||
.idea/**/tasks.xml |
||||
.idea/**/usage.statistics.xml |
||||
.idea/**/dictionaries |
||||
.idea/**/shelf |
||||
|
||||
# AWS User-specific |
||||
.idea/**/aws.xml |
||||
|
||||
# Generated files |
||||
.idea/**/contentModel.xml |
||||
|
||||
# Sensitive or high-churn files |
||||
.idea/**/dataSources/ |
||||
.idea/**/dataSources.ids |
||||
.idea/**/dataSources.local.xml |
||||
.idea/**/sqlDataSources.xml |
||||
.idea/**/dynamic.xml |
||||
.idea/**/uiDesigner.xml |
||||
.idea/**/dbnavigator.xml |
||||
|
||||
# Gradle |
||||
.idea/**/gradle.xml |
||||
.idea/**/libraries |
||||
|
||||
# Gradle and Maven with auto-import |
||||
# When using Gradle or Maven with auto-import, you should exclude module files, |
||||
# since they will be recreated, and may cause churn. Uncomment if using |
||||
# auto-import. |
||||
# .idea/artifacts |
||||
# .idea/compiler.xml |
||||
# .idea/jarRepositories.xml |
||||
# .idea/modules.xml |
||||
# .idea/*.iml |
||||
# .idea/modules |
||||
# *.iml |
||||
# *.ipr |
||||
|
||||
# CMake |
||||
cmake-build-*/ |
||||
|
||||
# Mongo Explorer plugin |
||||
.idea/**/mongoSettings.xml |
||||
|
||||
# File-based project format |
||||
*.iws |
||||
|
||||
# IntelliJ |
||||
out/ |
||||
|
||||
# mpeltonen/sbt-idea plugin |
||||
.idea_modules/ |
||||
|
||||
# JIRA plugin |
||||
atlassian-ide-plugin.xml |
||||
|
||||
# Cursive Clojure plugin |
||||
.idea/replstate.xml |
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ) |
||||
com_crashlytics_export_strings.xml |
||||
crashlytics.properties |
||||
crashlytics-build.properties |
||||
fabric.properties |
||||
|
||||
# Editor-based Rest Client |
||||
.idea/httpRequests |
||||
|
||||
# Android studio 3.1+ serialized cache file |
||||
.idea/caches/build_file_checksums.ser |
||||
|
||||
# ---> VisualStudio |
||||
## Ignore Visual Studio temporary files, build results, and |
||||
## files generated by popular Visual Studio add-ons. |
||||
## |
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore |
||||
|
||||
# User-specific files |
||||
*.rsuser |
||||
*.suo |
||||
*.user |
||||
*.userosscache |
||||
*.sln.docstates |
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio) |
||||
*.userprefs |
||||
|
||||
# Mono auto generated files |
||||
mono_crash.* |
||||
|
||||
# Build results |
||||
[Dd]ebug/ |
||||
[Dd]ebugPublic/ |
||||
[Rr]elease/ |
||||
[Rr]eleases/ |
||||
x64/ |
||||
x86/ |
||||
[Ww][Ii][Nn]32/ |
||||
[Aa][Rr][Mm]/ |
||||
[Aa][Rr][Mm]64/ |
||||
bld/ |
||||
[Bb]in/ |
||||
[Oo]bj/ |
||||
[Ll]og/ |
||||
[Ll]ogs/ |
||||
|
||||
# Visual Studio 2015/2017 cache/options directory |
||||
.vs/ |
||||
# Uncomment if you have tasks that create the project's static files in wwwroot |
||||
#wwwroot/ |
||||
|
||||
# Visual Studio 2017 auto generated files |
||||
Generated\ Files/ |
||||
|
||||
# MSTest test Results |
||||
[Tt]est[Rr]esult*/ |
||||
[Bb]uild[Ll]og.* |
||||
|
||||
# NUnit |
||||
*.VisualState.xml |
||||
TestResult.xml |
||||
nunit-*.xml |
||||
|
||||
# Build Results of an ATL Project |
||||
[Dd]ebugPS/ |
||||
[Rr]eleasePS/ |
||||
dlldata.c |
||||
|
||||
# Benchmark Results |
||||
BenchmarkDotNet.Artifacts/ |
||||
|
||||
# .NET Core |
||||
project.lock.json |
||||
project.fragment.lock.json |
||||
artifacts/ |
||||
|
||||
# ASP.NET Scaffolding |
||||
ScaffoldingReadMe.txt |
||||
|
||||
# StyleCop |
||||
StyleCopReport.xml |
||||
|
||||
# Files built by Visual Studio |
||||
*_i.c |
||||
*_p.c |
||||
*_h.h |
||||
*.ilk |
||||
*.meta |
||||
*.obj |
||||
*.iobj |
||||
*.pch |
||||
*.pdb |
||||
*.ipdb |
||||
*.pgc |
||||
*.pgd |
||||
*.rsp |
||||
*.sbr |
||||
*.tlb |
||||
*.tli |
||||
*.tlh |
||||
*.tmp |
||||
*.tmp_proj |
||||
*_wpftmp.csproj |
||||
*.log |
||||
*.tlog |
||||
*.vspscc |
||||
*.vssscc |
||||
.builds |
||||
*.pidb |
||||
*.svclog |
||||
*.scc |
||||
|
||||
# Chutzpah Test files |
||||
_Chutzpah* |
||||
|
||||
# Visual C++ cache files |
||||
ipch/ |
||||
*.aps |
||||
*.ncb |
||||
*.opendb |
||||
*.opensdf |
||||
*.sdf |
||||
*.cachefile |
||||
*.VC.db |
||||
*.VC.VC.opendb |
||||
|
||||
# Visual Studio profiler |
||||
*.psess |
||||
*.vsp |
||||
*.vspx |
||||
*.sap |
||||
|
||||
# Visual Studio Trace Files |
||||
*.e2e |
||||
|
||||
# TFS 2012 Local Workspace |
||||
$tf/ |
||||
|
||||
# Guidance Automation Toolkit |
||||
*.gpState |
||||
|
||||
# ReSharper is a .NET coding add-in |
||||
_ReSharper*/ |
||||
*.[Rr]e[Ss]harper |
||||
*.DotSettings.user |
||||
|
||||
# TeamCity is a build add-in |
||||
_TeamCity* |
||||
|
||||
# DotCover is a Code Coverage Tool |
||||
*.dotCover |
||||
|
||||
# AxoCover is a Code Coverage Tool |
||||
.axoCover/* |
||||
!.axoCover/settings.json |
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool |
||||
coverage*.json |
||||
coverage*.xml |
||||
coverage*.info |
||||
|
||||
# Visual Studio code coverage results |
||||
*.coverage |
||||
*.coveragexml |
||||
|
||||
# NCrunch |
||||
_NCrunch_* |
||||
.*crunch*.local.xml |
||||
nCrunchTemp_* |
||||
|
||||
# MightyMoose |
||||
*.mm.* |
||||
AutoTest.Net/ |
||||
|
||||
# Web workbench (sass) |
||||
.sass-cache/ |
||||
|
||||
# Installshield output folder |
||||
[Ee]xpress/ |
||||
|
||||
# DocProject is a documentation generator add-in |
||||
DocProject/buildhelp/ |
||||
DocProject/Help/*.HxT |
||||
DocProject/Help/*.HxC |
||||
DocProject/Help/*.hhc |
||||
DocProject/Help/*.hhk |
||||
DocProject/Help/*.hhp |
||||
DocProject/Help/Html2 |
||||
DocProject/Help/html |
||||
|
||||
# Click-Once directory |
||||
publish/ |
||||
|
||||
# Publish Web Output |
||||
*.[Pp]ublish.xml |
||||
*.azurePubxml |
||||
# Note: Comment the next line if you want to checkin your web deploy settings, |
||||
# but database connection strings (with potential passwords) will be unencrypted |
||||
*.pubxml |
||||
*.publishproj |
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to |
||||
# checkin your Azure Web App publish settings, but sensitive information contained |
||||
# in these scripts will be unencrypted |
||||
PublishScripts/ |
||||
|
||||
# NuGet Packages |
||||
*.nupkg |
||||
# NuGet Symbol Packages |
||||
*.snupkg |
||||
# The packages folder can be ignored because of Package Restore |
||||
**/[Pp]ackages/* |
||||
# except build/, which is used as an MSBuild target. |
||||
!**/[Pp]ackages/build/ |
||||
# Uncomment if necessary however generally it will be regenerated when needed |
||||
#!**/[Pp]ackages/repositories.config |
||||
# NuGet v3's project.json files produces more ignorable files |
||||
*.nuget.props |
||||
*.nuget.targets |
||||
|
||||
# Nuget personal access tokens and Credentials |
||||
nuget.config |
||||
|
||||
# Microsoft Azure Build Output |
||||
csx/ |
||||
*.build.csdef |
||||
|
||||
# Microsoft Azure Emulator |
||||
ecf/ |
||||
rcf/ |
||||
|
||||
# Windows Store app package directories and files |
||||
AppPackages/ |
||||
BundleArtifacts/ |
||||
Package.StoreAssociation.xml |
||||
_pkginfo.txt |
||||
*.appx |
||||
*.appxbundle |
||||
*.appxupload |
||||
|
||||
# Visual Studio cache files |
||||
# files ending in .cache can be ignored |
||||
*.[Cc]ache |
||||
# but keep track of directories ending in .cache |
||||
!?*.[Cc]ache/ |
||||
|
||||
# Others |
||||
ClientBin/ |
||||
~$* |
||||
*~ |
||||
*.dbmdl |
||||
*.dbproj.schemaview |
||||
*.jfm |
||||
*.pfx |
||||
*.publishsettings |
||||
orleans.codegen.cs |
||||
|
||||
# Including strong name files can present a security risk |
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424) |
||||
#*.snk |
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components |
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) |
||||
#bower_components/ |
||||
|
||||
# RIA/Silverlight projects |
||||
Generated_Code/ |
||||
|
||||
# Backup & report files from converting an old project file |
||||
# to a newer Visual Studio version. Backup files are not needed, |
||||
# because we have git ;-) |
||||
_UpgradeReport_Files/ |
||||
Backup*/ |
||||
UpgradeLog*.XML |
||||
UpgradeLog*.htm |
||||
ServiceFabricBackup/ |
||||
*.rptproj.bak |
||||
|
||||
# SQL Server files |
||||
*.mdf |
||||
*.ldf |
||||
*.ndf |
||||
|
||||
# Business Intelligence projects |
||||
*.rdl.data |
||||
*.bim.layout |
||||
*.bim_*.settings |
||||
*.rptproj.rsuser |
||||
*- [Bb]ackup.rdl |
||||
*- [Bb]ackup ([0-9]).rdl |
||||
*- [Bb]ackup ([0-9][0-9]).rdl |
||||
|
||||
# Microsoft Fakes |
||||
FakesAssemblies/ |
||||
|
||||
# GhostDoc plugin setting file |
||||
*.GhostDoc.xml |
||||
|
||||
# Node.js Tools for Visual Studio |
||||
.ntvs_analysis.dat |
||||
node_modules/ |
||||
|
||||
# Visual Studio 6 build log |
||||
*.plg |
||||
|
||||
# Visual Studio 6 workspace options file |
||||
*.opt |
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) |
||||
*.vbw |
||||
|
||||
# Visual Studio LightSwitch build output |
||||
**/*.HTMLClient/GeneratedArtifacts |
||||
**/*.DesktopClient/GeneratedArtifacts |
||||
**/*.DesktopClient/ModelManifest.xml |
||||
**/*.Server/GeneratedArtifacts |
||||
**/*.Server/ModelManifest.xml |
||||
_Pvt_Extensions |
||||
|
||||
# Paket dependency manager |
||||
.paket/paket.exe |
||||
paket-files/ |
||||
|
||||
# FAKE - F# Make |
||||
.fake/ |
||||
|
||||
# CodeRush personal settings |
||||
.cr/personal |
||||
|
||||
# Python Tools for Visual Studio (PTVS) |
||||
__pycache__/ |
||||
*.pyc |
||||
|
||||
# Cake - Uncomment if you are using it |
||||
# tools/** |
||||
# !tools/packages.config |
||||
|
||||
# Tabs Studio |
||||
*.tss |
||||
|
||||
# Telerik's JustMock configuration file |
||||
*.jmconfig |
||||
|
||||
# BizTalk build output |
||||
*.btp.cs |
||||
*.btm.cs |
||||
*.odx.cs |
||||
*.xsd.cs |
||||
|
||||
# OpenCover UI analysis results |
||||
OpenCover/ |
||||
|
||||
# Azure Stream Analytics local run output |
||||
ASALocalRun/ |
||||
|
||||
# MSBuild Binary and Structured Log |
||||
*.binlog |
||||
|
||||
# NVidia Nsight GPU debugger configuration file |
||||
*.nvuser |
||||
|
||||
# MFractors (Xamarin productivity tool) working folder |
||||
.mfractor/ |
||||
|
||||
# Local History for Visual Studio |
||||
.localhistory/ |
||||
|
||||
# BeatPulse healthcheck temp database |
||||
healthchecksdb |
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017 |
||||
MigrationBackup/ |
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder |
||||
.ionide/ |
||||
|
||||
# Fody - auto-generated XML schema |
||||
FodyWeavers.xsd |
||||
|
||||
# VS Code files for those working on multiple tools |
||||
.vscode/* |
||||
!.vscode/settings.json |
||||
!.vscode/tasks.json |
||||
!.vscode/launch.json |
||||
!.vscode/extensions.json |
||||
*.code-workspace |
||||
|
||||
# Local History for Visual Studio Code |
||||
.history/ |
||||
|
||||
# Windows Installer files from build outputs |
||||
*.cab |
||||
*.msi |
||||
*.msix |
||||
*.msm |
||||
*.msp |
||||
|
||||
# JetBrains Rider |
||||
.idea/ |
||||
*.sln.iml |
||||
|
||||
# ---> VisualStudioCode |
||||
# See http://help.github.com/ignore-files/ for more about ignoring files. |
||||
|
||||
# compiled output |
||||
/dist |
||||
/tmp |
||||
/out-tsc |
||||
# Only exists if Bazel was run |
||||
/bazel-out |
||||
|
||||
# dependencies |
||||
/node_modules |
||||
|
||||
# profiling files |
||||
chrome-profiler-events*.json |
||||
|
||||
# IDEs and editors |
||||
/.idea |
||||
.project |
||||
.classpath |
||||
.c9/ |
||||
*.launch |
||||
.settings/ |
||||
*.sublime-workspace |
||||
|
||||
# IDE - VSCode |
||||
.vscode/* |
||||
!.vscode/settings.json |
||||
!.vscode/tasks.json |
||||
!.vscode/launch.json |
||||
!.vscode/extensions.json |
||||
*.code-workspace |
||||
|
||||
# Local History for Visual Studio Code |
||||
.history/ |
||||
|
||||
.history/* |
||||
|
||||
# misc |
||||
/.sass-cache |
||||
/connect.lock |
||||
/coverage |
||||
/libpeerconnection.log |
||||
npm-debug.log |
||||
yarn-error.log |
||||
testem.log |
||||
/typings |
||||
|
||||
# System Files |
||||
.DS_Store |
||||
Thumbs.db |
||||
|
@ -0,0 +1,14 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<module type="WEB_MODULE" version="4"> |
||||
<component name="NewModuleRootManager" inherit-compiler-output="true"> |
||||
<exclude-output /> |
||||
<content url="file://$MODULE_DIR$"> |
||||
<excludeFolder url="file://$MODULE_DIR$/dist" /> |
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" /> |
||||
</content> |
||||
<orderEntry type="sourceFolder" forTests="false" /> |
||||
<orderEntry type="library" name="jquery-3.2.1.slim" level="application" /> |
||||
<orderEntry type="library" name="popper.js" level="application" /> |
||||
<orderEntry type="library" name="bootstrap" level="application" /> |
||||
</component> |
||||
</module> |
@ -0,0 +1,20 @@ |
||||
# Stage 1 : Building the application |
||||
FROM node:16-alpine3.15 as build-step |
||||
|
||||
RUN mkdir -p /app |
||||
|
||||
WORKDIR /app |
||||
|
||||
COPY . /app |
||||
|
||||
RUN npm install |
||||
|
||||
RUN npm run build --prod |
||||
|
||||
# Stage 2 : Deploying the application on Nginx |
||||
FROM nginx:1.23.1-alpine |
||||
|
||||
RUN rm -rf /usr/share/nginx/html/* && rm -rf /etc/nginx/nginx.conf |
||||
COPY ./nginx.conf /etc/nginx/nginx.conf |
||||
COPY --from=build-step /app/dist/Collaborateur-Epa-Front /usr/share/nginx/html |
||||
|
@ -1,2 +1,31 @@ |
||||
# Collaborateur_Epa_Front |
||||
# CollaborateurEpaFront |
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.0.0. |
||||
|
||||
## Development server |
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change |
||||
any of the source files. |
||||
|
||||
## Code scaffolding |
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also |
||||
use `ng generate directive|pipe|service|class|guard|interface|enum|module`. |
||||
|
||||
## Build |
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag |
||||
for a production build. |
||||
|
||||
## Running unit tests |
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). |
||||
|
||||
## Running end-to-end tests |
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. |
||||
|
||||
## Further help |
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out |
||||
the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. |
||||
|
@ -0,0 +1,131 @@ |
||||
{ |
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", |
||||
"cli": { |
||||
"analytics": false |
||||
}, |
||||
"version": 1, |
||||
"newProjectRoot": "projects", |
||||
"projects": { |
||||
"Collaborateur-Epa-Front": { |
||||
"projectType": "application", |
||||
"schematics": { |
||||
"@schematics/angular:application": { |
||||
"strict": true |
||||
}, |
||||
"@schematics/angular:component": { |
||||
"style": "scss", |
||||
"skipTests": true |
||||
}, |
||||
"@schematics/angular:class": { |
||||
"skipTests": true |
||||
}, |
||||
"@schematics/angular:directive": { |
||||
"skipTests": true |
||||
}, |
||||
"@schematics/angular:pipe": { |
||||
"skipTests": true |
||||
}, |
||||
"@schematics/angular:service": { |
||||
"skipTests": true |
||||
} |
||||
}, |
||||
"root": "", |
||||
"sourceRoot": "src", |
||||
"prefix": "app", |
||||
"architect": { |
||||
"build": { |
||||
"builder": "@angular-devkit/build-angular:browser", |
||||
"options": { |
||||
"outputPath": "dist/Collaborateur-Epa-Front", |
||||
"index": "src/index.html", |
||||
"main": "src/main.ts", |
||||
"polyfills": "src/polyfills.ts", |
||||
"tsConfig": "tsconfig.app.json", |
||||
"assets": [ |
||||
"src/favicon.ico", |
||||
"src/assets" |
||||
], |
||||
"styles": [ |
||||
"node_modules/ngx-toastr/toastr.css", |
||||
"node_modules/bootstrap/dist/css/bootstrap.min.css", |
||||
"src/styles.scss" |
||||
|
||||
], |
||||
"scripts": [ |
||||
"./node_modules/jquery/dist/jquery.min.js", |
||||
"./node_modules/bootstrap/dist/js/bootstrap.min.js" |
||||
] |
||||
}, |
||||
"configurations": { |
||||
"production": { |
||||
"budgets": [ |
||||
{ |
||||
"type": "initial", |
||||
"maximumWarning": "500kb", |
||||
"maximumError": "1mb" |
||||
}, |
||||
{ |
||||
"type": "anyComponentStyle", |
||||
"maximumWarning": "2kb", |
||||
"maximumError": "4kb" |
||||
} |
||||
], |
||||
"fileReplacements": [ |
||||
{ |
||||
"replace": "src/environments/environment.ts", |
||||
"with": "src/environments/environment.prod.ts" |
||||
} |
||||
], |
||||
"outputHashing": "all" |
||||
}, |
||||
"development": { |
||||
"buildOptimizer": false, |
||||
"optimization": false, |
||||
"vendorChunk": true, |
||||
"extractLicenses": false, |
||||
"sourceMap": true, |
||||
"namedChunks": true |
||||
} |
||||
}, |
||||
"defaultConfiguration": "production" |
||||
}, |
||||
"serve": { |
||||
"builder": "@angular-devkit/build-angular:dev-server", |
||||
"configurations": { |
||||
"production": { |
||||
"browserTarget": "Collaborateur-Epa-Front:build:production" |
||||
}, |
||||
"development": { |
||||
"browserTarget": "Collaborateur-Epa-Front:build:development" |
||||
} |
||||
}, |
||||
"defaultConfiguration": "development" |
||||
}, |
||||
"extract-i18n": { |
||||
"builder": "@angular-devkit/build-angular:extract-i18n", |
||||
"options": { |
||||
"browserTarget": "Collaborateur-Epa-Front:build" |
||||
} |
||||
}, |
||||
"test": { |
||||
"builder": "@angular-devkit/build-angular:karma", |
||||
"options": { |
||||
"main": "src/test.ts", |
||||
"polyfills": "src/polyfills.ts", |
||||
"tsConfig": "tsconfig.spec.json", |
||||
"karmaConfig": "karma.conf.js", |
||||
"assets": [ |
||||
"src/favicon.ico", |
||||
"src/assets" |
||||
], |
||||
"styles": [ |
||||
"src/styles.css" |
||||
], |
||||
"scripts": [] |
||||
} |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"defaultProject": "Collaborateur-Epa-Front" |
||||
} |
@ -0,0 +1,42 @@ |
||||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) { |
||||
config.set({ |
||||
basePath: '', |
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'], |
||||
plugins: [ |
||||
require('karma-chrome-launcher'), |
||||
require('karma-coverage'), |
||||
require('@angular-devkit/build-angular/plugins/karma') |
||||
], |
||||
client: { |
||||
jasmine: { |
||||
// you can add configuration options for Jasmine here
|
||||
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||
// for example, you can disable the random execution with `random: false`
|
||||
// or set a specific seed with `seed: 4321`
|
||||
}, |
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
}, |
||||
jasmineHtmlReporter: { |
||||
suppressAll: true // removes the duplicated traces
|
||||
}, |
||||
coverageReporter: { |
||||
dir: require('path').join(__dirname, './coverage/Collaborateur-Epa-Front'), |
||||
subdir: '.', |
||||
reporters: [ |
||||
{ type: 'html' }, |
||||
{ type: 'text-summary' } |
||||
] |
||||
}, |
||||
reporters: ['progress', 'kjhtml'], |
||||
port: 9876, |
||||
colors: true, |
||||
logLevel: config.LOG_INFO, |
||||
autoWatch: true, |
||||
browsers: ['Chrome'], |
||||
singleRun: false, |
||||
restartOnFileChange: true |
||||
}); |
||||
}; |
@ -0,0 +1,25 @@ |
||||
worker_processes 1; |
||||
|
||||
events { |
||||
worker_connections 1024; |
||||
} |
||||
|
||||
http { |
||||
server { |
||||
listen 80; |
||||
server_name localhost; |
||||
|
||||
root /usr/share/nginx/html; |
||||
index index.html index.htm; |
||||
include /etc/nginx/mime.types; |
||||
|
||||
gzip on; |
||||
gzip_min_length 1000; |
||||
gzip_proxied expired no-cache no-store private auth; |
||||
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; |
||||
|
||||
location / { |
||||
try_files $uri $uri/ /index.html; |
||||
} |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,40 @@ |
||||
{ |
||||
"name": "collaborateur-epa-front", |
||||
"version": "0.0.0", |
||||
"scripts": { |
||||
"ng": "ng", |
||||
"start": "ng serve", |
||||
"build": "ng build", |
||||
"watch": "ng build --watch --configuration development", |
||||
"test": "ng test" |
||||
}, |
||||
"private": true, |
||||
"dependencies": { |
||||
"@angular/animations": "~12.0.0", |
||||
"@angular/common": "~12.0.0", |
||||
"@angular/compiler": "~12.0.0", |
||||
"@angular/core": "~12.0.0", |
||||
"@angular/forms": "~12.0.0", |
||||
"@angular/localize": "~12.0.0", |
||||
"@angular/platform-browser": "~12.0.0", |
||||
"@angular/platform-browser-dynamic": "~12.0.0", |
||||
"@angular/router": "~12.0.0", |
||||
"@ng-bootstrap/ng-bootstrap": "^10.0.0", |
||||
"bootstrap": "^5.1.3", |
||||
"jquery": "^3.6.0", |
||||
"ngx-toastr": "^14.3.0", |
||||
"rxjs": "~6.6.0", |
||||
"tslib": "^2.1.0", |
||||
"zone.js": "~0.11.4" |
||||
}, |
||||
"devDependencies": { |
||||
"@angular-devkit/build-angular": "~12.0.0", |
||||
"@angular/cli": "~12.0.0", |
||||
"@angular/compiler-cli": "~12.0.0", |
||||
"@types/node": "^12.11.1", |
||||
"karma": "~6.3.0", |
||||
"karma-chrome-launcher": "~3.1.0", |
||||
"karma-coverage": "~2.0.3", |
||||
"typescript": "~4.2.3" |
||||
} |
||||
} |
@ -0,0 +1,46 @@ |
||||
import {NgModule} from '@angular/core'; |
||||
import {RouterModule, Routes} from "@angular/router"; |
||||
import {CollaborateurComponent} from "./components/collaborateur/collaborateur.component"; |
||||
import {CollaborateurEditComponent} from "./components/collaborateur/collaborateur-edit/collaborateur-edit.component"; |
||||
import {HomeComponent} from "./components/home/home.component"; |
||||
import {AgenceComponent} from "./components/agence/agence.component"; |
||||
import {AgenceEditComponent} from "./components/agence/agence-edit/agence-edit.component"; |
||||
import {BusinessunitComponent} from "./components/businessunit/businessunit.component"; |
||||
import {BusinessunitEditComponent} from "./components/businessunit/businessunit-edit/businessunit-edit.component"; |
||||
import {PeriodeEssaiComponent} from "./components/periode-essai/periode-essai.component"; |
||||
import {PeriodeEssaiEditComponent} from "./components/periode-essai/periode-essai-edit/periode-essai-edit.component"; |
||||
import {CollaborateurAddComponent} from "./components/collaborateur/collaborateur-add/collaborateur-add.component"; |
||||
import {ReferencementComponent} from "./components/referencement/referencement.component"; |
||||
import {ReferencementAddComponent} from "./components/referencement/referencement-add/referencement-add.component"; |
||||
import {ReferencementEditComponent} from "./components/referencement/referencement-edit/referencement-edit.component"; |
||||
import {PeriodeEssaiAddComponent} from "./components/periode-essai/periode-essai-add/periode-essai-add.component"; |
||||
import {AgenceAddComponent} from "./components/agence/agence-add/agence-add.component"; |
||||
import {BusinessunitAddComponent} from "./components/businessunit/businessunit-add/businessunit-add.component"; |
||||
|
||||
const routes: Routes = [ |
||||
{path: '', redirectTo: '/home', pathMatch: 'full'}, |
||||
{path: 'home', component: HomeComponent, data: {title: 'Services Collaborateurs'}}, |
||||
{path: 'collaborateurs', component: CollaborateurComponent, data: {title: 'Collaborateurs'}}, |
||||
{path: 'collaborateurs/add', component: CollaborateurAddComponent, data: {title: 'Collaborateurs'}}, |
||||
{path: 'collaborateurs/:id', component: CollaborateurEditComponent, data: {title: 'Collaborateurs'}}, |
||||
{path: 'referencements', component: ReferencementComponent, data: {title: 'Referencements'}}, |
||||
{path: 'referencements/add', component: ReferencementAddComponent, data: {title: 'Referencements'}}, |
||||
{path: 'referencements/:id', component: ReferencementEditComponent, data: {title: 'Referencements'}}, |
||||
{path: 'agences', component: AgenceComponent, data: {title: 'Agences'}}, |
||||
{path: 'agences/add', component: AgenceAddComponent, data: {title: 'Agences'}}, |
||||
{path: 'agences/:id', component: AgenceEditComponent, data: {title: 'Agences'}}, |
||||
{path: 'businessunits', component: BusinessunitComponent, data: {title: 'BusinessUnits'}}, |
||||
{path: 'businessunits/add', component: BusinessunitAddComponent, data: {title: 'BusinessUnits'}}, |
||||
{path: 'businessunits/:id', component: BusinessunitEditComponent, data: {title: 'BusinessUnits'}}, |
||||
{path: 'periodeessais', component: PeriodeEssaiComponent, data: {title: 'Periodes d\'Essai'}}, |
||||
{path: 'periodeessais/add', component: PeriodeEssaiAddComponent, data: {title: 'Periodes d\'Essai'}}, |
||||
{path: 'periodeessais/:id', component: PeriodeEssaiEditComponent, data: {title: 'Periodes d\'Essai'}}, |
||||
]; |
||||
|
||||
@NgModule({ |
||||
imports: [RouterModule.forRoot(routes)], |
||||
exports: [RouterModule] |
||||
}) |
||||
|
||||
export class AppRoutingModule { |
||||
} |
@ -0,0 +1,62 @@ |
||||
<div class="toolbar" role="banner"> |
||||
<nav> |
||||
<button routerLink="/home">Home</button> |
||||
</nav> |
||||
<div #dropBusinessUnit="ngbDropdown" class="d-inline-block" ngbDropdown> |
||||
<button (focus)="dropBusinessUnit.open()" id="dropdownBusinessUnit" ngbDropdownAnchor type="button"> |
||||
Business Units |
||||
</button> |
||||
<div aria-labelledby="dropdownBusinessUnit" ngbDropdownMenu> |
||||
<button ngbDropdownItem routerLink="/businessunits">Liste</button> |
||||
<button ngbDropdownItem routerLink="/businessunits/add">Ajouter</button> |
||||
</div> |
||||
</div> |
||||
<div #dropAgence="ngbDropdown" class="d-inline-block" ngbDropdown> |
||||
<button (focus)="dropAgence.open()" id="dropdownAgence" ngbDropdownAnchor type="button"> |
||||
Agences |
||||
</button> |
||||
<div aria-labelledby="dropdownAgence" ngbDropdownMenu> |
||||
<button ngbDropdownItem routerLink="/agences">Liste</button> |
||||
<button ngbDropdownItem routerLink="/agences/add">Ajouter</button> |
||||
</div> |
||||
</div> |
||||
|
||||
<div #dropCollaborateur="ngbDropdown" class="d-inline-block" ngbDropdown> |
||||
<button (focus)="dropCollaborateur.open()" id="dropdownCollaborateur" ngbDropdownAnchor type="button"> |
||||
Collaborateurs |
||||
</button> |
||||
<div aria-labelledby="dropdownCollaborateur" ngbDropdownMenu> |
||||
<button ngbDropdownItem routerLink="/collaborateurs">Liste</button> |
||||
<button ngbDropdownItem routerLink="/collaborateurs/add">Ajouter</button> |
||||
</div> |
||||
</div> |
||||
|
||||
<div #dropReferencement="ngbDropdown" class="d-inline-block" ngbDropdown> |
||||
<button (focus)="dropReferencement.open()" id="dropdownReferencement" ngbDropdownAnchor type="button"> |
||||
Référencements |
||||
</button> |
||||
<div aria-labelledby="dropdownReferencement" ngbDropdownMenu> |
||||
<button ngbDropdownItem routerLink="/referencements">Liste</button> |
||||
<button ngbDropdownItem routerLink="/referencements/add">Ajouter</button> |
||||
</div> |
||||
</div> |
||||
|
||||
<div #dropPeriodeEssai="ngbDropdown" class="d-inline-block" ngbDropdown> |
||||
<button (focus)="dropPeriodeEssai.open()" id="dropdownPeriodeEssai" ngbDropdownAnchor type="button">Périodes |
||||
d'essai |
||||
</button> |
||||
<div aria-labelledby="dropdownPeriodeEssai" ngbDropdownMenu> |
||||
<button ngbDropdownItem routerLink="/periodeessais">Liste</button> |
||||
<button ngbDropdownItem routerLink="/periodeessais/add">Ajouter</button> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
|
||||
<div class="container" role="main"> |
||||
|
||||
<router-outlet></router-outlet> |
||||
|
||||
</div> |
||||
|
@ -0,0 +1,58 @@ |
||||
:host { |
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; |
||||
font-size: 14px; |
||||
color: #333; |
||||
box-sizing: border-box; |
||||
-webkit-font-smoothing: antialiased; |
||||
-moz-osx-font-smoothing: grayscale; |
||||
} |
||||
|
||||
h1, |
||||
h2, |
||||
h3, |
||||
h4, |
||||
h5, |
||||
h6 { |
||||
margin: 8px 0; |
||||
} |
||||
|
||||
p { |
||||
margin: 0; |
||||
} |
||||
|
||||
.toolbar { |
||||
top: 0; |
||||
left: 0; |
||||
right: 0; |
||||
height: 60px; |
||||
display: flex; |
||||
align-items: center; |
||||
background-color: #183650; |
||||
color: white; |
||||
font-weight: 600; |
||||
} |
||||
|
||||
.terminal pre { |
||||
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace; |
||||
color: white; |
||||
padding: 0 1rem 1rem; |
||||
margin: 0; |
||||
} |
||||
|
||||
nav a { |
||||
padding: 5px; |
||||
text-decoration: none; |
||||
margin: 5px; |
||||
display: inline-block; |
||||
background-color: #E77620; |
||||
color: white; |
||||
border-radius: 4px; |
||||
} |
||||
|
||||
nav a:hover { |
||||
background-color: #42545C; |
||||
} |
||||
|
||||
.dropdown-menu { |
||||
min-width: fit-content; |
||||
} |
@ -0,0 +1,40 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {Title} from "@angular/platform-browser"; |
||||
import {ActivatedRoute, NavigationEnd, Router} from '@angular/router'; |
||||
import {filter} from 'rxjs/operators'; |
||||
|
||||
|
||||
@Component({ |
||||
selector: 'app-root', |
||||
templateUrl: './app.component.html', |
||||
styleUrls: ['./app.component.scss'] |
||||
}) |
||||
export class AppComponent implements OnInit { |
||||
|
||||
constructor(private router: Router, |
||||
private activatedRoute: ActivatedRoute, |
||||
private titleService: Title) { |
||||
|
||||
} |
||||
|
||||
ngOnInit() { |
||||
this.router.events.pipe( |
||||
filter(event => event instanceof NavigationEnd), |
||||
).subscribe(() => { |
||||
const rt = this.getChild(this.activatedRoute); |
||||
rt.data.subscribe(data => { |
||||
this.titleService.setTitle(data.title) |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
getChild(activatedRoute: ActivatedRoute): ActivatedRoute { |
||||
if (activatedRoute.firstChild) { |
||||
return this.getChild(activatedRoute.firstChild); |
||||
} else { |
||||
return activatedRoute; |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,64 @@ |
||||
import {NgModule} from '@angular/core'; |
||||
import {BrowserModule, Title} from '@angular/platform-browser'; |
||||
import {HttpClientModule} from "@angular/common/http"; |
||||
import {AppComponent} from './app.component'; |
||||
import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; |
||||
import {RouterModule} from "@angular/router"; |
||||
import {CollaborateurComponent} from './components/collaborateur/collaborateur.component'; |
||||
import {CollaborateurEditComponent} from './components/collaborateur/collaborateur-edit/collaborateur-edit.component'; |
||||
import {FormsModule, ReactiveFormsModule} from "@angular/forms"; |
||||
import {AppRoutingModule} from './app-routing.module'; |
||||
import {HomeComponent} from './components/home/home.component'; |
||||
import {AgenceComponent} from './components/agence/agence.component'; |
||||
import {AgenceEditComponent} from './components/agence/agence-edit/agence-edit.component'; |
||||
import {BusinessunitComponent} from './components/businessunit/businessunit.component'; |
||||
import {BusinessunitEditComponent} from './components/businessunit/businessunit-edit/businessunit-edit.component'; |
||||
import {PeriodeEssaiComponent} from './components/periode-essai/periode-essai.component'; |
||||
import {PeriodeEssaiEditComponent} from './components/periode-essai/periode-essai-edit/periode-essai-edit.component'; |
||||
import {CollaborateurAddComponent} from './components/collaborateur/collaborateur-add/collaborateur-add.component'; |
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; |
||||
import {ToastrModule} from 'ngx-toastr'; |
||||
import {ReferencementComponent} from './components/referencement/referencement.component'; |
||||
import {ReferencementAddComponent} from './components/referencement/referencement-add/referencement-add.component'; |
||||
import {ReferencementEditComponent} from './components/referencement/referencement-edit/referencement-edit.component'; |
||||
import {PeriodeEssaiAddComponent} from './components/periode-essai/periode-essai-add/periode-essai-add.component'; |
||||
import {BusinessunitAddComponent} from './components/businessunit/businessunit-add/businessunit-add.component'; |
||||
import {AgenceAddComponent} from './components/agence/agence-add/agence-add.component'; |
||||
|
||||
@NgModule({ |
||||
declarations: [ |
||||
AppComponent, |
||||
CollaborateurComponent, |
||||
CollaborateurEditComponent, |
||||
HomeComponent, |
||||
AgenceComponent, |
||||
AgenceEditComponent, |
||||
BusinessunitComponent, |
||||
BusinessunitEditComponent, |
||||
PeriodeEssaiComponent, |
||||
PeriodeEssaiEditComponent, |
||||
CollaborateurAddComponent, |
||||
ReferencementComponent, |
||||
ReferencementAddComponent, |
||||
ReferencementEditComponent, |
||||
PeriodeEssaiAddComponent, |
||||
BusinessunitAddComponent, |
||||
AgenceAddComponent, |
||||
|
||||
], |
||||
imports: [ |
||||
BrowserModule, |
||||
HttpClientModule, |
||||
NgbModule, |
||||
RouterModule, |
||||
FormsModule, |
||||
AppRoutingModule, |
||||
ReactiveFormsModule, |
||||
BrowserAnimationsModule, |
||||
ToastrModule.forRoot({preventDuplicates: true}), |
||||
], |
||||
providers: [Title], |
||||
bootstrap: [AppComponent] |
||||
}) |
||||
export class AppModule { |
||||
} |
@ -0,0 +1,33 @@ |
||||
<h3>Ajouter une agence : </h3> |
||||
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="registerForm"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3 mb-2"> |
||||
<label class="form-label">Nom</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && f.name.errors }" class="form-control" formControlName="name"> |
||||
<div *ngIf="submitted && f.name.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.name.errors.required">Le nom d'une agence est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-md-6"> |
||||
<label class="form-label">Business Unit</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && f.businessUnitId.errors }" class="form-select" |
||||
formControlName="businessUnitId" |
||||
id="businessUnit-select"> |
||||
<option disabled selected value="">Choisissez la business unit de cette agence</option> |
||||
<option *ngFor="let businessUnit of businessUnits" [ngValue]="businessUnit.id">{{businessUnit.name}}</option> |
||||
</select> |
||||
<div *ngIf="submitted && f.businessUnitId.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.businessUnitId.errors.required">Vous devez choisir la business unit à laquelle appartient |
||||
l'agence |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<div> |
||||
<button type="submit">Créer l'agence</button> |
||||
<button type="reset">Effacer</button> |
||||
</div> |
||||
</form> |
@ -0,0 +1,77 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {Agence} from "../../../interfaces/agence"; |
||||
import {Businessunit} from "../../../interfaces/businessunit"; |
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {AgenceService} from "../../../services/agence.service"; |
||||
import {BusinessunitService} from "../../../services/businessunit.service"; |
||||
import {ToastrService} from "ngx-toastr"; |
||||
|
||||
@Component({ |
||||
selector: 'app-agence-add', |
||||
templateUrl: './agence-add.component.html', |
||||
styleUrls: ['./agence-add.component.scss'] |
||||
}) |
||||
export class AgenceAddComponent implements OnInit { |
||||
|
||||
agence = {} as Agence; |
||||
businessUnits: Businessunit[] = []; |
||||
registerForm!: FormGroup; |
||||
submitted = false; |
||||
|
||||
constructor( |
||||
private http: HttpClient, |
||||
private agenceService: AgenceService, |
||||
private businessUnitService: BusinessunitService, |
||||
private formBuilder: FormBuilder, |
||||
private toastr: ToastrService |
||||
) { |
||||
} |
||||
|
||||
get f() { |
||||
return this.registerForm.controls; |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.getBusinessUnits(); |
||||
this.registerForm = this.formBuilder.group({ |
||||
name: ['', Validators.required], |
||||
businessUnitId: ['', Validators.required] |
||||
}); |
||||
} |
||||
|
||||
getBusinessUnits() { |
||||
this.businessUnitService.getBusinessunits() |
||||
.subscribe(businessunits => this.businessUnits = businessunits); |
||||
} |
||||
|
||||
onSubmit() { |
||||
this.submitted = true; |
||||
|
||||
if (this.registerForm.invalid) { |
||||
return; |
||||
} |
||||
this.agence.name = this.registerForm.value.name |
||||
this.agence.businessUnitId = this.registerForm.value.businessUnitId |
||||
this.agenceService.addAgence(this.agence) |
||||
.subscribe(() => { |
||||
this.showSuccess(); |
||||
}, |
||||
() => { |
||||
this.showError() |
||||
}); |
||||
} |
||||
|
||||
onReset() { |
||||
this.submitted = false; |
||||
this.registerForm.reset(); |
||||
} |
||||
|
||||
showSuccess() { |
||||
this.toastr.success('Création réussie', 'Agence'); |
||||
} |
||||
|
||||
showError() { |
||||
this.toastr.error('Création échouée', 'Agence'); |
||||
} |
||||
} |
@ -0,0 +1,41 @@ |
||||
<div *ngIf="agence"> |
||||
|
||||
<h2>{{agence.name | uppercase}} </h2> |
||||
|
||||
<form |
||||
(ngSubmit)="onSubmit()" |
||||
[formGroup]="registerForm"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3 mb-2"> |
||||
<label class="form-label">Nom</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && f.name.errors }" [value]="agence.name" class="form-control" |
||||
formControlName="name"> |
||||
<div *ngIf="submitted && f.name.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.name.errors.required">Le nom d'une agence est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-md-6"> |
||||
<label class="form-label">Business Unit</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && f.businessUnitId.errors }" class="form-select" |
||||
formControlName="businessUnitId" |
||||
id="businessUnit-select"> |
||||
<option disabled selected value="">Choisissez la business unit de cette agence</option> |
||||
<option *ngFor="let businessUnit of businessUnits" [ngValue]="businessUnit.id">{{businessUnit.name}}</option> |
||||
</select> |
||||
<div *ngIf="submitted && f.businessUnitId.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.businessUnitId.errors.required">Vous devez choisir la business unit à laquelle appartient |
||||
l'agence |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div> |
||||
<button type="submit">Sauvegarder les changements</button> |
||||
<button type="reset">Effacer</button> |
||||
<button (click)="goBack()" type="button">Retour</button> |
||||
</div> |
||||
</form> |
||||
|
||||
|
||||
</div> |
@ -0,0 +1,93 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {Agence} from "../../../interfaces/agence"; |
||||
import {ActivatedRoute} from "@angular/router"; |
||||
import {AgenceService} from "../../../services/agence.service"; |
||||
import {Location} from "@angular/common"; |
||||
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
||||
import {Businessunit} from "../../../interfaces/businessunit"; |
||||
import {BusinessunitService} from "../../../services/businessunit.service"; |
||||
import {Observable} from "rxjs"; |
||||
import {take, tap} from "rxjs/operators"; |
||||
import {ToastrService} from "ngx-toastr"; |
||||
|
||||
@Component({ |
||||
selector: 'app-agence-edit', |
||||
templateUrl: './agence-edit.component.html', |
||||
styleUrls: ['./agence-edit.component.scss'] |
||||
}) |
||||
export class AgenceEditComponent implements OnInit { |
||||
businessUnits: Businessunit[] = []; |
||||
agence = {} as Agence; |
||||
|
||||
agenceObservable!: Observable<Agence>; |
||||
id: number; |
||||
|
||||
registerForm!: FormGroup; |
||||
submitted = false; |
||||
|
||||
constructor( |
||||
private route: ActivatedRoute, |
||||
private agenceService: AgenceService, |
||||
private businessUnitService: BusinessunitService, |
||||
private location: Location, |
||||
private formBuilder: FormBuilder, |
||||
private toastr: ToastrService |
||||
) { |
||||
this.id = Number(this.route.snapshot.paramMap.get('id')) |
||||
} |
||||
|
||||
get f() { |
||||
return this.registerForm.controls; |
||||
} |
||||
|
||||
async ngOnInit() { |
||||
this.getBusinessUnits() |
||||
this.registerForm = this.formBuilder.group({ |
||||
name: ['', Validators.required], |
||||
businessUnitId: ['', Validators.required] |
||||
}); |
||||
this.agenceObservable = this.agenceService.getAgence(this.id).pipe(tap(agence => this.registerForm.patchValue(agence))) |
||||
this.agence = await this.agenceObservable.pipe(take(1)).toPromise() |
||||
} |
||||
|
||||
getBusinessUnits() { |
||||
this.businessUnitService.getBusinessunits() |
||||
.subscribe(businessunits => this.businessUnits = businessunits); |
||||
} |
||||
|
||||
goBack(): void { |
||||
this.location.back(); |
||||
} |
||||
|
||||
onSubmit(): void { |
||||
this.submitted = true |
||||
if (this.registerForm.invalid) { |
||||
return; |
||||
} |
||||
if (this.agence) { |
||||
this.agence.name = this.registerForm.value.name |
||||
this.agence.businessUnitId = this.registerForm.value.businessUnitId |
||||
this.agenceService.updateAgence(this.agence) |
||||
.subscribe(() => { |
||||
this.showSuccess(); |
||||
}, |
||||
() => { |
||||
this.showError() |
||||
}); |
||||
} |
||||
} |
||||
|
||||
onReset() { |
||||
this.submitted = false; |
||||
this.registerForm.reset(); |
||||
} |
||||
|
||||
showSuccess() { |
||||
this.toastr.success('Modification réussie', 'Agence'); |
||||
} |
||||
|
||||
showError() { |
||||
this.toastr.error('Modification échouée', 'Agence'); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,28 @@ |
||||
<div xmlns=""> |
||||
|
||||
<h2 class=mb-4>Agences</h2> |
||||
|
||||
<div style="display: flex"> |
||||
<p style="margin: 10px 0 10px 0">Pour ajouter une nouvelle agence, cliquez ici : </p> |
||||
<button routerLink="/agences/add">Ajouter</button> |
||||
</div> |
||||
|
||||
<div class="mb-5 col-12" style="overflow-x:auto;"> |
||||
<table class="table"> |
||||
<thead> |
||||
<tr> |
||||
<th scope="col">Nom</th> |
||||
<th scope="col"> Business Unit attitrée</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let agence of agences"> |
||||
<th>{{agence.name}}</th> |
||||
<td>{{getBusinessUnitById(agence.businessUnitId).name}}</td> |
||||
<td><a routerLink="{{agence.id}}"> Modifier </a></td> |
||||
</tr> |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
|
||||
</div> |
@ -0,0 +1,2 @@ |
||||
|
||||
|
@ -0,0 +1,53 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {Agence} from "../../interfaces/agence"; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {AgenceService} from "../../services/agence.service"; |
||||
import {Businessunit} from "../../interfaces/businessunit"; |
||||
import {BusinessunitService} from "../../services/businessunit.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-agence', |
||||
templateUrl: './agence.component.html', |
||||
styleUrls: ['./agence.component.scss'] |
||||
}) |
||||
export class AgenceComponent implements OnInit { |
||||
agences: Agence[] = []; |
||||
businessUnits: Businessunit[] = []; |
||||
|
||||
|
||||
constructor( |
||||
private http: HttpClient, |
||||
private agenceService: AgenceService, |
||||
private businessUnitService: BusinessunitService, |
||||
) { |
||||
} |
||||
|
||||
|
||||
ngOnInit(): void { |
||||
this.getAgences(); |
||||
this.getBusinessUnits(); |
||||
} |
||||
|
||||
getAgences(): void { |
||||
this.agenceService.getAgences() |
||||
.subscribe(agences => this.agences = agences); |
||||
} |
||||
|
||||
getBusinessUnits(): void { |
||||
this.businessUnitService.getBusinessunits() |
||||
.subscribe(bus => this.businessUnits = bus); |
||||
} |
||||
|
||||
getBusinessUnitById(id: number): Businessunit { |
||||
let bu = {} as Businessunit; |
||||
this.businessUnits.forEach(c => { |
||||
if (c.id == id) { |
||||
bu = c; |
||||
return; |
||||
} |
||||
}); |
||||
return bu; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,17 @@ |
||||
<h3>Ajouter une Business Unit : </h3> |
||||
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="registerForm"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3 mb-2"> |
||||
<label class="form-label">Nom</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && f.name.errors }" class="form-control" formControlName="name"> |
||||
<div *ngIf="submitted && f.name.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.name.errors.required">Le nom d'une business unit est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div> |
||||
<button type="submit">Créer la business unit</button> |
||||
<button type="reset">Effacer</button> |
||||
</div> |
||||
</form> |
@ -0,0 +1,72 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {Businessunit} from "../../../interfaces/businessunit"; |
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {BusinessunitService} from "../../../services/businessunit.service"; |
||||
import {ToastrService} from "ngx-toastr"; |
||||
|
||||
@Component({ |
||||
selector: 'app-businessunit-add', |
||||
templateUrl: './businessunit-add.component.html', |
||||
styleUrls: ['./businessunit-add.component.scss'] |
||||
}) |
||||
export class BusinessunitAddComponent implements OnInit { |
||||
|
||||
businessunit = {} as Businessunit; |
||||
|
||||
registerForm!: FormGroup; |
||||
submitted = false; |
||||
|
||||
constructor( |
||||
private http: HttpClient, |
||||
private businessunitService: BusinessunitService, |
||||
private formBuilder: FormBuilder, |
||||
private toastr: ToastrService |
||||
) { |
||||
} |
||||
|
||||
get f() { |
||||
return this.registerForm.controls; |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.registerForm = this.formBuilder.group({ |
||||
name: ['', Validators.required], |
||||
}); |
||||
} |
||||
|
||||
add(businessunit: Businessunit): void { |
||||
this.businessunitService.addBusinessunit(businessunit) |
||||
.subscribe(() => { |
||||
this.showSuccess(); |
||||
}, |
||||
() => { |
||||
this.showError() |
||||
}); |
||||
|
||||
} |
||||
|
||||
onSubmit() { |
||||
this.submitted = true; |
||||
|
||||
if (this.registerForm.invalid) { |
||||
return; |
||||
} |
||||
this.businessunit = this.registerForm.value |
||||
this.add(this.businessunit) |
||||
} |
||||
|
||||
onReset() { |
||||
this.submitted = false; |
||||
this.registerForm.reset(); |
||||
} |
||||
|
||||
showSuccess() { |
||||
this.toastr.success('Création réussie', 'Business Unit'); |
||||
} |
||||
|
||||
showError() { |
||||
this.toastr.error('Création échouée', 'Business Unit'); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,23 @@ |
||||
<div *ngIf="businessunit"> |
||||
|
||||
<h2>{{bu.name | uppercase}} </h2> |
||||
|
||||
<form |
||||
(ngSubmit)="onSubmit()" |
||||
[formGroup]="registerForm"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3 mb-2"> |
||||
<label class="form-label">Nom</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && f.name.errors }" class="form-control" formControlName="name"> |
||||
<div *ngIf="submitted && f.name.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.name.errors.required">Le nom d'une business unit est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div> |
||||
<button type="submit">Sauvegarder les changements</button> |
||||
<button type="reset">Effacer</button> |
||||
<button type="button" (click)="goBack()">Retour</button> |
||||
</div> |
||||
</form> |
||||
</div> |
@ -0,0 +1,82 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {Businessunit} from "../../../interfaces/businessunit"; |
||||
import {ActivatedRoute} from "@angular/router"; |
||||
import {BusinessunitService} from "../../../services/businessunit.service"; |
||||
import {Location} from "@angular/common"; |
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; |
||||
import {Observable} from "rxjs"; |
||||
import {take, tap} from "rxjs/operators"; |
||||
import {ToastrService} from "ngx-toastr"; |
||||
|
||||
@Component({ |
||||
selector: 'app-businessunit-edit', |
||||
templateUrl: './businessunit-edit.component.html', |
||||
styleUrls: ['./businessunit-edit.component.scss'] |
||||
}) |
||||
export class BusinessunitEditComponent implements OnInit { |
||||
|
||||
businessunit!: Observable<Businessunit>; |
||||
bu = {} as Businessunit; |
||||
id: number; |
||||
|
||||
registerForm!: FormGroup; |
||||
submitted = false; |
||||
|
||||
constructor( |
||||
private route: ActivatedRoute, |
||||
private businessunitService: BusinessunitService, |
||||
private location: Location, |
||||
private formBuilder: FormBuilder, |
||||
private toastr: ToastrService |
||||
) { |
||||
this.id = Number(this.route.snapshot.paramMap.get('id')) |
||||
} |
||||
|
||||
get f() { |
||||
return this.registerForm.controls; |
||||
} |
||||
|
||||
async ngOnInit() { |
||||
this.registerForm = this.formBuilder.group({ |
||||
name: ['', Validators.required] |
||||
}); |
||||
this.businessunit = this.businessunitService.getBusinessunit(this.id).pipe(tap(businessUnit => this.registerForm.patchValue(businessUnit))); |
||||
this.bu = await this.businessunit.pipe(take(1)).toPromise() |
||||
} |
||||
|
||||
onSubmit() { |
||||
this.submitted = true; |
||||
if (this.registerForm.invalid) { |
||||
return; |
||||
} |
||||
this.bu.name = this.registerForm.value.name |
||||
|
||||
if (this.businessunit) { |
||||
this.businessunitService.updateBusinessunit(this.bu, this.id) |
||||
.subscribe(() => { |
||||
this.showSuccess(); |
||||
}, |
||||
() => { |
||||
this.showError() |
||||
}); |
||||
} |
||||
} |
||||
|
||||
onReset() { |
||||
this.submitted = false; |
||||
this.registerForm.reset(); |
||||
} |
||||
|
||||
goBack(): void { |
||||
this.location.back(); |
||||
} |
||||
|
||||
showSuccess() { |
||||
this.toastr.success('Modification réussie', 'Business Unit'); |
||||
} |
||||
|
||||
showError() { |
||||
this.toastr.error('Modification échouée', 'Business Unit'); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,26 @@ |
||||
<div xmlns=""> |
||||
|
||||
<h2 class=mb-4>Business Units</h2> |
||||
|
||||
<div style="display: flex"> |
||||
<p style="margin: 10px 0 10px 0">Pour ajouter une nouvelle business unit, cliquez ici : </p> |
||||
<button routerLink="/businessunits/add">Ajouter</button> |
||||
</div> |
||||
|
||||
<div class="mb-5 col-12" style="overflow-x:auto;"> |
||||
<table class="table"> |
||||
<thead> |
||||
<tr> |
||||
<th scope="col">Nom</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let businessunit of businessunits"> |
||||
<th scope="row">{{businessunit.name}}</th> |
||||
<td><a routerLink="{{businessunit.id}}"> Modifier </a></td> |
||||
</tr> |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
|
||||
</div> |
@ -0,0 +1,37 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {Businessunit} from "../../interfaces/businessunit"; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {BusinessunitService} from "../../services/businessunit.service"; |
||||
import {FormGroup} from "@angular/forms"; |
||||
|
||||
|
||||
@Component({ |
||||
selector: 'app-businessunit', |
||||
templateUrl: './businessunit.component.html', |
||||
styleUrls: ['./businessunit.component.scss'] |
||||
}) |
||||
export class BusinessunitComponent implements OnInit { |
||||
|
||||
businessunits: Businessunit[] = []; |
||||
|
||||
registerForm!: FormGroup; |
||||
submitted = false; |
||||
|
||||
constructor( |
||||
private http: HttpClient, |
||||
private businessunitService: BusinessunitService, |
||||
) { |
||||
} |
||||
|
||||
|
||||
ngOnInit(): void { |
||||
this.getBusinessunits(); |
||||
} |
||||
|
||||
getBusinessunits(): void { |
||||
this.businessunitService.getBusinessunits() |
||||
.subscribe(businessunits => this.businessunits = businessunits); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,165 @@ |
||||
<h3>Ajouter un collaborateur : </h3> |
||||
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="registerForm"> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Nom</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && form.name.errors }" class="form-control" formControlName="name"> |
||||
<div *ngIf="submitted && form.name.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.name.errors.required">Le nom d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Prénom</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && form.firstName.errors }" class="form-control" |
||||
formControlName="firstName"> |
||||
<div *ngIf="submitted && form.firstName.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.firstName.errors.required">Le prénom d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de naissance</label> |
||||
<input (change)="onBirthDateChange($event)" [ngClass]="{ 'is-invalid': submitted && form.birthDate.errors }" |
||||
class="form-control" formControlName="birthDate" |
||||
type="date"> |
||||
<div *ngIf="submitted && form.birthDate.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.birthDate.errors.required">La date de naissance d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Genre</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && form.gender.errors }" class="form-select" |
||||
formControlName="gender"> |
||||
<option disabled selected value="">Genre</option> |
||||
<option value="MASCULIN">Masculin</option> |
||||
<option value="FEMININ">Féminin</option> |
||||
<option value="AUTRE">Autre</option> |
||||
</select> |
||||
<div *ngIf="submitted && form.gender.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.gender.errors.required">Vous devez préciser le genre du collaborateur</div> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Statut</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && form.status.errors }" class="form-select" |
||||
formControlName="status"> |
||||
<option disabled selected value="">Statut</option> |
||||
<option value="CADRE">Cadre</option> |
||||
<option value="NONCADRE">Non-cadre</option> |
||||
<option value="ALTERNANT">Alternant</option> |
||||
<option value="STAGIAIRE">Stagiaire</option> |
||||
</select> |
||||
<div *ngIf="submitted && form.status.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.status.errors.required">Vous devez préciser le statut du collaborateur</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Nombre d'enfants</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && form.childrenNumber.errors }" class="form-control" |
||||
formControlName="childrenNumber" min="0" onkeyup="if(this.value<0){this.value= this.value * -1}" |
||||
type="number"> |
||||
<div *ngIf="submitted && form.childrenNumber.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.childrenNumber.errors.required">Le nombre d'enfant d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Adresse</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && form.address.errors }" class="form-control" |
||||
formControlName="address"> |
||||
<div *ngIf="submitted && form.address.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.address.errors.required">L'adresse d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Téléphone</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && form.telephone.errors }" class="form-control" |
||||
formControlName="telephone"> |
||||
<div *ngIf="submitted && form.telephone.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.telephone.errors.required">Le numéro de téléphone d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<div style="display: flex"> |
||||
<label class="form-label" style="padding-right: 5px">Mail personnel</label> |
||||
<small>(pas Apside)</small> |
||||
</div> |
||||
<input [ngClass]="{ 'is-invalid': submitted && form.personalMail.errors }" class="form-control" |
||||
formControlName="personalMail" |
||||
placeholder="prenom.nom@example.com" type="email"> |
||||
<div *ngIf="submitted && form.personalMail.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.personalMail.errors.required">Le mail personnel d'un collaborateur est obligatoire</div> |
||||
<div *ngIf="form.personalMail.errors.pattern">Le mail personnel d'un collaborateur doit être au format |
||||
"exemple@nom.de.domaine" |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Mail Apside</label> |
||||
<input [ngClass]="{ 'is-invalid': (submitted && form.apsideMail.errors) || errorValue==1 }" |
||||
[value]="collaborateur.apsideMail" class="form-control" |
||||
formControlName="apsideMail" |
||||
placeholder="prenom.nom@apside-groupe.com" type="email"> |
||||
<div *ngIf="submitted && form.apsideMail.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.apsideMail.errors.required">Le mail Apside d'un collaborateur est obligatoire</div> |
||||
<div *ngIf="form.apsideMail.errors.pattern">Le mail Apside d'un collaborateur doit être au format |
||||
"exemple@apside-groupe.com" ou "exemple@apside.fr" |
||||
</div> |
||||
</div> |
||||
<div *ngIf="submitted && errorValue==1" class="invalid-feedback"> |
||||
<div *ngIf="errorValue==1">Le mail Apside que vous avez entré est déjà utilisé pour un autre collaborateur</div> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de départ</label> |
||||
<input (change)="onResignationDateChange($event)" |
||||
[ngClass]="{ 'is-invalid': submitted && form.resignationDate.errors }" class="form-control" |
||||
formControlName="resignationDate" |
||||
type="date"> |
||||
<div *ngIf="submitted && form.resignationDate.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.resignationDate.errors.required">La date de départ d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-md-6"> |
||||
<label class="form-label">Business Unit</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && form.businessUnitId.errors }" class="form-select" |
||||
formControlName="businessUnitId"> |
||||
<option disabled selected value="">Choisissez une Business Unit pour le collaborateur</option> |
||||
<option *ngFor="let businessUnit of businessUnits" [ngValue]="businessUnit.id">{{businessUnit.name}} </option> |
||||
</select> |
||||
<div *ngIf="submitted && form.businessUnitId.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.businessUnitId.errors.required">Vous devez préciser la Business Unit du collaborateur</div> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div> |
||||
<button type="submit">Ajouter le collaborateur</button> |
||||
<button type="reset">Effacer</button> |
||||
</div> |
||||
</form> |
@ -0,0 +1,108 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; |
||||
import {Collaborateur} from "../../../interfaces/collaborateur"; |
||||
import {Businessunit} from "../../../interfaces/businessunit"; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {BusinessunitService} from "../../../services/businessunit.service"; |
||||
import {CollaborateurService} from "../../../services/collaborateur.service"; |
||||
import {ToastrService} from "ngx-toastr"; |
||||
import {Router} from '@angular/router'; |
||||
|
||||
@Component({ |
||||
selector: 'app-collaborateur-add', |
||||
templateUrl: './collaborateur-add.component.html', |
||||
styleUrls: ['./collaborateur-add.component.scss'] |
||||
}) |
||||
export class CollaborateurAddComponent implements OnInit { |
||||
|
||||
collaborateurs: Collaborateur[] = []; |
||||
collaborateur = {} as Collaborateur; |
||||
businessUnits: Businessunit[] = []; |
||||
|
||||
errorValue: number = 0; |
||||
|
||||
registerForm!: FormGroup; |
||||
submitted = false; |
||||
|
||||
constructor(private http: HttpClient, |
||||
private businessunitService: BusinessunitService, |
||||
private collaborateurService: CollaborateurService, |
||||
private formBuilder: FormBuilder, |
||||
private toastr: ToastrService, |
||||
private router: Router) { |
||||
} |
||||
|
||||
get form() { |
||||
return this.registerForm.controls; |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.getCollaborateurs(); |
||||
this.getBusinessunits(); |
||||
this.registerForm = this.formBuilder.group({ |
||||
name: ['', Validators.required], |
||||
firstName: ['', Validators.required], |
||||
birthDate: ['', Validators.required], |
||||
gender: ['', Validators.required], |
||||
status: ['', Validators.required], |
||||
childrenNumber: ['', Validators.required], |
||||
address: ['', Validators.required], |
||||
telephone: ['', Validators.required], |
||||
personalMail: ['', Validators.compose([Validators.required, Validators.pattern(".*@[a-z]*\.[a-z]*")])], |
||||
apsideMail: ['', Validators.compose([Validators.required, Validators.pattern(".*@apside-groupe\.com|.*@apside\.fr")])], |
||||
resignationDate: [], |
||||
businessUnitId: ['', Validators.required], |
||||
}); |
||||
} |
||||
|
||||
getCollaborateurs(): void { |
||||
this.collaborateurService.getCollaborateurs() |
||||
.subscribe(collaborateurs => this.collaborateurs = collaborateurs); |
||||
} |
||||
|
||||
getBusinessunits(): void { |
||||
this.businessunitService.getBusinessunits() |
||||
.subscribe(businessunits => this.businessUnits = businessunits); |
||||
} |
||||
|
||||
onSubmit() { |
||||
this.submitted = true; |
||||
if (this.registerForm.invalid) { |
||||
return; |
||||
} |
||||
this.collaborateur = this.registerForm.value |
||||
if (this.collaborateur) { |
||||
this.collaborateurService.addCollaborateur(this.collaborateur).subscribe(collaborateur => { |
||||
this.collaborateurs.push(collaborateur); |
||||
this.showSuccess(); |
||||
this.router.navigateByUrl('/periodeessais/add?apsideMail=' + this.registerForm.value.apsideMail); |
||||
}, |
||||
() => { |
||||
this.showError() |
||||
}) |
||||
|
||||
} |
||||
} |
||||
|
||||
onReset() { |
||||
this.submitted = false; |
||||
this.registerForm.reset(); |
||||
} |
||||
|
||||
onResignationDateChange($event: any): void { |
||||
this.collaborateur.resignationDate = new Date($event.target.value); |
||||
} |
||||
|
||||
onBirthDateChange($event: any): void { |
||||
this.collaborateur.birthDate = new Date($event.target.value); |
||||
} |
||||
|
||||
showSuccess() { |
||||
this.toastr.success('Création réussie', 'Collaborateur'); |
||||
} |
||||
|
||||
showError() { |
||||
this.toastr.error('Création échouée', 'Collaborateur'); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,176 @@ |
||||
<div *ngIf="collaborateur"> |
||||
|
||||
<h2>{{collaborateur.name | uppercase}} {{collaborateur.firstName | uppercase}} </h2> |
||||
|
||||
<form (ngSubmit)="onSubmit()" |
||||
[formGroup]="registerForm"> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Nom</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && f.name.errors }" [value]="collaborateur.name" |
||||
class="form-control" |
||||
formControlName="name"> |
||||
<div *ngIf="submitted && f.name.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.name.errors.required">Le nom d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Prénom</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && f.firstName.errors }" [value]="collaborateur.firstName" |
||||
class="form-control" formControlName="firstName"> |
||||
<div *ngIf="submitted && f.firstName.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.firstName.errors.required">Le prénom d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de naissance</label> |
||||
<input (change)="onBirthDateChange($event)" [ngClass]="{ 'is-invalid': submitted && f.birthDate.errors }" |
||||
[value]="collaborateur.birthDate | date:'yyyy-MM-dd'" |
||||
class="form-control" formControlName="birthDate" |
||||
type="date"> |
||||
<div *ngIf="submitted && f.birthDate.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.birthDate.errors.required">La date de naissance d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Genre</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && f.gender.errors }" [value]="collaborateur.gender" |
||||
class="form-select" |
||||
formControlName="gender"> |
||||
<option disabled selected value="">Genre</option> |
||||
<option value="MASCULIN">Masculin</option> |
||||
<option value="FEMININ">Féminin</option> |
||||
<option value="AUTRE">Autre</option> |
||||
</select> |
||||
<div *ngIf="submitted && f.gender.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.gender.errors.required">Vous devez préciser le genre du collaborateur</div> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Statut</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && f.status.errors }" [value]="collaborateur.status" |
||||
class="form-select" |
||||
formControlName="status"> |
||||
<option disabled selected value="">Statut</option> |
||||
<option value="CADRE">Cadre</option> |
||||
<option value="NONCADRE">Non-cadre</option> |
||||
<option value="ALTERNANT">Alternant</option> |
||||
<option value="STAGIAIRE">Stagiaire</option> |
||||
</select> |
||||
<div *ngIf="submitted && f.status.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.status.errors.required">Vous devez préciser le statut du collaborateur</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Nombre d'enfants</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && f.childrenNumber.errors }" [value]="collaborateur.childrenNumber" |
||||
class="form-control" formControlName="childrenNumber" min="0" |
||||
onkeyup="if(this.value<0){this.value= this.value * -1}" type="number"> |
||||
<div *ngIf="submitted && f.childrenNumber.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.childrenNumber.errors.required">Le nombre d'enfant d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Adresse</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && f.address.errors }" [value]="collaborateur.address" |
||||
class="form-control" formControlName="address"> |
||||
<div *ngIf="submitted && f.address.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.address.errors.required">L'adresse d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Téléphone</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && f.telephone.errors }" [value]="collaborateur.telephone" |
||||
class="form-control" formControlName="telephone"> |
||||
<div *ngIf="submitted && f.telephone.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.telephone.errors.required">Le numéro de téléphone d'un collaborateur est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<div style="display: flex"> |
||||
<label class="form-label" style="padding-right: 5px">Mail personnel</label> |
||||
<small>(pas Apside)</small> |
||||
</div> |
||||
<input [ngClass]="{ 'is-invalid': submitted && f.personalMail.errors }" [value]="collaborateur.personalMail" |
||||
class="form-control" |
||||
formControlName="personalMail" placeholder="prenom.nom@example.com" |
||||
type="email"> |
||||
<div *ngIf="submitted && f.personalMail.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.personalMail.errors.required">Le mail personnel d'un collaborateur est obligatoire</div> |
||||
<div *ngIf="f.personalMail.errors.pattern">Le mail personnel d'un collaborateur doit être au format |
||||
"exemple@nom.de.domaine" |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Mail Apside</label> |
||||
<input [ngClass]="{ 'is-invalid': (submitted && f.apsideMail.errors) || errorValue==1 }" |
||||
[value]="collaborateur.apsideMail" class="form-control" |
||||
formControlName="apsideMail" |
||||
placeholder="prenom.nom@apside-groupe.com" type="email"> |
||||
<div *ngIf="submitted && f.apsideMail.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.apsideMail.errors.required">Le mail Apside d'un collaborateur est obligatoire</div> |
||||
<div *ngIf="f.apsideMail.errors.pattern">Le mail Apside d'un collaborateur doit être au format |
||||
"exemple@apside-groupe.com" ou "exemple@apside.fr" |
||||
</div> |
||||
</div> |
||||
<div *ngIf="submitted && errorValue==1" class="invalid-feedback"> |
||||
<div *ngIf="errorValue==1">Le mail Apside que vous avez entré est déjà utilisé pour un autre collaborateur |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de départ</label> |
||||
<input (change)="onResignationDateChange($event)" |
||||
[ngClass]="{ 'is-invalid': submitted && f.resignationDate.errors }" |
||||
[value]="collaborateur.resignationDate | date:'yyyy-MM-dd'" |
||||
class="form-control" formControlName="resignationDate" |
||||
type="date"> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-md-6"> |
||||
<label class="form-label">Business Unit</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && f.businessUnitId.errors }" class="form-select" |
||||
formControlName="businessUnitId"> |
||||
<option disabled selected value="">Choisissez une Business Unit pour le collaborateur</option> |
||||
<option *ngFor="let businessUnit of businessUnits" [ngValue]="businessUnit.id">{{businessUnit.name}} </option> |
||||
</select> |
||||
<div *ngIf="submitted && f.businessUnitId.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.businessUnitId.errors.required">Vous devez préciser la Business Unit du collaborateur</div> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div> |
||||
<button type="submit">Sauvegarder les changements</button> |
||||
<button type="button" (click)="delete()">Supprimer le collaborateur</button> |
||||
<button type="reset">Effacer</button> |
||||
<button type="button" (click)="goBack()">Retour</button> |
||||
</div> |
||||
</form> |
||||
|
||||
</div> |
@ -0,0 +1,142 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {Collaborateur} from "../../../interfaces/collaborateur"; |
||||
import {ActivatedRoute} from '@angular/router'; |
||||
import {Location} from '@angular/common'; |
||||
import {CollaborateurService} from "../../../services/collaborateur.service"; |
||||
import {BusinessunitService} from "../../../services/businessunit.service"; |
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; |
||||
import {Businessunit} from "../../../interfaces/businessunit"; |
||||
import {Observable} from "rxjs"; |
||||
import {take, tap} from "rxjs/operators"; |
||||
import {ToastrService} from "ngx-toastr"; |
||||
|
||||
@Component({ |
||||
selector: 'app-collaborateur-edit', |
||||
templateUrl: './collaborateur-edit.component.html', |
||||
styleUrls: ['./collaborateur-edit.component.scss'] |
||||
}) |
||||
export class CollaborateurEditComponent implements OnInit { |
||||
|
||||
collaborateurObservable!: Observable<Collaborateur>; |
||||
id: number; |
||||
|
||||
collaborateur = {} as Collaborateur; |
||||
collaborateurs: Collaborateur[] = []; |
||||
businessUnits: Businessunit[] = []; |
||||
errorValue: number = 0; |
||||
|
||||
registerForm!: FormGroup; |
||||
submitted = false; |
||||
|
||||
constructor( |
||||
private route: ActivatedRoute, |
||||
private collaborateurService: CollaborateurService, |
||||
private businessunitService: BusinessunitService, |
||||
private location: Location, |
||||
private formBuilder: FormBuilder, |
||||
private toastr: ToastrService |
||||
) { |
||||
this.id = Number(this.route.snapshot.paramMap.get('id')) |
||||
} |
||||
|
||||
get f() { |
||||
return this.registerForm.controls; |
||||
} |
||||
|
||||
async ngOnInit() { |
||||
this.getCollaborateurs() |
||||
this.getBusinessunits(); |
||||
this.registerForm = this.formBuilder.group({ |
||||
name: ['', Validators.required], |
||||
firstName: ['', Validators.required], |
||||
birthDate: ['', Validators.required], |
||||
gender: ['', Validators.required], |
||||
status: ['', Validators.required], |
||||
childrenNumber: ['', Validators.required], |
||||
address: ['', Validators.required], |
||||
telephone: ['', Validators.required], |
||||
personalMail: ['', Validators.compose([Validators.required, Validators.pattern(".+@[a-z]*\.[a-z]*")])], |
||||
apsideMail: ['', Validators.compose([Validators.required, Validators.pattern(".+@apside-groupe\.com|.*@apside\.fr")])], |
||||
resignationDate: [], |
||||
businessUnitId: ['', Validators.required], |
||||
}); |
||||
this.collaborateurObservable = this.collaborateurService.getCollaborateur(this.id).pipe(tap(collaborateur => this.registerForm.patchValue(collaborateur))) |
||||
this.collaborateur = await this.collaborateurObservable.pipe(take(1)).toPromise() |
||||
} |
||||
|
||||
getCollaborateurs(): void { |
||||
this.collaborateurService.getCollaborateurs() |
||||
.subscribe(collaborateurs => this.collaborateurs = collaborateurs); |
||||
} |
||||
|
||||
getBusinessunits(): void { |
||||
this.businessunitService.getBusinessunits() |
||||
.subscribe(businessunits => this.businessUnits = businessunits); |
||||
} |
||||
|
||||
goBack(): void { |
||||
this.location.back(); |
||||
} |
||||
|
||||
delete(): void { |
||||
if (this.collaborateur) { |
||||
this.collaborateurService.deleteCollaborateur(this.collaborateur) |
||||
.subscribe(() => this.goBack()); |
||||
} |
||||
} |
||||
|
||||
onSubmit() { |
||||
this.submitted = true; |
||||
|
||||
if (this.registerForm.invalid) { |
||||
return; |
||||
} |
||||
|
||||
this.collaborateur.name = this.registerForm.value.name |
||||
this.collaborateur.firstName = this.registerForm.value.firstName |
||||
this.collaborateur.birthDate = this.registerForm.value.birthDate |
||||
this.collaborateur.gender = this.registerForm.value.gender |
||||
this.collaborateur.businessUnitId = this.registerForm.value.businessUnitId |
||||
this.collaborateur.apsideMail = this.registerForm.value.apsideMail |
||||
this.collaborateur.personalMail = this.registerForm.value.personalMail |
||||
this.collaborateur.telephone = this.registerForm.value.telephone |
||||
this.collaborateur.address = this.registerForm.value.address |
||||
this.collaborateur.childrenNumber = this.registerForm.value.childrenNumber |
||||
this.collaborateur.status = this.registerForm.value.status |
||||
|
||||
if (this.registerForm.value.resignationDate == undefined) { |
||||
this.collaborateur.resignationDate = new Date(); |
||||
} |
||||
|
||||
if (this.collaborateur) { |
||||
this.collaborateurService.updateCollaborateur(this.collaborateur).subscribe(() => { |
||||
this.showSuccess(); |
||||
}, |
||||
() => { |
||||
this.showError() |
||||
}) |
||||
|
||||
} |
||||
} |
||||
|
||||
onReset() { |
||||
this.submitted = false; |
||||
this.registerForm.reset(); |
||||
} |
||||
|
||||
onResignationDateChange($event: any): void { |
||||
this.collaborateur.resignationDate = new Date($event.target.value); |
||||
} |
||||
|
||||
onBirthDateChange($event: any): void { |
||||
this.collaborateur.birthDate = new Date($event.target.value); |
||||
} |
||||
|
||||
showSuccess() { |
||||
this.toastr.success('Modification réussie', 'Collaborateur'); |
||||
} |
||||
|
||||
showError() { |
||||
this.toastr.error('Modification échouée', 'Collaborateur'); |
||||
} |
||||
} |
@ -0,0 +1,33 @@ |
||||
<div> |
||||
|
||||
<h2 class=mb-4>Collaborateurs</h2> |
||||
|
||||
<div style="display: flex"> |
||||
<p style="margin: 10px 0 10px 0">Pour ajouter un nouveau collaborateur, cliquez ici : </p> |
||||
<button routerLink="/collaborateurs/add">Ajouter</button> |
||||
</div> |
||||
|
||||
|
||||
<div class="mb-5 col-12" style="overflow-x:auto;"> |
||||
<table class="table"> |
||||
<thead> |
||||
<tr> |
||||
<th scope="col">Nom</th> |
||||
<th scope="col">Prénom</th> |
||||
<th scope="col">Mail Apside</th> |
||||
</tr> |
||||
</thead> |
||||
|
||||
<tbody> |
||||
<tr *ngFor="let collaborateur of collaborateurs"> |
||||
<th scope="row">{{collaborateur.name}}</th> |
||||
<td> {{collaborateur.firstName}} </td> |
||||
<td> {{collaborateur.apsideMail}} </td> |
||||
<td><a routerLink="{{collaborateur.id}}"> Modifier </a></td> |
||||
</tr> |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
|
||||
|
||||
</div> |
@ -0,0 +1,33 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {CollaborateurService} from "../../services/collaborateur.service"; |
||||
import {Collaborateur} from "../../interfaces/collaborateur"; |
||||
import {BusinessunitService} from "../../services/businessunit.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-collaborateur', |
||||
templateUrl: './collaborateur.component.html', |
||||
styleUrls: ['./collaborateur.component.scss'] |
||||
}) |
||||
export class CollaborateurComponent implements OnInit { |
||||
collaborateurs: Collaborateur[] = []; |
||||
|
||||
constructor( |
||||
private http: HttpClient, |
||||
private businessunitService: BusinessunitService, |
||||
private collaborateurService: CollaborateurService, |
||||
) { |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.getCollaborateurs(); |
||||
|
||||
} |
||||
|
||||
getCollaborateurs(): void { |
||||
this.collaborateurService.getCollaborateurs() |
||||
.subscribe(collaborateurs => this.collaborateurs = collaborateurs); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,2 @@ |
||||
<h2>Services Collaborateurs EPA</h2> |
||||
|
@ -0,0 +1,16 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
|
||||
@Component({ |
||||
selector: 'app-home', |
||||
templateUrl: './home.component.html', |
||||
styleUrls: ['./home.component.scss'] |
||||
}) |
||||
export class HomeComponent implements OnInit { |
||||
|
||||
constructor() { |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
} |
||||
|
||||
} |
@ -0,0 +1,75 @@ |
||||
<h3>Ajouter une Période d'essai : </h3> |
||||
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="registerForm"> |
||||
|
||||
<div class="form-group col-12 col-md-6"> |
||||
<label class="form-label">Collaborateur</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && f.collaborateurId.errors }" class="form-select" |
||||
formControlName="collaborateurId" |
||||
id="collaborateur-select"> |
||||
<option *ngFor="let collaborateur of collaborateurs" |
||||
[ngValue]="collaborateur.id">{{collaborateur.name}} {{collaborateur.firstName}}</option> |
||||
</select> |
||||
<div *ngIf="submitted && f.collaborateurId.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.collaborateurId.errors.required">Vous devez choisir le collaborateur concerné par cette période |
||||
d'essai |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="row mb-2"> |
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de début</label> |
||||
<input (change)="onStartingDateChange($event)" [ngClass]="{ 'is-invalid': submitted && f.startingDate.errors }" |
||||
class="form-control" formControlName="startingDate" |
||||
type="date"> |
||||
<div *ngIf="submitted && f.startingDate.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.startingDate.errors.required">La date de début d'une période d'essai est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de fin prévue</label> |
||||
<input (change)="onPlannedEndingDateChange($event)" |
||||
[ngClass]="{ 'is-invalid': submitted && f.plannedEndingDate.errors }" class="form-control" |
||||
formControlName="plannedEndingDate" |
||||
type="date"> |
||||
<div *ngIf="submitted && f.plannedEndingDate.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.plannedEndingDate.errors.required">La date de fin prévue d'une période d'essai est obligatoire |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de fin réelle</label> |
||||
<input (change)="onRealEndingDateChange($event)" class="form-control" formControlName="realEndingDate" |
||||
type="date"> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3 mb-2"> |
||||
<label class="form-label">Commentaire</label> |
||||
<input [ngClass]="{ 'is-invalid': submitted && f.comment.errors }" class="form-control" formControlName="comment"> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3 mb-2"> |
||||
<label class="form-label">Issue</label> |
||||
<select class="form-select" formControlName="issue"> |
||||
<option disabled selected value="">Statut</option> |
||||
<option value="VALIDEE">Validée</option> |
||||
<option value="PROLONGEE_COLLAB">Prolongée par le collaborateur</option> |
||||
<option value="PROLONGEE_APSIDE">Prolongée par Apside</option> |
||||
<option value="ARRETEE_COLLAB">Arrêtée par le collaborateur</option> |
||||
<option value="ARRETEE_APSIDE">Arrêtée par Apside</option> |
||||
<option value="INDETERMINEE">Indéterminée</option> |
||||
</select> |
||||
</div> |
||||
</div> |
||||
|
||||
<div> |
||||
<button type="submit">Créer la période d'essai</button> |
||||
<button type="reset">Effacer</button> |
||||
</div> |
||||
</form> |
@ -0,0 +1,127 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {Collaborateur} from "../../../interfaces/collaborateur"; |
||||
import {PeriodeEssai} from "../../../interfaces/periode-essai"; |
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {CollaborateurService} from "../../../services/collaborateur.service"; |
||||
import {PeriodeEssaiService} from "../../../services/periode-essai.service"; |
||||
import {ToastrService} from "ngx-toastr"; |
||||
import {ActivatedRoute} from "@angular/router"; |
||||
|
||||
@Component({ |
||||
selector: 'app-periode-essai-add', |
||||
templateUrl: './periode-essai-add.component.html', |
||||
styleUrls: ['./periode-essai-add.component.scss'] |
||||
}) |
||||
export class PeriodeEssaiAddComponent implements OnInit { |
||||
|
||||
collaborateurs: Collaborateur[] = []; |
||||
collaborateur = {} as Collaborateur; |
||||
periodeEssai = {} as PeriodeEssai; |
||||
|
||||
registerForm!: FormGroup; |
||||
submitted = false; |
||||
|
||||
apsideMail?: string | null; |
||||
id?: number; |
||||
|
||||
constructor( |
||||
private http: HttpClient, |
||||
private collaborateurService: CollaborateurService, |
||||
private periodeEssaiService: PeriodeEssaiService, |
||||
private formBuilder: FormBuilder, |
||||
private toastr: ToastrService, |
||||
private route: ActivatedRoute |
||||
) { |
||||
} |
||||
|
||||
get f() { |
||||
return this.registerForm.controls; |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.apsideMail = this.route.snapshot.queryParamMap.get('apsideMail'); |
||||
this.registerForm = this.formBuilder.group({ |
||||
comment: [], |
||||
collaborateurId: ['', Validators.required], |
||||
issue: [], |
||||
plannedEndingDate: ['', Validators.required], |
||||
realEndingDate: [], |
||||
startingDate: ['', Validators.required] |
||||
}); |
||||
|
||||
this.getCollaborateurs(); |
||||
|
||||
} |
||||
|
||||
getCollaborateurs(): void { |
||||
this.collaborateurService.getCollaborateurs() |
||||
.subscribe(collaborateurs => { |
||||
this.collaborateurs = collaborateurs; |
||||
if (this.apsideMail != undefined) { |
||||
this.collaborateurs.forEach(collab => { |
||||
if (this.apsideMail == collab.apsideMail) { |
||||
this.registerForm.get("collaborateurId")?.setValue(collab.id) |
||||
this.collaborateur = collab |
||||
} |
||||
}) |
||||
} |
||||
}); |
||||
} |
||||
|
||||
onSubmit() { |
||||
this.submitted = true; |
||||
if (this.registerForm.invalid) { |
||||
return; |
||||
} |
||||
|
||||
this.periodeEssai.comment = this.registerForm.value.comment; |
||||
this.periodeEssai.collaborateurId = this.registerForm.value.collaborateurId; |
||||
if (this.registerForm.value.issue == undefined) { |
||||
this.periodeEssai.issue = "INDETERMINEE"; |
||||
} else { |
||||
this.periodeEssai.issue = this.registerForm.value.issue; |
||||
} |
||||
if (this.registerForm.value.realEndingDate == undefined) { |
||||
this.periodeEssai.realEndingDate = new Date(); |
||||
} else { |
||||
this.periodeEssai.realEndingDate = this.registerForm.value.realEndingDate; |
||||
} |
||||
this.periodeEssai.plannedEndingDate = this.registerForm.value.plannedEndingDate; |
||||
this.periodeEssai.startingDate = this.registerForm.value.startingDate; |
||||
|
||||
this.periodeEssaiService.addPeriodeEssai(this.periodeEssai) |
||||
.subscribe(() => { |
||||
this.showSuccess(); |
||||
}, |
||||
() => { |
||||
this.showError() |
||||
}); |
||||
} |
||||
|
||||
onReset() { |
||||
this.submitted = false; |
||||
this.registerForm.reset(); |
||||
} |
||||
|
||||
onStartingDateChange($event: any): void { |
||||
this.periodeEssai.startingDate = new Date($event.target.value); |
||||
} |
||||
|
||||
onPlannedEndingDateChange($event: any): void { |
||||
this.periodeEssai.plannedEndingDate = new Date($event.target.value); |
||||
} |
||||
|
||||
onRealEndingDateChange($event: any): void { |
||||
this.periodeEssai.realEndingDate = new Date($event.target.value); |
||||
} |
||||
|
||||
showSuccess() { |
||||
this.toastr.success('Création réussie', 'Période d\'essai'); |
||||
} |
||||
|
||||
showError() { |
||||
this.toastr.error('Création échouée', 'Période d\'essai'); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,92 @@ |
||||
<div xmlns=""> |
||||
|
||||
<h3>Modifier une Période d'essai : </h3> |
||||
|
||||
<form (ngSubmit)="onSubmit()" |
||||
[formGroup]="registerForm"> |
||||
|
||||
<div class="form-group col-12 col-md-6"> |
||||
<label class="form-label">Collaborateur</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && f.collaborateurId.errors }" class="form-select" |
||||
formControlName="collaborateurId" |
||||
id="collaborateur-select"> |
||||
<option disabled selected value="">Choisissez le collaborateur concerné par cette période d'essai</option> |
||||
<option *ngFor="let collaborateur of collaborateurs" |
||||
[ngValue]="collaborateur.id">{{collaborateur.name}} {{collaborateur.firstName}}</option> |
||||
</select> |
||||
<div *ngIf="submitted && f.collaborateurId.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.collaborateurId.errors.required">Vous devez choisir le collaborateur concerné par cette période |
||||
d'essai |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de début</label> |
||||
<input (change)="onStartingDateChange($event)" [ngClass]="{ 'is-invalid': submitted && f.startingDate.errors }" |
||||
[value]="periodeEssai.startingDate | date:'yyyy-MM-dd'" |
||||
class="form-control" formControlName="startingDate" |
||||
type="date"> |
||||
<div *ngIf="submitted && f.startingDate.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.startingDate.errors.required">La date de début d'une période d'essai est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de fin prévue</label> |
||||
<input (change)="onPlannedEndingDateChange($event)" |
||||
[ngClass]="{ 'is-invalid': submitted && f.plannedEndingDate.errors }" |
||||
[value]="periodeEssai.plannedEndingDate | date:'yyyy-MM-dd'" |
||||
class="form-control" |
||||
formControlName="plannedEndingDate" |
||||
type="date"> |
||||
<div *ngIf="submitted && f.plannedEndingDate.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.plannedEndingDate.errors.required">La date de fin prévue d'une période d'essai est obligatoire |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de fin réelle</label> |
||||
<input (change)="onRealEndingDateChange($event)" [value]="periodeEssai.realEndingDate | date:'yyyy-MM-dd'" |
||||
class="form-control" |
||||
formControlName="realEndingDate" type="date"> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3 mb-2"> |
||||
<label class="form-label">Commentaire</label> |
||||
<input class="form-control" formControlName="comment"> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3 mb-2"> |
||||
<label class="form-label">Issue</label> |
||||
<select class="form-select" formControlName="issue"> |
||||
<option disabled selected value="">Statut</option> |
||||
<option value="VALIDEE">Validée</option> |
||||
<option value="PROLONGEE_COLLAB">Prolongée par le collaborateur</option> |
||||
<option value="PROLONGEE_APSIDE">Prolongée par Apside</option> |
||||
<option value="ARRETEE_COLLAB">Arrêtée par le collaborateur</option> |
||||
<option value="ARRETEE_APSIDE">Arrêtée par Apside</option> |
||||
<option value="INDETERMINEE">Indéterminée</option> |
||||
</select> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div> |
||||
<button type="submit">Sauvegarder les changements</button> |
||||
<button type="button" (click)="delete()">Supprimer la période d'essai</button> |
||||
<button type="reset">Effacer</button> |
||||
<button type="button" (click)="goBack()">Retour</button> |
||||
</div> |
||||
|
||||
</form> |
||||
|
||||
</div> |
@ -0,0 +1,143 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
||||
import {PeriodeEssai} from "../../../interfaces/periode-essai"; |
||||
import {Collaborateur} from "../../../interfaces/collaborateur"; |
||||
import {CollaborateurService} from "../../../services/collaborateur.service"; |
||||
import {PeriodeEssaiService} from "../../../services/periode-essai.service"; |
||||
import {Observable} from "rxjs"; |
||||
import {ActivatedRoute} from "@angular/router"; |
||||
import {take, tap} from "rxjs/operators"; |
||||
import {Location} from "@angular/common"; |
||||
import {ToastrService} from "ngx-toastr"; |
||||
|
||||
@Component({ |
||||
selector: 'app-periode-essai-edit', |
||||
templateUrl: './periode-essai-edit.component.html', |
||||
styleUrls: ['./periode-essai-edit.component.scss'] |
||||
}) |
||||
export class PeriodeEssaiEditComponent implements OnInit { |
||||
|
||||
periodeEssaiObservable!: Observable<PeriodeEssai>; |
||||
id: number; |
||||
|
||||
collaborateurs: Collaborateur[] = []; |
||||
collaborateur = {} as Collaborateur; |
||||
|
||||
periodeEssais: PeriodeEssai[] = []; |
||||
periodeEssai = {} as PeriodeEssai; |
||||
|
||||
registerForm!: FormGroup; |
||||
submitted = false; |
||||
|
||||
constructor( |
||||
private route: ActivatedRoute, |
||||
private location: Location, |
||||
private collaborateurService: CollaborateurService, |
||||
private periodeEssaiService: PeriodeEssaiService, |
||||
private formBuilder: FormBuilder, |
||||
private toastr: ToastrService |
||||
) { |
||||
this.id = Number(this.route.snapshot.paramMap.get('id')) |
||||
} |
||||
|
||||
get f() { |
||||
return this.registerForm.controls; |
||||
} |
||||
|
||||
async ngOnInit() { |
||||
this.getCollaborateurs(); |
||||
this.getPeriodeEssais(); |
||||
this.registerForm = this.formBuilder.group({ |
||||
comment: [], |
||||
collaborateurId: ['', Validators.required], |
||||
issue: [], |
||||
plannedEndingDate: ['', Validators.required], |
||||
realEndingDate: [], |
||||
startingDate: ['', Validators.required] |
||||
}); |
||||
this.periodeEssaiObservable = this.periodeEssaiService.getPeriodeEssai(this.id).pipe(tap(pe => this.registerForm.patchValue(pe))) |
||||
this.periodeEssai = await this.periodeEssaiObservable.pipe(take(1)).toPromise() |
||||
} |
||||
|
||||
getCollaborateurs(): void { |
||||
this.collaborateurService.getCollaborateurs() |
||||
.subscribe(collaborateurs => this.collaborateurs = collaborateurs); |
||||
} |
||||
|
||||
getPeriodeEssais() { |
||||
this.periodeEssaiService.getPeriodeEssais() |
||||
.subscribe(periodeEssais => this.periodeEssais = periodeEssais); |
||||
} |
||||
|
||||
goBack(): void { |
||||
this.location.back(); |
||||
} |
||||
|
||||
delete(): void { |
||||
if (this.periodeEssai) { |
||||
this.periodeEssaiService.deletePeriodeEssai(this.periodeEssai) |
||||
.subscribe(() => this.goBack()); |
||||
} |
||||
} |
||||
|
||||
onSubmit() { |
||||
this.submitted = true; |
||||
|
||||
if (this.registerForm.invalid) { |
||||
return; |
||||
} |
||||
|
||||
this.periodeEssai.comment = this.registerForm.value.comment; |
||||
this.periodeEssai.collaborateurId = this.registerForm.value.collaborateurId; |
||||
if (this.registerForm.value.issue == undefined) { |
||||
this.periodeEssai.issue = "INDETERMINEE"; |
||||
} else { |
||||
this.periodeEssai.issue = this.registerForm.value.issue; |
||||
} |
||||
if (this.registerForm.value.realEndingDate == undefined || this.registerForm.value.realEndingDate == '') { |
||||
this.periodeEssai.realEndingDate = null; |
||||
} else { |
||||
this.periodeEssai.realEndingDate = this.registerForm.value.realEndingDate; |
||||
} |
||||
this.periodeEssai.plannedEndingDate = this.registerForm.value.plannedEndingDate; |
||||
this.periodeEssai.startingDate = this.registerForm.value.startingDate; |
||||
|
||||
if (this.periodeEssai) { |
||||
this.periodeEssaiService.updatePeriodeEssai(this.periodeEssai) |
||||
.subscribe(() => { |
||||
this.showSuccess(); |
||||
}, |
||||
() => { |
||||
this.showError() |
||||
}); |
||||
} |
||||
} |
||||
|
||||
onReset() { |
||||
this.submitted = false; |
||||
this.registerForm.reset(); |
||||
} |
||||
|
||||
onStartingDateChange($event: any): void { |
||||
this.periodeEssai.startingDate = new Date($event.target.value); |
||||
} |
||||
|
||||
onPlannedEndingDateChange($event: any): void { |
||||
this.periodeEssai.plannedEndingDate = new Date($event.target.value); |
||||
} |
||||
|
||||
onRealEndingDateChange($event: any): void { |
||||
this.periodeEssai.realEndingDate = new Date($event.target.value); |
||||
} |
||||
|
||||
showSuccess() { |
||||
this.toastr.success('Modification réussie', 'Période d\'essai'); |
||||
} |
||||
|
||||
showError() { |
||||
this.toastr.error('Modification échouée', 'Période d\'essai'); |
||||
} |
||||
|
||||
} |
||||
|
||||
|
@ -0,0 +1,41 @@ |
||||
<div xmlns=""> |
||||
|
||||
<h2 *ngIf="isOld" class=mb-4>Périodes d'essai Passées</h2> |
||||
<h2 *ngIf="!isOld" class=mb-4>Périodes d'essai En cours</h2> |
||||
|
||||
<div style="display: flex"> |
||||
<p style="margin: 10px 0 10px 0">Pour ajouter une nouvelle période d'essai, cliquez ici : </p> |
||||
<button routerLink="/periodeessais/add">Ajouter</button> |
||||
</div> |
||||
<br/><br/> |
||||
|
||||
<div style="display: flex"> |
||||
<p *ngIf="!isOld" style="margin: 10px 0 10px 0">Pour voir les périodes d'essai passées, cliquez ici : </p> |
||||
<p *ngIf="isOld" style="margin: 10px 0 10px 0">Pour voir les périodes d'essai en cours, cliquez ici :</p> |
||||
<button (click)="onIsOldChange()">Changer</button> |
||||
</div> |
||||
|
||||
<div class="mb-5 col-12" style="overflow-x:auto;"> |
||||
<table class="table"> |
||||
<thead> |
||||
<tr> |
||||
<th scope="col">Collaborateur</th> |
||||
<th scope="col">Date de début</th> |
||||
<th scope="col">Date de fin prévue</th> |
||||
<th scope="col">Issue</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let periodeEssai of periodeEssais"> |
||||
<th |
||||
scope="row">{{getCollaborateurById(periodeEssai.collaborateurId).name}} {{getCollaborateurById(periodeEssai.collaborateurId).firstName}}</th> |
||||
<td> {{getSplitDate(periodeEssai.startingDate.toString())}}</td> |
||||
<th> {{getSplitDate(periodeEssai.plannedEndingDate.toString())}}</th> |
||||
<td> {{periodeEssai.issue}}</td> |
||||
<td><a routerLink="{{periodeEssai.id}}"> Modifier </a></td> |
||||
</tr> |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
|
||||
</div> |
@ -0,0 +1,89 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {PeriodeEssai} from "../../interfaces/periode-essai"; |
||||
import {Collaborateur} from "../../interfaces/collaborateur"; |
||||
import {CollaborateurService} from "../../services/collaborateur.service"; |
||||
import {PeriodeEssaiService} from "../../services/periode-essai.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-periode-essai', |
||||
templateUrl: './periode-essai.component.html', |
||||
styleUrls: ['./periode-essai.component.scss'] |
||||
}) |
||||
export class PeriodeEssaiComponent implements OnInit { |
||||
|
||||
collaborateurs: Collaborateur[] = []; |
||||
periodeEssais: PeriodeEssai[] = []; |
||||
|
||||
periodeEssaisEnCours: PeriodeEssai[] = []; |
||||
periodeEssaisPassees: PeriodeEssai[] = []; |
||||
|
||||
isOld: boolean = false; |
||||
|
||||
constructor( |
||||
private http: HttpClient, |
||||
private collaborateurService: CollaborateurService, |
||||
private periodeEssaiService: PeriodeEssaiService, |
||||
) { |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.getCollaborateurs(); |
||||
this.getPeriodeEssais(); |
||||
|
||||
} |
||||
|
||||
onIsOldChange() { |
||||
this.isOld = !this.isOld; |
||||
this.initPeriodeEssai(); |
||||
} |
||||
|
||||
initPeriodeEssai() { |
||||
if (this.isOld) { |
||||
this.periodeEssais = this.periodeEssaisPassees; |
||||
} else { |
||||
this.periodeEssais = this.periodeEssaisEnCours; |
||||
} |
||||
} |
||||
|
||||
getCollaborateurs(): void { |
||||
this.collaborateurService.getCollaborateurs() |
||||
.subscribe(collaborateurs => this.collaborateurs = collaborateurs); |
||||
} |
||||
|
||||
getCollaborateurById(id: number): Collaborateur { |
||||
let collab = {} as Collaborateur; |
||||
this.collaborateurs.forEach(c => { |
||||
if (c.id == id) { |
||||
collab = c; |
||||
return; |
||||
} |
||||
}); |
||||
|
||||
return collab; |
||||
} |
||||
|
||||
getPeriodeEssais() { |
||||
this.periodeEssaiService.getPeriodeEssais() |
||||
.subscribe(periodeEssais => { |
||||
periodeEssais.forEach(pe => { |
||||
if (new Date(pe.plannedEndingDate).getTime() > new Date().getTime()) { |
||||
this.periodeEssaisEnCours.push(pe); |
||||
} else { |
||||
this.periodeEssaisPassees.push(pe); |
||||
} |
||||
}) |
||||
this.periodeEssaisEnCours.sort((b, a) => new Date(b.plannedEndingDate).getTime() - new Date(a.plannedEndingDate).getTime()); |
||||
this.periodeEssaisPassees.sort((a, b) => new Date(b.plannedEndingDate).getTime() - new Date(a.plannedEndingDate).getTime()); |
||||
this.initPeriodeEssai(); |
||||
}); |
||||
} |
||||
|
||||
getSplitDate(date: string | undefined): string { |
||||
if (date == undefined) { |
||||
return ""; |
||||
} |
||||
return date.split('T')[0]; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,59 @@ |
||||
<h3>Ajouter un référencement : </h3> |
||||
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="registerForm"> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de début</label> |
||||
<input (change)="onStartingDateChange($event)" [ngClass]="{ 'is-invalid': submitted && form.startingDate.errors }" |
||||
class="form-control" |
||||
formControlName="startingDate" |
||||
type="date"> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de fin</label> |
||||
<input (change)="onEndingDateChange($event)" [ngClass]="{ 'is-invalid': submitted && form.endingDate.errors }" |
||||
class="form-control" |
||||
formControlName="endingDate" |
||||
type="date"> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-md-6"> |
||||
<label class="form-label">Référent</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && form.referrerId.errors }" class="form-select" |
||||
formControlName="referrerId"> |
||||
<option disabled selected value="">Choisissez le référent du référencement</option> |
||||
<option *ngFor="let collaborateur of collaborateurs" |
||||
[ngValue]="collaborateur.id">{{collaborateur.name}} {{collaborateur.firstName}}</option> |
||||
</select> |
||||
<div *ngIf="submitted && form.referrerId.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.referrerId.errors.required">Vous devez préciser le référent du référencement</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-md-6"> |
||||
<label class="form-label">Référé</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && form.referredId.errors }" class="form-select" |
||||
formControlName="referredId"> |
||||
<option disabled selected value="">Choisissez le référé du référencement</option> |
||||
<option *ngFor="let collaborateur of collaborateurs" |
||||
[ngValue]="collaborateur.id">{{collaborateur.name}} {{collaborateur.firstName}}</option> |
||||
</select> |
||||
<div *ngIf="submitted && form.referredId.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.referredId.errors.required">Vous devez préciser le référent du référencement</div> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div> |
||||
<button type="submit">Ajouter le référencement</button> |
||||
<button type="reset">Effacer</button> |
||||
</div> |
||||
</form> |
@ -0,0 +1,99 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {Collaborateur} from "../../../interfaces/collaborateur"; |
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {CollaborateurService} from "../../../services/collaborateur.service"; |
||||
import {ToastrService} from "ngx-toastr"; |
||||
import {ReferencementService} from "../../../services/referencement.service"; |
||||
import {Referencement} from "../../../interfaces/referencement"; |
||||
|
||||
@Component({ |
||||
selector: 'app-referencement-add', |
||||
templateUrl: './referencement-add.component.html', |
||||
styleUrls: ['./referencement-add.component.scss'] |
||||
}) |
||||
export class ReferencementAddComponent implements OnInit { |
||||
|
||||
collaborateurs: Collaborateur[] = []; |
||||
collaborateur = {} as Collaborateur; |
||||
referencement = {} as Referencement; |
||||
|
||||
errorValue: number = 0; |
||||
rDate: String = ""; |
||||
bDate: String = ""; |
||||
|
||||
registerForm!: FormGroup; |
||||
submitted = false; |
||||
|
||||
constructor(private http: HttpClient, |
||||
private referencementService: ReferencementService, |
||||
private collaborateurService: CollaborateurService, |
||||
private formBuilder: FormBuilder, |
||||
private toastr: ToastrService) { |
||||
} |
||||
|
||||
get form() { |
||||
return this.registerForm.controls; |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.getCollaborateurs(); |
||||
this.registerForm = this.formBuilder.group({ |
||||
referredId: ['', Validators.required], |
||||
referrerId: ['', Validators.required], |
||||
startingDate: ['', Validators.required], |
||||
endingDate: [], |
||||
}); |
||||
if (this.referencement.startingDate) { |
||||
this.rDate = new Date(this.collaborateur.resignationDate).toISOString().split('T')[0]; |
||||
} |
||||
if (this.referencement.endingDate) { |
||||
this.bDate = new Date(this.collaborateur.birthDate).toISOString().split('T')[0]; |
||||
} |
||||
} |
||||
|
||||
getCollaborateurs(): void { |
||||
this.collaborateurService.getCollaborateurs() |
||||
.subscribe(collaborateurs => this.collaborateurs = collaborateurs); |
||||
} |
||||
|
||||
onSubmit() { |
||||
this.submitted = true; |
||||
if (this.registerForm.invalid) { |
||||
return; |
||||
} |
||||
this.referencement = this.registerForm.value |
||||
if (this.referencement) { |
||||
this.referencementService.addReferencement(this.referencement).subscribe(() => { |
||||
this.showSuccess(); |
||||
}, |
||||
() => { |
||||
this.showError() |
||||
}) |
||||
|
||||
} |
||||
} |
||||
|
||||
onReset() { |
||||
this.submitted = false; |
||||
this.registerForm.reset(); |
||||
} |
||||
|
||||
onStartingDateChange($event: any): void { |
||||
this.collaborateur.resignationDate = new Date($event.target.value); |
||||
} |
||||
|
||||
onEndingDateChange($event: any): void { |
||||
this.collaborateur.birthDate = new Date($event.target.value); |
||||
} |
||||
|
||||
showSuccess() { |
||||
this.toastr.success('Création réussie', 'Référencement'); |
||||
} |
||||
|
||||
showError() { |
||||
this.toastr.error('Création échouée', 'Référencement'); |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,63 @@ |
||||
<h3>Modifier un référencement : </h3> |
||||
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="registerForm"> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de début</label> |
||||
<input (change)="onStartingDateChange($event)" [ngClass]="{ 'is-invalid': submitted && form.startingDate.errors }" |
||||
[value]="referencement.startingDate | date:'yyyy-MM-dd'" |
||||
class="form-control" |
||||
formControlName="startingDate" |
||||
type="date"> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de fin</label> |
||||
<input (change)="onEndingDateChange($event)" [ngClass]="{ 'is-invalid': submitted && form.endingDate.errors }" |
||||
[value]="referencement.endingDate | date:'yyyy-MM-dd'" |
||||
class="form-control" |
||||
formControlName="endingDate" |
||||
type="date"> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div class="row mb-2"> |
||||
|
||||
<div class="form-group col-12 col-md-6"> |
||||
<label class="form-label">Référent</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && form.referrerId.errors }" class="form-select" |
||||
formControlName="referrerId"> |
||||
<option disabled selected value="">Choisissez le référent du référencement</option> |
||||
<option *ngFor="let collaborateur of collaborateurs" |
||||
[ngValue]="collaborateur.id">{{collaborateur.name}} {{collaborateur.firstName}}</option> |
||||
</select> |
||||
<div *ngIf="submitted && form.referrerId.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.referrerId.errors.required">Vous devez préciser le référent du référencement</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-md-6"> |
||||
<label class="form-label">Référé</label> |
||||
<select [ngClass]="{ 'is-invalid': submitted && form.referredId.errors }" class="form-select" |
||||
formControlName="referredId"> |
||||
<option disabled selected value="">Choisissez le référé du référencement</option> |
||||
<option *ngFor="let collaborateur of collaborateurs" |
||||
[ngValue]="collaborateur.id">{{collaborateur.name}} {{collaborateur.firstName}}</option> |
||||
</select> |
||||
<div *ngIf="submitted && form.referredId.errors" class="invalid-feedback"> |
||||
<div *ngIf="form.referredId.errors.required">Vous devez préciser le référent du référencement</div> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div> |
||||
<button type="submit">Sauvegarder les changements</button> |
||||
<button type="button" (click)="delete()">Supprimer le référencement</button> |
||||
<button type="reset">Effacer</button> |
||||
<button type="button" (click)="goBack()">Retour</button> |
||||
</div> |
||||
</form> |
@ -0,0 +1,125 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {Collaborateur} from "../../../interfaces/collaborateur"; |
||||
import {Referencement} from "../../../interfaces/referencement"; |
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {ReferencementService} from "../../../services/referencement.service"; |
||||
import {CollaborateurService} from "../../../services/collaborateur.service"; |
||||
import {ToastrService} from "ngx-toastr"; |
||||
import {Location} from "@angular/common"; |
||||
import {ActivatedRoute} from "@angular/router"; |
||||
import {Observable} from "rxjs"; |
||||
import {take, tap} from "rxjs/operators"; |
||||
|
||||
@Component({ |
||||
selector: 'app-referencement-edit', |
||||
templateUrl: './referencement-edit.component.html', |
||||
styleUrls: ['./referencement-edit.component.scss'] |
||||
}) |
||||
export class ReferencementEditComponent implements OnInit { |
||||
|
||||
referencementObservable!: Observable<Referencement>; |
||||
id: number; |
||||
|
||||
collaborateurs: Collaborateur[] = []; |
||||
|
||||
referencement = {} as Referencement; |
||||
|
||||
errorValue: number = 0; |
||||
|
||||
registerForm!: FormGroup; |
||||
submitted = false; |
||||
|
||||
constructor(private http: HttpClient, |
||||
private referencementService: ReferencementService, |
||||
private collaborateurService: CollaborateurService, |
||||
private formBuilder: FormBuilder, |
||||
private location: Location, |
||||
private route: ActivatedRoute, |
||||
private toastr: ToastrService) { |
||||
this.id = Number(this.route.snapshot.paramMap.get('id')) |
||||
} |
||||
|
||||
get form() { |
||||
return this.registerForm.controls; |
||||
} |
||||
|
||||
async ngOnInit() { |
||||
this.getCollaborateurs(); |
||||
this.registerForm = this.formBuilder.group({ |
||||
referredId: ['', Validators.required], |
||||
referrerId: ['', Validators.required], |
||||
startingDate: ['', Validators.required], |
||||
endingDate: [], |
||||
}); |
||||
|
||||
this.referencementObservable = this.referencementService.getReferencement(this.id).pipe(tap(ref => this.registerForm.patchValue(ref))) |
||||
this.referencement = await this.referencementObservable.pipe(take(1)).toPromise() |
||||
|
||||
} |
||||
|
||||
getCollaborateurs(): void { |
||||
this.collaborateurService.getCollaborateurs() |
||||
.subscribe(collaborateurs => this.collaborateurs = collaborateurs); |
||||
} |
||||
|
||||
onSubmit() { |
||||
this.submitted = true; |
||||
if (this.registerForm.invalid) { |
||||
return; |
||||
} |
||||
|
||||
this.referencement.referredId = this.registerForm.value.referredId; |
||||
this.referencement.referrerId = this.registerForm.value.referrerId; |
||||
this.referencement.startingDate = this.registerForm.value.startingDate; |
||||
|
||||
if (this.registerForm.value.endingDate == undefined || this.registerForm.value.endingDate == '') { |
||||
this.referencement.endingDate = null; |
||||
} else { |
||||
this.referencement.endingDate = this.registerForm.value.endingDate; |
||||
} |
||||
|
||||
if (this.referencement) { |
||||
this.referencementService.updateReferencement(this.referencement).subscribe(() => { |
||||
this.showSuccess(); |
||||
}, |
||||
() => { |
||||
this.showError() |
||||
}) |
||||
|
||||
} |
||||
} |
||||
|
||||
onReset() { |
||||
this.submitted = false; |
||||
this.registerForm.reset(); |
||||
} |
||||
|
||||
onStartingDateChange($event: any): void { |
||||
this.referencement.startingDate = new Date($event.target.value); |
||||
} |
||||
|
||||
onEndingDateChange($event: any): void { |
||||
this.referencement.endingDate = new Date($event.target.value); |
||||
} |
||||
|
||||
showSuccess() { |
||||
this.toastr.success('Modification réussie', 'Référencement'); |
||||
} |
||||
|
||||
showError() { |
||||
this.toastr.error('Modification échouée', 'Référencement'); |
||||
} |
||||
|
||||
goBack(): void { |
||||
this.location.back(); |
||||
} |
||||
|
||||
delete(): void { |
||||
if (this.referencement) { |
||||
this.referencementService.deleteReferencement(this.referencement) |
||||
.subscribe(() => this.goBack()); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,61 @@ |
||||
<div> |
||||
|
||||
<h2 *ngIf="!isOld" class=mb-4>Collaborateurs sans référencement</h2> |
||||
<h2 *ngIf="isOld" class=mb-4>Référencements</h2> |
||||
<div style="display: flex"> |
||||
<p style="margin: 10px 0 10px 0">Pour ajouter un nouveau référencement, cliquez ici : </p> |
||||
<button routerLink="/referencements/add">Ajouter</button> |
||||
</div> |
||||
|
||||
<div style="display: flex"> |
||||
<p *ngIf="isOld" style="margin: 10px 0 10px 0">Pour voir les collaborateurs sans référencement, cliquez ici : </p> |
||||
<p *ngIf="!isOld" style="margin: 10px 0 10px 0">Pour voir les référencements, cliquez ici :</p> |
||||
<button (click)="isOldReverse()">Changer</button> |
||||
</div> |
||||
|
||||
<div *ngIf="!isOld" class="mb-5 col-12" style="overflow-x:auto;"> |
||||
<table class="table"> |
||||
<thead> |
||||
<tr> |
||||
<th scope="col">Nom</th> |
||||
<th scope="col">Prénom</th> |
||||
<th scope="col">Mail Apside</th> |
||||
</tr> |
||||
</thead> |
||||
|
||||
<tbody> |
||||
<tr *ngFor="let collaborateur of collaborateursSansRef"> |
||||
<th scope="row">{{collaborateur.name}}</th> |
||||
<td> {{collaborateur.firstName}} </td> |
||||
<td> {{collaborateur.apsideMail}} </td> |
||||
</tr> |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
|
||||
|
||||
<div *ngIf="isOld" class="mb-5 col-12" style="overflow-x:auto;"> |
||||
<table class="table"> |
||||
<thead> |
||||
<tr> |
||||
<th scope="col">Référent</th> |
||||
<th scope="col">Référé</th> |
||||
<th scope="col">Date de début</th> |
||||
<th scope="col">Date de fin</th> |
||||
</tr> |
||||
</thead> |
||||
|
||||
<tbody> |
||||
<tr *ngFor="let referencement of referencements"> |
||||
<td> {{getCollaborateurById(referencement.referrerId).name}} {{getCollaborateurById(referencement.referrerId).firstName}}</td> |
||||
<td> {{getCollaborateurById(referencement.referredId).name}} {{getCollaborateurById(referencement.referredId).firstName}} </td> |
||||
<td> {{getSplitDate(referencement.startingDate.toString())}} </td> |
||||
<td> {{getSplitDate(referencement.endingDate?.toString())}} </td> |
||||
<td><a routerLink="{{referencement.id}}"> Modifier </a></td> |
||||
</tr> |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
|
||||
|
||||
</div> |
@ -0,0 +1,79 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {ReferencementService} from "../../services/referencement.service"; |
||||
import {Referencement} from "../../interfaces/referencement"; |
||||
import {CollaborateurService} from "../../services/collaborateur.service"; |
||||
import {Collaborateur} from "../../interfaces/collaborateur"; |
||||
|
||||
@Component({ |
||||
selector: 'app-referencement', |
||||
templateUrl: './referencement.component.html', |
||||
styleUrls: ['./referencement.component.scss'] |
||||
}) |
||||
export class ReferencementComponent implements OnInit { |
||||
|
||||
referencements: Referencement[] = []; |
||||
collaborateurs: Collaborateur[] = []; |
||||
collaborateursSansRef: Collaborateur[] = []; |
||||
idReferredTab: number[] = []; |
||||
isOld: boolean = false; |
||||
|
||||
constructor( |
||||
private http: HttpClient, |
||||
private referencementService: ReferencementService, |
||||
private collaborateurService: CollaborateurService, |
||||
) { |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
|
||||
this.collaborateurService.getCollaborateurs() |
||||
.subscribe(collaborateurs => { |
||||
this.collaborateurs = collaborateurs; |
||||
|
||||
this.referencementService.getReferencements() |
||||
.subscribe(referencements => { |
||||
|
||||
this.referencements = referencements; |
||||
this.referencements.forEach(ref => { |
||||
|
||||
if (this.idReferredTab.find(id => ref.id == id) == undefined) { |
||||
this.idReferredTab.push(ref.referredId); |
||||
} |
||||
|
||||
}); |
||||
|
||||
this.collaborateurs.forEach(collab => { |
||||
if (this.idReferredTab.find(id => collab.id == id) == undefined) { |
||||
this.collaborateursSansRef.push(collab); |
||||
} |
||||
}) |
||||
}); |
||||
}); |
||||
|
||||
} |
||||
|
||||
isOldReverse() { |
||||
this.isOld = !this.isOld; |
||||
} |
||||
|
||||
getCollaborateurById(id: number): Collaborateur { |
||||
let collab = {} as Collaborateur; |
||||
this.collaborateurs.forEach(c => { |
||||
if (c.id == id) { |
||||
collab = c; |
||||
return; |
||||
} |
||||
}); |
||||
|
||||
return collab; |
||||
} |
||||
|
||||
getSplitDate(date: string | undefined): string { |
||||
if (date == undefined) { |
||||
return ""; |
||||
} |
||||
return date.split('T')[0]; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,5 @@ |
||||
export interface Agence { |
||||
name: string; |
||||
id: number; |
||||
businessUnitId: number; |
||||
} |
@ -0,0 +1,4 @@ |
||||
export interface Businessunit { |
||||
name: string; |
||||
id: number; |
||||
} |
@ -0,0 +1,15 @@ |
||||
export interface Collaborateur { |
||||
name: string; |
||||
firstName: string; |
||||
birthDate: Date; |
||||
gender: string; |
||||
status: string; |
||||
childrenNumber: number; |
||||
address: string; |
||||
telephone: string; |
||||
personalMail: string; |
||||
apsideMail: string; |
||||
resignationDate: Date; |
||||
businessUnitId: number; |
||||
id: number; |
||||
} |
@ -0,0 +1,9 @@ |
||||
export interface PeriodeEssai { |
||||
id: number; |
||||
collaborateurId: number; |
||||
startingDate: Date; |
||||
plannedEndingDate: Date; |
||||
realEndingDate: Date | null; |
||||
comment: string; |
||||
issue: string; |
||||
} |
@ -0,0 +1,7 @@ |
||||
export interface Referencement { |
||||
id: number; |
||||
startingDate: Date; |
||||
endingDate: Date | null; |
||||
referredId: number; |
||||
referrerId: number; |
||||
} |
@ -0,0 +1,36 @@ |
||||
import {Injectable} from '@angular/core'; |
||||
import {HttpClient, HttpHeaders} from "@angular/common/http"; |
||||
import {Observable} from "rxjs"; |
||||
import {Agence} from "../interfaces/agence"; |
||||
import {agencesUrl} from "../../ressources/routes/routesPreprod"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class AgenceService { |
||||
httpOptions = { |
||||
headers: new HttpHeaders({'Content-Type': 'application/json'}) |
||||
}; |
||||
private agencesUrl = agencesUrl; |
||||
|
||||
constructor(private http: HttpClient) { |
||||
} |
||||
|
||||
getAgences(): Observable<Agence[]> { |
||||
return this.http.get<Agence[]>(this.agencesUrl); |
||||
} |
||||
|
||||
getAgence(id: number): Observable<Agence> { |
||||
return this.http.get<Agence>(this.agencesUrl + "/" + id); |
||||
} |
||||
|
||||
updateAgence(agence: Agence): Observable<Agence> { |
||||
let body = JSON.stringify(agence); |
||||
return this.http.put<Agence>(this.agencesUrl + "/" + agence.id, body, this.httpOptions); |
||||
} |
||||
|
||||
addAgence(agence: Agence): Observable<Agence> { |
||||
let body = JSON.stringify(agence); |
||||
return this.http.post<Agence>(this.agencesUrl, body, this.httpOptions); |
||||
} |
||||
} |
@ -0,0 +1,36 @@ |
||||
import {Injectable} from '@angular/core'; |
||||
import {HttpClient, HttpHeaders} from "@angular/common/http"; |
||||
import {Observable} from "rxjs"; |
||||
import {Businessunit} from "../interfaces/businessunit"; |
||||
import {businessunitsUrl} from "../../ressources/routes/routesPreprod"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class BusinessunitService { |
||||
httpOptions = { |
||||
headers: new HttpHeaders({'Content-Type': 'application/json'}) |
||||
}; |
||||
private businessunitsUrl = businessunitsUrl; |
||||
|
||||
constructor(private http: HttpClient) { |
||||
} |
||||
|
||||
getBusinessunits(): Observable<Businessunit[]> { |
||||
return this.http.get<Businessunit[]>(this.businessunitsUrl); |
||||
} |
||||
|
||||
getBusinessunit(id: number): Observable<Businessunit> { |
||||
return this.http.get<Businessunit>(this.businessunitsUrl + "/" + id); |
||||
} |
||||
|
||||
updateBusinessunit(businessunit: Businessunit, id: number): Observable<Businessunit> { |
||||
let body = JSON.stringify(businessunit); |
||||
return this.http.put<Businessunit>(this.businessunitsUrl + "/" + id, body, this.httpOptions); |
||||
} |
||||
|
||||
addBusinessunit(businessunit: Businessunit): Observable<Businessunit> { |
||||
let body = JSON.stringify(businessunit); |
||||
return this.http.post<Businessunit>(this.businessunitsUrl, body, this.httpOptions); |
||||
} |
||||
} |
@ -0,0 +1,43 @@ |
||||
import {Collaborateur} from "../interfaces/collaborateur"; |
||||
import {Injectable} from '@angular/core'; |
||||
import {Observable} from "rxjs"; |
||||
import {HttpClient, HttpHeaders} from "@angular/common/http"; |
||||
import {collaborateursUrl} from "../../ressources/routes/routesPreprod"; |
||||
|
||||
|
||||
@Injectable({providedIn: 'root'}) |
||||
|
||||
export class CollaborateurService { |
||||
|
||||
httpOptions = { |
||||
headers: new HttpHeaders({'Content-Type': 'application/json'}) |
||||
}; |
||||
private collaborateursUrl = collaborateursUrl; |
||||
|
||||
constructor(private http: HttpClient) { |
||||
} |
||||
|
||||
getCollaborateurs(): Observable<Collaborateur[]> { |
||||
return this.http.get<Collaborateur[]>(this.collaborateursUrl); |
||||
} |
||||
|
||||
getCollaborateur(id: number): Observable<Collaborateur> { |
||||
return this.http.get<Collaborateur>(this.collaborateursUrl + "/" + id); |
||||
} |
||||
|
||||
updateCollaborateur(collaborateur: Collaborateur): Observable<Collaborateur> { |
||||
let body = JSON.stringify(collaborateur); |
||||
return this.http.put<Collaborateur>(this.collaborateursUrl + "/" + collaborateur.id, body, this.httpOptions); |
||||
|
||||
} |
||||
|
||||
deleteCollaborateur(collaborateur: Collaborateur) { |
||||
return this.http.delete(this.collaborateursUrl + "/" + collaborateur.id); |
||||
} |
||||
|
||||
addCollaborateur(collaborateur: Collaborateur): Observable<Collaborateur> { |
||||
let body = JSON.stringify(collaborateur); |
||||
return this.http.post<Collaborateur>(this.collaborateursUrl, body, this.httpOptions); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,41 @@ |
||||
import {Injectable} from '@angular/core'; |
||||
import {HttpClient, HttpHeaders} from "@angular/common/http"; |
||||
import {Observable} from "rxjs"; |
||||
import {periodeessaisUrl} from "../../ressources/routes/routesPreprod"; |
||||
import {PeriodeEssai} from "../interfaces/periode-essai"; |
||||
|
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class PeriodeEssaiService { |
||||
httpOptions = { |
||||
headers: new HttpHeaders({'Content-Type': 'application/json'}) |
||||
}; |
||||
private periodeessaisUrl = periodeessaisUrl; |
||||
|
||||
constructor(private http: HttpClient) { |
||||
} |
||||
|
||||
getPeriodeEssais(): Observable<PeriodeEssai[]> { |
||||
return this.http.get<PeriodeEssai[]>(this.periodeessaisUrl); |
||||
} |
||||
|
||||
getPeriodeEssai(id: number): Observable<PeriodeEssai> { |
||||
return this.http.get<PeriodeEssai>(this.periodeessaisUrl + "/" + id); |
||||
} |
||||
|
||||
updatePeriodeEssai(periodeEssai: PeriodeEssai): Observable<PeriodeEssai> { |
||||
let body = JSON.stringify(periodeEssai); |
||||
return this.http.put<PeriodeEssai>(this.periodeessaisUrl + "/" + periodeEssai.id, body, this.httpOptions); |
||||
} |
||||
|
||||
deletePeriodeEssai(periodeEssai: PeriodeEssai) { |
||||
return this.http.delete(this.periodeessaisUrl + "/" + periodeEssai.id); |
||||
} |
||||
|
||||
addPeriodeEssai(periodeEssai: PeriodeEssai): Observable<PeriodeEssai> { |
||||
let body = JSON.stringify(periodeEssai); |
||||
return this.http.post<PeriodeEssai>(this.periodeessaisUrl, body, this.httpOptions); |
||||
} |
||||
} |
@ -0,0 +1,43 @@ |
||||
import {Referencement} from "../interfaces/referencement"; |
||||
import {Injectable} from '@angular/core'; |
||||
import {Observable} from "rxjs"; |
||||
import {HttpClient, HttpHeaders} from "@angular/common/http"; |
||||
import {referencementsUrl} from "../../ressources/routes/routesPreprod"; |
||||
|
||||
|
||||
@Injectable({providedIn: 'root'}) |
||||
|
||||
export class ReferencementService { |
||||
|
||||
httpOptions = { |
||||
headers: new HttpHeaders({'Content-Type': 'application/json'}) |
||||
}; |
||||
private referencementsUrl = referencementsUrl; |
||||
|
||||
constructor(private http: HttpClient) { |
||||
} |
||||
|
||||
getReferencements(): Observable<Referencement[]> { |
||||
return this.http.get<Referencement[]>(this.referencementsUrl); |
||||
} |
||||
|
||||
getReferencement(id: number): Observable<Referencement> { |
||||
return this.http.get<Referencement>(this.referencementsUrl + "/" + id); |
||||
} |
||||
|
||||
updateReferencement(referencement: Referencement): Observable<Referencement> { |
||||
let body = JSON.stringify(referencement); |
||||
return this.http.put<Referencement>(this.referencementsUrl + "/" + referencement.id, body, this.httpOptions); |
||||
|
||||
} |
||||
|
||||
deleteReferencement(referencement: Referencement) { |
||||
return this.http.delete(this.referencementsUrl + "/" + referencement.id); |
||||
} |
||||
|
||||
addReferencement(referencement: Referencement): Observable<Referencement> { |
||||
let body = JSON.stringify(referencement); |
||||
return this.http.post<Referencement>(this.referencementsUrl, body, this.httpOptions); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,3 @@ |
||||
export const environment = { |
||||
production: true |
||||
}; |
@ -0,0 +1,16 @@ |
||||
// This file can be replaced during build by using the `fileReplacements` array.
|
||||
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
export const environment = { |
||||
production: false |
||||
}; |
||||
|
||||
/* |
||||
* For easier debugging in development mode, you can import the following file |
||||
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. |
||||
* |
||||
* This import should be commented out in production mode because it will have a negative impact |
||||
* on performance if an error is thrown. |
||||
*/ |
||||
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
@ -0,0 +1,15 @@ |
||||
<!doctype html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title>Services Collaborateurs</title> |
||||
<base href="/"> |
||||
<meta content="width=device-width, initial-scale=1" name="viewport"> |
||||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> |
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> |
||||
</head> |
||||
<body> |
||||
<app-root></app-root> |
||||
</body> |
||||
</html> |
@ -0,0 +1,12 @@ |
||||
import {enableProdMode} from '@angular/core'; |
||||
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; |
||||
|
||||
import {AppModule} from './app/app.module'; |
||||
import {environment} from './environments/environment'; |
||||
|
||||
if (environment.production) { |
||||
enableProdMode(); |
||||
} |
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule) |
||||
.catch(err => console.error(err)); |
@ -0,0 +1,69 @@ |
||||
/*************************************************************************************************** |
||||
* Load `$localize` onto the global scope - used if i18n tags appear in Angular templates. |
||||
*/ |
||||
import '@angular/localize/init'; |
||||
/** |
||||
* This file includes polyfills needed by Angular and is loaded before the app. |
||||
* You can add your own extra polyfills to this file. |
||||
* |
||||
* This file is divided into 2 sections: |
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. |
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main |
||||
* file. |
||||
* |
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that |
||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), |
||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. |
||||
* |
||||
* Learn more in https://angular.io/guide/browser-support
|
||||
*/ |
||||
|
||||
/*************************************************************************************************** |
||||
* BROWSER POLYFILLS |
||||
*/ |
||||
|
||||
/** |
||||
* IE11 requires the following for NgClass support on SVG elements |
||||
*/ |
||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
||||
|
||||
/** |
||||
* Web Animations `@angular/platform-browser/animations` |
||||
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. |
||||
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). |
||||
*/ |
||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
||||
|
||||
/** |
||||
* By default, zone.js will patch all possible macroTask and DomEvents |
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags |
||||
* because those flags need to be set before `zone.js` being loaded, and webpack |
||||
* will put import in the top of bundle, so user need to create a separate file |
||||
* in this directory (for example: zone-flags.ts), and put the following flags |
||||
* into that file, and then add the following code before importing zone.js. |
||||
* import './zone-flags'; |
||||
* |
||||
* The flags allowed in zone-flags.ts are listed here. |
||||
* |
||||
* The following flags will work for all browsers. |
||||
* |
||||
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
* |
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js |
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge |
||||
* |
||||
* (window as any).__Zone_enable_cross_context_check = true; |
||||
* |
||||
*/ |
||||
|
||||
/*************************************************************************************************** |
||||
* Zone JS is required by default for Angular itself. |
||||
*/ |
||||
import 'zone.js'; // Included with Angular CLI.
|
||||
|
||||
|
||||
/*************************************************************************************************** |
||||
* APPLICATION IMPORTS |
||||
*/ |
After Width: | Height: | Size: 40 KiB |
@ -0,0 +1,5 @@ |
||||
export const collaborateursUrl = 'https://localhost:5001/api/collaborateurs'; |
||||
export const agencesUrl = 'https://localhost:5001/api/agences'; |
||||
export const businessunitsUrl = 'https://localhost:5001/api/businessunits'; |
||||
export const periodeessaisUrl = 'https://localhost:5001/api/periodeessais'; |
||||
export const referencementsUrl = 'https://localhost:5001/api/referencements'; |
@ -0,0 +1,5 @@ |
||||
export const collaborateursUrl = 'https://collaborateur-epa.apsdigit.lan/api/collaborateurs'; |
||||
export const agencesUrl = 'https://collaborateur-epa.apsdigit.lan/api/agences'; |
||||
export const businessunitsUrl = 'https://collaborateur-epa.apsdigit.lan/api/businessunits'; |
||||
export const periodeessaisUrl = 'https://collaborateur-epa.apsdigit.lan/api/periodeessais'; |
||||
export const referencementsUrl = 'https://collaborateur-epa.apsdigit.lan/api/referencements'; |
@ -0,0 +1,79 @@ |
||||
/* You can add global styles to this file, and also import other style files */ |
||||
|
||||
$primary: #183650; |
||||
$secondary: #e77620; |
||||
$accent: #e1e4e6; |
||||
$error: #b53333; |
||||
$success: #0b7023; |
||||
$info: #fff; |
||||
$warning: #e07612; |
||||
|
||||
label { |
||||
color: $primary; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
input { |
||||
font-size: 1em; |
||||
padding: .3rem; |
||||
margin: 0 15px 0 0; |
||||
} |
||||
|
||||
.form-submit { |
||||
text-decoration: none; |
||||
background-color: $secondary; |
||||
color: white; |
||||
border-radius: 4px; |
||||
|
||||
} |
||||
|
||||
.form-submit:hover { |
||||
background-color: $primary; |
||||
} |
||||
|
||||
.form-submit:disabled { |
||||
background-color: #eee; |
||||
color: #ccc; |
||||
cursor: auto; |
||||
} |
||||
|
||||
a { |
||||
padding: 5px; |
||||
text-decoration: none; |
||||
margin: 2px; |
||||
display: inline-block; |
||||
background-color: $secondary; |
||||
color: white; |
||||
border-radius: 4px; |
||||
} |
||||
|
||||
a:hover { |
||||
background-color: $primary; |
||||
color: white; |
||||
} |
||||
|
||||
a:active { |
||||
background-color: #525252; |
||||
color: white; |
||||
} |
||||
|
||||
button { |
||||
padding: 5px; |
||||
text-decoration: none; |
||||
margin: 2px; |
||||
display: inline-block; |
||||
background-color: $secondary; |
||||
color: white; |
||||
border-radius: 4px; |
||||
border-color: transparent; |
||||
} |
||||
|
||||
button:hover { |
||||
background-color: $primary; |
||||
} |
||||
|
||||
button:disabled { |
||||
background-color: #eee; |
||||
color: #ccc; |
||||
cursor: auto; |
||||
} |
@ -0,0 +1,15 @@ |
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */ |
||||
{ |
||||
"extends": "./tsconfig.json", |
||||
"compilerOptions": { |
||||
"outDir": "./out-tsc/app", |
||||
"types": [] |
||||
}, |
||||
"files": [ |
||||
"src/main.ts", |
||||
"src/polyfills.ts" |
||||
], |
||||
"include": [ |
||||
"src/**/*.d.ts" |
||||
] |
||||
} |
@ -0,0 +1,30 @@ |
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */ |
||||
{ |
||||
"compileOnSave": false, |
||||
"compilerOptions": { |
||||
"baseUrl": "./", |
||||
"outDir": "./dist/out-tsc", |
||||
"forceConsistentCasingInFileNames": true, |
||||
"strict": true, |
||||
"noImplicitReturns": true, |
||||
"noFallthroughCasesInSwitch": true, |
||||
"sourceMap": true, |
||||
"declaration": false, |
||||
"downlevelIteration": true, |
||||
"experimentalDecorators": true, |
||||
"moduleResolution": "node", |
||||
"importHelpers": true, |
||||
"target": "es2017", |
||||
"module": "es2020", |
||||
"lib": [ |
||||
"es2018", |
||||
"dom" |
||||
] |
||||
}, |
||||
"angularCompilerOptions": { |
||||
"enableI18nLegacyMessageIdFormat": false, |
||||
"strictInjectionParameters": true, |
||||
"strictInputAccessModifiers": true, |
||||
"strictTemplates": true |
||||
} |
||||
} |
@ -0,0 +1,18 @@ |
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */ |
||||
{ |
||||
"extends": "./tsconfig.json", |
||||
"compilerOptions": { |
||||
"outDir": "./out-tsc/spec", |
||||
"types": [ |
||||
"jasmine" |
||||
] |
||||
}, |
||||
"files": [ |
||||
"src/app/tests/test.ts", |
||||
"src/polyfills.ts" |
||||
], |
||||
"include": [ |
||||
"src/**/*.spec.ts", |
||||
"src/**/*.d.ts" |
||||
] |
||||
} |
Loading…
Reference in new issue