diff --git a/Mohem/src/app/uI-elements/button.input.ts b/Mohem/src/app/uI-elements/button.input.ts
new file mode 100644
index 00000000..aa24fedd
--- /dev/null
+++ b/Mohem/src/app/uI-elements/button.input.ts
@@ -0,0 +1,23 @@
+import { UiElement } from "./ui-element";
+
+export class ButtonInput extends UiElement {
+ constructor(
+ //private label: string,
+ private elementId: string,
+ private value: any,
+ private containerId: string,
+ private disabled: string) {
+ super(elementId, containerId, '');
+ this.createElement(this.getTemplate());
+
+ }
+
+ public getTemplate() {
+ if (this.disabled == "N") { this.disabled = "disabled" } else { this.disabled = "" }
+ const template =
+ "
" +
+ "
" +
+ " " + this.label + "" +
+ " " +
+ " ";
+
+ return template;
+ }
+}
diff --git a/Mohem/src/app/uI-elements/time.input.ts b/Mohem/src/app/uI-elements/time.input.ts
new file mode 100644
index 00000000..33fec9f1
--- /dev/null
+++ b/Mohem/src/app/uI-elements/time.input.ts
@@ -0,0 +1,51 @@
+import { UiElement } from "./ui-element";
+
+export class TimeInput extends UiElement {
+ constructor(
+ private label: string,
+ private elementId: string,
+ private value: any,
+ private containerId: string,
+ private disabled: string,
+ private hidden: string,
+ private required: string) {
+ super(elementId, containerId, '');
+ this.createElement(this.getTemplate());
+
+ }
+
+ formatDate() {
+ let date = new Date();
+ this.value = date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
+ }
+
+
+ public getTemplate() {
+ let requiredClass: string = "";
+ let disaledClass = "";
+ if (this.required == 'Y')
+ requiredClass = "requiredClass"
+ if (this.disabled == "N") { this.disabled = "disabled"; disaledClass = "disabled" } else { this.disabled = ""; disaledClass = "" }
+ if (this.hidden == "N") { this.hidden = "display:none;" } else { this.hidden = "" }
+ if (this.value == "currentTime") {
+ this.formatDate();
+ }
+ const template =
+ // "
" +
+ // "
" +
+ // // "
"+
+ // "
"+this.value+"
"+
+ // "
";
+
+ "
" +
+ " " + this.label + "" +
+ // " " + this.value + "
" +
+ "" +
+ // " "+
+ // " "+
+ // " "+
+ ""
+ return template;
+ }
+
+}
\ No newline at end of file
diff --git a/Mohem/src/app/uI-elements/ui-element.ts b/Mohem/src/app/uI-elements/ui-element.ts
new file mode 100644
index 00000000..2d7ec8f8
--- /dev/null
+++ b/Mohem/src/app/uI-elements/ui-element.ts
@@ -0,0 +1,64 @@
+export class UiElement {
+
+ constructor(private elementID, private containerID, private viewClass) {
+ }
+
+
+ private getContainer() {
+ return document.getElementById(this.containerID);
+ }
+
+ public createElement(html: string) {
+
+ const container = this.getContainer();
+ if (container) {
+ container.appendChild(this.getElement(html));
+ }
+ // this.registerEvents(onConfirm, onCancel);
+ }
+
+ public delete() {
+ const element = document.getElementById(this.elementID);
+ if (element) {
+ element.remove();
+ }
+ }
+
+ public onClicked(listener: any) {
+ this.registerEvent('click', listener);
+ }
+
+
+ public onChanged(listener: any) {
+ this.registerEvent('change', listener);
+ }
+
+
+ public onBlur(listener: any) {
+ this.registerEvent('blur', listener);
+ }
+
+ private registerEvent(event: string, listener: any) {
+ const element = document.getElementById(this.elementID);
+ element.addEventListener(event, (e) => {
+ if (listener) {
+ listener();
+ }
+ e.stopImmediatePropagation();
+ });
+ }
+
+
+ private getElement(html: string) {
+ const elemDiv = document.createElement('div');
+ //elemDiv.id = this.elementID;
+ elemDiv.className = this.viewClass;
+ elemDiv.innerHTML = html;
+ return elemDiv;
+ }
+
+ public getValue() {
+ return (document.getElementById(this.elementID) as HTMLInputElement).value;
+ }
+}
+
diff --git a/Mohem/src/app/vacation-rule/home/home.component.html b/Mohem/src/app/vacation-rule/home/home.component.html
index 5f71bdcc..2bd909e4 100644
--- a/Mohem/src/app/vacation-rule/home/home.component.html
+++ b/Mohem/src/app/vacation-rule/home/home.component.html
@@ -6,6 +6,10 @@
+
+
+
@@ -73,6 +77,7 @@
-
+
\ No newline at end of file
diff --git a/Mohem/src/app/vacation-rule/home/home.component.ts b/Mohem/src/app/vacation-rule/home/home.component.ts
index a192200b..e9a0785f 100644
--- a/Mohem/src/app/vacation-rule/home/home.component.ts
+++ b/Mohem/src/app/vacation-rule/home/home.component.ts
@@ -6,7 +6,7 @@ import { VacationRuleServiceService } from './../service/vacation-rule-service.s
import { VacationRuleRequest } from './../model/VacationRuleRequest';
import { Component, OnInit } from '@angular/core';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
-import { NavigationExtras, Router } from '@angular/router';
+import { Router } from '@angular/router';
@Component({
selector: 'app-home',
@@ -23,16 +23,59 @@ export class HomeComponent implements OnInit {
IsReachEnd: boolean = false;
RespondAttributeList: any;
+ // button: ButtonInput;
+ // dateTime: DateTimeInput;
+ // date: DateInput;
+ // numberInput: NumberInput;
+ // selectInput: SelectInput;
+ // textAreaInput: TextAreaInput;
+ // timeInput: TimeInput;
+
constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService, private router: Router) {
this.P_PAGE_NUM = 1;
this.P_PAGE_LIMIT = 50;
+
+ // this.button = new ButtonInput('btnSubmit', 'Submit', 'containerDiv', 'Y');
+ // this.dateTime = new DateTimeInput('Start Date', 'SDate', '', 'containerDiv', 'Y', 'Y', 'Y');
+ // this.date = new DateInput('Start Date', 'SDate', '', 'containerDiv', 'Y', 'Y', 'Y');
+ // this.numberInput = new NumberInput('Roll No.:', 'rollNo', '', 'containerDiv', 'Y', 'Y', 'Y');
+ // this.selectInput = new SelectInput('Gender', 'genderSelect', 'm', 'containerDiv', 'Y', 'Y', 'Y');
+ // this.textAreaInput = new TextAreaInput('Message:', 'messageText', '', 'containerDiv', 'Y', 'Y', 'Y');
+ // this.timeInput = new TimeInput('Time', 'SDate', '', 'containerDiv', 'Y', 'Y', 'Y');
+
+ }
+
+ showAlert() {
+ this.cs.presentAlert('Button Clicked');
}
ngOnInit() {
console.log('OnInit');
this.getVacationRules();
- console.log(this.GetVacationRulesList);
+ // let elem = document.getElementById('btnSubmit');
+
+ // const elemDiv = document.createElement('div');
+ //elemDiv.id = this.elementID;
+ // elemDiv.className = '';
+
+ // elemDiv.innerHTML = this.button.getTemplate();
+ // elemDiv.innerHTML = this.dateTime.getTemplate();
+ // elemDiv.innerHTML = this.date.getTemplate();
+ // elemDiv.innerHTML = this.numberInput.getTemplate();
+ // elemDiv.innerHTML = this.selectInput.getTemplate();
+ // elemDiv.innerHTML = this.textAreaInput.getTemplate();
+ // elemDiv.innerHTML = this.timeInput.getTemplate();
+
+ // document.getElementById('containerDiv').appendChild(elemDiv);
+
+ // let elem = document.getElementById("btnSubmit");
+ // console.log(elem);
+ // elem.addEventListener("click", (e) => {
+ // this.showAlert();
+ // e.stopImmediatePropagation();
+ // });
+
}
Vacation_Type() {
@@ -52,7 +95,6 @@ export class HomeComponent implements OnInit {
}, this.ts.trPK('general', 'retry')).subscribe((result) => {
if (this.cs.validResponse(result)) {
this.GetVacationRulesList = result.GetVacationRulesList;
- console.log(result.GetVacationRulesList);
} else {
this.cs.presentAlert(result.ErrorEndUserMessage);
}
@@ -93,7 +135,7 @@ export class HomeComponent implements OnInit {
this.cs.sharedService.setSharedData(this.GetVacationRulesList[i], vacationRuleResponse.SHARED_DATA);
this.isUpdate = true;
-
+
this.cs.sharedService.setSharedData(this.isUpdate, 'isUpdate');
this.router.navigate(['/vacation-rule/create-vacation-rule']);
}
diff --git a/Mohem/src/app/vacation-rule/service/vacation-rule-service.service.ts b/Mohem/src/app/vacation-rule/service/vacation-rule-service.service.ts
index 4359879f..03b7a670 100644
--- a/Mohem/src/app/vacation-rule/service/vacation-rule-service.service.ts
+++ b/Mohem/src/app/vacation-rule/service/vacation-rule-service.service.ts
@@ -34,7 +34,6 @@ export class VacationRuleServiceService {
public getVacationRule(vacationRuleRequest: VacationRuleRequest, onError: any, errorLabel: string): Observable {
const request = vacationRuleRequest;
- console.log(request);
this.authService.authenticateRequest(request);
return this.con.post(VacationRuleServiceService.getVacationRule, request, onError, errorLabel);
}