-
-
+
+
+
{{
@@ -445,4 +443,4 @@
-
+
diff --git a/src/app/content/hemat-app/device/add-edit-device/add-edit-device.component.ts b/src/app/content/hemat-app/device/add-edit-device/add-edit-device.component.ts
index bb63cda..07d3c76 100644
--- a/src/app/content/hemat-app/device/add-edit-device/add-edit-device.component.ts
+++ b/src/app/content/hemat-app/device/add-edit-device/add-edit-device.component.ts
@@ -1,4 +1,4 @@
-import { Component, ViewChild } from "@angular/core";
+import { Component, OnInit, ViewChild } from "@angular/core";
import { FormBuilder, FormGroup, NgForm, Validators } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router";
import { BlockUI, NgBlockUI } from "ng-block-ui";
@@ -8,7 +8,7 @@ import { BlockUI, NgBlockUI } from "ng-block-ui";
templateUrl: "./add-edit-device.component.html",
styleUrls: ["./add-edit-device.component.css"],
})
-export class AddEditDeviceComponent {
+export class AddEditDeviceComponent implements OnInit{
@ViewChild("f", { read: true }) userProfileForm: NgForm;
model: any = {};
@@ -59,27 +59,8 @@ export class AddEditDeviceComponent {
ngOnInit() {
this.route.data.subscribe((data) => {
this.mode = data.mode;
- console.log(this.mode);
});
- this.breadcrumb = {
- mainlabel: "Basic Forms",
- links: [
- {
- name: "Home",
- isLink: true,
- link: "/dashboard/sales",
- },
- {
- name: "Form Layouts",
- isLink: true,
- link: "#",
- },
- {
- name: "Basic Forms",
- isLink: false,
- },
- ],
- };
+ this.setBreadcrumb()
this.projectInfo = this.formBuilder.group({
firstName: ["", Validators.required],
@@ -94,6 +75,64 @@ export class AddEditDeviceComponent {
});
}
+ setBreadcrumb() {
+ if (this.isAddMode()) {
+ this.breadcrumb = {
+ mainlabel: "Device",
+ links: [
+ {
+ name: "Home",
+ isLink: false,
+ },
+ {
+ name: "Device",
+ isLink: false,
+ },
+ {
+ name: "Add new device",
+ isLink: false,
+ },
+ ],
+ };
+ } else if (this.isEditMode()) {
+ this.breadcrumb = {
+ mainlabel: "Device",
+ links: [
+ {
+ name: "Home",
+ isLink: false,
+ },
+ {
+ name: "Device",
+ isLink: false,
+ },
+ {
+ name: "Edit new device",
+ isLink: false,
+ },
+ ],
+ };
+ } else if (this.isViewMode()) {
+ this.breadcrumb = {
+ mainlabel: "Device",
+ links: [
+ {
+ name: "Home",
+ isLink: false,
+ },
+ {
+ name: "Device",
+ isLink: false,
+ },
+ {
+ name: "View new device",
+ isLink: false,
+ },
+ ],
+ };
+ }
+ }
+
isEditMode() {
return this.mode === "edit";
}
@@ -112,31 +151,13 @@ export class AddEditDeviceComponent {
onProjectInfoSubmit() {
this.submitted = true;
-
if (this.projectInfo.invalid) {
return;
}
}
- reloadProjectInfo() {
- this.blockUIProjectInfo.start("Loading..");
-
- setTimeout(() => {
- this.blockUIProjectInfo.stop();
- }, 2500);
- }
-
- reloadUserProfile() {
- this.blockUIUserProfile.start("Loading..");
-
- setTimeout(() => {
- this.blockUIUserProfile.stop();
- }, 2500);
- }
-
keyPress(event: any) {
const pattern = /[0-9\+\-\ ]/;
-
const inputChar = String.fromCharCode(event.charCode);
if (event.keyCode !== 8 && !pattern.test(inputChar)) {
event.preventDefault();
@@ -146,6 +167,6 @@ export class AddEditDeviceComponent {
addData() {}
cancel() {
- this.router.navigate(["/device"]); // Adjust the path as per your routing setup
+ this.router.navigate(["/device"]);
}
}