build_app

This commit is contained in:
risadmin_prod 2024-10-08 11:21:49 +00:00
parent 8840360c85
commit 34e164fe80
12 changed files with 233 additions and 32 deletions

View File

@ -72,6 +72,9 @@ public class BuilderService {
addCustomMenu( "Forma", "Transcations");
addCustomMenu( "Forma", "Transcations");
System.out.println("dashboard and menu inserted...");

View File

@ -23,8 +23,8 @@ import com.realnet.WhoColumn.Extension;
private String name;
@Column(length = 2000)
private String description;
private String filetrerstname;
private String filetrerstpath ;
}

View File

@ -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;}

View File

@ -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));

View File

@ -27,7 +27,6 @@
<th>Name</th>
<th>Description</th>
<th>Action</th> </tr>
</thead>
@ -37,7 +36,6 @@
<td>{{data.name}}</td>
<td (click)="goToReplaceStringdescription(data.description)" data-bs-toggle="modal" data-bs-target="#descriptionModal" style="cursor: pointer; align-items: center;"><i class="bi bi-card-text"></i></td>
<td><i class="bi bi-pencil" style="cursor: pointer; padding-right: 10px"(click)="goToEdit(data.id)"></i><i class="bi bi-trash" style="cursor: pointer;" data-bs-toggle="modal" data-bs-target="#deleteModal" (click)="onDelete(data)"></i></td>
</tr>
@ -77,19 +75,5 @@
<div class="modal fade" id="descriptionModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<textarea class="form-control" style="width:100%; height: 400px;" readonly>{{rowSelected}}</textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

View File

@ -28,7 +28,20 @@ export class FormaService {
}
uploadfilefiletrerst(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);
}
uploadfilegetByIdfiletrerst(ref:any, Forma:any,): Observable<any> {
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Forma}`);
}
uploadfiledeletefiletrerst(id: number): Observable<any> {
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
}
// updateaction
}

View File

@ -17,15 +17,45 @@
</div>
</div>
<div class="col-md-4 col-sm-12">
<label> description</label>
<textarea cols="10" rows="2" formControlName="description" placeholder="Textarea"> </textarea>
</div>
</div>
<h6> List of filetrerst</h6>
<div class="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 FileDatafiletrerst; let i=index">
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
<td><input type="file" (change)="onFileChangedfiletrerst($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)="deleteRowfiletrerst(i)">
<i class="bi bi-trash is-error"></i>
</a>
</td>
</tr>
</tbody>
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesfiletrerst()">
<i class="bi bi-plus"></i>
</button>
</table> </div>
</form>

View File

@ -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);
})
}
}
}

View File

@ -14,15 +14,44 @@
<input type="text" class="input" name="name" [(ngModel)]="data1.name" >
</div>
<div class="col-md-4 col-sm-12">
<label> description</label>
<textarea cols="10" rows="2" [(ngModel)]="data1.description" name="description " placeholder="Textarea"> </textarea>
</div>
</div>
<h6> List of filetrerst</h6>
<div class="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 FileDatafiletrerst; let i=index">
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
<td><input type="file" (change)="onFileChangedfiletrerst($event, i)" accept = "application/pdf,.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
</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>
<i class="bi bi-trash is-error" data-bs-toggle="modal" data-bs-target="#filetrerstdeleteModal" (click)="deleteRowfiletrerst(i,attach.id)" style="cursor: pointer;">
</i>
</td>
</tr>
</tbody>
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesfiletrerst()">
<i class="bi bi-plus"></i>
</button>
</table> </div>
</form>
@ -34,5 +63,21 @@
<div class="modal fade" id="filetrerstdeleteModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" *ngIf="rowSelected.id">
<h5 class="modal-title" id="exampleModalLabel">Delete</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>Are You Sure Want to delete?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" (click)="deletefiletrerst(rowSelected.index,rowSelected.id)">Delete</button>
</div>
</div>
</div>
</div>

View File

@ -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);
})
}
}
}

View File

@ -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},

View File

@ -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,