UNPKG

@asadi/angular-date-components

Version:

`Angular Date Components` is a comprehensive angular library of date-related components designed to meet the needs of applications that require localization based on various calendar systems. While the package currently includes two powerful components (S

1 lines 100 kB
{"version":3,"file":"asadi-angular-date-components-resource-scheduler.mjs","sources":["../../../../projects/asadi/angular-date-components/resource-scheduler/src/directives/adc-resource-scheduler-source.directive.ts","../../../../projects/asadi/angular-date-components/resource-scheduler/src/utils/resource-scheduler-event.tools.ts","../../../../projects/asadi/angular-date-components/resource-scheduler/src/utils/resource-scheduler.tools.ts","../../../../projects/asadi/angular-date-components/resource-scheduler/src/components/adc-resource-scheduler-base/adc-resource-scheduler-base.ts","../../../../projects/asadi/angular-date-components/resource-scheduler/src/components/adc-week-view/adc-week-view.component.ts","../../../../projects/asadi/angular-date-components/resource-scheduler/src/components/adc-week-view/adc-week-view.component.html","../../../../projects/asadi/angular-date-components/resource-scheduler/src/components/adc-month-view/adc-month-view.component.ts","../../../../projects/asadi/angular-date-components/resource-scheduler/src/components/adc-month-view/adc-month-view.component.html","../../../../projects/asadi/angular-date-components/resource-scheduler/src/components/adc-day-view/adc-day-view.component.ts","../../../../projects/asadi/angular-date-components/resource-scheduler/src/components/adc-day-view/adc-day-view.component.html","../../../../projects/asadi/angular-date-components/resource-scheduler/src/adc-resource-scheduler.module.ts","../../../../projects/asadi/angular-date-components/resource-scheduler/src/components/adc-resource-scheduler/adc-resource-scheduler.component.ts","../../../../projects/asadi/angular-date-components/resource-scheduler/src/components/adc-resource-scheduler/adc-resource-scheduler.component.html","../../../../projects/asadi/angular-date-components/resource-scheduler/asadi-angular-date-components-resource-scheduler.ts"],"sourcesContent":["import { Directive, EventEmitter, Input, Output } from '@angular/core';\r\nimport { ADCIResourceSchedulerEvent, ADCIResourceSchedulerEventSelectEvent, ADCIResourceSchedulerResource, ADCIResourceSchedulerTableEvent } from '../interface.global';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\nimport { ADCIDateRangeChangeEvent } from '@asadi/angular-date-components/core';\r\n\r\n/**\r\n * The `ADCResourceSchedulerSource` directive is used to manage and interact with the data source \r\n * for the resource scheduler. It provides input properties for resources, events, holidays, and weekends,\r\n * and emits output events for date range changes, event selection, and date range selection.\r\n */\r\n@Directive({\r\n selector: '[ResourceSchedulerSource]',\r\n standalone: true\r\n})\r\nexport class ADCResourceSchedulerSource {\r\n\r\n private _events: BehaviorSubject<ADCIResourceSchedulerEvent[]> = new BehaviorSubject(([] as ADCIResourceSchedulerEvent[]));\r\n private _resources: BehaviorSubject<ADCIResourceSchedulerResource[]> = new BehaviorSubject(([] as ADCIResourceSchedulerResource[]));\r\n private _holidays: BehaviorSubject<string[]> = new BehaviorSubject(([] as string[]));\r\n private _weekends: BehaviorSubject<number[]> = new BehaviorSubject(([] as number[]));\r\n\r\n /**\r\n * Event emitted when a date range is selected.\r\n */\r\n @Output('dateRangeSelect')\r\n private dateRangeSelect: EventEmitter<ADCIResourceSchedulerTableEvent> = new EventEmitter<ADCIResourceSchedulerTableEvent>();\r\n\r\n /**\r\n * Event emitted when an event is selected.\r\n */\r\n @Output('eventSelect')\r\n private eventSelect: EventEmitter<ADCIResourceSchedulerEventSelectEvent> = new EventEmitter<ADCIResourceSchedulerEventSelectEvent>();\r\n\r\n /**\r\n * Event emitted when the date range changes.\r\n */\r\n @Output('dateRangeChange')\r\n private dateRangeChange: EventEmitter<ADCIDateRangeChangeEvent> = new EventEmitter<ADCIDateRangeChangeEvent>();\r\n\r\n /**\r\n * Input property for setting the list of events in the resource scheduler.\r\n * @param value The events to be set in the scheduler.\r\n */\r\n @Input('events')\r\n set events(value: ADCIResourceSchedulerEvent[])\r\n {\r\n if(value == null)\r\n {\r\n this._events.next([]);\r\n }\r\n else\r\n {\r\n this._events.next(value);\r\n }\r\n }\r\n get events(): ADCIResourceSchedulerEvent[]\r\n {\r\n return this._events.value;\r\n }\r\n\r\n /**\r\n * Input property for setting the list of resources in the resource scheduler.\r\n * @param value The resources to be set in the scheduler.\r\n */\r\n @Input('resources')\r\n set resources(value: ADCIResourceSchedulerResource[])\r\n {\r\n if(value == null)\r\n {\r\n this._resources.next([]);\r\n }\r\n else\r\n {\r\n this._resources.next(value);\r\n }\r\n \r\n }\r\n get resources(): ADCIResourceSchedulerResource[]\r\n {\r\n return this._resources.value;\r\n }\r\n\r\n /**\r\n * Input property for setting the list of holidays in the resource scheduler.\r\n * @param value The holidays to be set in the scheduler.\r\n */\r\n @Input(\"holidays\")\r\n set holidays(value: string[])\r\n {\r\n if(value == null)\r\n {\r\n this._holidays.next([]);\r\n }\r\n else\r\n {\r\n this._holidays.next(value);\r\n }\r\n }\r\n get holidays(): string[]\r\n {\r\n return this._holidays.value;\r\n }\r\n\r\n /**\r\n * Input property for setting the list of weekends in the resource scheduler.\r\n * @param value The weekends to be set in the scheduler.\r\n */\r\n @Input(\"weekends\")\r\n set weekends(value: number[])\r\n {\r\n if(value == null)\r\n {\r\n this._weekends.next([]);\r\n }\r\n else\r\n {\r\n this._weekends.next(value);\r\n }\r\n }\r\n get weekends(): number[]\r\n {\r\n return this._weekends.value;\r\n }\r\n\r\n @Input('startOf')\r\n startOf: string | null = null;\r\n\r\n resourceChanges(): Observable<ADCIResourceSchedulerResource[]>\r\n {\r\n return this._resources.asObservable();\r\n }\r\n\r\n eventChanges(): Observable<ADCIResourceSchedulerEvent[]>\r\n {\r\n return this._events.asObservable();\r\n }\r\n\r\n holidayChanges(): Observable<string[]>\r\n {\r\n return this._holidays.asObservable();\r\n }\r\n\r\n weekendChanges(): Observable<number[]>\r\n {\r\n return this._weekends.asObservable();\r\n }\r\n\r\n onEventSelect(e: ADCIResourceSchedulerEventSelectEvent): void\r\n {\r\n this.eventSelect.emit(e);\r\n }\r\n\r\n onDateRangeSelect(e: ADCIResourceSchedulerTableEvent)\r\n {\r\n this.dateRangeSelect.next(e);\r\n };\r\n\r\n onDateRangeChange(e: ADCIDateRangeChangeEvent): void\r\n {\r\n this.dateRangeChange.emit(e);\r\n }\r\n}\r\n","import { ADCDateTimeTools } from \"@asadi/angular-date-components/core\";\r\nimport { ADCIResourceSchedulerEvent } from \"../interface.global\";\r\n\r\n/**\r\n * `ResourceSchedulerEventTools` provides utility methods to work with resource scheduler events, such as \r\n * filtering events between a given date range.\r\n */\r\nexport class ResourceSchedulerEventTools\r\n{\r\n private readonly tools: ADCDateTimeTools = new ADCDateTimeTools();\r\n\r\n /**\r\n * Filters and returns events that fall within the specified date range.\r\n * \r\n * The method checks each event's start and end dates against the provided range \r\n * and returns events that overlap with the range, are contained within it, \r\n * or completely span it.\r\n * \r\n * @param startDate The start date of the range in string format (e.g., 'YYYY-MM-DD').\r\n * @param endDate The end date of the range in string format (e.g., 'YYYY-MM-DD').\r\n * @param events The list of events to filter, or `null` if no events are provided.\r\n * \r\n * @returns An array of events that fall within the date range.\r\n */\r\n getEventsBetweenDateRange(startDate: string, endDate: string, events: ADCIResourceSchedulerEvent[] | null): ADCIResourceSchedulerEvent[]\r\n {\r\n if(events == null) return [];\r\n\r\n const rangeStart = this.tools.dateOnly(startDate);\r\n const rangeEnd = this.tools.dateOnly(endDate);\r\n \r\n return events.filter((e) => {\r\n\r\n const eventStart = this.tools.dateOnly(e.startDate);\r\n const eventEnd = this.tools.dateOnly(e.endDate);\r\n\r\n return eventStart >= rangeStart && eventStart <= rangeEnd || \r\n eventEnd >= rangeStart && eventEnd <= rangeEnd || \r\n eventStart < rangeStart && eventEnd > rangeEnd\r\n });\r\n }\r\n}","import { ADCDateTimeTools } from \"@asadi/angular-date-components/core\";\r\nimport { ResourceSchedulerEventTools } from \"./resource-scheduler-event.tools\";\r\n\r\nexport class ADCResourceSchedulerTools\r\n{\r\n readonly dateTime: ADCDateTimeTools = new ADCDateTimeTools();\r\n readonly resourceScheduler: ResourceSchedulerEventTools = new ResourceSchedulerEventTools();\r\n}","import { inject } from '@angular/core';\r\nimport { ADCIDateAdapter, ADCIDateFormatter, ADCIDateRangeChangeEvent, ADCILabels, ADCIOptions, ADCITableEvent, ADC_DATE_ADAPTER, ADC_DATE_FORMATTER, ADC_LABELS, ADC_OPTIONS, DateChangeService } from '@asadi/angular-date-components/core';\r\nimport { Subject, takeUntil } from 'rxjs';\r\nimport { ADCResourceSchedulerSource } from '../../directives/adc-resource-scheduler-source.directive';\r\nimport { ADCIResourceSchedulerEvent, ADCIResourceSchedulerEventSelectEvent, ADCIResourceSchedulerResource, ADCIResourceSchedulerTableEvent } from '../../interface.global';\r\nimport { ADCResourceSchedulerTools } from '../../utils/resource-scheduler.tools';\r\n\r\n/**\r\n * The `AdcResourceSchedulerBase` class provides the base functionality for resource schedulers.\r\n * It manages date navigation, event changes, and resource updates. Derived classes are expected to\r\n * implement specific handling for buttons, event changes, resource changes, and date range changes.\r\n */\r\nexport abstract class AdcResourceSchedulerBase {\r\n\r\n private readonly destory$ = new Subject<void>();\r\n private readonly dateChangeService: DateChangeService = inject(DateChangeService);\r\n private readonly resourceSchedulerSource: ADCResourceSchedulerSource = inject(ADCResourceSchedulerSource);\r\n private isViewReady: boolean = false;\r\n\r\n /**\r\n * The date adapter used for formatting and managing date operations in the resouce scheduler.\r\n */\r\n readonly dateAdapter: ADCIDateAdapter = inject(ADC_DATE_ADAPTER);\r\n\r\n /**\r\n * The date formatter used to format dates in the resource scheduler.\r\n */\r\n readonly dateFormatter: ADCIDateFormatter = inject(ADC_DATE_FORMATTER);\r\n\r\n /**\r\n * Utility tools for working with resource scheduler data.\r\n */\r\n readonly tools: ADCResourceSchedulerTools = new ADCResourceSchedulerTools();\r\n\r\n /**\r\n * Optional labels used for localizing or customizing the text displayed in the resource scheduler.\r\n */\r\n readonly labels?: ADCILabels = inject(ADC_LABELS);\r\n\r\n /**\r\n * start of date provided in the scheduler component use it to set initial date range.\r\n */\r\n readonly startOf: string | null = this.resourceSchedulerSource.startOf;\r\n\r\n readonly options: ADCIOptions = inject(ADC_OPTIONS);\r\n\r\n\r\n /**\r\n * Initializes the resource scheduler by subscribing to date and resource changes, and setting up event handlers.\r\n */\r\n init(): void \r\n {\r\n this.initViewHanlder();\r\n\r\n this.dateChangeService.onNext().pipe(takeUntil(this.destory$)).subscribe(() => {\r\n this.isViewReady = false;\r\n this.nextButtonHandler();\r\n ///this.dateChangesHandler();\r\n //this.eventChangesHandler(undefined);\r\n });\r\n\r\n this.dateChangeService.onPrevious().pipe(takeUntil(this.destory$)).subscribe(() => {\r\n this.isViewReady = false;\r\n this.previousButtonHandler();\r\n //this.dateChangesHandler();\r\n //this.eventChangesHandler(undefined);\r\n });\r\n\r\n this.dateChangeService.onToday().pipe(takeUntil(this.destory$)).subscribe(() => {\r\n this.isViewReady = false;\r\n this.todayButtonHandler();\r\n //this.dateChangesHandler();\r\n //this.eventChangesHandler(undefined);\r\n });\r\n\r\n this.resourceSchedulerSource.resourceChanges().pipe(takeUntil(this.destory$)).subscribe((value) => {\r\n this.isViewReady = false;\r\n this.resourceChangesHandler(value);\r\n //this.dateChangesHandler();\r\n //this.eventChangesHandler(undefined);\r\n });\r\n\r\n this.resourceSchedulerSource.eventChanges().pipe(takeUntil(this.destory$)).subscribe((events) => {\r\n if(!this.isViewReady) return;\r\n\r\n this.eventChangesHandler(events);\r\n });\r\n\r\n this.resourceSchedulerSource.holidayChanges().pipe(takeUntil(this.destory$)).subscribe((value: string[]) => {\r\n this.holidaysChangesHandler(value);\r\n //this.dateChangesHandler();\r\n });\r\n\r\n this.resourceSchedulerSource.weekendChanges().pipe(takeUntil(this.destory$)).subscribe((value: number[]) => {\r\n this.weekendChangesHandler(value);\r\n //this.dateChangesHandler();\r\n });\r\n }\r\n\r\n /**\r\n * Handler for the init view. This method should implement logic for setting the initial view date.\r\n * \r\n * @returns void\r\n */\r\n abstract initViewHanlder(): void;\r\n\r\n /**\r\n * Abstract method for handling the \"Today\" button click.\r\n * Must be implemented by subclasses.\r\n */\r\n abstract todayButtonHandler(): void\r\n\r\n /**\r\n * Abstract method for handling the \"Previous\" button click.\r\n * Must be implemented by subclasses.\r\n */\r\n abstract previousButtonHandler(): void\r\n\r\n /**\r\n * Abstract method for handling the \"Next\" button click.\r\n * Must be implemented by subclasses.\r\n */\r\n abstract nextButtonHandler(): void\r\n\r\n /**\r\n * Abstract method for handling changes to events.\r\n * Must be implemented by subclasses.\r\n * \r\n * @param events - The events that have changed, or undefined if there are no events.\r\n */\r\n abstract eventChangesHandler(events: ADCIResourceSchedulerEvent[]): void\r\n\r\n /**\r\n * Abstract method for handling changes to resources.\r\n * Must be implemented by subclasses.\r\n * \r\n * @param resources - The resources that have changed.\r\n */\r\n abstract resourceChangesHandler(resources: ADCIResourceSchedulerResource[]): void\r\n\r\n // /**\r\n // * Abstract method for handling date changes.\r\n // * Must be implemented by subclasses.\r\n // */\r\n // abstract dateChangesHandler(): void\r\n\r\n /**\r\n * Abstract method for handling changes to holidays.\r\n * Must be implemented by subclasses.\r\n * \r\n * @param holidays - The updated list of holidays.\r\n */\r\n abstract holidaysChangesHandler(holidays: string[]): void\r\n\r\n\r\n /**\r\n * Abstract method for handling changes to weekends.\r\n * Must be implemented by subclasses.\r\n * \r\n * @param weekends - The updated list of weekends.\r\n */\r\n abstract weekendChangesHandler(weekends: number[]): void\r\n\r\n /**\r\n * Handles date range change events and forwards them to the resource scheduler source.\r\n * \r\n * @param e - The date range change event.\r\n */\r\n dateRangeChange(e: ADCIDateRangeChangeEvent): void\r\n {\r\n this.resourceSchedulerSource.onDateRangeChange(e);\r\n }\r\n\r\n /**\r\n * Handles date range select events and forwards them to the resource scheduler source.\r\n * \r\n * @param e - The date range select event.\r\n */\r\n dateRangeSelect(e: ADCIResourceSchedulerTableEvent): void\r\n {\r\n this.resourceSchedulerSource.onDateRangeSelect(e);\r\n }\r\n\r\n /**\r\n * Handles event select events and forwards them to the resource scheduler source.\r\n * \r\n * @param e - The event select event.\r\n */\r\n eventClick(e: ADCIResourceSchedulerEventSelectEvent): void\r\n {\r\n this.resourceSchedulerSource.onEventSelect(e);\r\n }\r\n\r\n abstract onEventClick(event: ADCITableEvent, dom: HTMLElement, jsEvent: MouseEvent): void;\r\n\r\n /**\r\n * Marks the view as ready to process events.\r\n * \r\n * Once this method is called:\r\n * - The `eventChangesHandler` will be triggered immediately with the current list of events.\r\n * - Subsequent updates to events will also be handled automatically until the view is marked as unready.\r\n * \r\n * @returns void\r\n */\r\n markViewAsReady(): void\r\n {\r\n this.isViewReady = true;\r\n this.eventChangesHandler(this.resourceSchedulerSource.events);\r\n }\r\n\r\n /**\r\n * Destroys the resource scheduler instance and cleans up any active subscriptions.\r\n */\r\n destory(): void \r\n {\r\n this.destory$.next();\r\n }\r\n}\r\n","import { Component, OnDestroy, OnInit } from '@angular/core';\r\nimport { ADCCommonService, ADCDateSplitter, ADCITableCell, ADCITableColumn, ADCITableEvent, ADCITableRow, ADCStaticValues, FlatEventBuilder, TableSelection } from '@asadi/angular-date-components/core';\r\nimport { ADCIResourceSchedulerEvent, ADCIResourceSchedulerResource, ADCIResourceSchedulerTableEvent } from \"../../interface.global\";\r\nimport { AdcResourceSchedulerBase } from '../adc-resource-scheduler-base/adc-resource-scheduler-base';\r\n\r\n@Component({\r\n selector: 'adc-week-view',\r\n templateUrl: './adc-week-view.component.html',\r\n styleUrls: ['./adc-week-view.component.css']\r\n})\r\nexport class ADCWeekViewComponent extends AdcResourceSchedulerBase implements OnInit, OnDestroy{\r\n\r\n week: number = 0;\r\n year: number = 0;\r\n\r\n private daysOfWeek: string[] = ADCStaticValues.getDaysOfWeek();\r\n\r\n title: string = '';\r\n \r\n dateSplitter: ADCDateSplitter = this.dateFormatter.DateSplitter;\r\n\r\n resources: ADCIResourceSchedulerResource[] = [];\r\n events: ADCIResourceSchedulerEvent[] = [];\r\n\r\n rows: ADCITableRow[] = [];\r\n\r\n private startOfWeek: string = '';\r\n private endOfWeek: string = '';\r\n\r\n weekends: number[] = [];\r\n holidays: string[] = [];\r\n\r\n readonly commonService = new ADCCommonService(this.dateAdapter, this.labels);\r\n readonly today: string = this.dateAdapter.today();\r\n readonly selectionManager = new TableSelection(this.dateFilter);\r\n readonly eventBuilder = new FlatEventBuilder();\r\n\r\n constructor(\r\n )\r\n {\r\n super();\r\n }\r\n\r\n ngOnInit(): void \r\n {\r\n super.init();\r\n\r\n this.selectionManager.cellSelectionStream.subscribe(event => this.onDateRangeSelect(event.start, event.end));\r\n\r\n this.eventBuilder.eventSelectionStream.subscribe(e => {\r\n this.onEventClick(e.event, e.dom, e.jsEvent);\r\n });\r\n }\r\n\r\n dateFilter(cell1: ADCITableCell, cell2: ADCITableCell): boolean\r\n {\r\n return cell1.rowValue == cell2.rowValue && cell2.columnValue >= cell1.columnValue;\r\n }\r\n\r\n override initViewHanlder(): void \r\n {\r\n if(this.startOf == null)\r\n {\r\n this.todayButtonHandler();\r\n }\r\n else\r\n {\r\n this.week = this.dateAdapter.getWeekOf(this.startOf);\r\n this.year = this.dateAdapter.getYearOf(this.startOf);\r\n this.calculateCurrentDate();\r\n }\r\n }\r\n\r\n override todayButtonHandler(): void\r\n {\r\n this.week = this.dateAdapter.getCurrentWeek();\r\n this.year = this.dateAdapter.getCurrentYear();\r\n this.calculateCurrentDate();\r\n }\r\n\r\n override previousButtonHandler(): void\r\n {\r\n this.week--;\r\n\r\n if(this.week < 1)\r\n {\r\n this.year--;\r\n this.week = this.dateAdapter.getWeeksOfYear(this.year) - 1;\r\n }\r\n this.calculateCurrentDate();\r\n }\r\n\r\n override nextButtonHandler(): void\r\n {\r\n this.week++;\r\n const weeksOfYear = this.dateAdapter.getWeeksOfYear(this.year);\r\n\r\n if(this.week >= weeksOfYear)\r\n {\r\n this.year++;\r\n this.week = 1;\r\n }\r\n\r\n this.calculateCurrentDate();\r\n }\r\n\r\n calculateCurrentDate(): void\r\n {\r\n const start = this.dateAdapter.getDateOfDay(this.year, this.week, 0);\r\n const end = this.dateAdapter.getDateOfDay(this.year, this.week, 6);\r\n\r\n this.startOfWeek = this.dateAdapter.transformDate(+start.split(this.dateSplitter)[0], +start.split(this.dateSplitter)[1], +start.split(this.dateSplitter)[2]);\r\n this.endOfWeek = this.dateAdapter.transformDate(+end.split(this.dateSplitter)[0], +end.split(this.dateSplitter)[1], +end.split(this.dateSplitter)[2]);\r\n\r\n this.title = `${this.labels?.week || \"Week\"} ${this.week} ${this.labels?.year || \"Year\"} ${this.year}`;\r\n\r\n this.dateChangesHandler();\r\n super.dateRangeChange({startDate: this.startOfWeek, endDate: this.endOfWeek});\r\n }\r\n\r\n override eventChangesHandler(events: ADCIResourceSchedulerEvent[]): void\r\n {\r\n const tableEvents: ADCITableEvent[] = [];\r\n\r\n this.events = events;\r\n\r\n const viewEvents = this.tools.resourceScheduler.getEventsBetweenDateRange(this.startOfWeek, this.endOfWeek, this.events);\r\n\r\n viewEvents.forEach((e: ADCIResourceSchedulerEvent) => {\r\n\r\n const rowIndex = this.rows.findIndex((r: ADCITableRow) => r.value == e.resourceId);\r\n\r\n if(rowIndex == -1) return;\r\n\r\n const row = this.rows[rowIndex];\r\n\r\n const startColumnIndex = row.columns.findIndex((c: ADCITableColumn) => {\r\n return this.tools.dateTime.dateOnly(c.value) == this.tools.dateTime.dateOnly(e.startDate)\r\n });\r\n\r\n const endColumnIndex = row.columns.findIndex((c: ADCITableColumn) => {\r\n return this.tools.dateTime.dateOnly(c.value) == this.tools.dateTime.dateOnly(e.endDate)\r\n });\r\n\r\n const startTime = +this.tools.dateTime.hourOrDefault(e.startTime, '00');\r\n const endTime = +this.tools.dateTime.hourOrDefault(e.endTime, '24');\r\n\r\n const cellEvent: ADCITableEvent = {\r\n columnStart: startColumnIndex != -1 ? startColumnIndex : null,\r\n columnEnd: endColumnIndex != -1 ? endColumnIndex : null,\r\n data: e,\r\n rowStart: rowIndex,\r\n rowEnd: rowIndex,\r\n offsetX: startTime / 24,\r\n fractionX: e.allDay == true ? 1 : (endTime / 24),\r\n overlapTolerance: this.options.eventOverlapTolerance / 24\r\n };\r\n\r\n tableEvents.push(cellEvent);\r\n });\r\n\r\n this.eventBuilder.data = tableEvents;\r\n }\r\n\r\n override resourceChangesHandler(resources: ADCIResourceSchedulerResource[]): void {\r\n this.resources = resources;\r\n this.dateChangesHandler();\r\n }\r\n\r\n dateChangesHandler(): void\r\n {\r\n this.rows = this.getRowIntialValue();\r\n \r\n if(this.resources.length == 0) return;\r\n\r\n this.resources.forEach((resource: ADCIResourceSchedulerResource, rowIndex: number) => {\r\n const row: ADCITableRow =\r\n {\r\n classList: '',\r\n label: resource.title,\r\n prefix: '',\r\n suffix: '',\r\n value: resource.id.toString(),\r\n verticalAlign: 'center',\r\n horizontalAlign: 'center',\r\n columns: []\r\n }\r\n \r\n this.daysOfWeek.forEach((day: string, dayIndex: number) => {\r\n \r\n const date = this.getDate(dayIndex);\r\n \r\n const column: ADCITableColumn = \r\n {\r\n label: '',\r\n classList: '',\r\n prefix: '',\r\n suffix: '',\r\n value: date.transformedDate.split('T')[0],\r\n verticalAlign: 'center',\r\n horizontalAlign: 'center',\r\n selectable: true,\r\n }\r\n \r\n row.columns.push(column);\r\n });\r\n\r\n this.rows.push(row);\r\n });\r\n }\r\n\r\n override holidaysChangesHandler(holidays: string[]): void \r\n {\r\n this.holidays = holidays;\r\n this.dateChangesHandler();\r\n }\r\n\r\n override weekendChangesHandler(weekends: number[]): void \r\n {\r\n this.weekends = weekends;\r\n this.dateChangesHandler();\r\n }\r\n\r\n onDateRangeSelect(start: ADCITableCell, end: ADCITableCell): void\r\n {\r\n const e: ADCIResourceSchedulerTableEvent = \r\n {\r\n endDate: end.columnValue.toString(),\r\n endTime: '00:00',\r\n startDate: start.columnValue.toString(),\r\n startTime: '00:00',\r\n resourceId: start.rowValue\r\n }\r\n \r\n super.dateRangeSelect(e);\r\n }\r\n\r\n override onEventClick(event: ADCITableEvent, dom: HTMLElement, jsEvent: MouseEvent): void \r\n {\r\n const resourceSchedulerEvent: ADCIResourceSchedulerEvent = this.events.filter(item => item.id == event.data.id)[0];\r\n\r\n super.eventClick({dom: dom, jsEvent: jsEvent, event: resourceSchedulerEvent});\r\n }\r\n\r\n getDate(dayOfWeek: number): {date: string, transformedDate: string}\r\n {\r\n const date = this.dateAdapter.getDateOfDay(this.year, this.week, dayOfWeek);\r\n const changedDate = this.dateAdapter.transformDate(+date.split(this.dateSplitter)[0], +date.split(this.dateSplitter)[1] , +date.split(this.dateSplitter)[2]);\r\n return {date: date, transformedDate: changedDate};\r\n }\r\n\r\n ngOnDestroy(): void \r\n {\r\n super.destory();\r\n }\r\n\r\n private getRowIntialValue(): ADCITableRow[]\r\n {\r\n const row: ADCITableRow = {\r\n verticalAlign: 'center',\r\n horizontalAlign: 'center',\r\n classList: '',\r\n columns: [],\r\n label: '',\r\n prefix: '',\r\n suffix: '',\r\n value: ''\r\n };\r\n\r\n this.daysOfWeek.forEach((day: string, dayIndex: number) => {\r\n\r\n const date = this.getDate(dayIndex);\r\n const dIndex = this.commonService.getDayIndex(dayIndex);\r\n\r\n const column: ADCITableColumn = \r\n {\r\n label: this.labels?.daysOfWeek[dIndex] || day,\r\n classList: ''.concat(\r\n date.transformedDate.split('T')[0] == this.today ? ' today ' : ' ',\r\n this.weekends.includes(dayIndex) || this.holidays.includes(date.transformedDate.split('T')[0]) ? ' holiday ' : ' '\r\n ),\r\n prefix: '',\r\n suffix: date.date.split(this.dateSplitter)[1] + this.dateSplitter + date.date.split(this.dateSplitter)[2],\r\n value: dayIndex.toString(),\r\n verticalAlign: 'center',\r\n horizontalAlign: 'center',\r\n selectable: false,\r\n }\r\n\r\n row.columns.push(column);\r\n })\r\n\r\n return [row];\r\n }\r\n}\r\n","<ng-container *ngIf=\"resources.length != 0\">\r\n <adc-table\r\n [rows]=\"rows\"\r\n [title]=\"title\" \r\n [selectionManager]=\"selectionManager\"\r\n [eventBuilder]=\"eventBuilder\"\r\n (viewReady)=\"markViewAsReady()\"\r\n ></adc-table>\r\n</ng-container>","import { Component, OnDestroy, OnInit } from '@angular/core';\r\nimport { ADCCommonService, ADCDateSplitter, ADCITableCell, ADCITableColumn, ADCITableEvent, ADCITableRow, ADCStaticValues, FlatEventBuilder, TableSelection } from '@asadi/angular-date-components/core';\r\nimport { ADCIResourceSchedulerEvent, ADCIResourceSchedulerResource, ADCIResourceSchedulerTableEvent} from \"../../interface.global\";\r\nimport { AdcResourceSchedulerBase } from '../adc-resource-scheduler-base/adc-resource-scheduler-base';\r\n\r\n@Component({\r\n selector: 'adc-month-view',\r\n templateUrl: './adc-month-view.component.html',\r\n styleUrls: ['./adc-month-view.component.css']\r\n})\r\nexport class ADCMonthViewComponent extends AdcResourceSchedulerBase implements OnInit, OnDestroy{\r\n\r\n \r\n month: number = 0;\r\n year: number = 0;\r\n\r\n daysOfWeek: string[] = ADCStaticValues.getDaysOfWeek();\r\n monthsOfYear: string[] = this.dateAdapter.getMonthsOfYear();\r\n weeksOfMonth: string[] = [];\r\n\r\n title: string = '';\r\n \r\n dateSplitter: ADCDateSplitter = this.dateFormatter.DateSplitter;\r\n\r\n resources: ADCIResourceSchedulerResource[] = [];\r\n events: ADCIResourceSchedulerEvent[] = [];\r\n\r\n rows: ADCITableRow[] = [];\r\n\r\n private startOfMonth: string = '';\r\n private endOfMonth: string = '';\r\n\r\n weekends: number[] = [];\r\n holidays: string[] = [];\r\n\r\n readonly commonService = new ADCCommonService(this.dateAdapter, this.labels);\r\n readonly today: string = this.dateAdapter.today();\r\n readonly selectionManager = new TableSelection(this.dateFilter);\r\n readonly eventBuilder = new FlatEventBuilder();\r\n\r\n constructor(\r\n )\r\n {\r\n super();\r\n }\r\n\r\n ngOnInit(): void \r\n {\r\n super.init();\r\n\r\n this.selectionManager.cellSelectionStream.subscribe(event => this.onDateRangeSelect(event.start, event.end));\r\n\r\n this.eventBuilder.eventSelectionStream.subscribe(e => {\r\n this.onEventClick(e.event, e.dom, e.jsEvent);\r\n });\r\n }\r\n\r\n dateFilter(cell1: ADCITableCell, cell2: ADCITableCell): boolean\r\n {\r\n return cell1.rowValue == cell2.rowValue && cell2.columnValue >= cell1.columnValue;\r\n }\r\n\r\n override initViewHanlder(): void \r\n {\r\n if(this.startOf == null)\r\n {\r\n this.todayButtonHandler();\r\n }\r\n else\r\n {\r\n this.month = this.dateAdapter.getMonthOf(this.startOf);\r\n this.year = this.dateAdapter.getYearOf(this.startOf);\r\n \r\n this.calculateCurrentDate();\r\n }\r\n }\r\n\r\n override todayButtonHandler(): void\r\n {\r\n this.month = this.dateAdapter.getCurrentMonth();\r\n this.year = this.dateAdapter.getCurrentYear();\r\n this.calculateCurrentDate();\r\n }\r\n\r\n override previousButtonHandler(): void\r\n {\r\n this.month--;\r\n if(this.month < 1)\r\n {\r\n this.month = 12;\r\n this.year--;\r\n }\r\n\r\n this.calculateCurrentDate();\r\n }\r\n\r\n override nextButtonHandler(): void\r\n {\r\n this.month++;\r\n if(this.month > 12)\r\n {\r\n this.month = 1;\r\n this.year++;\r\n }\r\n\r\n this.calculateCurrentDate();\r\n }\r\n\r\n calculateCurrentDate(): void\r\n {\r\n this.weeksOfMonth = this.dateAdapter.getWeeksOfMonth(this.year, this.month);\r\n this.startOfMonth = this.dateAdapter.transformDate(this.year, this.month, 1);\r\n const daysOfMonth = this.dateAdapter.getDaysOfMonth(this.year, this.month);\r\n this.endOfMonth = this.dateAdapter.transformDate(this.year, this.month, daysOfMonth);\r\n\r\n const month = this.monthsOfYear[this.month - 1];\r\n\r\n this.title = this.commonService.getMonthName(month) || month + ' ' + this.year;\r\n\r\n this.dateChangesHandler();\r\n super.dateRangeChange({startDate: this.startOfMonth, endDate: this.endOfMonth});\r\n }\r\n\r\n override eventChangesHandler(events: ADCIResourceSchedulerEvent[]): void\r\n {\r\n const tableEvents: ADCITableEvent[] = [];\r\n\r\n this.events = events;\r\n \r\n const viewEvents = this.tools.resourceScheduler.getEventsBetweenDateRange(this.startOfMonth, this.endOfMonth, this.events);\r\n\r\n viewEvents.forEach((e: ADCIResourceSchedulerEvent) => {\r\n\r\n const rowIndex = this.rows.findIndex((r: ADCITableRow) => r.value == e.resourceId);\r\n\r\n if(rowIndex == -1) return;\r\n\r\n const row = this.rows[rowIndex];\r\n\r\n const startColumnIndex = row.columns.findIndex((c: ADCITableColumn) => {\r\n return this.tools.dateTime.dateOnly(c.value.toString()) == this.tools.dateTime.dateOnly(e.startDate)\r\n });\r\n\r\n const endColumnIndex = row.columns.findIndex((c: ADCITableColumn) => {\r\n return this.tools.dateTime.dateOnly(c.value.toString()) == this.tools.dateTime.dateOnly(e.endDate)\r\n });\r\n\r\n const startTime = +this.tools.dateTime.hourOrDefault(e.startTime, '00');\r\n const endTime = +this.tools.dateTime.hourOrDefault(e.endTime, '24');\r\n\r\n const cellEvent: ADCITableEvent = {\r\n columnStart: startColumnIndex != -1 ? startColumnIndex : null,\r\n columnEnd: endColumnIndex != - 1 ? endColumnIndex : null,\r\n data: e,\r\n rowStart: rowIndex,\r\n rowEnd: rowIndex,\r\n offsetX: startTime / 24,\r\n fractionX: e.allDay == true ? 1 : (endTime / 24),\r\n overlapTolerance: this.options.eventOverlapTolerance / 24\r\n };\r\n\r\n tableEvents.push(cellEvent);\r\n });\r\n\r\n this.eventBuilder.data = tableEvents;\r\n }\r\n\r\n override resourceChangesHandler(resources: ADCIResourceSchedulerResource[]): void {\r\n this.resources = resources;\r\n this.dateChangesHandler();\r\n }\r\n\r\n dateChangesHandler(): void\r\n {\r\n this.rows = this.getRowInitialValue();\r\n\r\n if(this.resources.length == 0) return;\r\n\r\n this.resources.forEach((resource: ADCIResourceSchedulerResource, rowIndex: number) => {\r\n\r\n const row: ADCITableRow = \r\n {\r\n label: resource.title,\r\n classList: '',\r\n prefix: '',\r\n suffix: '',\r\n value: resource.id.toString(),\r\n verticalAlign: 'center',\r\n horizontalAlign: 'center',\r\n columns: [],\r\n }\r\n\r\n this.weeksOfMonth.forEach((week: string, weekIndex) => {\r\n\r\n this.daysOfWeek.forEach((day: string, dayIndex: number) => {\r\n \r\n const date = this.dateAdapter.getDateOfDay(this.year, +week, dayIndex);\r\n const splittedDate = date.split(this.dateSplitter);\r\n const transformedDate = this.dateAdapter.transformDate(+splittedDate[0], +splittedDate[1], +splittedDate[2]);\r\n\r\n if(+splittedDate[1] != this.month) return;\r\n \r\n row.columns.push({\r\n label: '',\r\n classList: '',\r\n prefix: '',\r\n suffix: '',\r\n value: transformedDate.split('T')[0],\r\n verticalAlign: 'center',\r\n horizontalAlign: 'center',\r\n selectable: true\r\n })\r\n });\r\n \r\n });\r\n\r\n this.rows.push(row);\r\n\r\n })\r\n }\r\n\r\n override holidaysChangesHandler(holidays: string[]): void \r\n {\r\n this.holidays = holidays;\r\n this.dateChangesHandler();\r\n }\r\n\r\n override weekendChangesHandler(weekends: number[]): void \r\n {\r\n this.weekends = weekends;\r\n this.dateChangesHandler();\r\n }\r\n\r\n onDateRangeSelect(start: ADCITableCell, end: ADCITableCell): void\r\n {\r\n const e: ADCIResourceSchedulerTableEvent = \r\n {\r\n endDate: end.columnValue.split('T')[0],\r\n endTime: '00:00',\r\n startDate: start.columnValue.split('T')[0],\r\n startTime: '00:00',\r\n resourceId: start.rowValue\r\n }\r\n \r\n super.dateRangeSelect(e);\r\n }\r\n\r\n override onEventClick(event: ADCITableEvent, dom: HTMLElement, jsEvent: MouseEvent): void \r\n {\r\n const resourceSchedulerEvent: ADCIResourceSchedulerEvent = this.events.filter(item => item.id == event.data.id)[0];\r\n\r\n super.eventClick({dom: dom, jsEvent: jsEvent, event: resourceSchedulerEvent});\r\n }\r\n\r\n ngOnDestroy(): void \r\n {\r\n super.destory();\r\n }\r\n\r\n private getRowInitialValue(): ADCITableRow[]\r\n {\r\n const row: ADCITableRow = {\r\n verticalAlign: 'center',\r\n horizontalAlign: 'center',\r\n classList: '',\r\n label: '',\r\n prefix: '',\r\n suffix: '',\r\n value: '',\r\n columns: [],\r\n };\r\n\r\n this.weeksOfMonth.forEach((week: string, weekIndex) => {\r\n\r\n this.daysOfWeek.forEach((day: string, dayIndex: number) => {\r\n\r\n const date = this.dateAdapter.getDateOfDay(this.year, +week, dayIndex);\r\n const splittedDate = date.split(this.dateSplitter);\r\n const transformedDate = this.dateAdapter.transformDate(+splittedDate[0], +splittedDate[1], +splittedDate[2]);\r\n const dIndex = this.commonService.getDayIndex(dayIndex);\r\n\r\n if(+splittedDate[1] != this.month) return;\r\n\r\n row.columns.push({\r\n label: this.labels?.daysOfWeek[dIndex] || day,\r\n classList: ''.concat(\r\n transformedDate.split('T')[0] == this.today ? ' today ' : ' ',\r\n this.weekends.includes(dayIndex) || this.holidays.includes(transformedDate.split('T')[0]) ? ' holiday ' : ' '\r\n ),\r\n prefix: '',\r\n suffix: date.split(this.dateSplitter)[1] + this.dateSplitter + date.split(this.dateSplitter)[2],\r\n value: dayIndex.toString(),\r\n verticalAlign: 'center',\r\n horizontalAlign: 'center',\r\n selectable: false\r\n })\r\n });\r\n\r\n });\r\n\r\n return [row];\r\n }\r\n}\r\n","<ng-container *ngIf=\"resources.length != 0\">\r\n <adc-table\r\n [rows]=\"rows\"\r\n [title]=\"title\" \r\n [selectionManager]=\"selectionManager\"\r\n [eventBuilder]=\"eventBuilder\"\r\n (viewReady)=\"markViewAsReady()\"\r\n ></adc-table>\r\n</ng-container>\r\n\r\n\r\n\r\n\r\n\r\n","import { Component, forwardRef,OnDestroy, OnInit } from '@angular/core';\r\nimport { ADCCommonService, ADCDateSplitter, ADCIOptions, ADCITableCell, ADCITableColumn, ADCITableEvent, ADCITableRow, ADCStaticValues, FlatEventBuilder, TableSelection } from '@asadi/angular-date-components/core';\r\nimport { ADCIResourceSchedulerEvent, ADCIResourceSchedulerResource, ADCIResourceSchedulerTableEvent } from \"../../interface.global\";\r\nimport { AdcResourceSchedulerBase } from '../adc-resource-scheduler-base/adc-resource-scheduler-base';\r\n\r\n@Component({\r\n selector: 'adc-day-view',\r\n templateUrl: './adc-day-view.component.html',\r\n styleUrls: ['./adc-day-view.component.css']\r\n})\r\nexport class ADCDayViewComponent extends AdcResourceSchedulerBase implements OnInit, OnDestroy \r\n{\r\n\r\n year: number = 0;\r\n week: number = 0;\r\n day: number = 0;\r\n\r\n currentDate: string = '';\r\n title: string = '';\r\n\r\n hoursOfDay: string[] = ADCStaticValues.getHoursOfDay();\r\n daysOfweek: string[] = ADCStaticValues.getDaysOfWeek();\r\n monthsOfYear: string[] = this.dateAdapter.getMonthsOfYear();\r\n\r\n dateSplitter: ADCDateSplitter = this.dateFormatter.DateSplitter;\r\n\r\n resources: ADCIResourceSchedulerResource[] = [];\r\n events: ADCIResourceSchedulerEvent[] = [];\r\n\r\n rows: ADCITableRow[] = [];\r\n\r\n weekends: number[] = [];\r\n holidays: string[] = [];\r\n\r\n readonly commonService = new ADCCommonService(this.dateAdapter, this.labels);\r\n readonly today: string = this.dateAdapter.today();\r\n readonly selectionManager = new TableSelection(this.dateFilter);\r\n readonly eventBuilder = new FlatEventBuilder();\r\n\r\n constructor(\r\n )\r\n {\r\n super();\r\n }\r\n\r\n ngOnInit(): void \r\n {\r\n super.init();\r\n\r\n this.selectionManager.cellSelectionStream.subscribe(event => this.onDateRangeSelect(event.start, event.end));\r\n\r\n this.eventBuilder.eventSelectionStream.subscribe(e => {\r\n this.onEventClick(e.event, e.dom, e.jsEvent);\r\n });\r\n }\r\n\r\n dateFilter(cell1: ADCITableCell, cell2: ADCITableCell): boolean\r\n {\r\n return cell1.rowValue == cell2.rowValue && cell2.columnValue >= cell1.columnValue;\r\n }\r\n\r\n override initViewHanlder(): void \r\n {\r\n if(this.startOf == null)\r\n {\r\n this.todayButtonHandler();\r\n }\r\n else\r\n {\r\n this.day = this.dateAdapter.getDayIndexOf(this.startOf);\r\n this.week = this.dateAdapter.getWeekOf(this.startOf);\r\n this.year = this.dateAdapter.getYearOf(this.startOf);\r\n this.calculateCurrentDate();\r\n }\r\n }\r\n\r\n override todayButtonHandler(): void\r\n {\r\n this.day = this.dateAdapter.getCurrentDay();\r\n this.week = this.dateAdapter.getCurrentWeek();\r\n this.year = this.dateAdapter.getCurrentYear();\r\n this.calculateCurrentDate();\r\n }\r\n\r\n override previousButtonHandler(): void\r\n {\r\n this.day--;\r\n if(this.day < 0)\r\n {\r\n this.day = 6;\r\n this.week--;\r\n\r\n if(this.week < 1)\r\n {\r\n this.year--;\r\n this.week = this.dateAdapter.getWeeksOfYear(this.year);\r\n }\r\n }\r\n this.calculateCurrentDate();\r\n }\r\n\r\n override nextButtonHandler(): void\r\n {\r\n this.day++;\r\n if(this.day > 6)\r\n {\r\n this.day = 0;\r\n this.week++;\r\n\r\n const weeksOfYear = this.dateAdapter.getWeeksOfYear(this.year);\r\n\r\n if(this.week > weeksOfYear)\r\n {\r\n this.week = 1;\r\n this.year++;\r\n }\r\n }\r\n this.calculateCurrentDate();\r\n }\r\n\r\n calculateCurrentDate(): void\r\n {\r\n const date = this.dateAdapter.getDateOfDay(this.year, this.week, this.day);\r\n this.currentDate = this.dateAdapter.transformDate(+date.split(this.dateSplitter)[0], +date.split(this.dateSplitter)[1], +date.split(this.dateSplitter)[2]);\r\n\r\n const dayIndex = this.commonService.getDayIndex(this.day);\r\n const month = this.monthsOfYear[+date.split(this.dateSplitter)[1] - 1];\r\n\r\n this.title = `${this.labels?.daysOfWeek[dayIndex] || this.daysOfweek[dayIndex]} \r\n ${+date.split(this.dateSplitter)[2]} \r\n ${this.commonService.getMonthName(month) || month} ${this.labels?.year || \"Year\"} \r\n ${this.year}`;\r\n\r\n this.dateChangesHandler();\r\n super.dateRangeChange({startDate: this.currentDate, endDate: this.currentDate});\r\n }\r\n\r\n override eventChangesHandler(events: ADCIResourceSchedulerEvent[]): void\r\n {\r\n const tableEvents: ADCITableEvent[] = [];\r\n\r\n this.events = events;\r\n\r\n const viewEvents = this.tools.resourceScheduler.getEventsBetweenDateRange(this.currentDate, this.currentDate, this.events);\r\n \r\n viewEvents.forEach((e: ADCIResourceSchedulerEvent) => {\r\n\r\n const rowIndex = this.rows.findIndex((r: ADCITableRow) => r.value == e.resourceId);\r\n\r\n if(rowIndex == -1) return;\r\n\r\n const row = this.rows[rowIndex];\r\n\r\n const startColumnIndex = row.columns.findIndex((c: ADCITableColumn) => {\r\n\r\n const time = this.tools.dateTime.timeOnly(c.value);\r\n const date = this.tools.dateTime.dateOnly(c.value);\r\n\r\n return date == this.tools.dateTime.dateOnly(e.startDate) &&\r\n this.tools.dateTime.hour(time) == this.tools.dateTime.hourOrDefault(e.startTime, '00');\r\n });\r\n\r\n const endColumnIndex = row.columns.findIndex((c: ADCITableColumn) => {\r\n \r\n const time = this.tools.dateTime.timeOnly(c.value);\r\n const date = this.tools.dateTime.dateOnly(c.value);\r\n\r\n return date == this.tools.dateTime.dateOnly(e.endDate) && \r\n this.tools.dateTime.hour(time) == this.tools.dateTime.hourOrDefault(e.endTime, '23');\r\n });\r\n\r\n const startTime = +this.tools.dateTime.minutesOrDefault(e.startTime, '00');\r\n const endTime = +this.tools.dateTime.minutesOrDefault(e.endTime, '60');\r\n\r\n const currentDateOnly = this.tools.dateTime.dateOnly(this.currentDate);\r\n\r\n const cellEvent: ADCITableEvent = {\r\n columnStart: startColumnIndex != -1 ? startColumnIndex : null,\r\n columnEnd: endColumnIndex != -1 ? endColumnIndex : null,\r\n data: e,\r\n rowStart: rowIndex,\r\n rowEnd: rowIndex,\r\n offsetX: this.tools.dateTime.dateOnly(e.startDate) == currentDateOnly ? startTime / 60 : 0,\r\n fractionX: endTime / 60,\r\n overlapTolerance: this.options.eventOverlapTolerance / 60\r\n };\r\n\r\n if(e.allDay == true)\r\n {\r\n const eventHourEnd = +this.tools.dateTime.hourOrDefault(e.endTime, '23');\r\n const eventMinuteEnd = +this.tools.dateTime.minutesOrDefault(e.endTime, '00');\r\n\r\n cellEvent.fractionX = 24 - eventHourEnd + (eventMinuteEnd / 60);\r\n }\r\n\r\n tableEvents.push(cellEvent);\r\n });\r\n\r\n this.eventBuilder.data = tableEvents;\r\n }\r\n\r\n override resourceChangesHandler(resources: ADCIResourceSchedulerResource[]): void \r\n {\r\n this.resources = resources;\r\n this.dateChangesHandler();\r\n }\r\n\r\n dateChangesHandler(): void\r\n {\r\n this.rows = this.getRowInitialValue();\r\n\r\n if(this.resources.length == 0) return;\r\n\r\n const date = this.dateAdapter.getDateOfDay(this.year, this.week, this.day).split(this.dateSplitter);\r\n const transformedDate = this.dateAdapter.transformDate(+date[0], +date[1], +date[2]).split('T')[0];\r\n\r\n this.resources.forEach((resource: ADCIResourceSchedulerResource, rowIndex: number) => {\r\n\r\n const row: ADCITableRow =\r\n {\r\n classList: '',\r\n label: resource.title,\r\n prefix: '',\r\n suffix: '',\r\n value: resource.id.toString(),\r\n verticalAlign: 'center',\r\n horizontalAlign: 'center',\r\n columns: [],\r\n }\r\n\r\n this.hoursOfDay.forEach((hour: string) => {\r\n\r\n const column: ADCITableColumn =\r\n {\r\n classList: '',\r\n label: '',\r\n prefix: '',\r\n suffix: '',\r\n value: `${transformedDate}T${hour}`,\r\n verticalAlign: 'center',\r\n horizontalAlign: 'center',\r\n selectable: true,\r\n }\r\n \r\n row.columns.push(column);\r\n });\r\n\r\n this.rows.push(row);\r\n\r\n });\r\n }\r\n\r\n override holidaysChangesHandler(holidays: string[]): void {\r\n this.holidays = holidays;\r\n this.dateChangesHandler();\r\n }\r\n\r\n override weekendChangesHandler(weekends: number[]): void {\r\n this.weekends = weekends;\r\n this.dateChangesHandler();\r\n }\r\n\r\n onDateRangeSelect(start: ADCITableCell, end: ADCITableCell): void\r\n {\r\n const e: ADCIResourceSchedulerTableEvent = \r\n {\r\n endDate: end.columnValue.split('T')[0],\r\n endTime: end.columnValue.split('T')[1],\r\n startDate: start.columnValue.split('T')[0],\r\n startTime: start.columnValue.split('T')[1],\r\n resourceId: start.rowValue\r\n }\r\n\r\n super.dateRangeSelect(e);\r\n }\r\n\r\n override onEventClick(event: ADCITableEvent, dom: HTMLElement, jsEvent: MouseEvent): void \r\n {\r\n const resourceSchedulerEvent: ADCIResourceSchedulerEvent = this.events.filter(item => item.id == event.data.id)[0];\r\n\r\n super.eventClick({dom: dom, jsEvent: jsEvent, event: resourceSchedulerEvent});\r\n }\r\n\r\n ngOnDestroy(): void \r\n {\r\n super.destory();\r\n }\r\n\r\n private getRowInitialValue(): ADCITableRow[]\r\n {\r\n const row: ADCITableRow = {\r\n verticalAlign: 'center',\r\n horizontalAlign: 'center',\r\n classList: '',\r\n columns: [],\r\n label: '',\r\n prefix: '',\r\n suffix: '',\r\n value: '',\r\n };\r\n\r\n this.hoursOfDay.forEach((hour: string) => {\r\n\r\n const column: ADCITableColumn =\r\n {\r\n classList: '',\r\n label: hour,\r\n prefix: '',\r\n suffix: '',\r\n value: hour,\r\n verticalAlign: 'center',\r\n horizontalAlign: 'center',\r\n selectable: false,\r\n }\r\n\r\n row.columns.push(column);\r\n });\r\n\r\n\r\n\r\n return [row];\r\n }\r\n}\r\n","<ng-container *ngIf=\"resources.length != 0\">\r\n <adc-table\r\n [rows]=\"rows\"\r\n [title]=\"title\"\r\n [titleClass]=\"''.concat(\r\n today == currentDate.split('T')[0] ? ' today ' : ' ',\r\n weekends.includes(day) || holidays.includes(currentDate.split('T')[0]) ? ' holiday ' : ' '\r\n )\"\r\n [selectionManager]=\"selectionManager\"\r\n [eventBuilder]=\"eventBuilder\"\r\n (viewReady)=\"markViewAsReady()\"\r\n ></adc-table>\r\n</ng-container>","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { ADCWeekViewComponent } from './components/adc-week-view/adc-week-view.component';\r\nimport { ADCMonthViewComponent } from './components/adc-month-view/adc-month-view.component';\r\nimport { ADCDayViewComponent } from './components/adc-day-view/adc-day-view.component';\r\nimport { ADCTableComponent } from '@asadi/angular-date-components/core';\r\n\r\n\r\n\r\n@NgModule({\r\n declarations: [\r\n ADCWeekViewComponent,\r\n ADCMonthViewComponent,\r\n ADCDayViewComponent\r\n ],\r\n imports: [\r\n CommonModule,\r\n\r\n ADCTableComponent,\r\n ],\r\n exports: [\r\n ADCWeekViewComponent,\r\n ADCMonthViewComponent,\r\n ADCDayViewComponent\r\n ]\r\n})\r\nexport class AdcResourceSchedulerModule { }\r\n","import { booleanAttribute, Component, EventEmitter, Inject, Input, Optional, Output } from '@angular/core';\r\nimport { AdcResourceSchedulerModule } from '../../adc-resource-scheduler.module';\r\nimport { ADCBaseContainerComponent, ADCILabels, ADCIOptions, ADCIViewButton, ADC_LABELS, ADC_OPTIONS, DateChangeService } from '@asadi/angular-date-components/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { ADCResourceSchedulerSource } from '../../directives/adc-resource-scheduler-source.directive';\r\nimport { ADCIResourceSchedulerView } from '../../interface.global';\r\nimport { ADCMonthViewComponent } from '../adc-month-view/adc-month-view.component';\r\nimport { ADCWeekViewComponent } from '../adc-week-view/adc-week-view.component';\r\nimport { ADCDayViewComponent } from '../adc-day-view/adc-day-view.component';\r\n\r\n\r\nconst defaultViews: string[] = ['month', 'week', 'day'];\r\n\r\n\r\n/**\r\n * The ADCResourceSchedulerComponent is responsible for rendering a resource scheduler view. \r\n * It supports different views (e.g., month, week, day) and handles navigation through date ranges.\r\n * This component integrates with other services like date changes and event handling.\