build_app

This commit is contained in:
risadmin_prod 2025-06-16 09:34:57 +00:00
parent b61f2df77b
commit 6073b18ae3
10 changed files with 841 additions and 0 deletions

View File

@ -69,6 +69,12 @@ public class BuilderService {
executeDump(true);
// ADD OTHER SERVICE
addCustomMenu( "steps01","Stepper_workflow", "Transcations");
addCustomMenu( "Forma","Forma", "Transcations");
addCustomMenu( "Forma","Forma", "Transcations");

View File

@ -19,6 +19,7 @@
import { Component, OnInit } from '@angular/core';
@ -249,6 +250,8 @@ export class Stepper_workflowComponent implements OnInit {
console.log('id is ', id)
// stepper route
this.router.navigate(["../steps01/", id], { relativeTo: this.route });

View File

@ -0,0 +1 @@
{"version":3,"sources":["steps01.component.scss","steps01.component.css"],"names":[],"mappings":"AAAA;EACE,UAAA;EACA,YAAA;ACCF;;ADCA;EACE,UAAA;EACA,aAAA;ACEF;;ADAA;EACE,UAAA;EACA,aAAA;ACGF;;ADDA;EACE,UAAA;EACA,aAAA;ACIF;;ADDA;EACE,WAAA;EACA,aAAA;ACIF;;ADDA;EACE,WAAA;EACA,kBAAA;EACA,aAAA;EACA,qBAAA;EACA,sBAAA;EACA,kBAAA;EACA,sBAAA;ACIF;;ADFA;EACE,UAAA;ACKF;;ADHA;EACE,kBAAA;ACMF;;ADHA;EACE,WAAA;ACMF;;ADJA;EACA;IACA,WAAA;ECOE;AACF","file":"steps01.component.css"}

View File

@ -0,0 +1,268 @@
<ol class="breadcrumb breadcrumb-arrow font-trirong">
<li><a href="javascript://" [routerLink]="['/']">Home</a></li>
<li><a href="javascript://">stepper</a></li>
</ol>
<div class="button-bar">
<span class="spacer"></span>
<button class="btn btn-sm btn-primary" (click)="reset()">Reset</button>
<button class="btn btn-sm btn-primary" (click)="changeToHorizonTal()"
*ngIf="layout.direction === 'vertical'">HorizonTal Layout</button>
<button class="btn btn-sm btn-primary" (click)="changeToVertical()" *ngIf="layout.direction === 'horizontal'">Vertical
Layout</button>
</div>
<div class="clr-row">
<div [class]="layout.block1">
<div class="card">
<div class="card-header">
<h3 style="text-align: center;"> Workflow</h3>
</div>
<div class=" card-block container">
<clr-timeline [clrLayout]="layout.direction">
<clr-timeline-step [clrState]="timelineStyle.step0.state">
<clr-timeline-step-header>step 0</clr-timeline-step-header>
<clr-timeline-step-title> <span *ngIf="!appToUpdate">Application</span><span *ngIf="appToUpdate"> Update
Datagrid</span> </clr-timeline-step-title>
<clr-timeline-step-description> <span>Create/step01<br> Information Of
Customer</span></clr-timeline-step-description>
</clr-timeline-step>
<clr-timeline-step [clrState]="timelineStyle.step1.state">
<clr-timeline-step-header>Step 2</clr-timeline-step-header>
<clr-timeline-step-title>Review And <br>Confirmation</clr-timeline-step-title>
<clr-timeline-step-description>
Finish .
</clr-timeline-step-description>
</clr-timeline-step></clr-timeline>
</div>
</div>
</div>
<div [class]="layout.block2">
<!--STEP 0-->
<div class="card" *ngIf="timelineStyle.step0.open">
<div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">step01</h3>
<h3 style="text-align: center;" *ngIf="appToUpdate"> Update {{FormaentryForm.name}}</h3>
<div class="container">
<br />
<form [formGroup]="FormaentryForm">
<div class="container">
<div class="clr-row"><div class="clr-col-sm-12">
<label> Name</label>
<input class="clr-input" type="text" formControlName="name" />
</div>
</div>
<h6> List of fileupload_field</h6>
<div class="clr-row" style="margin-top: 10px;">
<table class="table">
<thead>
<tr>
<th>No</th>
<th> File</th>
<th>File Name</th>
<th>Preview</th>
<th>Cancel</th>
</tr>
</thead>
<tbody >
<tr *ngFor="let attach of FileDatafileupload_field; let i=index">
<td style="width: 70px;"><input type="text" class="clr-input" value={{i+1}} [readonly]="true"> </td>
<td><input type="file" (change)="onFileChangedfileupload_field($event, i)" accept = "application/pdf,.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" /><!--accept=".pdf,.doc,.docx,.jpg,.msg"-->
</td>
<td>{{attach.uploadedfile_name}}</td>
<td > <img [src]="attach.filePreview" alt="File Preview" [ngModelOptions]="{standalone: true}" name="filePreview" width="100px" height="100px"></td>
<td>
<a (click)="deleteRowfileupload_field(i)">
<clr-icon shape="trash" class="is-error"></clr-icon>
</a>
</td>
</tr>
</tbody>
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesfileupload_field()">
<clr-icon shape="plus"></clr-icon>
</button>
</table> </div>
<h6> List of imageupload_field</h6>
<div class="clr-row" style="margin-top: 10px;">
<table class="table">
<thead>
<tr>
<th>No</th>
<th> File</th>
<th>File Name</th>
<th>Preview</th>
<th>Cancel</th>
</tr>
</thead>
<tbody >
<tr *ngFor="let attach of FileDataimageupload_field; let i=index">
<td style="width: 70px;"><input type="text" class="clr-input" value={{i+1}} [readonly]="true"> </td>
<td><input type="file" (change)="onFileChangedimageupload_field($event, i)" accept="image/*" /><!--accept=".pdf,.doc,.docx,.jpg,.msg"-->
</td>
<td>{{attach.uploadedfile_name}}</td>
<td > <img [src]="attach.filePreview" alt="File Preview" [ngModelOptions]="{standalone: true}" name="filePreview" width="100px" height="100px"></td>
<td>
<a (click)="deleteRowimageupload_field(i)">
<clr-icon shape="trash" class="is-error"></clr-icon>
</a>
</td>
</tr>
</tbody>
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesimageupload_field()">
<clr-icon shape="plus"></clr-icon>
</button>
</table> </div>
<h6> List of audio_field</h6>
<div class="clr-row" style="margin-top: 10px;">
<table class="table">
<thead>
<tr>
<th>No</th>
<th> File</th>
<th>File Name</th>
<th>Preview</th>
<th>Cancel</th>
</tr>
</thead>
<tbody >
<tr *ngFor="let attach of FileDataaudio_field; let i=index">
<td style="width: 70px;"><input type="text" class="clr-input" value={{i+1}} [readonly]="true"> </td>
<td><input type="file" (change)="onFileChangedaudio_field($event, i)" accept="audio/*" /><!--accept=".pdf,.doc,.docx,.jpg,.msg"-->
</td>
<td>{{attach.uploadedfile_name}}</td>
<td > <audio *ngIf="attach.filePreview" [src]="attach.filePreview" controls></audio></td>
<td>
<a (click)="deleteRowaudio_field(i)">
<clr-icon shape="trash" class="is-error"></clr-icon>
</a>
</td>
</tr>
</tbody>
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesaudio_field()">
<clr-icon shape="plus"></clr-icon>
</button>
</table> </div>
<h6> List of video_field</h6>
<div class="clr-row" style="margin-top: 10px;">
<table class="table">
<thead>
<tr>
<th>No</th>
<th> File</th>
<th>File Name</th>
<th>Preview</th>
<th>Cancel</th>
</tr>
</thead>
<tbody >
<tr *ngFor="let attach of FileDatavideo_field; let i=index">
<td style="width: 70px;"><input type="text" class="clr-input" value={{i+1}} [readonly]="true"> </td>
<td><input type="file" (change)="onFileChangedvideo_field($event, i)" accept="video/*" /><!--accept=".mp4,.mpeg4"-->
</td>
<td>{{attach.uploadedfile_name}}</td>
<td > <video *ngIf="attach.filePreview" [src]="attach.filePreview" width="100px" height="100px" controls></video></td>
<td>
<a (click)="deleteRowvideo_field(i)">
<clr-icon shape="trash" class="is-error"></clr-icon>
</a>
</td>
</tr>
</tbody>
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesvideo_field()">
<clr-icon shape="plus"></clr-icon>
</button>
</table> </div>
<div class="clr-row">
</div>
<!-- end row -->
<br>
<div class="button">
<button type="submit" class="btn btn-primary" (click)="onstep01Save()">Submit</button>
<button type="button" class="btn btn-primary"
(click)="this.timelineStyle.step0 = { state: 'success', open: false };
this.timelineStyle.step1 = { state: 'current', open: true }; this.current()">Complete</button>
<button type="button" class="btn btn-primary"
(click)="this.timelineStyle.step0 = { state: 'current', open: false };
this.timelineStyle.step1 = { state: 'not-started', open: true }">Next</button>
</div> </div>
</form>
</div>
</div>
</div>
<!--STEP 1--> <div class="card" *ngIf="timelineStyle.step1.open">
<div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate"> Review And Confirmation</h3>
<div class="container">
<!-- Info -->
<div class="clr-row mb-3">
<div class="clr-col-12">
<h5>step01 Summary:</h5><p><strong>Name : </strong> {{ FormaentryForm.get('name')?.value }}</p>
<p><strong>Fileupload Field : </strong> {{ FormaentryForm.get('fileupload_field')?.value }}</p>
<p><strong>Imageupload Field : </strong> {{ FormaentryForm.get('imageupload_field')?.value }}</p>
<p><strong>audio Field : </strong> {{ FormaentryForm.get('audio_field')?.value }}</p>
<p><strong>video Field : </strong> {{ FormaentryForm.get('video_field')?.value }}</p>
</div>
</div><div class="button">
<button class="btn btn-primary-outline"
(click)="this.timelineStyle.step0 = { state: 'current', open: true };
this.timelineStyle.step1 = { state: 'not-started', open: false }">Back</button>
<button class="btn btn-primary"
(click)="timelineStyle.step1 = { state: 'success', open: false }; current();
alert('Process Finished Successfully!')">Finish</button>
</div></div>
</div>
</div>

View File

@ -0,0 +1,46 @@
.horizontal{
width: 25%;
padding: 5px;
}
.horizontal1{
width: 50%;
padding: 10px;
}
.middle{
width: 33%;
padding: 10px;
}
.middle1{
width: 75%;
padding: 10px;
}
.full{
width: 100%;
padding: 10px;
}
input[type=text],[type=date], select {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.required-field{
color: red;
}
.center {
text-align: center;
}
.center{
color: blue;
}
@media (max-width: 600px){
.horizontal,.middle,.horizontal1,.middle1 {
width: 100%;
}}

View File

@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { steps01Component } from './steps01.component';
describe('steps01Component', () => {
let component: steps01Component;
let fixture: ComponentFixture<steps01Component>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ steps01Component ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(steps01Component);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,370 @@
import { Component, OnInit } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { ActivatedRoute, Router } from '@angular/router';
import { College } from 'src/app/models/fnd/play';
import { student } from 'src/app/models/fnd/Studentadd';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Observable } from 'rxjs';
import { ValidationError } from 'src/app/models/fnd/ValidationError';
import { steps01service } from './steps01.service';
@Component({
selector: 'app-editstepper',
templateUrl: './steps01.component.html',
styleUrls: ['./steps01.component.scss']
})
export class steps01Component implements OnInit {
updated = false;
stringJson: any;
customerId: string = '';
selectedFile!: File;
fileName = '';
id: number;
errorFields: ValidationError[] = [];
appToUpdate: College = null;
trained = false;
json: string = "";
luisApp =
{
name: '',
created: 1,
trained: 1,
tested: 1,
updated: 1,
published: 1,
};
// Layout direction changing
layout = {
direction: "vertical",
block1: "clr-col-lg-3 clr-col-12 ",
block2: "clr-col-lg-9 clr-col-12 ",
};
timelineStyle = {
step0: { state: "current", open: true, failed: false },
step1: { state: "not-started", open: false, failed: false },
};
public FormaentryForm: FormGroup;
submitted = false;
rowSelected: any = {};
modalcomplete = false;
constructor(
private mainService: steps01service,
private step01_fb: FormBuilder,
private router: Router,
private route: ActivatedRoute,
private toastr: ToastrService,
) { }
ngOnInit(): void {
this.id = this.route.snapshot.params["id"];
console.log("update with id = ", this.id);
this.FormaentryForm = this.step01_fb.group({
name : [null],
});
const stepId = this.id; // or from route/query/etc
this.getResolvedDataFromStepper(stepId).subscribe(res => {
console.log('response get ', res);
if (res === null) {
this.showEmptyForm();
} else {
if (res['Forma']) {
this.prefillstep01Form(res['Forma']);
}
}
});
}
showEmptyForm(): void {
console.log('No config found. Showing empty form.');
// You can choose to show one or both based on some logic
this.FormaentryForm.reset();
} prefillstep01Form(data: any): void {
console.log(' step01 data ', data)
this.FormaentryForm.patchValue({
id: data.id || '',
name: data.name || '',
fileupload_field: data.fileupload_field || '',
imageupload_field: data.imageupload_field || '',
audio_field: data.audio_field || '',
video_field: data.video_field || '',
});
}
getResolvedDataFromStepper(id: number): Observable<any> {
console.log('get step config');
return new Observable(observer => {
this.mainService.gettabledata(id).subscribe(configList => {
if (!configList || configList.length === 0) {
console.log('empty config');
observer.next(null);
observer.complete();
return;
}
const results: { [key: string]: any } = {};
let processed = 0;
configList.forEach(config => {
const { table_name, table_id } = config;
this.getByTableNameAndId(table_name, table_id).subscribe(data => {
console.log('data is ', data);
results[table_name] = data;
processed++;
if (processed === configList.length) {
observer.next(results); // emit combined data
observer.complete();
}
}, error => {
console.error(`Error loading data for table ${table_name}`, error);
processed++;
if (processed === configList.length) {
observer.next(results); // continue with what we have
observer.complete();
}
});
});
}, error => {
console.error("Error loading stepper config", error);
observer.error(error);
});
});
}
getByTableNameAndId(tableName: string, id: number): Observable<any> {
switch (tableName) {
case 'Forma':
return this.mainService.getFormaById(id);// aur bhi cases agar naye table add ho to
default:
throw new Error(`Unknown table name: ${tableName}`);
}
}
// Change to Horizontal Layout
changeToHorizonTal() {
this.layout = {
direction: "horizontal",
block1: "clr-col-lg-12 clr-col-12 height container",
block2: "clr-col-lg-12 clr-col-12 container",
}
}
// Change to Vertical Layout
changeToVertical() {
this.layout = {
direction: "vertical",
block1: "clr-col-lg-3 clr-col-12 ",
block2: "clr-col-lg-9 clr-col-12 ",
}
}
onstep01Save() {
console.log('Form Submitted:', this.FormaentryForm.value);
this.submitted = true;
if (this.FormaentryForm.invalid) {
console.log('invalid form ..');
// Log all form errors
Object.keys(this.FormaentryForm.controls).forEach(field => {
const control = this.FormaentryForm.get(field);
if (control && control.invalid) {
console.log(`Error in field: ${field}`, control.errors);
}
}
);
return;
}
this.onstep01Create();
}
onstep01Create() {
this.mainService.createForma(this.FormaentryForm.value).subscribe(
(data) => {
console.log('adding data ', data);
this.customerId = data.id;
console.log('id is ', this.customerId);
const tableId = data.id;
const tableName = 'Forma';
const stepperId = this.id;
// Save stepper config
this.mainService.saveStepperConfig(stepperId, tableId, tableName).subscribe(() => {
this.toastr.success("Stepper Config Saved");
}); if (data || data.status >= 200 && data.status <= 299) {
this.toastr.success("Added Successfully");
}
setTimeout(() => {
this.ngOnInit();
}, 500);
for (let i = 0; i < this.selectedfileupload_field.length; i++){
this.mainService.uploadfilefileupload_field(data.id,tableName,this.selectedfileupload_field[i]).subscribe(uploaddata =>{
console.log(uploaddata);
})
}
for (let i = 0; i < this.selectedimageupload_field.length; i++){
this.mainService.uploadImageupload_field(data.id,tableName,this.selectedimageupload_field[i]).subscribe(uploaddata =>{
console.log(uploaddata);
})
}
for (let i = 0; i < this.selectedaudio_field.length; i++){
this.mainService.uploadAudio_field(data.id,tableName,this.selectedaudio_field[i]).subscribe(uploaddata =>{
console.log(uploaddata);
})
}
for (let i = 0; i < this.selectedvideo_field.length; i++){
this.mainService.uploadVideo_field(data.id,tableName,this.selectedvideo_field[i]).subscribe(uploaddata =>{
console.log(uploaddata);
})
}
}, (error) => {
console.log(error);
if (error.status >= 200 && error.status <= 299) {
// this.toastr.success("Added Succesfully");
}
if (error.status >= 400 && error.status <= 499) {
this.toastr.error("Not Added");
}
if (error.status >= 500 && error.status <= 599) {
this.toastr.error("Not Added");
}
});
this.rowSelected = this.FormaentryForm.value;
setTimeout(() => {
this.ngOnInit();
}, 500);
}
onnext() {
this.router.navigate(["../../main/workflow"], { relativeTo: this.route });
}
reset() {
this.json = "";
this.luisApp =
{
name: '',
trained: 1,
tested: 1,
updated: 1,
published: 1,
created: 1,
};
this.timelineStyle = {
step0: { state: "current", open: true, failed: false },
step1: { state: "not-started", open: false, failed: false },
};
}
current() {
console.log(this.timelineStyle)
this.stringJson = JSON.stringify(this.timelineStyle);
console.log("String json object :", this.stringJson);
}
FileDataImageupload_field: any[];
selectedImageupload_field: any[];
FileDataAudio_field: any[];
selectedAudio_field: any[];
FileDataVideo_field: any[];
selectedVideo_field: any[];
// updateaction
}

View File

@ -0,0 +1,108 @@
import { Injectable } from '@angular/core';
import { Observable } from "rxjs";
import { HttpClient, HttpHeaders, HttpParams, } from "@angular/common/http";
import { ApiRequestService } from "src/app/services/api/api-request.service";
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root'
})
export class steps01service{
private StepperURL = "Stepper_table_config/Stepper_table_config";
private FormaURL = "Forma/Forma" ; constructor(
private http: HttpClient,
private apiRequest: ApiRequestService,
) { }
gettabledata(id: number): Observable<any> {
const _http = this.StepperURL + "/stepId/" + id;
return this.apiRequest.get(_http);
}
saveStepperConfig(stepperId: number, tableId: number, tableName: string): Observable<any> {
const params = new HttpParams()
.set('stepperId', stepperId.toString())
.set('tableId', tableId.toString())
.set('tableName', tableName);
return this.apiRequest.post(this.StepperURL, null, params); // null body, params used
} getAllForma(page?: number, size?: number): Observable<any> {
return this.apiRequest.get(this.FormaURL);
}
getFormaById(id: number): Observable<any> {
const _http = this.FormaURL + "/" + id;
return this.apiRequest.get(_http);
}
createForma(data: any): Observable<any> {
return this.apiRequest.post(this.FormaURL, data);
}
updateForma(id: number, data: any): Observable<any> {
const _http = this.FormaURL + "/" + id;
return this.apiRequest.put(_http, data);
}
deleteForma(id: number): Observable<any> {
const _http = this.FormaURL + "/" + id;
return this.apiRequest.delete(_http);
}
uploadfilefileupload_field(ref:any, Forma:any, file:any): Observable<any>{
const formData = new FormData();
formData.append('file', file);
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Forma}`, formData);
}
uploadfilegetByIdfileupload_field(ref:any, Forma:any,): Observable<any> {
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Forma}`);
}
uploadfiledeletefileupload_field(id: number): Observable<any> {
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
}
uploadImageupload_field(ref:any, Forma:any, file:any): Observable<any>{
const formData = new FormData();
formData.append('file', file);
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Forma}`, formData);
}
uploadImageupload_fieldgetById(ref:any, Forma:any,): Observable<any> {
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Forma}`);
}
uploadImageupload_fielddelete(id: number): Observable<any> {
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
}
uploadAudio_field(ref:any, Forma:any, file:any): Observable<any>{
const formData = new FormData();
formData.append('file', file);
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Forma}`, formData);
}
uploadAudio_fieldgetById(ref:any, Forma:any,): Observable<any> {
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Forma}`);
}
uploadAudio_fielddelete(id: number): Observable<any> {
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
}
uploadVideo_field(ref:any, Forma:any, file:any): Observable<any>{
const formData = new FormData();
formData.append('file', file);
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Forma}`, formData);
}
uploadVideo_fieldgetById(ref:any, Forma:any,): Observable<any> {
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Forma}`);
}
uploadVideo_fielddelete(id: number): Observable<any> {
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
}
// updateaction
}

View File

@ -1,3 +1,5 @@
import { steps01Component } from './BuilderComponents/stepperworkflow/steps01/steps01.component';
import { FormaComponent } from './BuilderComponents/basicp1/Forma/Forma.component';
import { SequencegenaratorComponent } from './fnd/sequencegenarator/sequencegenarator.component';
@ -257,6 +259,11 @@ const routes: Routes = [
// buildercomponents
{path:'steps01/:id',component:steps01Component},
{path:'Forma',component:FormaComponent},

View File

@ -1,3 +1,5 @@
import { steps01Component } from './BuilderComponents/stepperworkflow/steps01/steps01.component';
import { FormaComponent } from './BuilderComponents/basicp1/Forma/Forma.component';
@ -130,6 +132,11 @@ import { Stepper_workflowComponent } from './BuilderComponents/stepperworkflow/S
// buildercomponents
steps01Component,
FormaComponent,