perbaikan profil, update password dan master

This commit is contained in:
Fuzi_fauzia 2024-07-11 14:39:06 +07:00
parent 28067d1704
commit a9034c1a32
9 changed files with 76 additions and 52 deletions

View File

@ -13,7 +13,7 @@
href="https://allbestsistem.com/" href="https://allbestsistem.com/"
target="_blank" target="_blank"
style="background-color: #000000 !important;" style="background-color: #000000 !important;"
>Smart Building Management Systems (V@2024-07-11.02) >Smart Building Management Systems (V@2024-07-11.03)
</a></span </a></span
> >
</p> </p>

View File

@ -91,7 +91,7 @@
let-value="value" let-value="value"
> >
<p style="color: #ffffff"> <p style="color: #ffffff">
{{ value === "2" ? "Aktif" : "Nonaktif" }} {{ value }}
</p> </p>
</ng-template> </ng-template>
</ngx-datatable-column> </ngx-datatable-column>

View File

@ -91,7 +91,7 @@
let-value="value" let-value="value"
> >
<p style="color: #ffffff"> <p style="color: #ffffff">
{{ value === "2" ? "Aktif" : "Nonaktif" }} {{ value }}
</p> </p>
</ng-template> </ng-template>
</ngx-datatable-column> </ngx-datatable-column>

View File

