build_app

This commit is contained in:
string 2024-11-05 04:43:28 +00:00
parent 54b7eca028
commit afa6ba830e
18 changed files with 2214 additions and 0 deletions

@ -69,6 +69,9 @@ public class BuilderService {
executeDump(true);
// ADD OTHER SERVICE
addCustomMenu( "Formc", "Transcations");
System.out.println("dashboard and menu inserted...");

@ -0,0 +1,155 @@
package com.realnet.back.Controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.web.bind.annotation.CrossOrigin;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.realnet.config.EmailService;
import com.realnet.users.entity1.AppUser;
import com.realnet.users.service1.AppUserServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.data.domain.Pageable;
import org.springframework.beans.factory.annotation.*;
import com.realnet.back.Entity.Formc;
import com.realnet.back.Services.FormcService ;
@RequestMapping(value = "/Formc")
@CrossOrigin("*")
@RestController
public class FormcController {
@Autowired
private FormcService Service;
@Value("${projectPath}")
private String projectPath;
@PostMapping("/Formc")
public Formc Savedata(@RequestBody Formc data) {
Formc save = Service.Savedata(data) ;
System.out.println("data saved..." + save);
return save;
}
@PutMapping("/Formc/{id}")
public Formc update(@RequestBody Formc data,@PathVariable Integer id ) {
Formc update = Service.update(data,id);
System.out.println("data update..." + update);
return update;
}
// get all with pagination
@GetMapping("/Formc/getall/page")
public Page<Formc> getall(@RequestParam(value = "page", required = false) Integer page,
@RequestParam(value = "size", required = false) Integer size) {
Pageable paging = PageRequest.of(page, size);
Page<Formc> get = Service.getAllWithPagination(paging);
return get;
}
@GetMapping("/Formc")
public List<Formc> getdetails() {
List<Formc> get = Service.getdetails();
return get;
}
// get all without authentication
@GetMapping("/token/Formc")
public List<Formc> getallwioutsec() {
List<Formc> get = Service.getdetails();
return get;
}
@GetMapping("/Formc/{id}")
public Formc getdetailsbyId(@PathVariable Integer id ) {
Formc get = Service.getdetailsbyId(id);
return get;
}
@DeleteMapping("/Formc/{id}")
public void delete_by_id(@PathVariable Integer id ) {
Service.delete_by_id(id);
}
}

@ -0,0 +1,85 @@
package com.realnet.back.Entity;
import lombok.*;
import com.realnet.WhoColumn.Extension;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.*;
@Entity
@Data
public class Formc extends Extension {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String radios;
private boolean a;
private boolean b;
private String fileuploadtname;
private String fileuploadtpath ;
private String imageuploadtname;
private String imageuploadtpath ;
private String audiotname;
private String audiotpath ;
private String videotname;
private String videotpath ;
private String k;
private String l;
private String currencyt;
private String qrcodet;
private String barcodet;
}

@ -0,0 +1,35 @@
package com.realnet.back.Repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.*;
import com.realnet.back.Entity.Formc;
@Repository
public interface FormcRepository extends JpaRepository<Formc, Integer> {
}

@ -0,0 +1,174 @@
package com.realnet.back.Services;
import com.realnet.back.Repository.FormcRepository;
import com.realnet.back.Entity.Formc;import java.util.List;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import com.realnet.SequenceGenerator.Service.SequenceService;
import com.realnet.Notification.Entity.NotificationService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import com.realnet.users.service1.AppUserServiceImpl;
import org.springframework.http.HttpStatus;
import com.realnet.users.entity1.AppUser;
import org.springframework.stereotype.Service;
@Service
public class FormcService {
@Autowired
private FormcRepository Repository;
@Autowired
private AppUserServiceImpl userService;
public Formc Savedata(Formc data) {
Formc save = Repository.save(data);
return save;
}
// get all with pagination
public Page<Formc> getAllWithPagination(Pageable page) {
return Repository.findAll(page);
}
public List<Formc> getdetails() {
return (List<Formc>) Repository.findAll();
}
public Formc getdetailsbyId(Integer id) {
return Repository.findById(id).get();
}
public void delete_by_id(Integer id) {
Repository.deleteById(id);
}
public Formc update(Formc data,Integer id) {
Formc old = Repository.findById(id).get();
old.setRadios(data.getRadios());
old.setA(data.isA());
old.setB(data.isB());
old.setK(data.getK());
old.setL(data.getL());
old.setCurrencyt(data.getCurrencyt());
old.setQrcodet(data.getQrcodet());
old.setBarcodet(data.getBarcodet());
final Formc test = Repository.save(old);
return test;}
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;
}}

