From 34e164fe80768179b876b4596c7782c093bed82c Mon Sep 17 00:00:00 2001 From: risadmin_prod Date: Tue, 8 Oct 2024 11:21:49 +0000 Subject: [PATCH] build_app --- .../Builders/Services/BuilderService.java | 3 + .../com/realnet/basicp1/Entity/Forma.java | 4 +- .../basicp1/Services/FormaService.java | 2 +- .../authsec_mysql/mysql/wf_table/wf_table.sql | 2 +- .../basicp1/Forma/Forma.component.html | 18 +----- .../basicp1/Forma/Forma.service.ts | 13 ++++ .../Forma/Formaadd/Formaadd.component.html | 38 ++++++++++-- .../Forma/Formaadd/Formaadd.component.ts | 46 +++++++++++++- .../Forma/Formaedit/Formaedit.component.html | 55 +++++++++++++++-- .../Forma/Formaedit/Formaedit.component.ts | 60 ++++++++++++++++++- .../app/modules/main/main-routing.module.ts | 12 ++++ .../src/app/modules/main/main.module.ts | 12 ++++ 12 files changed, 233 insertions(+), 32 deletions(-) diff --git a/pro103ab-back-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java b/pro103ab-back-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java index f294100..2f39862 100644 --- a/pro103ab-back-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java +++ b/pro103ab-back-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java @@ -72,6 +72,9 @@ public class BuilderService { addCustomMenu( "Forma", "Transcations"); +addCustomMenu( "Forma", "Transcations"); + + System.out.println("dashboard and menu inserted..."); diff --git a/pro103ab-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Forma.java b/pro103ab-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Forma.java index 243587d..ecca117 100644 --- a/pro103ab-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Forma.java +++ b/pro103ab-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Forma.java @@ -23,8 +23,8 @@ import com.realnet.WhoColumn.Extension; private String name; -@Column(length = 2000) -private String description; +private String filetrerstname; +private String filetrerstpath ; } diff --git a/pro103ab-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/FormaService.java b/pro103ab-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/FormaService.java index 9ab2cae..f140dbd 100644 --- a/pro103ab-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/FormaService.java +++ b/pro103ab-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/FormaService.java @@ -59,7 +59,7 @@ public Forma update(Forma data,Integer id) { Forma old = Repository.findById(id).get(); old.setName(data.getName()); -old.setDescription(data.getDescription()); + final Forma test = Repository.save(old); return test;} diff --git a/pro103ab-db-d/authsec_mysql/mysql/wf_table/wf_table.sql b/pro103ab-db-d/authsec_mysql/mysql/wf_table/wf_table.sql index 288d5a1..0c0ca15 100755 --- a/pro103ab-db-d/authsec_mysql/mysql/wf_table/wf_table.sql +++ b/pro103ab-db-d/authsec_mysql/mysql/wf_table/wf_table.sql @@ -1,2 +1,2 @@ -CREATE TABLE db.Forma(id BIGINT NOT NULL AUTO_INCREMENT, description VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id)); +CREATE TABLE db.Forma(id BIGINT NOT NULL AUTO_INCREMENT, filetrerst VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id)); diff --git a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Forma.component.html b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Forma.component.html index bb62e5d..d48047d 100644 --- a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Forma.component.html +++ b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Forma.component.html @@ -27,7 +27,6 @@ Name -Description Action @@ -37,7 +36,6 @@ {{data.name}} - @@ -77,19 +75,5 @@ - + diff --git a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Forma.service.ts b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Forma.service.ts index 4884ef7..888b904 100644 --- a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Forma.service.ts +++ b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Forma.service.ts @@ -28,7 +28,20 @@ export class FormaService { } + uploadfilefiletrerst(ref:any, Forma:any, file:any): Observable{ + const formData = new FormData(); + formData.append('file', file); + return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Forma}`, formData); + } + uploadfilegetByIdfiletrerst(ref:any, Forma:any,): Observable { + return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Forma}`); + } + + + uploadfiledeletefiletrerst(id: number): Observable { + return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`); + } // updateaction } \ No newline at end of file diff --git a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component.html b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component.html index 7b7e44a..60029fa 100644 --- a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component.html +++ b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component.html @@ -17,15 +17,45 @@ -
- - -
+ +
List of filetrerst
+
+ + + + + + + + + + + + + + + + + + + + + + + +
No FileFile NamePreviewCancel
+ {{attach.uploadedfile_name}} File Preview + + + +
diff --git a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component.ts b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component.ts index 68e091b..62a8f72 100644 --- a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component.ts +++ b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component.ts @@ -34,7 +34,7 @@ tableName = 'Forma'; this.entryForm = this._fb.group({ name :[null], -description :[null], + @@ -74,7 +74,12 @@ description :[null], +for (let i = 0; i < this.selectedfiletrerst.length; i++){ + this.mainservice.uploadfilefiletrerst(data.id,this.tableName,this.selectedfiletrerst[i]).subscribe(uploaddata =>{ + console.log(uploaddata); + }) +} }, (error) => { @@ -96,7 +101,46 @@ goback(){ this.router.navigate(["../Forma"], { relativeTo: this.route }); } +filePreviewfiletrerst: string | ArrayBuffer | null = null; +FileDatafiletrerst: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array +selectedfiletrerst: File[]=[]; +public onFileChangedfiletrerst(event, index) { + const files = event.target.files; + for (let i = 0; i < files.length; i++) { + const file = files[i]; + this.FileDatafiletrerst[index].uploadedfile_name = files[i].name; + this.selectedfiletrerst.push(files[i]); + if (file.type.startsWith('image/')) { + const reader = new FileReader(); + reader.onload = (e) => { + // Set the file preview source + const filePreview = e.target?.result as string; + this.FileDatafiletrerst[index] = { + ...this.FileDatafiletrerst[index], // Preserve existing properties + filePreview: filePreview // Update only the filePreview property + }; + }; + reader.readAsDataURL(file); + } + } +} + onAddLinesfiletrerst(){ + this.FileDatafiletrerst.push({ + uploadedfile_name: "", + filePreview: "", + // f3: "", + }); + } + deleteRowfiletrerst(index,id) { + this.FileDatafiletrerst.splice(index, 1); + + if(id){ + this.mainservice.uploadfiledeletefiletrerst(id).subscribe(data =>{ + console.log(data); + }) + } + } } diff --git a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component.html b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component.html index 48e8a18..849b494 100644 --- a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component.html +++ b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component.html @@ -14,15 +14,44 @@ -
- - -
+ +
List of filetrerst
+
+ + + + + + + + + + + + + + + + + + + + + + + +
No FileFile NamePreviewCancel
+ {{attach.uploadedfile_name}} File Preview + + +
@@ -34,5 +63,21 @@ - + diff --git a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component.ts b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component.ts index e1821a1..e16e98d 100644 --- a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component.ts +++ b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component.ts @@ -49,7 +49,12 @@ this.mainservice.getbyid(id).subscribe((data)=>{ this.data1=data; - + this.selectedfiletrerst = []; + this.mainservice.uploadfilegetByIdfiletrerst(data.id,this.tableName).subscribe(uploaddata =>{ + console.log(uploaddata); + this.FileDatafiletrerst = uploaddata; + + }) console.log(this.data1); @@ -68,7 +73,12 @@ console.log(data); if (data || data.status >= 200 && data.status <= 299) +for (let i = 0; i < this.selectedfiletrerst.length; i++){ + this.mainservice.uploadfilefiletrerst(data.id,this.tableName,this.selectedfiletrerst[i]).subscribe(uploaddata =>{ + console.log(uploaddata); + }) +} this.router.navigate(["../../Forma"], { relativeTo: this.route }); @@ -90,7 +100,55 @@ goback(){ this.router.navigate(["../../Forma"], { relativeTo: this.route }); } +filePreviewfiletrerst: string | ArrayBuffer | null = null; +FileDatafiletrerst: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array +selectedfiletrerst: File[]=[]; +public onFileChangedfiletrerst(event, index) { + const files = event.target.files; + for (let i = 0; i < files.length; i++) { + const file = files[i]; + this.FileDatafiletrerst[index].uploadedfile_name = files[i].name; + this.selectedfiletrerst.push(files[i]); + if (file.type.startsWith('image/')) { + const reader = new FileReader(); + reader.onload = (e) => { + // Set the file preview source + const filePreview = e.target?.result as string; + this.FileDatafiletrerst[index] = { + ...this.FileDatafiletrerst[index], // Preserve existing properties + filePreview: filePreview // Update only the filePreview property + }; + }; + reader.readAsDataURL(file); + } + } +} + onAddLinesfiletrerst(){ + this.FileDatafiletrerst.push({ + uploadedfile_name: "", + filePreview: "", + // f3: "", + }); + } + rowSelected :any= {}; + deleteRowfiletrerst(index,id) { + // this.modalissue.removeAllBackdrops(); + const row:any = { + index: index, + id: id + } + this.rowSelected = row; + } + deletefiletrerst(index,id) { + this.FileDatafiletrerst.splice(index, 1); + + if(id){ + this.mainservice.uploadfiledeletefiletrerst(id).subscribe(data =>{ + console.log(data); + }) + } + } } \ No newline at end of file diff --git a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/main-routing.module.ts b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/main-routing.module.ts index 2535418..c423748 100644 --- a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/main-routing.module.ts +++ b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/main-routing.module.ts @@ -1,3 +1,6 @@ + + + import { FormaeditComponent } from './BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component'; import { FormaaddComponent } from './BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component'; import { FormaComponent } from './BuilderComponents/basicp1/Forma/Forma.component'; @@ -112,6 +115,15 @@ const routes: Routes = [ {path:'Formaadd',component:FormaaddComponent}, +{path:'Forma',component:FormaComponent}, + + +{path:'Formaedit/:id',component:FormaeditComponent}, + + +{path:'Formaadd',component:FormaaddComponent}, + + {path:'Forma',component:FormaComponent}, diff --git a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/main.module.ts b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/main.module.ts index 7b285cd..378e8d4 100644 --- a/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/main.module.ts +++ b/pro103ab-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/main.module.ts @@ -1,3 +1,6 @@ + + + import { FormaeditComponent } from './BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component'; import { FormaaddComponent } from './BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component'; import { FormaComponent } from './BuilderComponents/basicp1/Forma/Forma.component'; @@ -111,6 +114,15 @@ FormaaddComponent, FormaComponent, +FormaeditComponent, + + +FormaaddComponent, + + +FormaComponent, + +