perbaikan login dan tampilan cost management
This commit is contained in:
parent
efaf30d55e
commit
23154e6862
|
@ -177,7 +177,6 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<ng-select
|
<ng-select
|
||||||
|
@ -191,7 +190,6 @@
|
||||||
</ng-select>
|
</ng-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<button
|
<button
|
||||||
|
|
|
@ -1,29 +1,49 @@
|
||||||
<div class="modal-body" style="background-color: #000000 !important">
|
<div class="modal-body" style="background-color: #252525 !important">
|
||||||
<h4 style="color: #ffffff">Input the actual cost of your expenses</h4>
|
<h4 style="color: #ffffff">Input the actual cost of your expenses</h4>
|
||||||
<p style="color: #ffffff">Building : {{ buildingName }}</p>
|
<p style="color: #ffffff">Building : {{ buildingName }}</p>
|
||||||
<p style="color: #ffffff">Periode : {{ formattedDate }}</p>
|
<p style="color: #ffffff">Periode : {{ formattedDate }}</p>
|
||||||
<form [formGroup]="myForm">
|
<form [formGroup]="myForm">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<div
|
||||||
|
class="input-group-prepend"
|
||||||
|
style="background-color: #252525 !important"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="input-group-text"
|
||||||
|
id="basic-addon1"
|
||||||
|
style="
|
||||||
|
background-color: #252525 !important;
|
||||||
|
color: #ffffff;
|
||||||
|
height: calc(1.5em + 0.75rem + 2px) !important;
|
||||||
|
"
|
||||||
|
>Rp</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="real_cost"
|
id="real_cost"
|
||||||
|
aria-describedby="basic-addon1"
|
||||||
formControlName="real_cost"
|
formControlName="real_cost"
|
||||||
placeholder="0.00"
|
placeholder="..............."
|
||||||
mask="separator"
|
mask="separator"
|
||||||
thousandSeparator="."
|
thousandSeparator="."
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer" style="background-color: #000000 !important">
|
<div class="modal-footer justify-content-between" style="background-color: #252525 !important; border-style: none !important;">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-secondary"
|
class="btn btn-secondary"
|
||||||
style="
|
style="
|
||||||
color: #c3f164;
|
color: #c3f164;
|
||||||
background-color: #000000 !important;
|
width: 25%;
|
||||||
|
background-color: #252525 !important;
|
||||||
border-color: #c3f164 !important;
|
border-color: #c3f164 !important;
|
||||||
|
border-radius: 10px;
|
||||||
"
|
"
|
||||||
(click)="activeModal.dismiss('Cross click')"
|
(click)="activeModal.dismiss('Cross click')"
|
||||||
>
|
>
|
||||||
|
@ -33,12 +53,15 @@
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
style="
|
style="
|
||||||
color: #000000 !important;
|
color: #252525 !important;
|
||||||
|
width: 25%;
|
||||||
background-color: #c3f164 !important;
|
background-color: #c3f164 !important;
|
||||||
border-color: #c3f164 !important;
|
border-color: #c3f164 !important;
|
||||||
|
border-radius: 10px;
|
||||||
"
|
"
|
||||||
(click)="addRow()"
|
(click)="addRow()"
|
||||||
>
|
>
|
||||||
Save Changes
|
Add
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
class="brand-logo"
|
class="brand-logo"
|
||||||
src="assets/images/logo/smart.png"
|
src="assets/images/logo/smart.png"
|
||||||
alt="branding logo"
|
alt="branding logo"
|
||||||
height="100" width="400"
|
height="100%" width="75%"
|
||||||
/>
|
/>
|
||||||
<!-- <h3 class="brand-text" style="color: #000000; margin: 0; font-weight: 600;">
|
<!-- <h3 class="brand-text" style="color: #000000; margin: 0; font-weight: 600;">
|
||||||
Smart Building
|
Smart Building
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
<div
|
<div
|
||||||
class="col-md-6 col-12 text-center text-sm-left pr-0"
|
class="col-md-6 col-12 text-center text-sm-left pr-0"
|
||||||
>
|
>
|
||||||
<fieldset>
|
<!-- <fieldset>
|
||||||
<div
|
<div
|
||||||
class="icheckbox_square-blue"
|
class="icheckbox_square-blue"
|
||||||
id="icheckbox"
|
id="icheckbox"
|
||||||
|
@ -116,14 +116,14 @@
|
||||||
<label class="lb-remember" for="remember-me"
|
<label class="lb-remember" for="remember-me"
|
||||||
>Remember Me</label
|
>Remember Me</label
|
||||||
>
|
>
|
||||||
</fieldset>
|
</fieldset> -->
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="col-md-6 col-12 float-sm-left text-center text-sm-right"
|
class="col-md-6 col-12 float-sm-left text-center text-sm-right"
|
||||||
>
|
>
|
||||||
<a href="recover-password.html" class="card-link"
|
<!-- <a href="recover-password.html" class="card-link"
|
||||||
>Forgot Password?</a
|
>Forgot Password?</a
|
||||||
>
|
> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { AuthService } from "../_services/auth.service";
|
||||||
import { AlertService } from "../_services/alert.service";
|
import { AlertService } from "../_services/alert.service";
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { BuildingService } from "../content/hemat-app/service/monitoring-api.service";
|
import { BuildingService } from "../content/hemat-app/service/monitoring-api.service";
|
||||||
|
import { ToastrService } from "ngx-toastr";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: "login.component.html",
|
templateUrl: "login.component.html",
|
||||||
|
@ -23,7 +24,8 @@ export class LoginComponent implements OnInit {
|
||||||
public authService: AuthService,
|
public authService: AuthService,
|
||||||
private renderer: Renderer2,
|
private renderer: Renderer2,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private monitoringApiService: BuildingService
|
private monitoringApiService: BuildingService,
|
||||||
|
private toastr: ToastrService
|
||||||
) {
|
) {
|
||||||
this.route.queryParams.subscribe((params) => {
|
this.route.queryParams.subscribe((params) => {
|
||||||
this.returnUrl = params["returnUrl"];
|
this.returnUrl = params["returnUrl"];
|
||||||
|
@ -41,6 +43,9 @@ export class LoginComponent implements OnInit {
|
||||||
password: ["password", Validators.required],
|
password: ["password", Validators.required],
|
||||||
rememberMe: false,
|
rememberMe: false,
|
||||||
});
|
});
|
||||||
|
if (localStorage.getItem("currentUser")) {
|
||||||
|
this.router.navigate(["/monitoring"]);
|
||||||
|
}
|
||||||
// Remember Me
|
// Remember Me
|
||||||
// console.log(localStorage.getItem("remember"));
|
// console.log(localStorage.getItem("remember"));
|
||||||
|
|
||||||
|
@ -116,23 +121,29 @@ export class LoginComponent implements OnInit {
|
||||||
this.monitoringApiService.postLogin(loginData)
|
this.monitoringApiService.postLogin(loginData)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(response: any) => {
|
(response: any) => {
|
||||||
console.log('Login successful:', response);
|
|
||||||
localStorage.setItem('access_token', response.access_token);
|
localStorage.setItem('access_token', response.access_token);
|
||||||
|
|
||||||
// Store the user profile information
|
|
||||||
const userProfile = {
|
const userProfile = {
|
||||||
displayName: this.loginForm.value.email,
|
displayName: this.loginForm.value.email,
|
||||||
buildingId: 4
|
buildingId: 4
|
||||||
};
|
};
|
||||||
|
this.toastr.success("Success", "Selamat Datang " + userProfile.displayName , {
|
||||||
|
timeOut: 5000,
|
||||||
|
closeButton: true,
|
||||||
|
});
|
||||||
localStorage.setItem('currentUser', JSON.stringify(userProfile));
|
localStorage.setItem('currentUser', JSON.stringify(userProfile));
|
||||||
|
|
||||||
this.router.navigate(['/monitoring']);
|
this.router.navigate(['/monitoring']);
|
||||||
|
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
this.toastr.error("Error", "Akun yang anda masukan salah!", {
|
||||||
|
timeOut: 5000,
|
||||||
|
closeButton: true,
|
||||||
|
});
|
||||||
console.error('Login failed:', error);
|
console.error('Login failed:', error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
addCheckbox(event) {
|
addCheckbox(event) {
|
||||||
const toggle = document.getElementById("icheckbox");
|
const toggle = document.getElementById("icheckbox");
|
||||||
if (event.currentTarget.className === "icheckbox_square-blue") {
|
if (event.currentTarget.className === "icheckbox_square-blue") {
|
||||||
|
@ -143,6 +154,7 @@ export class LoginComponent implements OnInit {
|
||||||
this.renderer.removeClass(toggle, "checked");
|
this.renderer.removeClass(toggle, "checked");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setUserInStorage(res) {
|
setUserInStorage(res) {
|
||||||
if (res.user) {
|
if (res.user) {
|
||||||
localStorage.setItem("currentUser", JSON.stringify(res.user));
|
localStorage.setItem("currentUser", JSON.stringify(res.user));
|
||||||
|
|
Loading…
Reference in New Issue