@ -0,0 +1,2 @@
CREATE TABLE db.Formc(id BIGINT NOT NULL AUTO_INCREMENT, a bit(1), imageuploadt VARCHAR(400), b bit(1), barcodet VARCHAR(400), currencyt VARCHAR(400), radios VARCHAR(400), audiot VARCHAR(400), videot VARCHAR(400), k VARCHAR(400), fileuploadt VARCHAR(400), l VARCHAR(400), qrcodet VARCHAR(400), PRIMARY KEY (id));

@ -0,0 +1,155 @@
<div class="dg-wrapper">
<div class="row">
<div class="col-2">
<h3>Formc </h3>&nbsp;
</div>
<div class="col-6">
<div class="input-group " style="width: 40%; margin-bottom: 10px;">
<span class="input-group-text" id="basic-addon2"><i class="bi bi-search"></i></span>
<input placeholder="Search" type="text" name="searchFilter" [(ngModel)]="searchFilter" class="form-control" aria-label="Recipient's username" aria-describedby="basic-addon2">
</div>
</div> <div class="col-4" style="text-align: right;">
<div class="btn-group" role="group" aria-label="Basic example">
<button type="button" class="btn btn-primary" (click)="goToAdd()">Add</button>
</div>
</div>
</div>
<div style="max-height: 500px; overflow: auto;">
<table class="table">
<thead class="table-primary">
<tr>
<th>Radios</th>
<th>a</th>
<th>b</th>
<th>audiot</th>
<th>Fieldgg</th>
<th>Currencyt</th>
<th>QRCodet</th>
<th>BarCodet</th>
<th>Action</th> </tr>
</thead>
<tbody>
<tr *ngFor="let data of givendata?.slice()?.reverse() | searchFilter:searchFilter; let i = index">
<td>{{data.radios}}</td>
<td>{{data.a}}</td>
<td>{{data.b}}</td>
<td>{{data.audiotname}}</td>
<td>{{data.fieldgg}}</td>
<td>{{data.currencyt}}</td>
<td>{{data.qrcodet}}</td>
<td>{{data.barcodet}}</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>
</tbody>
</table></div>
</div>
<div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" data-bs-backdrop="false">
<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>
<h2 class="heading">{{rowSelected.id}}</h2>
</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)="delete(rowSelected.id)">Delete</button>
</div>
</div>
</div>
</div>

@ -0,0 +1,4 @@
.delete,.heading{
text-align: center;
color: red;
}

@ -0,0 +1,100 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
import * as bootstrap from 'bootstrap';
import { FormcService } from './Formc.service';
import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'app-Formc',
templateUrl: './Formc.component.html',
styleUrls: ['./Formc.component.scss']
})
export class FormcComponent implements OnInit {
loading = false;
loading1=false;
public entryForm: FormGroup;
givendata;
orders;
modalAdd= false;
modaledit=false;
mcreate;
medit;
mdelete;
showdata;
error;
modaldelete=false;
rowSelected :any= {};
searchFilter;
constructor(
private _fb: FormBuilder,
private router: Router, private toastr:ToastrService,
private route: ActivatedRoute,
private mainservice:FormcService,
) {this.loading1 = true;
setTimeout(() => {
this.loading1 = false;
}, 1000); }
ngOnInit(): void {
this.getData();
}
getData(){
this.mainservice.getAll().subscribe((data) => {
console.log(data);
this.givendata = data;
if(this.givendata.length==0){
this.error="No data Available";
console.log(this.error)
}
},(error) => {
console.log(error);
if(error){
this.error="Server Error";
}
});
}
goToAdd() {
this.router.navigate(["../Formcadd"],{relativeTo:this.route});
}
goToEdit(id: any){
this.router.navigate(["../Formcedit/"+ id], { relativeTo: this.route });
}
onDelete(row) {
this.rowSelected = row;
this.modaldelete=true;
}
delete(id)
{
this.modaldelete = false;
console.log("in delete "+id);
this.mainservice.deleteusr(id).subscribe(
(data) => {
console.log(data);
this.ngOnInit();
if (data == null || data) {
this.toastr.success('Deleted successfully');
}
},
(error) => {
console.log('Error in adding data...',+error);
if(error){
this.toastr.error('Not Deleted Data Getting Some Error');
}
}
);
}
}

