This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FormErrors } from '../interfaces/form-errors.interface'; | |
export const FORM_ERRORS_CONFIG: FormErrors = { | |
required: error => `Este campo é obrigatório`, | |
email: error => `Email inválido`, | |
min: ({ min, actual }) => `O mínimo é ${min} e tem ${actual}`, | |
max: ({ max, actual }) => `O máximo é ${max} e tem ${actual}`, | |
minlength: ({ requiredLength, actualLength }) => | |
`O mínimo é ${requiredLength} e tem ${actualLength}`, | |
maxlength: ({ requiredLength, actualLength }) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Directive({ | |
selector: '[uiErrorBuilder], formControlName, ngModel, [ngModel], [formControlName], [formControl]', | |
exportAs: 'errorBuilder' | |
}) | |
export class ErrorBuilderDirective implements OnInit, OnDestroy { | |
@Input() messages: ErrorMessages = {}; | |
public message: string; | |
private sub: Subscription; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: cc-by-4.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Inj..... | |
export class ClientService { | |
//.... | |
async saveMeasures({ id, ...data }: PatientMeasures) { | |
let path = `${this.document.ref.path}/measures`; | |
path = id ? `${path}/${id}` : path; | |
const date = this.timenow; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { firestore } from 'firebase/app'; | |
export class FirebaseQuery { | |
where?: Array< | |
[ | |
string | firestore.FieldPath, | |
firestore.WhereFilterOp, | |
any | |
] | |
>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Função | |
export const addColumn = <T = any>(prop: string) => { | |
const shift = prop.split('.').pop(); | |
return (payload: T): T => { | |
const column = prop.split('.') | |
.reduce((p, c) => payload[p][c]); | |
return ({ ...payload, [shift]: column }); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function getAge(birthday: Date, date = new Date()) { | |
let age = date.getFullYear() - birthday.getFullYear(); | |
const m = date.getMonth() - birthday.getMonth(); | |
if (m < 0 || (m === 0 && date.getDate() < birthday.getDate())) { | |
age--; | |
} | |
return age; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function orZero(data) { | |
return !!data | |
&& typeof data === 'number' | |
&& !isNaN(data) ? data : 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mat-sidenav-container class="sidenav-container" [hasBackdrop]="(isHandset$ | async) === true"> | |
<mat-sidenav #drawer class="sidenav" fixedInViewport [attr.role]="(isHandset$ | async) ? 'dialog' : 'navigation'" | |
[mode]="(isHandset$ | async) ? 'over' : 'side'" [opened]="(isHandset$ | async) === false"> | |
<div class="tool-list"> | |
<my-city-tool-items> | |
<div myCityToolItem role="listitem"> | |
<my-city-tool-item *ngFor="let toolItem of toolsList" [tool]="toolItem" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Confirm Action | |
* | |
* Keep it Simple Sir | |
* | |
* @param message | |
*/ | |
export function Confirm(message: string) { | |
/** | |
* @param target é a classe, no nosso claso o componente ListaComponent |