build_app

This commit is contained in:
risadmin_prod 2024-10-08 11:40:10 +00:00
parent b25c89ccf5
commit 5c087d0f01
14 changed files with 80 additions and 138 deletions

View File

@ -72,6 +72,9 @@ public class BuilderService {
addCustomMenu( "Forma", "Transcations");
addCustomMenu( "Forma", "Transcations");
addCustomMenu( "Forma", "Transcations");

View File

@ -19,8 +19,6 @@ import com.realnet.basicp1.Entity.Forma;
import com.realnet.basicp1.Services.FormaService ;
@RequestMapping(value = "/Forma")
@CrossOrigin("*")
@RestController
@ -33,14 +31,10 @@ public class FormaController {
@PostMapping("/Forma")
public Forma Savedata(@RequestBody Forma data) {
Forma save = Service.Savedata(data) ;
System.out.println("data saved..." + save);
return save;
@ -86,6 +80,4 @@ public class FormaController {
}

View File

@ -7,8 +7,6 @@ import com.realnet.WhoColumn.Extension;
@Entity
@Data
public class Forma extends Extension {
@ -21,10 +19,8 @@ import com.realnet.WhoColumn.Extension;
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
private String filetrerstname;
private String filetrerstpath ;
private String imagetestname;
private String imagetestpath ;
}

View File

@ -10,8 +10,6 @@ import java.util.*;
import com.realnet.basicp1.Entity.Forma;
@Repository

View File

@ -13,8 +13,6 @@ import org.springframework.http.HttpStatus;
import com.realnet.users.entity1.AppUser;
import org.springframework.stereotype.Service;
@Service
@ -24,13 +22,9 @@ private FormaRepository Repository;
@Autowired
private AppUserServiceImpl userService;
public Forma Savedata(Forma data) {
Forma save = Repository.save(data);
return save;
}
@ -57,16 +51,12 @@ public Forma getdetailsbyId(Integer id) {
public Forma update(Forma data,Integer id) {
Forma old = Repository.findById(id).get();
old.setName(data.getName());
final Forma test = Repository.save(old);
return test;}
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;

View File

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

View File

@ -24,18 +24,12 @@
<thead class="table-primary">
<tr>
<th>Name</th>
<th>Action</th> </tr>
</thead>
<tbody>
<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>
</tr>
@ -75,5 +69,3 @@

View File

@ -26,20 +26,18 @@ export class FormaService {
const _http = this.baseURL + "/" + id;
return this.apiRequest.delete(_http);
}
uploadfilefiletrerst(ref:any, Forma:any, file:any): Observable<any>{
uploadImagetest(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> {
uploadImagetestgetById(ref:any, Forma:any,): Observable<any> {
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}`);
}

View File

@ -2,27 +2,15 @@
<h4 style="font-weight: 500;display: inline;"> Forma</h4>
<span class="label label-light-blue" style="display: inline;margin-left: 30px;">Add Mode</span>
<br>
<hr>
<div class="main" >
<form [formGroup]="entryForm">
<div class="row"><div class="col-md-4 col-sm-12">
<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 class="row">
</div>
<h6> List of filetrerst</h6>
<h6> List of imagetest</h6>
<div class="row" style="margin-top: 10px;">
<table class="table">
@ -36,14 +24,14 @@
</tr>
</thead>
<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><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>{{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)">
<a (click)="deleteRowimagetest(i)">
<i class="bi bi-trash is-error"></i>
</a>
</td>
@ -51,7 +39,7 @@
</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>
</button>
@ -68,5 +56,3 @@

View File

@ -32,10 +32,6 @@ tableName = 'Forma';
ngOnInit(): void {
this.entryForm = this._fb.group({
name :[null],
@ -44,8 +40,6 @@ name :[null],
});
}
givendata;
getData(){
@ -63,8 +57,6 @@ name :[null],
}
console.log(this.entryForm.value);
this.mainservice.create(this.entryForm.value).subscribe(data => {
console.log(data)
@ -72,11 +64,9 @@ name :[null],
this.toastr.success("Added Successfully");
}
for (let i = 0; i < this.selectedimagetest.length; i++){
for (let i = 0; i < this.selectedfiletrerst.length; i++){
this.mainservice.uploadfilefiletrerst(data.id,this.tableName,this.selectedfiletrerst[i]).subscribe(uploaddata =>{
this.mainservice.uploadimagetest(data.id,this.tableName,this.selectedimagetest[i]).subscribe(uploaddata =>{
console.log(uploaddata);
})
}
@ -99,24 +89,22 @@ for (let i = 0; i < this.selectedfiletrerst.length; i++){
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) {
}filePreviewimagetest: string | ArrayBuffer | null = null;
FileDataimagetest: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
selectedimagetest: File[]=[];
public onFileChangedimagetest(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]);
this.FileDataimagetest[index].uploadedfile_name = files[i].name;
this.selectedimagetest.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
this.FileDataimagetest[index] = {
...this.FileDataimagetest[index], // Preserve existing properties
filePreview: filePreview // Update only the filePreview property
};
};
@ -124,19 +112,19 @@ public onFileChangedfiletrerst(event, index) {
}
}
}
onAddLinesfiletrerst(){
this.FileDatafiletrerst.push({
onAddLinesimagetest(){
this.FileDataimagetest.push({
uploadedfile_name: "",
filePreview: "",
// f3: "",
});
}
deleteRowfiletrerst(index,id) {
this.FileDatafiletrerst.splice(index, 1);
deleteRowimagetest(index,id) {
this.FileDataimagetest.splice(index, 1);
if(id){
this.mainservice.uploadfiledeletefiletrerst(id).subscribe(data =>{
this.mainservice.uploadfiledelete(id).subscribe(data =>{
console.log(data);
})
}
@ -145,5 +133,3 @@ public onFileChangedfiletrerst(event, index) {
}

View File

@ -1,25 +1,14 @@
<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>
<br>
<hr>
<div class="main" >
<form *ngIf="data1">
<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>
<h6> List of filetrerst</h6>
<h6> List of imagetest</h6>
<div class="row" style="margin-top: 10px;">
<table class="table">
@ -33,21 +22,21 @@
</tr>
</thead>
<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><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>{{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 class="bi bi-trash is-error" data-bs-toggle="modal" data-bs-target="#imagetestdeleteModal" (click)="deleteRowimagetest(i,attach.id)" style="cursor: pointer;">
</i>
</td>
</tr>
</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>
</button>
@ -61,9 +50,7 @@
</div>
</div>
<div class="modal fade" id="filetrerstdeleteModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal fade" id="imagetestdeleteModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" *ngIf="rowSelected.id">
@ -75,7 +62,7 @@
</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>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" (click)="deleteimagetest(rowSelected.index,rowSelected.id)">Delete</button>
</div>
</div>
</div>

View File

@ -32,8 +32,6 @@ tableName = 'Forma';
}
givendata;
getData(){
@ -47,12 +45,10 @@ tableName = 'Forma';
getById(id:number){
this.mainservice.getbyid(id).subscribe((data)=>{
this.data1=data;
this.selectedfiletrerst = [];
this.mainservice.uploadfilegetByIdfiletrerst(data.id,this.tableName).subscribe(uploaddata =>{
this.selectedimagetest = [];
this.mainservice.uploadfilegetById(data.id,this.tableName).subscribe(uploaddata =>{
console.log(uploaddata);
this.FileDatafiletrerst = uploaddata;
this.FileDataimagetest = uploaddata;
})
@ -63,19 +59,15 @@ this.mainservice.getbyid(id).subscribe((data)=>{
update(){
console.log(this.data1);
this.mainservice.updatenew(this.id,this.data1).subscribe((data)=>{
console.log(data); if (data || data.status >= 200 && data.status <= 299) {
this.toastr.success("Update Successfully");
}
for (let i = 0; i < this.selectedimagetest.length; i++){
for (let i = 0; i < this.selectedfiletrerst.length; i++){
this.mainservice.uploadfilefiletrerst(data.id,this.tableName,this.selectedfiletrerst[i]).subscribe(uploaddata =>{
this.mainservice.uploadimagetest(data.id,this.tableName,this.selectedimagetest[i]).subscribe(uploaddata =>{
console.log(uploaddata);
})
}
@ -98,24 +90,22 @@ this.router.navigate(["../../Forma"], { relativeTo: this.route });
}
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) {
}filePreviewimagetest: string | ArrayBuffer | null = null;
FileDataimagetest: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
selectedimagetest: File[]=[];
public onFileChangedimagetest(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]);
this.FileDataimagetest[index].uploadedfile_name = files[i].name;
this.selectedimagetest.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
this.FileDataimagetest[index] = {
...this.FileDataimagetest[index], // Preserve existing properties
filePreview: filePreview // Update only the filePreview property
};
};
@ -123,15 +113,15 @@ public onFileChangedfiletrerst(event, index) {
}
}
}
onAddLinesfiletrerst(){
this.FileDatafiletrerst.push({
onAddLinesimagetest(){
this.FileDataimagetest.push({
uploadedfile_name: "",
filePreview: "",
// f3: "",
});
}
rowSelected :any= {};
deleteRowfiletrerst(index,id) {
deleteRowimagetest(index,id) {
// this.modalissue.removeAllBackdrops();
const row:any = {
index: index,
@ -140,11 +130,11 @@ public onFileChangedfiletrerst(event, index) {
this.rowSelected = row;
}
deletefiletrerst(index,id) {
this.FileDatafiletrerst.splice(index, 1);
deleteimagetest(index,id) {
this.FileDataimagetest.splice(index, 1);
if(id){
this.mainservice.uploadfiledeletefiletrerst(id).subscribe(data =>{
this.mainservice.uploadfiledelete(id).subscribe(data =>{
console.log(data);
})
}

View File

@ -1,6 +1,9 @@
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';
@ -124,6 +127,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,6 +1,9 @@
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';
@ -123,6 +126,15 @@ FormaaddComponent,
FormaComponent,
FormaeditComponent,
FormaaddComponent,
FormaComponent,