@ -0,0 +1,106 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { ApiRequestService } from 'src/app/services/api/api-request.service';
import baseUrl from 'src/app/services/api/helper';
@Injectable({
providedIn: 'root'
})
export class FormcService {
private baseURL = "Formc/Formc" ; constructor(private http: HttpClient, private apiRequest:ApiRequestService) { }
getAll(page?: number, size?: number): Observable<any> {
return this.apiRequest.get(this.baseURL);
}
getbyid(id: number): Observable<any> {
const _http = this.baseURL + "/" + id;
return this.apiRequest.get(_http);
}
create(data: any, file: any): Observable<any> {
const formData = new FormData();
formData.append('data', JSON.stringify(data));
formData.append('file', file);
return this.apiRequest.postFormData(this.baseURL, formData);
}
updatenew(id: number, data: any): Observable<any> {
const _http = this.baseURL + "/" + id;
return this.apiRequest.put(_http, data);
}
deleteusr(id: number): Observable<any> {
const _http = this.baseURL + "/" + id;
return this.apiRequest.delete(_http);
}
uploadfilefileuploadt(ref:any, Formc:any, file:any): Observable<any>{
const formData = new FormData();
formData.append('file', file);
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Formc}`, formData);
}
uploadfilegetByIdfileuploadt(ref:any, Formc:any,): Observable<any> {
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Formc}`);
}
uploadfiledeletefileuploadt(id: number): Observable<any> {
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
}
uploadImageuploadt(ref:any, Formc:any, file:any): Observable<any>{
const formData = new FormData();
formData.append('file', file);
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Formc}`, formData);
}
uploadImageuploadtgetById(ref:any, Formc:any,): Observable<any> {
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Formc}`);
}
uploadImageuploadtdelete(id: number): Observable<any> {
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
}
uploadAudiot(ref:any, Formc:any, file:any): Observable<any>{
const formData = new FormData();
formData.append('file', file);
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Formc}`, formData);
}
uploadAudiotgetById(ref:any, Formc:any,): Observable<any> {
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Formc}`);
}
uploadAudiotdelete(id: number): Observable<any> {
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
}
uploadVideot(ref:any, Formc:any, file:any): Observable<any>{
const formData = new FormData();
formData.append('file', file);
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Formc}`, formData);
}
uploadVideotgetById(ref:any, Formc:any,): Observable<any> {
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Formc}`);
}
uploadVideotdelete(id: number): Observable<any> {
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
}
// updateaction
}

@ -0,0 +1,255 @@
<h4 style="font-weight: 500;display: inline;"> Formc</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>radios</label>
<div class="form-check">
<input class="form-check-input" type="radio" formControlName="radios" id="flexRadioDefaultf" (change)="updateradios('f')" [checked]="entryForm.get('radios').value === 'f'">
<label class="form-check-label" for="flexRadioDefaultf"> f </label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" formControlName="radios" id="flexRadioDefaultm" (change)="updateradios('m')" [checked]="entryForm.get('radios').value === 'm'">
<label class="form-check-label" for="flexRadioDefaultm"> m </label>
</div>
</div>
<!-- multiselect checkbox field start -->
<div class="col-md-4 col-sm-12" style="max-height: 150px; overflow: auto;">
<label> checkboxs</label>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="a" formControlName="a" >
<label class="form-check-label" for="a">a</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="b" formControlName="b" >
<label class="form-check-label" for="b">b</label>
</div>
</div>
<!-- multiselect checkbox field end -->
<div class="col-md-4 col-sm-12">
<label>audiot</label><br>
<input type="file"accept="audio/*" (change)="onFileChanged($event)"/>
</div>
<div class="col-md-4 col-sm-12">
<label for="name"> fieldgg </label>
<input type="text" class="input" formControlName="fieldgg" >
<div *ngIf="submitted && entryForm.controls.fieldgg.errors" class="error_mess">
<div *ngIf="submitted && entryForm.controls.fieldgg.errors.required" class="error_mess">*This field is Required</div>
</div>
</div>
<!-- currency field start -->
<div class="col-md-4 col-sm-12">
<label> currencyt</label>
<input type="number" class="input" formControlName="currencyt" [value]="entryForm.value.currencyt | number:'1.2-2' | removeCommas">
</div>
<!-- currency field end -->
<!-- qrCode field start --> <div class="col-md-4 col-sm-12">
<label>qrcodet </label>
<input class="input" type="text" formControlName="qrcodet" />
<qrcode [qrdata]="entryForm.value.qrcodet ? entryForm.value.qrcodet : '' " [width]="135" [errorCorrectionLevel]="'M'" ></qrcode> </div>
<!-- qrCode field end -->
<!-- bar code field start -->
<div class="col-md-4 col-sm-12">
<label> barcodet </label>
<input type="text" class="input" formControlName="barcodet" (input)="generateBarcodebarcodet($event.target.value)" /> <svg id="barcodebarcodet"></svg>
</div> <!-- bar code field end -->
</div>
<h6> List of fileuploadt</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 FileDatafileuploadt; let i=index">
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
<td><input type="file" (change)="onFileChangedfileuploadt($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)="deleteRowfileuploadt(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)="onAddLinesfileuploadt()">
<i class="bi bi-plus"></i>
</button>
</table> </div>
<h6> List of imageuploadt</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 FileDataimageuploadt; let i=index">
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
<td><input type="file" (change)="onFileChangedimageuploadt($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)="deleteRowimageuploadt(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)="onAddLinesimageuploadt()">
<i class="bi bi-plus"></i>
</button>
</table> </div>
<h6> List of videot</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 FileDatavideot; let i=index">
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
<td><input type="file" (change)="onFileChangedvideot($event, i)" accept="video/*" /><!--accept=".mp4, .mpe4"-->
</td>
<td>{{attach.uploadedfile_name}}</td>
<td > <video *ngIf="attach.filePreview" [src]="attach.filePreview" width="100px" height="100px" controls></video> </td>
<td>
<a (click)="deleteRowvideot(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)="onAddLinesvideot()">
<i class="bi bi-plus"></i>
</button>
</table> </div>
</form>
<div class="modal-footer">
<button type="button" class="btn btn-outline" (click)="goback()">Cancel</button>
<button type="submit" class="btn btn-primary" (click)="onSubmit()">ADD</button>
</div>
</div>

