diff --git a/src/app/organization/holidays/create-holiday/create-holiday.component.html b/src/app/organization/holidays/create-holiday/create-holiday.component.html
new file mode 100644
index 000000000..088d31e8e
--- /dev/null
+++ b/src/app/organization/holidays/create-holiday/create-holiday.component.html
@@ -0,0 +1,92 @@
+
diff --git a/src/app/organization/holidays/create-holiday/create-holiday.component.scss b/src/app/organization/holidays/create-holiday/create-holiday.component.scss
new file mode 100644
index 000000000..690b3262a
--- /dev/null
+++ b/src/app/organization/holidays/create-holiday/create-holiday.component.scss
@@ -0,0 +1,3 @@
+.container{
+ max-width: 37rem;
+}
diff --git a/src/app/organization/holidays/create-holiday/create-holiday.component.spec.ts b/src/app/organization/holidays/create-holiday/create-holiday.component.spec.ts
new file mode 100644
index 000000000..b8964339e
--- /dev/null
+++ b/src/app/organization/holidays/create-holiday/create-holiday.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { CreateHolidayComponent } from './create-holiday.component';
+
+describe('CreateHolidayComponent', () => {
+ let component: CreateHolidayComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ CreateHolidayComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(CreateHolidayComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/organization/holidays/create-holiday/create-holiday.component.ts b/src/app/organization/holidays/create-holiday/create-holiday.component.ts
new file mode 100644
index 000000000..476fd662e
--- /dev/null
+++ b/src/app/organization/holidays/create-holiday/create-holiday.component.ts
@@ -0,0 +1,108 @@
+/** Angular Imports. */
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
+import { ActivatedRoute, Router } from '@angular/router';
+import { DatePipe } from '@angular/common';
+
+/** Custom Services. */
+import { OrganizationService } from 'app/organization/organization.service';
+
+/**
+ * Create Holiday component.
+ * TODO: Develop a custom angular checkbox tree and replace offices select.
+ */
+@Component({
+ selector: 'mifosx-create-holiday',
+ templateUrl: './create-holiday.component.html',
+ styleUrls: ['./create-holiday.component.scss']
+})
+export class CreateHolidayComponent implements OnInit {
+
+ /** Create Holiday form. */
+ holidayForm: FormGroup;
+ /** Repayment Scheduling data. */
+ repaymentSchedulingTypes: any;
+ /** Offices Data */
+ officesData: any;
+ /** Minimum Date allowed. */
+ minDate = new Date(2000, 0, 1);
+ /** Maximum Date allowed. */
+ maxDate = new Date();
+
+ /**
+ * Get offices and holiday template from `Resolver`.
+ * @param {FormBuilder} formBuilder Form Builder.
+ * @param {ActivatedRoute} route Activated Route.
+ * @param {DatePipe} datePipe Date Pipe.
+ * @param {OrganizationService} organizationService Organization Service.
+ * @param {Router} router Router.
+ */
+ constructor(private formBuilder: FormBuilder,
+ private route: ActivatedRoute,
+ private datePipe: DatePipe,
+ private organizationService: OrganizationService,
+ private router: Router ) {
+ this.route.data.subscribe((data: { offices: any, holidayTemplate: any }) => {
+ this.officesData = data.offices;
+ this.repaymentSchedulingTypes = data.holidayTemplate;
+ });
+ }
+
+ ngOnInit() {
+ this.setHolidayForm();
+ this.buildDependencies();
+ }
+
+ /**
+ * Sets Holiday Form.
+ */
+ setHolidayForm() {
+ this.holidayForm = this.formBuilder.group({
+ 'name': ['', Validators.required],
+ 'fromDate': ['', Validators.required],
+ 'toDate': ['', Validators.required],
+ 'reschedulingType': ['', Validators.required],
+ 'description': [''],
+ 'offices': ['', Validators.required]
+ });
+ }
+
+ /**
+ * Sets the conditional controls.
+ */
+ buildDependencies() {
+ this.holidayForm.get('reschedulingType').valueChanges.subscribe((option: any) => {
+ if (option === 2) {
+ this.holidayForm.addControl('repaymentsRescheduledTo', new FormControl('', Validators.required));
+ } else {
+ this.holidayForm.removeControl('repaymentsRescheduledTo');
+ }
+ });
+ }
+
+ /**
+ * Submits the create holiday Form.
+ */
+ submit() {
+ const dateFormat = 'yyyy-MM-dd';
+ const locale = 'en';
+ this.holidayForm.patchValue({
+ 'fromDate': this.datePipe.transform(this.holidayForm.value.fromDate, dateFormat),
+ 'toDate': this.datePipe.transform(this.holidayForm.value.toDate, dateFormat),
+ });
+ if (this.holidayForm.contains('repaymentsRescheduledTo')) {
+ this.holidayForm.patchValue({
+ 'repaymentsRescheduledTo': this.datePipe.transform(this.holidayForm.value.repaymentsRescheduledTo, dateFormat)
+ });
+ }
+ const holiday = {
+ ...this.holidayForm.value,
+ dateFormat,
+ locale
+ };
+ this.organizationService.createHoliday(holiday).subscribe((response: any) => {
+ this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
+ });
+ }
+
+}
diff --git a/src/app/organization/holidays/edit-holiday/edit-holiday.component.scss b/src/app/organization/holidays/edit-holiday/edit-holiday.component.scss
index 0f0bec918..690b3262a 100644
--- a/src/app/organization/holidays/edit-holiday/edit-holiday.component.scss
+++ b/src/app/organization/holidays/edit-holiday/edit-holiday.component.scss
@@ -1,3 +1,3 @@
.container{
- max-width: 37rem;
+ max-width: 37rem;
}
diff --git a/src/app/organization/holidays/holidays.component.html b/src/app/organization/holidays/holidays.component.html
index decd3daae..ed8be2255 100644
--- a/src/app/organization/holidays/holidays.component.html
+++ b/src/app/organization/holidays/holidays.component.html
@@ -1,6 +1,6 @@
-