Skip to content

Commit

Permalink
Merge branch 'sandbox' of https://github.com/betagouv/a-just into san…
Browse files Browse the repository at this point in the history
…dbox
  • Loading branch information
MrJimmyChevallier committed Jul 20, 2023
2 parents a0a6a2b + 530c824 commit 913e300
Show file tree
Hide file tree
Showing 25 changed files with 214 additions and 98 deletions.
2 changes: 2 additions & 0 deletions api/src/constants/referentiel.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ export function etpLabel (value) {
return 'Mi-temps'
case 0:
return 'Ne travaille pas'
case ETP_NEED_TO_BE_UPDATED:
return null
}

return `${fixDecimal(value * 100)}%`
Expand Down
11 changes: 10 additions & 1 deletion api/src/models/TableHumanresources.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { posad } from '../constants/hr'
import { ETP_NEED_TO_BE_UPDATED } from '../constants/referentiel'
import { snakeToCamelObject } from '../utils/utils'
import config from 'config'

Expand Down Expand Up @@ -200,7 +201,6 @@ export default (sequelizeInstance, Model) => {

console.log('findCategory', findCategory)
if (findCategory) {
console.log('oui ?', filterNoEtpt.includes(list[i].fonction), privilegedInGreff.includes(list[i].grade))
if (filterNoEtpt.includes(list[i].fonction) || privilegedInGreff.includes(list[i].grade)) {
situation.category_id = findEAM.id

Expand Down Expand Up @@ -261,6 +261,7 @@ export default (sequelizeInstance, Model) => {
let findFonction = await Model.models.HRFonctions.findOne({
where: {
code,
category_id: situation.category_id,
},
logging: false,
})
Expand Down Expand Up @@ -290,6 +291,12 @@ export default (sequelizeInstance, Model) => {
}
}

// control ETP to complete
const gradeToETPComplete = ['MTT', 'MHFJ', 'MHFNJ']
if (gradeToETPComplete.indexOf(list[i].grade) !== -1) {
situation.etp = ETP_NEED_TO_BE_UPDATED
}

let updatedAt = new Date()
const dateUpdatedSplited = (list[i].date_modif || '').split('/')
if (dateUpdatedSplited.length === 3) {
Expand All @@ -314,6 +321,8 @@ export default (sequelizeInstance, Model) => {
situation.date_start = new Date(dateSplited[2], +dateSplited[1] - 1, dateSplited[0])
}

//console.log(options, situation)

// create person
findHRToDB = await Model.create(options)

Expand Down
15 changes: 12 additions & 3 deletions front/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AfterViewInit, Component } from '@angular/core'
import { Router } from '@angular/router'
import { NavigationEnd, Router } from '@angular/router'
import { environment } from 'src/environments/environment'
import { USER_ACCESS_AVERAGE_TIME } from './constants/user-access'
import { AlertInterface } from './interfaces/alert'
Expand All @@ -8,6 +8,7 @@ import { ContentieuxOptionsService } from './services/contentieux-options/conten
import { UserService } from './services/user/user.service'
import { iIOS } from './utils/system'
import { copy } from './utils'
import { filter } from 'rxjs'

/**
* Variable d'environement en global
Expand Down Expand Up @@ -50,6 +51,15 @@ export class AppComponent implements AfterViewInit {
}

this.onControlSSL()

router.events
.pipe(filter((event) => event instanceof NavigationEnd))
// @ts-ignore
.subscribe((event: NavigationEnd) => {
this.appService.previousUrl = this.appService.currentUrl
this.appService.currentUrl = event.url
})

router.events.subscribe(() => {
const user = this.userService.user.getValue()
if (user && this.dbReady === false) {
Expand Down Expand Up @@ -106,7 +116,7 @@ export class AppComponent implements AfterViewInit {
onCloseAlert(clickToOk = false) {
const alertObject = this.appService.alert.getValue()
this.appService.alert.next(null)
if(clickToOk && alertObject && alertObject.callback) {
if (clickToOk && alertObject && alertObject.callback) {
alertObject.callback()
}
}
Expand Down Expand Up @@ -135,7 +145,6 @@ export class AppComponent implements AfterViewInit {
observer.observe(elementToObserve, { subtree: true, childList: true });
*/

/* document.addEventListener(
'DOMNodeInserted',
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
<p>Taux de couverture</p>
</div>
<div class="item">
<p>DTES</p>
<p>DTES en mois</p>
</div>
<div class="item blue-bg">
<p>Temps moyen / dossier</p>
</div>
<div class="item">
<div class="item end-item">
<p></p>
</div>
</div>
Expand Down Expand Up @@ -74,12 +74,11 @@
</div>
</form>

<div class="line-item" style="display:block; margin: auto;">
<div class="validate-button" (click)="validateWhiteSimulator()" *ngIf="!isValidatedWhiteSimu; else locked">
Valider
</div>
<div class="line-item validate-button">
<label (click)="validateWhiteSimulator()" *ngIf="!isValidatedWhiteSimu; else locked"
class="validate-label">Valider</label>
<ng-template #locked>
<div class="edit-button" (click)="editWhiteSimulator()">
<div class="validate-label" (click)="editWhiteSimulator()">
Editer</div>
</ng-template>

Expand Down Expand Up @@ -122,7 +121,7 @@
<input [value]="endSituationDisplay.magRealTimePerCase" type="text" class="disabled" />
</div>
</form>
<div class="line-item" style="display:block; margin: auto;">
<div class="line-item validate-button">
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,29 @@
top: auto !important;
height: 60px !important;
}

.actual-situation {
top: auto !important;
}

.validate-button {
width: 60px;
margin-left: 10px;
.validate-label {
background-color: #000091;
height: 22px;
border-radius: 6px;
padding: 3px;
margin: auto;
right: 0px;
position: relative;
color: white;
}

.validate-button {
border-radius: 6px;
color: white;
text-align: center;
cursor: pointer;
flex: 0.855 !important;
height: 104px !important;
font-size: 14px;
}

.edit-button {
Expand Down Expand Up @@ -59,6 +69,7 @@
}
}


.item:first-child {
margin-left: 200px;
}
Expand All @@ -73,6 +84,10 @@
align-items: center;
justify-content: center;

&.end-item {
flex: 0.855;
}

&.blue-bg {
background-color: #f5f5fe;

Expand All @@ -97,6 +112,9 @@
}
}
}



.actual-situation {
background-color: #fef6e3;
position: relative;
Expand Down Expand Up @@ -306,13 +324,16 @@
}
}
}

.disabled {
pointer-events: none;
}

.disabled-field {
pointer-events: none;
background-color: rgba(185, 184, 182, 0.2901960784)!important;
background-color: rgba(185, 184, 182, 0.2901960784) !important;
}

.line-item {
flex: 1;
display: flex;
Expand All @@ -321,6 +342,7 @@
color: #161616;
position: relative;
height: 100%;

&.orange-bg {
background-color: #feecc2;

Expand Down Expand Up @@ -460,4 +482,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class EditableSituationComponent implements OnChanges {

const dtes = fixDecimal(startLastStock / startTotalOut)
this.formWhiteSim.controls['realDTESInMonths'].setValue(
String(dtes) + ' mois'
String(dtes) //+ ' mois'
)

const prefix1 = this.category==='MAGISTRAT'?'nbDaysByMagistrat':'nbDaysByFonctionnaire'
Expand Down Expand Up @@ -220,7 +220,7 @@ export class EditableSituationComponent implements OnChanges {
}
this.endSituationDisplay.realCoverage = fixDecimal(coverage) + '%'
this.endSituationDisplay.realDTESInMonths =
fixDecimal(endStock / startTotalOut) + ' mois'
fixDecimal(endStock / startTotalOut) +''//+ ' mois'
this.endSituationDisplay.magRealTimePerCase = decimalToStringDate(tmd)

this.simulatorService.situationProjected.next({
Expand Down
2 changes: 1 addition & 1 deletion front/src/app/components/wrapper/wrapper.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ <h6>{{ hrBackup && hrBackup.label }}</h6>
</ul>
</div>
<div class="menu-item">
<a [routerLink]="['/contact']">
<a [routerLink]="['/contact']" [queryParams]="{backUrl: true}">
<p>Nous contacter</p>
</a>
</div>
Expand Down
12 changes: 12 additions & 0 deletions front/src/app/constants/colors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* RED COLOR
*/
export const RED_COLOR = 'rgb(255, 86, 85)'

export const GET_COLOR = (color: string, opacity: number = 1) => {
if (color.startsWith('rgb(')) {
return color.replace('rgb(', 'rgba(').replace(')', `, ${opacity})`)
}

return color
}
6 changes: 3 additions & 3 deletions front/src/app/routes/calculator/calculator.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<div class="container" *ngIf="categorySelected">
<div class="sub-main-header">
<aj-date-select title="Pour la période du" [value]="dateStart"
(valueChange)="updateReferentielSelected('dateStart', $event)" class="date-start bg-white"
[max]="maxDateSelectionDate" [dateClass]="dateClass">
(valueChange)="updateReferentielSelected('dateStart', $event)" class="date-start bg-white" [max]="dateStop"
[dateClass]="dateClass">
</aj-date-select>
<aj-date-select title="À" [value]="dateStop" (valueChange)="updateReferentielSelected('dateStop', $event)"
class="date-stop bg-white" [max]="maxDateSelectionDate" [dateClass]="dateClass">
class="date-stop bg-white" [dateClass]="dateClass">
</aj-date-select>
<div class="flex-1"></div>
<button class="ref-button" (click)="calculatorSaver();$event.stopPropagation();">
Expand Down
2 changes: 1 addition & 1 deletion front/src/app/routes/contact/contact.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<img src="/assets/icons/bloc-marque/bloc-marque-white@2x.svg" alt="ministère de la justice" />
<img src="/assets/icons/logos/white-192x192@1x.svg" alt="a-just" />
</div>
<p class="back-link"><a routerLink="/">Retour</a></p>
<p class="back-link"><a [routerLink]="routerLinkToGoBack">Retour</a></p>
<h3>Contact</h3>

<div id="hubspotForm"></div>
Expand Down
30 changes: 23 additions & 7 deletions front/src/app/routes/contact/contact.page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { AfterViewInit, Component } from '@angular/core'
import { Title } from '@angular/platform-browser'
import { ActivatedRoute } from '@angular/router'
import { AppService } from 'src/app/services/app/app.service'

declare const hbspt: any

Expand All @@ -12,20 +14,34 @@ declare const hbspt: any
styleUrls: ['./contact.page.scss'],
})
export class ContactPage implements AfterViewInit {
/**
* Get Link to back
*/
routerLinkToGoBack: string[] = ['/']

/**
* Constructeur
* @param title
* @param title
*/
constructor(private title: Title) {
constructor(
private title: Title,
private route: ActivatedRoute,
private appService: AppService
) {
this.title.setTitle('Contact | A-Just')
}

ngAfterViewInit() {
hbspt.forms.create({
region: "eu1",
portalId: "26493393",
formId: "0f776962-cddf-4ccb-b2a8-100936289ebb",
target: "#hubspotForm"
});
region: 'eu1',
portalId: '26493393',
formId: '0f776962-cddf-4ccb-b2a8-100936289ebb',
target: '#hubspotForm',
})

const { backUrl } = this.route.snapshot.queryParams
if (backUrl && backUrl === 'true' && this.appService.previousUrl) {
this.routerLinkToGoBack = [this.appService.previousUrl]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="preview">
<span>ETPT</span>
<p>{{ etp }}</p>
<span [ngStyle]="{visibility: warningETP ? 'hidden' : 'visible'}">ETPT</span>
<p [ngClass]="{alert: warningETP}">{{ warningETP ? '?' : etp }}</p>
</div>
<canvas #canvas [width]="width" [height]="height"></canvas>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

p {
font-size: 26px;

&.alert {
color: fColor(cred);
}
}
}

Expand Down
Loading

0 comments on commit 913e300

Please sign in to comment.