@ -0,0 +1,63 @@
input[type=text],[type=date],[type=password],[type=number],[type=email],[type=url],[type=datetime-local],textarea {
width: 100%;
padding: 5px 20px;
// margin: 3px 0;
background-color:rgb(255, 255, 255);
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.required-field{
color: red;
font-size: 18px;
}
.green{
background-color: rgb(156, 231, 156);
color: black;
}
.blue{
background-color: #57abcf;//rgb(82, 87, 161);
color: black;
}
.td-title {
text-align: center;
width: 150px;
color: white;
font-weight: bold;
background-color: rgba(63, 122, 231, 0.863);
//color: rgb(24, 13, 13);
}
th{
background-color:rgb(170, 169, 169);
font-weight: bold;
}
.td-content{
text-align: left;
}
.delete,.heading{
text-align: center;
color: red;
}
.section p {
background-color: rgb(206, 201, 201);
padding: 10px;
font-size: 18px;
}
select{
width: 100%;
padding: 5px 5px;
border: 1px solid #ccc;
border-radius: 4px;
}
input.ng-invalid.ng-touched {
border-color: red;
}
.error_mess {
color: red;
}

@ -0,0 +1,335 @@
import { Component, OnInit } from '@angular/core';
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { ToastrService } from 'ngx-toastr';
import { AbstractControl, ValidationErrors } from '@angular/forms';
declare var JsBarcode: any;
import { AccesstypeService } from 'src/app/services/admin/accesstype.service';
import { FormcService } from '../Formc.service';
@Component({
selector: 'app-Formcadd',
templateUrl: './Formcadd.component.html',
styleUrls: ['./Formcadd.component.scss']
})
export class FormcaddComponent implements OnInit {
public entryForm: FormGroup;
loading = false;
tableName = 'Formc';
error;
submitted=false;
constructor(private _fb: FormBuilder,
private mainservice:FormcService,
private router: Router,private accesstype:AccesstypeService,
private route: ActivatedRoute,
private toastr: ToastrService ) { }
ngOnInit(): void {
this.entryForm = this._fb.group({
radios :[null],
a:[false],
b:[false],
fieldgg :[null],
currencyt : [null, { updateOn: 'blur' }],
qrcodet :[null],
barcodet :[null],
});
}
givendata;
getData(){
this.mainservice.getAll().subscribe((data) => {
console.log(data);
this.givendata = data;
},(error) => {
console.log(error);
});
}
onSubmit(){
this.submitted=true
if (this.entryForm.invalid) {
return;
}
console.log(this.entryForm.value);
this.mainservice.create(this.entryForm.value, this.selectedvideot).subscribe(data => {
console.log(data)
if (data || data.status >= 200 && data.status <= 299) {
this.toastr.success("Added Successfully");
}
},
(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.router.navigate(["../Formc"], { relativeTo: this.route });
}
goback(){
this.router.navigate(["../Formc"], { relativeTo: this.route });
}updateradios (radios : string): void {
this.entryForm.get('radios').setValue(radios); };
filePreviewfileuploadt: string | ArrayBuffer | null = null;
FileDatafileuploadt: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
selectedfileuploadt: File[]=[];
public onFileChangedfileuploadt(event, index) {
const files = event.target.files;
for (let i = 0; i < files.length; i++) {
const file = files[i];
this.FileDatafileuploadt[index].uploadedfile_name = files[i].name;
this.selectedfileuploadt.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.FileDatafileuploadt[index] = {
...this.FileDatafileuploadt[index], // Preserve existing properties
filePreview: filePreview // Update only the filePreview property
};
};
reader.readAsDataURL(file);
}
}
}
onAddLinesfileuploadt(){
this.FileDatafileuploadt.push({
uploadedfile_name: "",
filePreview: "",
// f3: "",
});
}
deleteRowfileuploadt(index,id) {
this.FileDatafileuploadt.splice(index, 1);
if(id){
this.mainservice.uploadfiledeletefileuploadt(id).subscribe(data =>{
console.log(data);
})
}
}
filePreviewimageuploadt: string | ArrayBuffer | null = null;
FileDataimageuploadt: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
selectedimageuploadt: File[]=[];
public onFileChangedimageuploadt(event, index) {
const files = event.target.files;
for (let i = 0; i < files.length; i++) {
const file = files[i];
this.FileDataimageuploadt[index].uploadedfile_name = files[i].name;
this.selectedimageuploadt.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.FileDataimageuploadt[index] = {
...this.FileDataimageuploadt[index], // Preserve existing properties
filePreview: filePreview // Update only the filePreview property
};
};
reader.readAsDataURL(file);
}
}
}
onAddLinesimageuploadt(){
this.FileDataimageuploadt.push({
uploadedfile_name: "",
filePreview: "",
// f3: "",
});
}
deleteRowimageuploadt(index,id) {
this.FileDataimageuploadt.splice(index, 1);
if(id){
this.mainservice.uploadfiledelete(id).subscribe(data =>{
console.log(data);
})
}
}
selectedaudiot: File[]=[]; public onFileChanged(event) {
console.log(event);
this.selectedaudiot = event.target.files[0];
}
filePreviewvideot: string | ArrayBuffer | null = null;
FileDatavideot: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
selectedvideot: File[]=[];
public onFileChangedvideot(event, index) {
const files = event.target.files;
for (let i = 0; i < files.length; i++) {
const file = files[i];
this.FileDatavideot[index].uploadedfile_name = files[i].name;
this.selectedvideot.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.FileDatavideot[index] = {
...this.FileDatavideot[index], // Preserve existing properties
filePreview: filePreview // Update only the filePreview property
};
};
reader.readAsDataURL(file);
}
}
}
onAddLinesvideot(){
this.FileDatavideot.push({
uploadedfile_name: "",
filePreview: "",
// f3: "",
});
}
deleteRowvideot(index,id) {
this.FileDatavideot.splice(index, 1);
if(id){
this.mainservice.uploadfiledelete(id).subscribe(data =>{
console.log(data);
})
}
}
//bar code field start
generateBarcodebarcodet(value) {
const barcodeValue = value;
const barcodeElement = document.getElementById("barcodebarcodet");
if (barcodeElement) { if (barcodeValue) {
JsBarcode(barcodeElement, barcodeValue, { format: "CODE128"
}); } else {
// Clear the barcode if the input is empty
barcodeElement.innerHTML = ''; } } }
// bar code field end
}

