build_app
This commit is contained in:
parent
b25c89ccf5
commit
5c087d0f01
|
@ -72,6 +72,9 @@ public class BuilderService {
|
||||||
addCustomMenu( "Forma", "Transcations");
|
addCustomMenu( "Forma", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Forma", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
addCustomMenu( "Forma", "Transcations");
|
addCustomMenu( "Forma", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@ import com.realnet.basicp1.Entity.Forma;
|
||||||
import com.realnet.basicp1.Services.FormaService ;
|
import com.realnet.basicp1.Services.FormaService ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/Forma")
|
@RequestMapping(value = "/Forma")
|
||||||
@CrossOrigin("*")
|
@CrossOrigin("*")
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -33,14 +31,10 @@ public class FormaController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/Forma")
|
@PostMapping("/Forma")
|
||||||
public Forma Savedata(@RequestBody Forma data) {
|
public Forma Savedata(@RequestBody Forma data) {
|
||||||
Forma save = Service.Savedata(data) ;
|
Forma save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println("data saved..." + save);
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
return save;
|
return save;
|
||||||
|
@ -86,6 +80,4 @@ public class FormaController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -7,8 +7,6 @@ import com.realnet.WhoColumn.Extension;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Data
|
||||||
public class Forma extends Extension {
|
public class Forma extends Extension {
|
||||||
|
@ -21,10 +19,8 @@ import com.realnet.WhoColumn.Extension;
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
private String name;
|
private String imagetestname;
|
||||||
|
private String imagetestpath ;
|
||||||
private String filetrerstname;
|
|
||||||
private String filetrerstpath ;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ import org.springframework.stereotype.Repository;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,6 @@ import org.springframework.http.HttpStatus;
|
||||||
import com.realnet.users.entity1.AppUser;
|
import com.realnet.users.entity1.AppUser;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -24,13 +22,9 @@ private FormaRepository Repository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AppUserServiceImpl userService;
|
private AppUserServiceImpl userService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Forma Savedata(Forma data) {
|
public Forma Savedata(Forma data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Forma save = Repository.save(data);
|
Forma save = Repository.save(data);
|
||||||
return save;
|
return save;
|
||||||
}
|
}
|
||||||
|
@ -57,16 +51,12 @@ public Forma getdetailsbyId(Integer id) {
|
||||||
|
|
||||||
public Forma update(Forma data,Integer id) {
|
public Forma update(Forma data,Integer id) {
|
||||||
Forma old = Repository.findById(id).get();
|
Forma old = Repository.findById(id).get();
|
||||||
old.setName(data.getName());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final Forma test = Repository.save(old);
|
final Forma test = Repository.save(old);
|
||||||
return test;}
|
return test;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public AppUser getUser() {
|
public AppUser getUser() {
|
||||||
AppUser user = userService.getLoggedInUser();
|
AppUser user = userService.getLoggedInUser();
|
||||||
return user;
|
return user;
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
CREATE TABLE db.Forma(id BIGINT NOT NULL AUTO_INCREMENT, filetrerst VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));
|
CREATE TABLE db.Forma(id BIGINT NOT NULL AUTO_INCREMENT, imagetest VARCHAR(400), PRIMARY KEY (id));
|
||||||
|
|
||||||
|
|
|
@ -24,18 +24,12 @@
|
||||||
<thead class="table-primary">
|
<thead class="table-primary">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<th>Name</th>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<th>Action</th> </tr>
|
<th>Action</th> </tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let data of givendata?.slice()?.reverse() | searchFilter:searchFilter; let i = index">
|
<tr *ngFor="let data of givendata?.slice()?.reverse() | searchFilter:searchFilter; let i = index">
|
||||||
|
|
||||||
<td>{{data.name}}</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>
|
<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>
|
</tr>
|
||||||
|
@ -75,5 +69,3 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,20 +26,18 @@ export class FormaService {
|
||||||
const _http = this.baseURL + "/" + id;
|
const _http = this.baseURL + "/" + id;
|
||||||
return this.apiRequest.delete(_http);
|
return this.apiRequest.delete(_http);
|
||||||
}
|
}
|
||||||
|
uploadImagetest(ref:any, Forma:any, file:any): Observable<any>{
|
||||||
|
|
||||||
uploadfilefiletrerst(ref:any, Forma:any, file:any): Observable<any>{
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Forma}`, formData);
|
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Forma}`, formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadfilegetByIdfiletrerst(ref:any, Forma:any,): Observable<any> {
|
uploadImagetestgetById(ref:any, Forma:any,): Observable<any> {
|
||||||
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Forma}`);
|
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Forma}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uploadfiledeletefiletrerst(id: number): Observable<any> {
|
uploadImagetestdelete(id: number): Observable<any> {
|
||||||
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
|
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,27 +2,15 @@
|
||||||
<h4 style="font-weight: 500;display: inline;"> Forma</h4>
|
<h4 style="font-weight: 500;display: inline;"> Forma</h4>
|
||||||
<span class="label label-light-blue" style="display: inline;margin-left: 30px;">Add Mode</span>
|
<span class="label label-light-blue" style="display: inline;margin-left: 30px;">Add Mode</span>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="main" >
|
<div class="main" >
|
||||||
<form [formGroup]="entryForm">
|
<form [formGroup]="entryForm">
|
||||||
|
|
||||||
<div class="row"><div class="col-md-4 col-sm-12">
|
<div class="row">
|
||||||
<label for="name"> name </label>
|
|
||||||
<input type="text" class="input" formControlName="name" >
|
|
||||||
<div *ngIf="submitted && entryForm.controls.name.errors" class="error_mess">
|
|
||||||
<div *ngIf="submitted && entryForm.controls.name.errors.required" class="error_mess">*This field is Required</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<h6> List of imagetest</h6>
|
||||||
|
|
||||||
<h6> List of filetrerst</h6>
|
|
||||||
|
|
||||||
<div class="row" style="margin-top: 10px;">
|
<div class="row" style="margin-top: 10px;">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
@ -36,14 +24,14 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody >
|
<tbody >
|
||||||
<tr *ngFor="let attach of FileDatafiletrerst; let i=index">
|
<tr *ngFor="let attach of FileDataimagetest; let i=index">
|
||||||
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
|
<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><input type="file" (change)="onFileChangedimagetest($event, i)" accept="image/*" /><!--accept=".pdf,.doc,.docx,.jpg,.msg"-->
|
||||||
</td>
|
</td>
|
||||||
<td>{{attach.uploadedfile_name}}</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 > <img [src]="attach.filePreview" alt="File Preview" [ngModelOptions]="{standalone: true}" name="filePreview" width="100px" height="100px"></td>
|
||||||
<td>
|
<td>
|
||||||
<a (click)="deleteRowfiletrerst(i)">
|
<a (click)="deleteRowimagetest(i)">
|
||||||
<i class="bi bi-trash is-error"></i>
|
<i class="bi bi-trash is-error"></i>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
@ -51,7 +39,7 @@
|
||||||
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesfiletrerst()">
|
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesimagetest()">
|
||||||
<i class="bi bi-plus"></i>
|
<i class="bi bi-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -68,5 +56,3 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,20 +32,14 @@ tableName = 'Forma';
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.entryForm = this._fb.group({
|
this.entryForm = this._fb.group({
|
||||||
name :[null],
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
givendata;
|
givendata;
|
||||||
getData(){
|
getData(){
|
||||||
|
@ -62,8 +56,6 @@ name :[null],
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.log(this.entryForm.value);
|
console.log(this.entryForm.value);
|
||||||
this.mainservice.create(this.entryForm.value).subscribe(data => {
|
this.mainservice.create(this.entryForm.value).subscribe(data => {
|
||||||
|
@ -72,11 +64,9 @@ name :[null],
|
||||||
this.toastr.success("Added Successfully");
|
this.toastr.success("Added Successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < this.selectedimagetest.length; i++){
|
||||||
|
|
||||||
|
this.mainservice.uploadimagetest(data.id,this.tableName,this.selectedimagetest[i]).subscribe(uploaddata =>{
|
||||||
for (let i = 0; i < this.selectedfiletrerst.length; i++){
|
|
||||||
|
|
||||||
this.mainservice.uploadfilefiletrerst(data.id,this.tableName,this.selectedfiletrerst[i]).subscribe(uploaddata =>{
|
|
||||||
console.log(uploaddata);
|
console.log(uploaddata);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -99,24 +89,22 @@ for (let i = 0; i < this.selectedfiletrerst.length; i++){
|
||||||
|
|
||||||
goback(){
|
goback(){
|
||||||
this.router.navigate(["../Forma"], { relativeTo: this.route });
|
this.router.navigate(["../Forma"], { relativeTo: this.route });
|
||||||
}
|
}filePreviewimagetest: string | ArrayBuffer | null = null;
|
||||||
|
FileDataimagetest: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
|
||||||
filePreviewfiletrerst: string | ArrayBuffer | null = null;
|
selectedimagetest: File[]=[];
|
||||||
FileDatafiletrerst: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
|
public onFileChangedimagetest(event, index) {
|
||||||
selectedfiletrerst: File[]=[];
|
|
||||||
public onFileChangedfiletrerst(event, index) {
|
|
||||||
const files = event.target.files;
|
const files = event.target.files;
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let i = 0; i < files.length; i++) {
|
||||||
const file = files[i];
|
const file = files[i];
|
||||||
this.FileDatafiletrerst[index].uploadedfile_name = files[i].name;
|
this.FileDataimagetest[index].uploadedfile_name = files[i].name;
|
||||||
this.selectedfiletrerst.push(files[i]);
|
this.selectedimagetest.push(files[i]);
|
||||||
if (file.type.startsWith('image/')) {
|
if (file.type.startsWith('image/')) {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
// Set the file preview source
|
// Set the file preview source
|
||||||
const filePreview = e.target?.result as string;
|
const filePreview = e.target?.result as string;
|
||||||
this.FileDatafiletrerst[index] = {
|
this.FileDataimagetest[index] = {
|
||||||
...this.FileDatafiletrerst[index], // Preserve existing properties
|
...this.FileDataimagetest[index], // Preserve existing properties
|
||||||
filePreview: filePreview // Update only the filePreview property
|
filePreview: filePreview // Update only the filePreview property
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -124,19 +112,19 @@ public onFileChangedfiletrerst(event, index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onAddLinesfiletrerst(){
|
onAddLinesimagetest(){
|
||||||
this.FileDatafiletrerst.push({
|
this.FileDataimagetest.push({
|
||||||
uploadedfile_name: "",
|
uploadedfile_name: "",
|
||||||
filePreview: "",
|
filePreview: "",
|
||||||
// f3: "",
|
// f3: "",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteRowfiletrerst(index,id) {
|
deleteRowimagetest(index,id) {
|
||||||
this.FileDatafiletrerst.splice(index, 1);
|
this.FileDataimagetest.splice(index, 1);
|
||||||
|
|
||||||
if(id){
|
if(id){
|
||||||
this.mainservice.uploadfiledeletefiletrerst(id).subscribe(data =>{
|
this.mainservice.uploadfiledelete(id).subscribe(data =>{
|
||||||
console.log(data);
|
console.log(data);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -145,5 +133,3 @@ public onFileChangedfiletrerst(event, index) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,14 @@
|
||||||
<h4 style="font-weight: 500;display: inline;">table_name</h4>
|
<h4 style="font-weight: 500;display: inline;">table_name</h4>
|
||||||
<span class="label label-light-blue" style="display: inline;margin-left: 30px;">Edit Mode</span>
|
<span class="label label-light-blue" style="display: inline;margin-left: 30px;">Edit Mode</span>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="main" >
|
<div class="main" >
|
||||||
<form *ngIf="data1">
|
<form *ngIf="data1">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-md-4 col-sm-12">
|
|
||||||
<label for="name"> name</label>
|
|
||||||
<input type="text" class="input" name="name" [(ngModel)]="data1.name" >
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<h6> List of imagetest</h6>
|
||||||
|
|
||||||
<h6> List of filetrerst</h6>
|
|
||||||
|
|
||||||
<div class="row" style="margin-top: 10px;">
|
<div class="row" style="margin-top: 10px;">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
@ -33,21 +22,21 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody >
|
<tbody >
|
||||||
<tr *ngFor="let attach of FileDatafiletrerst; let i=index">
|
<tr *ngFor="let attach of FileDataimagetest; let i=index">
|
||||||
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
|
<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><input type="file" (change)="onFileChangedimagetest($event, i)" accept="image/*" />
|
||||||
</td>
|
</td>
|
||||||
<td>{{attach.uploadedfile_name}}</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 > <img [src]="attach.filePreview" alt="File Preview" [ngModelOptions]="{standalone: true}" name="filePreview" width="100px" height="100px"></td>
|
||||||
<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 class="bi bi-trash is-error" data-bs-toggle="modal" data-bs-target="#imagetestdeleteModal" (click)="deleteRowimagetest(i,attach.id)" style="cursor: pointer;">
|
||||||
</i>
|
</i>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesfiletrerst()">
|
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesimagetest()">
|
||||||
<i class="bi bi-plus"></i>
|
<i class="bi bi-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -61,9 +50,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="imagetestdeleteModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||||
|
|
||||||
<div class="modal fade" id="filetrerstdeleteModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header" *ngIf="rowSelected.id">
|
<div class="modal-header" *ngIf="rowSelected.id">
|
||||||
|
@ -75,7 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
<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>
|
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" (click)="deleteimagetest(rowSelected.index,rowSelected.id)">Delete</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -32,8 +32,6 @@ tableName = 'Forma';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
givendata;
|
givendata;
|
||||||
getData(){
|
getData(){
|
||||||
|
@ -47,12 +45,10 @@ tableName = 'Forma';
|
||||||
getById(id:number){
|
getById(id:number){
|
||||||
this.mainservice.getbyid(id).subscribe((data)=>{
|
this.mainservice.getbyid(id).subscribe((data)=>{
|
||||||
this.data1=data;
|
this.data1=data;
|
||||||
|
this.selectedimagetest = [];
|
||||||
|
this.mainservice.uploadfilegetById(data.id,this.tableName).subscribe(uploaddata =>{
|
||||||
this.selectedfiletrerst = [];
|
|
||||||
this.mainservice.uploadfilegetByIdfiletrerst(data.id,this.tableName).subscribe(uploaddata =>{
|
|
||||||
console.log(uploaddata);
|
console.log(uploaddata);
|
||||||
this.FileDatafiletrerst = uploaddata;
|
this.FileDataimagetest = uploaddata;
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -62,8 +58,6 @@ this.mainservice.getbyid(id).subscribe((data)=>{
|
||||||
}
|
}
|
||||||
update(){
|
update(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.log(this.data1);
|
console.log(this.data1);
|
||||||
this.mainservice.updatenew(this.id,this.data1).subscribe((data)=>{
|
this.mainservice.updatenew(this.id,this.data1).subscribe((data)=>{
|
||||||
|
@ -71,11 +65,9 @@ console.log(data); if (data || data.status >= 200 && data.status <= 299)
|
||||||
this.toastr.success("Update Successfully");
|
this.toastr.success("Update Successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < this.selectedimagetest.length; i++){
|
||||||
|
|
||||||
|
this.mainservice.uploadimagetest(data.id,this.tableName,this.selectedimagetest[i]).subscribe(uploaddata =>{
|
||||||
for (let i = 0; i < this.selectedfiletrerst.length; i++){
|
|
||||||
|
|
||||||
this.mainservice.uploadfilefiletrerst(data.id,this.tableName,this.selectedfiletrerst[i]).subscribe(uploaddata =>{
|
|
||||||
console.log(uploaddata);
|
console.log(uploaddata);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -98,24 +90,22 @@ this.router.navigate(["../../Forma"], { relativeTo: this.route });
|
||||||
}
|
}
|
||||||
goback(){
|
goback(){
|
||||||
this.router.navigate(["../../Forma"], { relativeTo: this.route });
|
this.router.navigate(["../../Forma"], { relativeTo: this.route });
|
||||||
}
|
}filePreviewimagetest: string | ArrayBuffer | null = null;
|
||||||
|
FileDataimagetest: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
|
||||||
filePreviewfiletrerst: string | ArrayBuffer | null = null;
|
selectedimagetest: File[]=[];
|
||||||
FileDatafiletrerst: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
|
public onFileChangedimagetest(event, index) {
|
||||||
selectedfiletrerst: File[]=[];
|
|
||||||
public onFileChangedfiletrerst(event, index) {
|
|
||||||
const files = event.target.files;
|
const files = event.target.files;
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let i = 0; i < files.length; i++) {
|
||||||
const file = files[i];
|
const file = files[i];
|
||||||
this.FileDatafiletrerst[index].uploadedfile_name = files[i].name;
|
this.FileDataimagetest[index].uploadedfile_name = files[i].name;
|
||||||
this.selectedfiletrerst.push(files[i]);
|
this.selectedimagetest.push(files[i]);
|
||||||
if (file.type.startsWith('image/')) {
|
if (file.type.startsWith('image/')) {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
// Set the file preview source
|
// Set the file preview source
|
||||||
const filePreview = e.target?.result as string;
|
const filePreview = e.target?.result as string;
|
||||||
this.FileDatafiletrerst[index] = {
|
this.FileDataimagetest[index] = {
|
||||||
...this.FileDatafiletrerst[index], // Preserve existing properties
|
...this.FileDataimagetest[index], // Preserve existing properties
|
||||||
filePreview: filePreview // Update only the filePreview property
|
filePreview: filePreview // Update only the filePreview property
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -123,15 +113,15 @@ public onFileChangedfiletrerst(event, index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onAddLinesfiletrerst(){
|
onAddLinesimagetest(){
|
||||||
this.FileDatafiletrerst.push({
|
this.FileDataimagetest.push({
|
||||||
uploadedfile_name: "",
|
uploadedfile_name: "",
|
||||||
filePreview: "",
|
filePreview: "",
|
||||||
// f3: "",
|
// f3: "",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
rowSelected :any= {};
|
rowSelected :any= {};
|
||||||
deleteRowfiletrerst(index,id) {
|
deleteRowimagetest(index,id) {
|
||||||
// this.modalissue.removeAllBackdrops();
|
// this.modalissue.removeAllBackdrops();
|
||||||
const row:any = {
|
const row:any = {
|
||||||
index: index,
|
index: index,
|
||||||
|
@ -140,11 +130,11 @@ public onFileChangedfiletrerst(event, index) {
|
||||||
this.rowSelected = row;
|
this.rowSelected = row;
|
||||||
}
|
}
|
||||||
|
|
||||||
deletefiletrerst(index,id) {
|
deleteimagetest(index,id) {
|
||||||
this.FileDatafiletrerst.splice(index, 1);
|
this.FileDataimagetest.splice(index, 1);
|
||||||
|
|
||||||
if(id){
|
if(id){
|
||||||
this.mainservice.uploadfiledeletefiletrerst(id).subscribe(data =>{
|
this.mainservice.uploadfiledelete(id).subscribe(data =>{
|
||||||
console.log(data);
|
console.log(data);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import { FormaeditComponent } from './BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component';
|
import { FormaeditComponent } from './BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component';
|
||||||
import { FormaaddComponent } from './BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component';
|
import { FormaaddComponent } from './BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component';
|
||||||
import { FormaComponent } from './BuilderComponents/basicp1/Forma/Forma.component';
|
import { FormaComponent } from './BuilderComponents/basicp1/Forma/Forma.component';
|
||||||
|
@ -124,6 +127,15 @@ const routes: Routes = [
|
||||||
{path:'Formaadd',component:FormaaddComponent},
|
{path:'Formaadd',component:FormaaddComponent},
|
||||||
|
|
||||||
|
|
||||||
|
{path:'Forma',component:FormaComponent},
|
||||||
|
|
||||||
|
|
||||||
|
{path:'Formaedit/:id',component:FormaeditComponent},
|
||||||
|
|
||||||
|
|
||||||
|
{path:'Formaadd',component:FormaaddComponent},
|
||||||
|
|
||||||
|
|
||||||
{path:'Forma',component:FormaComponent},
|
{path:'Forma',component:FormaComponent},
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import { FormaeditComponent } from './BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component';
|
import { FormaeditComponent } from './BuilderComponents/basicp1/Forma/Formaedit/Formaedit.component';
|
||||||
import { FormaaddComponent } from './BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component';
|
import { FormaaddComponent } from './BuilderComponents/basicp1/Forma/Formaadd/Formaadd.component';
|
||||||
import { FormaComponent } from './BuilderComponents/basicp1/Forma/Forma.component';
|
import { FormaComponent } from './BuilderComponents/basicp1/Forma/Forma.component';
|
||||||
|
@ -123,6 +126,15 @@ FormaaddComponent,
|
||||||
FormaComponent,
|
FormaComponent,
|
||||||
|
|
||||||
|
|
||||||
|
FormaeditComponent,
|
||||||
|
|
||||||
|
|
||||||
|
FormaaddComponent,
|
||||||
|
|
||||||
|
|
||||||
|
FormaComponent,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue