fx-form-builder-wrapper 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/fx-form-builder-wrapper.mjs +5 -0
- package/esm2022/lib/components/dynamic-table/dynamic-table.component.mjs +184 -0
- package/esm2022/lib/components/fx-form-component/fx-form-component.component.mjs +85 -0
- package/esm2022/lib/components/toggle/toggle.component.mjs +33 -0
- package/esm2022/lib/components/toggle-button/toggle-button.component.mjs +38 -0
- package/esm2022/lib/components/uploader/uploader.component.mjs +58 -0
- package/esm2022/lib/custom-controls/dispatch-to-clinic/dispatch-to-clinic.component.mjs +42 -0
- package/esm2022/lib/fx-builder-wrapper.component.mjs +76 -0
- package/esm2022/lib/fx-builder-wrapper.service.mjs +40 -0
- package/esm2022/lib/panel/configuration-panel/configuration-panel.component.mjs +89 -0
- package/esm2022/lib/panel/settings-panel/settings-panel.component.mjs +24 -0
- package/esm2022/public-api.mjs +7 -0
- package/fesm2022/fx-form-builder-wrapper.mjs +615 -0
- package/fesm2022/fx-form-builder-wrapper.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/dynamic-table/dynamic-table.component.d.ts +51 -0
- package/lib/components/fx-form-component/fx-form-component.component.d.ts +18 -0
- package/lib/components/toggle/toggle.component.d.ts +13 -0
- package/lib/components/toggle-button/toggle-button.component.d.ts +15 -0
- package/lib/components/uploader/uploader.component.d.ts +16 -0
- package/lib/custom-controls/dispatch-to-clinic/dispatch-to-clinic.component.d.ts +17 -0
- package/lib/fx-builder-wrapper.component.d.ts +18 -0
- package/lib/fx-builder-wrapper.service.d.ts +13 -0
- package/lib/panel/configuration-panel/configuration-panel.component.d.ts +25 -0
- package/lib/panel/settings-panel/settings-panel.component.d.ts +10 -0
- package/package.json +18 -5
- package/public-api.d.ts +3 -0
- package/ng-package.json +0 -7
- package/src/lib/components/button/button.component.css +0 -0
- package/src/lib/components/button/button.component.html +0 -1
- package/src/lib/components/button/button.component.ts +0 -24
- package/src/lib/components/dynamic-table/dynamic-table.component.css +0 -0
- package/src/lib/components/dynamic-table/dynamic-table.component.html +0 -69
- package/src/lib/components/dynamic-table/dynamic-table.component.ts +0 -201
- package/src/lib/components/fx-form-component/fx-form-component.component.ts +0 -64
- package/src/lib/components/toggle/toggle.component.css +0 -51
- package/src/lib/components/toggle/toggle.component.html +0 -12
- package/src/lib/components/toggle/toggle.component.ts +0 -33
- package/src/lib/components/toggle-button/toggle-button.component.css +0 -22
- package/src/lib/components/toggle-button/toggle-button.component.html +0 -10
- package/src/lib/components/toggle-button/toggle-button.component.ts +0 -40
- package/src/lib/components/uploader/uploader.component.css +0 -49
- package/src/lib/components/uploader/uploader.component.html +0 -23
- package/src/lib/components/uploader/uploader.component.ts +0 -59
- package/src/lib/custom-controls/dispatch-to-clinic/dispatch-to-clinic.component.html +0 -78
- package/src/lib/custom-controls/dispatch-to-clinic/dispatch-to-clinic.component.ts +0 -44
- package/src/lib/fx-builder-wrapper.component.ts +0 -64
- package/src/lib/fx-builder-wrapper.service.ts +0 -34
- package/src/lib/panel/configuration-panel/configuration-panel.component.css +0 -65
- package/src/lib/panel/configuration-panel/configuration-panel.component.html +0 -96
- package/src/lib/panel/configuration-panel/configuration-panel.component.ts +0 -90
- package/src/lib/panel/settings-panel/settings-panel.component.css +0 -30
- package/src/lib/panel/settings-panel/settings-panel.component.html +0 -28
- package/src/lib/panel/settings-panel/settings-panel.component.ts +0 -23
- package/src/public-api.ts +0 -7
- package/src/styles/styles.css +0 -22
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { AfterViewInit, ChangeDetectorRef, Component, inject, Input, NgZone, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
-
import { HttpClient } from '@angular/common/http';
|
|
5
|
-
import { FxBaseComponent, FxMode, FxSetting, FxStringSetting, FxValidation, FxValidatorService } from '@instantsys-labs/fx';
|
|
6
|
-
import { SettingsPanelComponent } from '../../panel/settings-panel/settings-panel.component';
|
|
7
|
-
import { FxBuilderWrapperService } from '../../fx-builder-wrapper.service';
|
|
8
|
-
import {Subject, takeUntil } from 'rxjs';
|
|
9
|
-
|
|
10
|
-
export interface TableColumnConfig {
|
|
11
|
-
header: string;
|
|
12
|
-
cellType: 'text' | 'input-text' | 'input-number' | 'dropdown' | 'smart-dropdown' | 'checkbox' | 'radio' | 'radio-group' | 'file-upload' | 'textarea';
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
options?: string[];
|
|
15
|
-
apiUrl?: string;
|
|
16
|
-
valueKey?: string;
|
|
17
|
-
labelKey?: string;
|
|
18
|
-
className?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface TableConfig {
|
|
21
|
-
columns: TableColumnConfig[];
|
|
22
|
-
rows: any[];
|
|
23
|
-
}
|
|
24
|
-
@Component({
|
|
25
|
-
selector: 'fx-dynamic-table',
|
|
26
|
-
standalone: true,
|
|
27
|
-
imports: [CommonModule, FormsModule, SettingsPanelComponent, ReactiveFormsModule],
|
|
28
|
-
templateUrl: './dynamic-table.component.html',
|
|
29
|
-
styleUrl: './dynamic-table.component.css',
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
export class DynamicTableComponent extends FxBaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
33
|
-
@Input() tableRows: Array<any> = [];
|
|
34
|
-
@Input() previewType: FxMode = FxMode.VIEW;
|
|
35
|
-
@Input() tableConfig: any = {
|
|
36
|
-
columns: [
|
|
37
|
-
{ header: 'Column 1', cellType: 'text' },
|
|
38
|
-
{ header: 'Column 2', cellType: 'text' },
|
|
39
|
-
{ header: 'Column 3', cellType: 'text' },
|
|
40
|
-
{ header: 'Column 4', cellType: 'text' },
|
|
41
|
-
{ header: 'Column 5', cellType: 'text' },
|
|
42
|
-
],
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
private destroy$ = new Subject<Boolean>();
|
|
46
|
-
public uploadedImages: Array<string | null> = [];
|
|
47
|
-
public tableFormControl = new FormControl();
|
|
48
|
-
public smartDropdownOptions: { [key: string]: Array<{ name: string, value: string }> } = {};
|
|
49
|
-
private http = inject(HttpClient);
|
|
50
|
-
constructor(private cdr: ChangeDetectorRef, private fxBuilderWrapperService: FxBuilderWrapperService) {
|
|
51
|
-
super(cdr);
|
|
52
|
-
this.onInit.subscribe((fxData)=>{
|
|
53
|
-
this._register(this.tableFormControl);
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public ngOnInit(): void {
|
|
58
|
-
this.fxBuilderWrapperService.variables$.pipe(
|
|
59
|
-
takeUntil(this.destroy$)).subscribe((variables: any) => {
|
|
60
|
-
if(variables) {
|
|
61
|
-
let dynamicTableValues: any;
|
|
62
|
-
for(const [key, value] of Object.entries(variables)) {
|
|
63
|
-
if(key.includes('dynamic-table')) {
|
|
64
|
-
dynamicTableValues = value;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if(Object.keys(dynamicTableValues).length) {
|
|
68
|
-
const fileHeaderName = dynamicTableValues?.columns.find((f: any) => f.cellType === 'file-upload')?.header;
|
|
69
|
-
dynamicTableValues?.rows?.forEach((item: any, index: number) => {
|
|
70
|
-
this.uploadedImages[index] = item[fileHeaderName] ? item[fileHeaderName]: null;
|
|
71
|
-
})
|
|
72
|
-
this.tableConfig = dynamicTableValues;
|
|
73
|
-
this.fxData.value = this.tableConfig;
|
|
74
|
-
this.tableFormControl.reset();
|
|
75
|
-
this.tableFormControl.setValue(this.tableConfig);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public ngAfterViewInit(): void {
|
|
82
|
-
setTimeout(() => {
|
|
83
|
-
if(this.fxData?.value && Object.keys(this.fxData?.value)?.length != 0) {
|
|
84
|
-
this.tableConfig = this.fxData.value;
|
|
85
|
-
this.fetchSmartDropdownData();
|
|
86
|
-
}
|
|
87
|
-
}, 100)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
protected fetchSmartDropdownData(): void {
|
|
91
|
-
this.tableConfig.columns
|
|
92
|
-
.filter((column: TableColumnConfig) => column.cellType === 'smart-dropdown' && column?.apiUrl)
|
|
93
|
-
.forEach((column: TableColumnConfig) => {
|
|
94
|
-
this.http.get<any>(column.apiUrl!).subscribe((response: any) => {
|
|
95
|
-
this.smartDropdownOptions[column.header] = response.map((item: any) => ({
|
|
96
|
-
value: item[column.valueKey!],
|
|
97
|
-
name: item[column.labelKey!],
|
|
98
|
-
}));
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
public uploadImage(event: Event, rowIndex: number): void {
|
|
104
|
-
const file = (event.target as HTMLInputElement).files?.[0];
|
|
105
|
-
if (file) {
|
|
106
|
-
const reader = new FileReader();
|
|
107
|
-
reader.onload = () => {
|
|
108
|
-
this.uploadedImages[rowIndex] = reader.result as string;
|
|
109
|
-
};
|
|
110
|
-
reader.readAsDataURL(file);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
protected settings(): FxSetting[] {
|
|
115
|
-
return [
|
|
116
|
-
new FxStringSetting({ key: 'column-size', $title: 'No. of columns', value: 1 }),
|
|
117
|
-
new FxStringSetting({ key: 'table-config', $title: 'Table Configuration', value: {} }),
|
|
118
|
-
];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
protected validations(): FxValidation[] {
|
|
122
|
-
return [FxValidatorService.required];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
public getArray(count: number): number[] {
|
|
126
|
-
return Array.from({ length: count });
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
public onChangeConfiguration(event: any): void {
|
|
130
|
-
const columns = event.columns.map((col: any) => {
|
|
131
|
-
return {
|
|
132
|
-
header: col?.header,
|
|
133
|
-
cellType: col?.cellType,
|
|
134
|
-
placeholder: col?.placeholder,
|
|
135
|
-
options: col?.options,
|
|
136
|
-
apiUrl: col?.apiUrl,
|
|
137
|
-
valueKey: col?.valueKey,
|
|
138
|
-
labelKey: col?.labelKey,
|
|
139
|
-
className: col?.className,
|
|
140
|
-
apiKey: col?.apiKey
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
if(!event?.enableAPI) {
|
|
144
|
-
this.tableConfig.columns = columns;
|
|
145
|
-
this.tableConfig.rows = Array.from({ length: +event?.rows }, (e, index) => ({ name: `SKU-${index + 1}`, age: index % 2 !== 0, gender: 'male' }))
|
|
146
|
-
this.fetchSmartDropdownData();
|
|
147
|
-
}
|
|
148
|
-
if(event?.enableAPI) {
|
|
149
|
-
this.drawTable(event, columns)
|
|
150
|
-
this.tableConfig = {
|
|
151
|
-
columns: columns,
|
|
152
|
-
rows: []
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
this.fxData.value = this.tableConfig;
|
|
157
|
-
this.tableFormControl.reset();
|
|
158
|
-
this.tableFormControl.setValue(this.tableConfig);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
private updateSettings(): void{
|
|
162
|
-
if(this.fxData.settings){
|
|
163
|
-
for(let setting of this.fxData.settings){
|
|
164
|
-
if(setting.key === 'table-config'){
|
|
165
|
-
setting.value = this.tableConfig;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
public drawTable(event: any, columns: any): void {
|
|
172
|
-
let rows;
|
|
173
|
-
this.http.get(event.api).subscribe((res: any) => {
|
|
174
|
-
if(res) {
|
|
175
|
-
rows = res.map((item: any) => {
|
|
176
|
-
const newObj: Record<string, any> = {};
|
|
177
|
-
columns.forEach((col: any) => {
|
|
178
|
-
newObj[col.header] = item[col.apiKey];
|
|
179
|
-
});
|
|
180
|
-
return newObj;
|
|
181
|
-
});
|
|
182
|
-
this.tableConfig = {
|
|
183
|
-
columns,
|
|
184
|
-
rows
|
|
185
|
-
}
|
|
186
|
-
this.fxData.value = this.tableConfig;
|
|
187
|
-
this.tableFormControl.reset();
|
|
188
|
-
this.tableFormControl.setValue(this.tableConfig);
|
|
189
|
-
}
|
|
190
|
-
})
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
public deleteFile(file: any, index: number): void {
|
|
194
|
-
this.uploadedImages.splice(index, 1, null);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
public ngOnDestroy(): void {
|
|
198
|
-
this.destroy$.next(true);
|
|
199
|
-
this.destroy$.complete();
|
|
200
|
-
}
|
|
201
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';
|
|
3
|
-
import { FxForm, FxFormComponent } from '@instantsys-labs/fx';
|
|
4
|
-
import { DispatchToClinicComponent } from '../../custom-controls/dispatch-to-clinic/dispatch-to-clinic.component';
|
|
5
|
-
import { FxBuilderWrapperService } from '../../fx-builder-wrapper.service';
|
|
6
|
-
import { DynamicTableComponent } from '../dynamic-table/dynamic-table.component';
|
|
7
|
-
import { ToggleButtonComponent } from '../toggle-button/toggle-button.component';
|
|
8
|
-
import { UploaderComponent } from '../uploader/uploader.component';
|
|
9
|
-
import { ToggleComponent } from '../toggle/toggle.component';
|
|
10
|
-
|
|
11
|
-
@Component({
|
|
12
|
-
selector: 'fx-form-component',
|
|
13
|
-
standalone: true,
|
|
14
|
-
imports: [CommonModule, FxFormComponent],
|
|
15
|
-
template: `
|
|
16
|
-
<fx-form
|
|
17
|
-
[fxForm]="fxForm"
|
|
18
|
-
[value]="variables"
|
|
19
|
-
(onSubmit)="onSubmit($event)"
|
|
20
|
-
#form
|
|
21
|
-
>
|
|
22
|
-
</fx-form>
|
|
23
|
-
`,
|
|
24
|
-
})
|
|
25
|
-
export class FxFormWrapperComponent implements OnChanges, OnInit {
|
|
26
|
-
@ViewChild('form') form!: FxFormComponent;
|
|
27
|
-
@Input() fxForm!: FxForm;
|
|
28
|
-
@Input() variables: any;
|
|
29
|
-
@Output() fxFormSubmit = new EventEmitter<any>();
|
|
30
|
-
|
|
31
|
-
constructor(private fxWrapperService: FxBuilderWrapperService) { }
|
|
32
|
-
|
|
33
|
-
public ngOnChanges(changes: SimpleChanges): void {
|
|
34
|
-
if('variables' in changes && !changes['fxForm']) {
|
|
35
|
-
this.fxWrapperService.variables$.next(this.variables);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public ngOnInit(): void {
|
|
40
|
-
if (!Boolean(this.fxWrapperService.getComponent('dispatch-to-clinic'))) {
|
|
41
|
-
this.fxWrapperService.registerCustomComponent('Dispatch To Clinic', 'dispatch-to-clinic', DispatchToClinicComponent);
|
|
42
|
-
}
|
|
43
|
-
if (!Boolean(this.fxWrapperService.getComponent('dynamic-table'))) {
|
|
44
|
-
this.fxWrapperService.registerCustomComponent('Dynamic Table', 'dynamic-table', DynamicTableComponent);
|
|
45
|
-
}
|
|
46
|
-
if (!Boolean(this.fxWrapperService.getComponent('toggle-button'))) {
|
|
47
|
-
this.fxWrapperService.registerCustomComponent('Toggle Button', 'toggle-button', ToggleButtonComponent);
|
|
48
|
-
}
|
|
49
|
-
if (!Boolean(this.fxWrapperService.getComponent('uploader'))) {
|
|
50
|
-
this.fxWrapperService.registerCustomComponent('Uploader', 'uploader', UploaderComponent);
|
|
51
|
-
}
|
|
52
|
-
if (!Boolean(this.fxWrapperService.getComponent('toggle'))) {
|
|
53
|
-
this.fxWrapperService.registerCustomComponent('Toggle', 'toggle', ToggleComponent);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public onSubmit(event: any): void {
|
|
58
|
-
this.fxFormSubmit.emit(event);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public submit(): void {
|
|
62
|
-
this.form.submit();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
label {
|
|
2
|
-
position: relative;
|
|
3
|
-
white-space: nowrap;
|
|
4
|
-
border-radius: 0;
|
|
5
|
-
border: 0 solid #999999;
|
|
6
|
-
margin: 0 14px 0 0;
|
|
7
|
-
width: 120px;
|
|
8
|
-
height: auto;
|
|
9
|
-
padding: 0;
|
|
10
|
-
text-align: center;
|
|
11
|
-
cursor: pointer;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.form-radio {
|
|
15
|
-
background-color: #DAE6F0;
|
|
16
|
-
color: white;
|
|
17
|
-
box-shadow: none;
|
|
18
|
-
transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
|
|
19
|
-
border: 1px solid #DEDEDE;
|
|
20
|
-
padding: 9px 10px;
|
|
21
|
-
margin: 0;
|
|
22
|
-
white-space: nowrap;
|
|
23
|
-
width: 100%;
|
|
24
|
-
height: 38px;
|
|
25
|
-
background-image: none;
|
|
26
|
-
border-radius: 4px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.form-radio:checked {
|
|
30
|
-
background-color: #ADD8E6;
|
|
31
|
-
border-color: #9BBBD6;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.form-radio:focus {
|
|
35
|
-
box-shadow: 0 0 0 2px #fff, 0 0 0 4px #9dc1fb, 0 1px 2px 0 black;
|
|
36
|
-
background-color: #ADD8E6;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.form-radio:hover {
|
|
40
|
-
border-color: #4682B4;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
span {
|
|
44
|
-
position: absolute;
|
|
45
|
-
left: 0;
|
|
46
|
-
right: 0;
|
|
47
|
-
top: 8px;
|
|
48
|
-
bottom: 0;
|
|
49
|
-
margin: 0;
|
|
50
|
-
padding: 0;
|
|
51
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<fx-component [fxData]="fxData">
|
|
2
|
-
<div style="display: flex;">
|
|
3
|
-
<label>
|
|
4
|
-
<input [formControl]="toggleControl" type="radio" name="radio_grp" class="form-radio mr-3" value="true">
|
|
5
|
-
<span class="mt-1">{{setting('accept')}}</span>
|
|
6
|
-
</label>
|
|
7
|
-
<label>
|
|
8
|
-
<input [formControl]="toggleControl" type="radio" name="radio_grp" class="form-radio mr-3" value="false">
|
|
9
|
-
<span class="mt-1">{{setting('reject')}}</span>
|
|
10
|
-
</label>
|
|
11
|
-
</div>
|
|
12
|
-
</fx-component>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { ChangeDetectorRef, Component, inject } from '@angular/core';
|
|
3
|
-
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
-
import { FxBaseComponent, FxComponent, FxSetting, FxStringSetting, FxValidation, FxValidatorService } from '@instantsys-labs/fx';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'fx-toggle',
|
|
8
|
-
standalone: true,
|
|
9
|
-
imports: [CommonModule, FxComponent, FormsModule, ReactiveFormsModule],
|
|
10
|
-
templateUrl: './toggle.component.html',
|
|
11
|
-
styleUrl: './toggle.component.css'
|
|
12
|
-
})
|
|
13
|
-
export class ToggleComponent extends FxBaseComponent {
|
|
14
|
-
public toggleControl = new FormControl<boolean>(false)
|
|
15
|
-
|
|
16
|
-
constructor(private cdr: ChangeDetectorRef) {
|
|
17
|
-
super(cdr)
|
|
18
|
-
this.onInit.subscribe((fxData)=>{
|
|
19
|
-
this._register(this.toggleControl);
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
protected settings(): FxSetting[] {
|
|
24
|
-
return [
|
|
25
|
-
new FxStringSetting({ key: 'accept', $title: 'Accept Text', value: 'Yes' }),
|
|
26
|
-
new FxStringSetting({ key: 'reject', $title: 'Reject Text', value: 'No' })
|
|
27
|
-
];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
protected validations(): FxValidation[] {
|
|
31
|
-
return [FxValidatorService.required];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.custom-toggle-btn {
|
|
2
|
-
padding: 10px 20px;
|
|
3
|
-
font-size: 16px;
|
|
4
|
-
font-weight: bold;
|
|
5
|
-
color: white;
|
|
6
|
-
border: none;
|
|
7
|
-
border-radius: 5px;
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
background-color: #ccc;
|
|
10
|
-
transition: background-color 0.3s;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.custom-toggle-btn.active {
|
|
14
|
-
background-color: #4caf50;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.custom-toggle-btn:hover {
|
|
18
|
-
opacity: 0.9;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<fx-component [fxData]="fxData">
|
|
2
|
-
<button
|
|
3
|
-
class="custom-toggle-btn"
|
|
4
|
-
[class]="setting('classes') ? setting('classes'): ''"
|
|
5
|
-
[class.active]="toggleBtnControl.value"
|
|
6
|
-
(click)="toggle()"
|
|
7
|
-
>
|
|
8
|
-
{{ toggleBtnControl.value ? setting('active-text') : setting('inactive-text') }}
|
|
9
|
-
</button>
|
|
10
|
-
</fx-component>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
|
|
3
|
-
import { FormControl, FormsModule, ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
|
|
4
|
-
import { FxBaseComponent, FxComponent, FxIconSetting, FxSetting, FxStringSetting, FxValidation, FxValidatorService } from '@instantsys-labs/fx';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'lib-toggle-button',
|
|
8
|
-
standalone: true,
|
|
9
|
-
imports: [CommonModule, FxComponent, ReactiveFormsModule, FormsModule],
|
|
10
|
-
templateUrl: './toggle-button.component.html',
|
|
11
|
-
styleUrl: './toggle-button.component.css'
|
|
12
|
-
})
|
|
13
|
-
export class ToggleButtonComponent extends FxBaseComponent {
|
|
14
|
-
public toggleBtnControl = new UntypedFormControl(false);
|
|
15
|
-
public isToggled = false;
|
|
16
|
-
|
|
17
|
-
constructor(private cdr: ChangeDetectorRef) {
|
|
18
|
-
super(cdr);
|
|
19
|
-
this.onInit.subscribe((fxData)=>{
|
|
20
|
-
this._register(this.toggleBtnControl);
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public toggle(): void {
|
|
25
|
-
this.isToggled = !this.toggleBtnControl.value;
|
|
26
|
-
this.toggleBtnControl.setValue(this.isToggled);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
protected settings(): FxSetting[] {
|
|
30
|
-
return [
|
|
31
|
-
new FxStringSetting({ key: 'classes', $title: 'Classes', value: '' }),
|
|
32
|
-
new FxStringSetting({ key: 'active-text', $title: 'Active Text', value: 'On' }),
|
|
33
|
-
new FxStringSetting({ key: 'inactive-text', $title: 'Inactive Text', value: 'Off' }),
|
|
34
|
-
];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
protected validations(): FxValidation[] {
|
|
38
|
-
return [FxValidatorService.required];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
.custom-upload {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: row;
|
|
4
|
-
align-items: flex-start;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.custom-upload button {
|
|
8
|
-
padding: 10px 20px;
|
|
9
|
-
font-size: 16px;
|
|
10
|
-
font-weight: bold;
|
|
11
|
-
color: white;
|
|
12
|
-
background-color: #007bff;
|
|
13
|
-
border: none;
|
|
14
|
-
border-radius: 5px;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
transition: background-color 0.3s;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.custom-upload button:hover {
|
|
20
|
-
background-color: #0056b3;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.custom-upload .file-list {
|
|
24
|
-
display: flex;
|
|
25
|
-
/* margin-top: 10px; */
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.custom-upload .file-list p {
|
|
29
|
-
margin: 0;
|
|
30
|
-
padding: 5px;
|
|
31
|
-
background-color: #f1f1f1;
|
|
32
|
-
border: 1px solid #ddd;
|
|
33
|
-
border-radius: 3px;
|
|
34
|
-
font-size: 14px;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.custom-upload .file-list > div {
|
|
38
|
-
display: flex;
|
|
39
|
-
flex-direction: column;
|
|
40
|
-
align-items: center;
|
|
41
|
-
justify-content: center;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.custom-upload .file-list .file-thumbnail {
|
|
45
|
-
width: 100px;
|
|
46
|
-
height: 100px;
|
|
47
|
-
object-fit: contain;
|
|
48
|
-
}
|
|
49
|
-
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<fx-component [fxData]="fxData">
|
|
2
|
-
<div class="custom-upload">
|
|
3
|
-
<button type="button" (click)="fileInput.click()">
|
|
4
|
-
{{setting('upload-text')}}
|
|
5
|
-
</button>
|
|
6
|
-
<input
|
|
7
|
-
#fileInput
|
|
8
|
-
type="file"
|
|
9
|
-
[multiple]="setting('multiple-upload')"
|
|
10
|
-
(change)="onFileSelected($event)"
|
|
11
|
-
[formControl]="uploadFileControl"
|
|
12
|
-
hidden
|
|
13
|
-
/>
|
|
14
|
-
<div class="file-list">
|
|
15
|
-
<ng-container *ngIf="uploadedFiles?.length">
|
|
16
|
-
<div (click)="deleteFile(file?.id)" *ngFor="let file of uploadedFiles">
|
|
17
|
-
<img class="file-thumbnail" style="border-radius: 4px" [src]="file?.previewUrl" alt="">
|
|
18
|
-
<!-- <p>{{file?.name}}</p> -->
|
|
19
|
-
</div>
|
|
20
|
-
</ng-container>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</fx-component>
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { ChangeDetectorRef, Component } from '@angular/core';
|
|
3
|
-
import { FormsModule, ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
|
|
4
|
-
import { FxBaseComponent, FxComponent, FxSelectSetting, FxSetting, FxStringSetting, FxValidation, FxValidatorService } from '@instantsys-labs/fx';
|
|
5
|
-
import { v4 as uuidv4} from 'uuid';
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
selector: 'fx-uploader',
|
|
9
|
-
standalone: true,
|
|
10
|
-
imports: [CommonModule, FxComponent, FormsModule, ReactiveFormsModule],
|
|
11
|
-
templateUrl: './uploader.component.html',
|
|
12
|
-
styleUrl: './uploader.component.css'
|
|
13
|
-
})
|
|
14
|
-
export class UploaderComponent extends FxBaseComponent {
|
|
15
|
-
public uploadFileControl = new UntypedFormControl();
|
|
16
|
-
public uploadedFiles: Array<any> = [];
|
|
17
|
-
|
|
18
|
-
constructor(private cdr: ChangeDetectorRef) {
|
|
19
|
-
super(cdr)
|
|
20
|
-
this.onInit.subscribe((fxData)=>{
|
|
21
|
-
this._register(this.uploadFileControl);
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public onFileSelected(event: Event) {
|
|
26
|
-
const input = event.target as HTMLInputElement;
|
|
27
|
-
if (input.files) {
|
|
28
|
-
for(let i = 0; i < input?.files?.length; i++) {
|
|
29
|
-
const file = input.files[i];
|
|
30
|
-
const reader = new FileReader();
|
|
31
|
-
reader.onload = e => {
|
|
32
|
-
this.uploadedFiles.push({
|
|
33
|
-
file: file,
|
|
34
|
-
previewUrl: e.target?.result,
|
|
35
|
-
name: file?.name,
|
|
36
|
-
id: uuidv4()
|
|
37
|
-
})
|
|
38
|
-
this.uploadFileControl.setValue(this.uploadedFiles)
|
|
39
|
-
}
|
|
40
|
-
reader.readAsDataURL(file);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public deleteFile(id: string): void {
|
|
46
|
-
this.uploadedFiles = this.uploadedFiles.filter(file => file?.id !== id);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
protected settings(): FxSetting[] {
|
|
50
|
-
return [
|
|
51
|
-
new FxStringSetting({ key: 'upload-text', $title: 'Upload Text', value: 'Upload File'}),
|
|
52
|
-
new FxSelectSetting({key: 'multiple-upload', $title: 'Multiple Upload', value: false}, [{option: 'Enable', value: true}, {option: 'Disable', value: false}])
|
|
53
|
-
];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
protected validations(): FxValidation[] {
|
|
57
|
-
return [FxValidatorService.required];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
<fx-component [fxData]="fxData">
|
|
2
|
-
<section
|
|
3
|
-
class="justify-content-around lg:justify-content-between w-full white-color border-1 border-solid stroke_light_grey p-3 mb-3 mt-3">
|
|
4
|
-
<form [formGroup]="dispatchForm">
|
|
5
|
-
<div class="grid">
|
|
6
|
-
<!-- Courier Name -->
|
|
7
|
-
<div class="col-12 sm:col-6 md:col-3 input-container">
|
|
8
|
-
<label for="courierName" class="input-title">Courier Name</label>
|
|
9
|
-
<input autocomplete="off" formControlName="courierName" type="text" id="courierName"
|
|
10
|
-
name="courierName" class="p-inputtext p-component p-element input-field border-1 w-full"
|
|
11
|
-
placeholder="enter courier name" />
|
|
12
|
-
|
|
13
|
-
<!-- validation -->
|
|
14
|
-
<small *ngIf="dispatchForm.get('courierName')?.invalid && dispatchForm.get('courierName')?.touched"
|
|
15
|
-
class="text-danger-color block mt-1">
|
|
16
|
-
Courier Name is required.
|
|
17
|
-
</small>
|
|
18
|
-
<!-- validation -->
|
|
19
|
-
</div>
|
|
20
|
-
<!-- Courier Name -->
|
|
21
|
-
|
|
22
|
-
<!-- Tracking Number -->
|
|
23
|
-
<div class="col-12 sm:col-6 md:col-3 input-container">
|
|
24
|
-
<label for="trackingNumber" class="input-title">Tracking Number</label>
|
|
25
|
-
<input autocomplete="off" formControlName="trackingNumber" type="text" id="trackingNumber"
|
|
26
|
-
name="trackingNumber" class="p-inputtext p-component p-element input-field border-1 w-full"
|
|
27
|
-
placeholder="enter tracking number" />
|
|
28
|
-
<small
|
|
29
|
-
*ngIf="dispatchForm.get('trackingNumber')?.invalid && dispatchForm.get('trackingNumber')?.touched"
|
|
30
|
-
class="text-danger-color block mt-1">
|
|
31
|
-
Tracking Number is required.
|
|
32
|
-
</small>
|
|
33
|
-
</div>
|
|
34
|
-
<!-- Tracking Number -->
|
|
35
|
-
|
|
36
|
-
<!-- Tracking URL -->
|
|
37
|
-
<div class="col-12 sm:col-6 md:col-3 input-container">
|
|
38
|
-
<label for="trackingUrl" class="input-title">Tracking URL</label>
|
|
39
|
-
<input autocomplete="off" formControlName="trackingUrl" type="text" id="trackingUrl"
|
|
40
|
-
name="trackingUrl" class="p-inputtext p-component p-element input-field border-1 w-full"
|
|
41
|
-
placeholder="enter tracking url" />
|
|
42
|
-
<small *ngIf="dispatchForm.get('trackingUrl')?.invalid && dispatchForm.get('trackingUrl')?.touched"
|
|
43
|
-
class="text-danger-color block mt-1">
|
|
44
|
-
<span *ngIf="dispatchForm.get('trackingUrl')?.errors?.['required']">Tracking URL is
|
|
45
|
-
required.</span>
|
|
46
|
-
<span *ngIf="dispatchForm.get('trackingUrl')?.errors?.['pattern']">Invalid URL format.</span>
|
|
47
|
-
</small>
|
|
48
|
-
</div>
|
|
49
|
-
<!-- Tracking URL -->
|
|
50
|
-
|
|
51
|
-
<!-- Notes -->
|
|
52
|
-
<div class="col-12 md:col-6 input-container">
|
|
53
|
-
<label for="notes" class="input-title">Notes</label>
|
|
54
|
-
<textarea autocomplete="off" formControlName="notes" rows="5" id="notes" name="notes"
|
|
55
|
-
class="p-inputtext p-component p-element input-field border-1 w-full"
|
|
56
|
-
placeholder="enter notes"></textarea>
|
|
57
|
-
<small *ngIf="dispatchForm.get('notes')?.invalid && dispatchForm.get('notes')?.touched"
|
|
58
|
-
class="text-danger-color block mt-1">
|
|
59
|
-
Notes are required.
|
|
60
|
-
</small>
|
|
61
|
-
</div>
|
|
62
|
-
<!-- Notes -->
|
|
63
|
-
|
|
64
|
-
<!-- Address with Copy Icon -->
|
|
65
|
-
<div class="col-12 md:col-6 pt-0">
|
|
66
|
-
<div class="mb-1">Address</div>
|
|
67
|
-
<ng-container *ngIf="(clinicAddress$ | async) as address">
|
|
68
|
-
<address #completeAddress>{{address?.street}}, {{address?.state}}, {{address?.postalCode}}
|
|
69
|
-
<i class="pi pi-copy cursor-pointer text-xl text-secondary-color"
|
|
70
|
-
(click)="copyToClipboard(completeAddress.textContent)"></i>
|
|
71
|
-
</address>
|
|
72
|
-
</ng-container>
|
|
73
|
-
</div>
|
|
74
|
-
<!-- Address with Copy Icon -->
|
|
75
|
-
</div>
|
|
76
|
-
</form>
|
|
77
|
-
</section>
|
|
78
|
-
</fx-component>
|