@ -0,0 +1,294 @@
<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>radios</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="radios" id="flexRadioDefaultf" (change)="updateradiosEdit('f')" [checked]="data1.radios === 'f'">
<label class="form-check-label" for="flexRadioDefaultf"> f </label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="radios" id="flexRadioDefaultm" (change)="updateradiosEdit('m')" [checked]="data1.radios === 'm'">
<label class="form-check-label" for="flexRadioDefaultm"> m </label>
</div>
</div>
<!-- multiselect checkbox field start -->
<div class="col-md-4 col-sm-12" style="max-height: 150px; overflow: auto;">
<label> checkboxs </label>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="a" name="a" [(ngModel)]="data1.a">
<label class="form-check-label" for="a">a</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="b" name="b" [(ngModel)]="data1.b">
<label class="form-check-label" for="b">b</label>
</div>
</div>
<!-- multiselect checkbox field end -->
<div class="col-md-4 col-sm-12">
<label for="name"> fieldgg</label>
<input type="text" class="input" name="fieldgg" [(ngModel)]="data1.fieldgg" >
</div>
<!-- currency field start -->
<div class="col-md-4 col-sm-12">
<label> currencyt </label>
<input type="number" class="input" [(ngModel)]="data1.currencyt" name="currencyt" (blur)="formatCurrencycurrencyt()" [value]="data1.currencyt | removeCommas">
</div>
<!-- currency field end -->
<!-- qrCode field start -->
<div class="col-md-4 col-sm-12">
<label> qrcodet </label>
<input class="input" type="text" name="qrcodet" [(ngModel)]="data1.qrcodet" />
<qrcode [qrdata]="data1.qrcodet ? data1.qrcodet : '' " [width]="135" [errorCorrectionLevel]="'M'"></qrcode>
</div>
<!-- qrCode field end -->
<!-- bar code field start -->
<div class="col-md-4 col-sm-12">
<label> barcodet </label>
<input type="text" class="input" name="barcodet" [(ngModel)]="data1.barcodet" (input)="generateBarcodebarcodet($event.target.value)" /> <svg id="barcodebarcodet"></svg>
</div> <!-- bar code field end -->
</div>
<h6> List of fileuploadt</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 FileDatafileuploadt; let i=index">
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
<td><input type="file" (change)="onFileChangedfileuploadt($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="#fileuploadtdeleteModal" (click)="deleteRowfileuploadt(i,attach.id)" style="cursor: pointer;">
</i>
</td>
</tr>
</tbody>
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesfileuploadt()">
<i class="bi bi-plus"></i>
</button>
</table> </div>
<h6> List of imageuploadt</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 FileDataimageuploadt; let i=index">
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
<td><input type="file" (change)="onFileChangedimageuploadt($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="#imageuploadtdeleteModal" (click)="deleteRowimageuploadt(i,attach.id)" style="cursor: pointer;">
</i>
</td>
</tr>
</tbody>
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesimageuploadt()">
<i class="bi bi-plus"></i>
</button>
</table> </div>
<h6> List of videot</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 FileDatavideot; let i=index">
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
<td><input type="file" (change)="onFileChangedvideot($event, i)" accept="image/*" />
</td>
<td>{{attach.uploadedfile_name}}</td>
<td > <video *ngIf="attach.filePreview" [src]="attach.filePreview" width="100px" height="100px" controls></video></td>
<td>
<i class="bi bi-trash is-error" data-bs-toggle="modal" data-bs-target="#videotdeleteModal" (click)="deleteRowvideot(i,attach.id)" style="cursor: pointer;">
</i>
</td>
</tr>
</tbody>
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesvideot()">
<i class="bi bi-plus"></i>
</button>
</table> </div>
</form>
<div class="modal-footer">
<button type="button" class="btn btn-outline" (click)="goback()">Close</button>
<button type="button" class="btn btn-primary" (click)="update()">Update</button>
</div>
</div>
<div class="modal fade" id="fileuploadtdeleteModal" 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)="deletefileuploadt(rowSelected.index,rowSelected.id)">Delete</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="imageuploadtdeleteModal" 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)="deleteimageuploadt(rowSelected.index,rowSelected.id)">Delete</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="videotdeleteModal" 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)="deletevideot(rowSelected.index,rowSelected.id)">Delete</button>
</div>
</div>
</div>
</div>