@ -5,6 +5,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { BuildingService } from '../../service/monitoring-api.service'; import { BuildingService } from '../../service/monitoring-api.service';
import { LoginService } from '../../service/login.service'; import { LoginService } from '../../service/login.service';
import { ToastrService } from 'ngx-toastr';
@Component({ @Component({
selector: 'app-master-voltage', selector: 'app-master-voltage',
@ -24,7 +25,8 @@ export class MasterVoltageComponent {
private modalService: NgbModal, private modalService: NgbModal,
private router: Router, private router: Router,
private monitoringApiService: BuildingService, private monitoringApiService: BuildingService,
private authService: LoginService private authService: LoginService,
private toastr: ToastrService,
) {} ) {}
ngOnInit() { ngOnInit() {
@ -88,8 +90,13 @@ export class MasterVoltageComponent {
modalRef.componentInstance.mode = "add"; modalRef.componentInstance.mode = "add";
modalRef.result.then( modalRef.result.then(
(result) => { (result) => {
console.log(result);
if (result) { if (result) {
if (this.filteredRows.some(value => value.name.toLowerCase() === result.name.toLowerCase())) {
this.toastr.error("Warning", "Data yang anda masukan double.", {
timeOut: 5000,
closeButton: true,
});
} else {
this.monitoringApiService this.monitoringApiService
.postHeaderDetailParam(result) .postHeaderDetailParam(result)
.subscribe((res) => { .subscribe((res) => {
@ -97,6 +104,7 @@ export class MasterVoltageComponent {
this.fetchData(); this.fetchData();
}); });
} }
}
}, },
(reason) => { (reason) => {
console.log(`Dismissed: ${reason}`); console.log(`Dismissed: ${reason}`);
@ -117,14 +125,14 @@ export class MasterVoltageComponent {
modalRef.result.then( modalRef.result.then(
(result) => { (result) => {
console.log(result); console.log(result);
if (result) { // if (result) {
this.monitoringApiService // this.monitoringApiService
.putHeaderDetailParam(result, row.id) // .putHeaderDetailParam(result, row.id)
.subscribe((res) => { // .subscribe((res) => {
console.log(res); // console.log(res);
this.fetchData(); // this.fetchData();
}); // });
} // }
}, },
(reason) => { (reason) => {
console.log(`Dismissed: ${reason}`); console.log(`Dismissed: ${reason}`);

View File

@ -16,7 +16,6 @@
class="form-control" class="form-control"
formControlName="firstName" formControlName="firstName"
maxlength="20" maxlength="20"
placeholder="John Vander"
[ngClass]="{'is-invalid': profilInfo.get('firstName').invalid && profilInfo.get('firstName').touched}" [ngClass]="{'is-invalid': profilInfo.get('firstName').invalid && profilInfo.get('firstName').touched}"
/> />
<div *ngIf="profilInfo.get('firstName').invalid && profilInfo.get('firstName').touched" class="text-danger"> <div *ngIf="profilInfo.get('firstName').invalid && profilInfo.get('firstName').touched" class="text-danger">
@ -31,7 +30,6 @@
class="form-control" class="form-control"
formControlName="lastName" formControlName="lastName"
maxlength="20" maxlength="20"
placeholder="John Vander"
[ngClass]="{'is-invalid': profilInfo.get('lastName').invalid && profilInfo.get('lastName').touched}" [ngClass]="{'is-invalid': profilInfo.get('lastName').invalid && profilInfo.get('lastName').touched}"
/> />
<div *ngIf="profilInfo.get('firstName').invalid && profilInfo.get('firstName').touched" class="text-danger"> <div *ngIf="profilInfo.get('firstName').invalid && profilInfo.get('firstName').touched" class="text-danger">
@ -45,7 +43,6 @@
id="email" id="email"
class="form-control" class="form-control"
formControlName="email" formControlName="email"
placeholder="email@email.com"
maxlength="50" maxlength="50"
[ngClass]="{'is-invalid': profilInfo.get('email').invalid && profilInfo.get('email').touched}" [ngClass]="{'is-invalid': profilInfo.get('email').invalid && profilInfo.get('email').touched}"
/> />
@ -61,7 +58,6 @@
class="form-control" class="form-control"
formControlName="phone" formControlName="phone"
maxlength="13" maxlength="13"
placeholder="08**************"
pattern="^[0-9]*$" pattern="^[0-9]*$"
[ngClass]="{'is-invalid': profilInfo.get('phone').invalid && profilInfo.get('phone').touched}" [ngClass]="{'is-invalid': profilInfo.get('phone').invalid && profilInfo.get('phone').touched}"
/> />

View File

@ -52,7 +52,7 @@ export class ProfilInformationComponent {
lastName: ["", Validators.required], lastName: ["", Validators.required],
email: ["", [Validators.required, Validators.pattern(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/)]], email: ["", [Validators.required, Validators.pattern(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/)]],
phone: ["", [Validators.required, Validators.pattern(/^[0-9]{10,15}$/)]], phone: ["", [Validators.required, Validators.pattern(/^[0-9]{10,15}$/)]],
image: [null], image: [null, Validators.required],
}); });
this.dataProfil(this.storedData.sub); this.dataProfil(this.storedData.sub);
this.profilInfo.valueChanges.subscribe(() => { this.profilInfo.valueChanges.subscribe(() => {

View File

@ -49,7 +49,9 @@
</button> </button>
</div> --> </div> -->
<div class="form-group"> <div class="form-group">
<label for="newPass" style="color: #ffffff">New Password</label> <label for="newPass" style="color: #ffffff"
>New Password</label
>
<div class="input-group"> <div class="input-group">
<input <input
[type]="showNewPass ? 'text' : 'password'" [type]="showNewPass ? 'text' : 'password'"
@ -67,29 +69,38 @@
type="button" type="button"
class="btn btn-link" class="btn btn-link"
(click)="toggleNewPassVisibility()" (click)="toggleNewPassVisibility()"
style="color: #c3f164 !important;" style="color: #c3f164 !important"
> >
<i [class]="showNewPass ? 'fa fa-eye-slash' : 'fa fa-eye'"></i> <i
[class]="
showNewPass ? 'fa fa-eye-slash' : 'fa fa-eye'
"
></i>
</button> </button>
</div> </div>
</div>
<small <small
class="form-text text-muted danger" class="form-text text-muted danger"
*ngIf="submitted && f.newPass.errors" *ngIf="submitted && f.newPass.errors"
class="invalid-feedback" class="invalid-feedback"
> >
<div *ngIf="f.newPass.errors.required">New Password is required</div> <div *ngIf="f.newPass.errors.required">
New Password is required
</div>
<div *ngIf="f.newPass.errors.minlength"> <div *ngIf="f.newPass.errors.minlength">
New Password must be at least 8 characters long New Password must be at least 8 characters long
</div> </div>
<div *ngIf="f.newPass.errors.pattern"> <div *ngIf="f.newPass.errors.pattern">
New Password must contain at least one uppercase letter, one lowercase letter, and one number New Password must contain at least one uppercase
letter, one lowercase letter, and one number
</div> </div>
</small> </small>
</div> </div>
</div>
<div class="form-group"> <div class="form-group">
<label for="confirmPass" style="color: #ffffff">Confirm Password</label> <label for="confirmPass" style="color: #ffffff"
>Confirm Password</label
>
<div class="input-group"> <div class="input-group">
<input <input
[type]="showConfirmPass ? 'text' : 'password'" [type]="showConfirmPass ? 'text' : 'password'"
@ -107,18 +118,25 @@
type="button" type="button"
class="btn btn-link" class="btn btn-link"
(click)="toggleConfirmPassVisibility()" (click)="toggleConfirmPassVisibility()"
style="color: #c3f164 !important;" style="color: #c3f164 !important"
> >
<i [class]="showConfirmPass ? 'fa fa-eye-slash' : 'fa fa-eye'"></i> <i
[class]="
showConfirmPass
? 'fa fa-eye-slash'
: 'fa fa-eye'
"
></i>
</button> </button>
</div> </div>
</div>
<small <small
class="form-text text-muted danger" class="form-text text-muted danger"
*ngIf="submitted && f.confirmPass.errors" *ngIf="submitted && f.confirmPass.errors"
class="invalid-feedback" class="invalid-feedback"
> >
<div *ngIf="f.confirmPass.errors.required">Confirm Password is required</div> <div *ngIf="f.confirmPass.errors.required">
Confirm Password is required
</div>
<div *ngIf="f.confirmPass.errors.matchPassword"> <div *ngIf="f.confirmPass.errors.matchPassword">
Confirm Password must match the New Password Confirm Password must match the New Password
</div> </div>
@ -127,6 +145,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="form-actions text-right"> <div class="form-actions text-right">
<button <button
type="button" type="button"

View File

@ -93,8 +93,6 @@ export class UpdatePasswordComponent {
if (this.profilInfo.invalid) { if (this.profilInfo.invalid) {
return; return;
} }
// Handle form submission
} }
cancel() { cancel() {
@ -114,6 +112,7 @@ export class UpdatePasswordComponent {
} }
saveEdit() { saveEdit() {
this.submitted = true;
if (this.profilInfo.valid) { if (this.profilInfo.valid) {
const dataPassword = { const dataPassword = {
userid: this.profilInfo.value.userid, userid: this.profilInfo.value.userid,
@ -135,6 +134,8 @@ export class UpdatePasswordComponent {
}); });
} }
); );
} else {
} }
} }

View File

@ -138,7 +138,7 @@
<p <p
class="card-subtitle line-on-side text-muted text-center font-small-3 mx-2 my-1" class="card-subtitle line-on-side text-muted text-center font-small-3 mx-2 my-1"
> >
<span>(v@2024.07.11.02)</span> <span>(v@2024.07.11.03)</span>
</p> </p>
<!-- <div class="card-body"> <!-- <div class="card-body">
<a <a