@ -0,0 +1,55 @@
input[type=text],[type=date],[type=password],[type=number],[type=email],[type=url],[type=datetime-local],textarea {
width: 100%;
padding: 5px 20px;
// margin: 3px 0;
background-color:rgb(255, 255, 255);
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.required-field{
color: red;
font-size: 18px;
}
.green{
background-color: rgb(156, 231, 156);
color: black;
}
.blue{
background-color: #57abcf;//rgb(82, 87, 161);
color: black;
}
.td-title {
text-align: center;
width: 150px;
color: white;
font-weight: bold;
background-color: rgba(63, 122, 231, 0.863);
//color: rgb(24, 13, 13);
}
th{
background-color:rgb(170, 169, 169);
font-weight: bold;
}
.td-content{
text-align: left;
}
.delete,.heading{
text-align: center;
color: red;
}
.section p {
background-color: rgb(206, 201, 201);
padding: 10px;
font-size: 18px;
}
select{
width: 100%;
padding: 5px 5px;
border: 1px solid #ccc;
border-radius: 4px;
}

@ -0,0 +1,369 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ToastrService } from 'ngx-toastr';
import { AbstractControl, ValidationErrors } from '@angular/forms';
declare var JsBarcode: any;
import { FormcService } from '../Formc.service';
@Component({
selector: 'app-Formcedit',
templateUrl: './Formcedit.component.html',
styleUrls: ['./Formcedit.component.scss']
})
export class FormceditComponent implements OnInit {
id:number;
data1:any={};
loading = false;
tableName = 'Formc';
error;
constructor( private route:ActivatedRoute,
private mainservice:FormcService,
private router: Router,
private toastr: ToastrService, ) { }
ngOnInit(): void {
this.id = this.route.snapshot.params["id"];
console.log("update with id = ", this.id);
this.getById(this.id);
//
// bar code field start
setTimeout(function(){
JsBarcode("#barcodebarcodet", this.data1?.barcodet);
}, 500);
// bar code field start
}
givendata;
getData(){
this.mainservice.getAll().subscribe((data) => {
console.log(data);
this.givendata = data;
},(error) => {
console.log(error);
});
}
getById(id:number){
this.mainservice.getbyid(id).subscribe((data)=>{
this.data1=data;
this.selectedfileuploadt = [];
this.mainservice.uploadfilegetByIdfileuploadt(data.id,this.tableName).subscribe(uploaddata =>{
console.log(uploaddata);
this.FileDatafileuploadt = uploaddata;
})
this.selectedimageuploadt = [];
this.mainservice.uploadfilegetById(data.id,this.tableName).subscribe(uploaddata =>{
console.log(uploaddata);
this.FileDataimageuploadt = uploaddata;
})
this.selectedvideot = [];
this.mainservice.uploadfilegetById(data.id,this.tableName).subscribe(uploaddata =>{
console.log(uploaddata);
this.FileDatavideot = uploaddata;
})
console.log(this.data1);
});
}
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.selectedfileuploadt.length; i++){
this.mainservice.uploadfilefileuploadt(data.id,this.tableName,this.selectedfileuploadt[i]).subscribe(uploaddata =>{
console.log(uploaddata);
})
}
for (let i = 0; i < this.selectedimageuploadt.length; i++){
this.mainservice.uploadimageuploadt(data.id,this.tableName,this.selectedimageuploadt[i]).subscribe(uploaddata =>{
console.log(uploaddata);
})
}
for (let i = 0; i < this.selectedvideot.length; i++){
this.mainservice.uploadfile(data.id,this.tableName,this.selectedvideot[i]).subscribe(uploaddata =>{
console.log(uploaddata);
})
}
this.router.navigate(["../../Formc"], { relativeTo: this.route });
},(error)=>{
console.log(error); if (error.status >= 200 && error.status <= 299) {
// this.toastr.success("update Succesfully");
}
if (error.status >= 400 && error.status <= 499) {
this.toastr.error("Not Updated");
}
if (error.status >= 500 && error.status <= 599) {
this.toastr.error("Not Updated");
}
});
}
goback(){
this.router.navigate(["../../Formc"], { relativeTo: this.route });
}updateradiosEdit(radios : string): void { this.data1.radios = radios }
filePreviewfileuploadt: string | ArrayBuffer | null = null;
FileDatafileuploadt: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
selectedfileuploadt: File[]=[];
public onFileChangedfileuploadt(event, index) {
const files = event.target.files;
for (let i = 0; i < files.length; i++) {
const file = files[i];
this.FileDatafileuploadt[index].uploadedfile_name = files[i].name;
this.selectedfileuploadt.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.FileDatafileuploadt[index] = {
...this.FileDatafileuploadt[index], // Preserve existing properties
filePreview: filePreview // Update only the filePreview property
};
};
reader.readAsDataURL(file);
}
}
}
onAddLinesfileuploadt(){
this.FileDatafileuploadt.push({
uploadedfile_name: "",
filePreview: "",
// f3: "",
});
}
rowSelected :any= {};
deleteRowfileuploadt(index,id) {
// this.modalissue.removeAllBackdrops();
const row:any = {
index: index,
id: id
}
this.rowSelected = row;
}
deletefileuploadt(index,id) {
this.FileDatafileuploadt.splice(index, 1);
if(id){
this.mainservice.uploadfiledeletefileuploadt(id).subscribe(data =>{
console.log(data);
})
}
}
filePreviewimageuploadt: string | ArrayBuffer | null = null;
FileDataimageuploadt: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
selectedimageuploadt: File[]=[];
public onFileChangedimageuploadt(event, index) {
const files = event.target.files;
for (let i = 0; i < files.length; i++) {
const file = files[i];
this.FileDataimageuploadt[index].uploadedfile_name = files[i].name;
this.selectedimageuploadt.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.FileDataimageuploadt[index] = {
...this.FileDataimageuploadt[index], // Preserve existing properties
filePreview: filePreview // Update only the filePreview property
};
};
reader.readAsDataURL(file);
}
}
}
onAddLinesimageuploadt(){
this.FileDataimageuploadt.push({
uploadedfile_name: "",
filePreview: "",
// f3: "",
});
}
rowSelected :any= {};
deleteRowimageuploadt(index,id) {
// this.modalissue.removeAllBackdrops();
const row:any = {
index: index,
id: id
}
this.rowSelected = row;
}
deleteimageuploadt(index,id) {
this.FileDataimageuploadt.splice(index, 1);
if(id){
this.mainservice.uploadfiledelete(id).subscribe(data =>{
console.log(data);
})
}
}
filePreviewvideot: string | ArrayBuffer | null = null;
FileDatavideot: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
selectedvideot: File[]=[];
public onFileChangedvideot(event, index) {
const files = event.target.files;
for (let i = 0; i < files.length; i++) {
const file = files[i];
this.FileDatavideot[index].uploadedfile_name = files[i].name;
this.selectedvideot.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.FileDatavideot[index] = {
...this.FileDatavideot[index], // Preserve existing properties
filePreview: filePreview // Update only the filePreview property
};
};
reader.readAsDataURL(file);
}
}
}
onAddLinesvideot(){
this.FileDatavideot.push({
uploadedfile_name: "",
filePreview: "",
// f3: "",
});
}
rowSelected :any= {};
deleteRowvideot(index,id) {
this.modalissue.removeAllBackdrops();
const row:any = {
index: index,
id: id
}
this.rowSelected = row;
}
deletevideot(index,id) {
this.FileDatavideot.splice(index, 1);
if(id){
this.mainservice.uploadfiledelete(id).subscribe(data =>{
console.log(data);
})
}
}
//currency field start
formatCurrencycurrencyt () {
// Format the currency with two decimal places
this.data1.currencyt = Number(this.data1.currencyt ).toFixed(2);
// Remove commas from the formatted currency
this.data1.currencyt = this.data1.currencyt?.replace(/,/g, ''); }
//currency field end
//bar code field start
generateBarcodebarcodet(value) {
const barcodeValue = value;
const barcodeElement = document.getElementById("barcodebarcodet");
if (barcodeElement) { if (barcodeValue) {
JsBarcode(barcodeElement, barcodeValue, { format: "CODE128"
}); } else {
// Clear the barcode if the input is empty
barcodeElement.innerHTML = ''; } } }
// bar code field end
}

@ -1,3 +1,6 @@
import { FormceditComponent } from './BuilderComponents/back/Formc/Formcedit/Formcedit.component';
import { FormcaddComponent } from './BuilderComponents/back/Formc/Formcadd/Formcadd.component';
import { FormcComponent } from './BuilderComponents/back/Formc/Formc.component';
import { Component, NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
@ -103,6 +106,15 @@ const routes: Routes = [
},
// buildercomponents
{path:'Formcedit/:id',component:FormceditComponent},
{path:'Formcadd',component:FormcaddComponent},
{path:'Formc',component:FormcComponent},
{

@ -1,3 +1,6 @@
import { FormceditComponent } from './BuilderComponents/back/Formc/Formcedit/Formcedit.component';
import { FormcaddComponent } from './BuilderComponents/back/Formc/Formcadd/Formcadd.component';
import { FormcComponent } from './BuilderComponents/back/Formc/Formc.component';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
@ -99,6 +102,15 @@ import { SearchFilterPipe } from 'src/app/pipes/search-filter.pipe';
MenumaintanceComponent, OauthComponent, QueryComponent, SubmenuComponent, AccesstypeComponent, ModulesComponent, SessionloggerComponent, LogreaderComponent, ExceptionComponent, AuditreportComponent, AudithistoryComponent,
// buildercomponents
FormceditComponent,
FormcaddComponent,
FormcComponent,