build_app

This commit is contained in:
string 2024-11-05 04:12:08 +00:00
parent e465f529b7
commit abfae4f08b
18 changed files with 1992 additions and 0 deletions

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

@ -0,0 +1,187 @@
package com.realnet.basicp1.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.basicp1.Entity.Formb;
import com.realnet.basicp1.Services.FormbService ;
@RequestMapping(value = "/Formb")
@CrossOrigin("*")
@RestController
public class FormbController {
@Autowired
private FormbService Service;
@Value("${projectPath}")
private String projectPath;
@PostMapping("/Formb")
public Formb Savedata(@RequestBody Formb data) {
Formb save = Service.Savedata(data) ;
System.out.println("data saved..." + save);
return save;
}
@PutMapping("/Formb/{id}")
public Formb update(@RequestBody Formb data,@PathVariable Integer id ) {
Formb update = Service.update(data,id);
System.out.println("data update..." + update);
return update;
}
// get all with pagination
@GetMapping("/Formb/getall/page")
public Page<Formb> getall(@RequestParam(value = "page", required = false) Integer page,
@RequestParam(value = "size", required = false) Integer size) {
Pageable paging = PageRequest.of(page, size);
Page<Formb> get = Service.getAllWithPagination(paging);
return get;
}
@GetMapping("/Formb")
public List<Formb> getdetails() {
List<Formb> get = Service.getdetails();
return get;
}
// get all without authentication
@GetMapping("/token/Formb")
public List<Formb> getallwioutsec() {
List<Formb> get = Service.getdetails();
return get;
}
@GetMapping("/Formb/{id}")
public Formb getdetailsbyId(@PathVariable Integer id ) {
Formb get = Service.getdetailsbyId(id);
return get;
}
@DeleteMapping("/Formb/{id}")
public void delete_by_id(@PathVariable Integer id ) {
Service.delete_by_id(id);
}
}

@ -0,0 +1,82 @@
package com.realnet.basicp1.Entity;
import lombok.*;
import com.realnet.WhoColumn.Extension;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.*;
@Entity
@Data
public class Formb extends Extension {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String textf;
private int numberg;
private String phoneg;
@Column(length = 2000)
private String paragraphg;
private String passwordg;
@Transient
private String confirmpasswordg;
@Column(length = 2000)
private String textareag;
private String dateg;
private String datetimey;
private String emailg;
private boolean toggler;
private String urlg;
private int decimalh;
private int percentages;
private String recaptchad;
}

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

@ -0,0 +1,195 @@
package com.realnet.basicp1.Services;
import com.realnet.basicp1.Repository.FormbRepository;
import com.realnet.basicp1.Entity.Formb;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 FormbService {
@Autowired
private FormbRepository Repository;
@Autowired
private AppUserServiceImpl userService;
public Formb Savedata(Formb data) {
Formb save = Repository.save(data);
return save;
}
// get all with pagination
public Page<Formb> getAllWithPagination(Pageable page) {
return Repository.findAll(page);
}
public List<Formb> getdetails() {
return (List<Formb>) Repository.findAll();
}
public Formb getdetailsbyId(Integer id) {
return Repository.findById(id).get();
}
public void delete_by_id(Integer id) {
Repository.deleteById(id);
}
public Formb update(Formb data,Integer id) {
Formb old = Repository.findById(id).get();
old.setTextf(data.getTextf());
old.setNumberg(data.getNumberg());
old.setPhoneg(data.getPhoneg());
old.setParagraphg(data.getParagraphg());
old.setPasswordg(data.getPasswordg());
old.setTextareag(data.getTextareag());
old.setDateg(data.getDateg());
old.setDatetimey(data.getDatetimey());
old.setEmailg(data.getEmailg());
old.setToggler (data.isToggler());
old.setUrlg(data.getUrlg());
old.setDecimalh(data.getDecimalh());
old.setPercentages(data.getPercentages());
old.setRecaptchad(data.getRecaptchad());
final Formb test = Repository.save(old);
return test;}
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;
}}

@ -0,0 +1,2 @@
CREATE TABLE db.Formb(id BIGINT NOT NULL AUTO_INCREMENT, datetimey VARCHAR(400), paragraphg VARCHAR(400), percentages int, numberg int, toggler VARCHAR(400), emailg VARCHAR(400), phoneg VARCHAR(400), recaptchad VARCHAR(400), urlg VARCHAR(400), passwordg VARCHAR(400), dateg Date, textf VARCHAR(400), textareag VARCHAR(400), decimalh int, PRIMARY KEY (id));

@ -0,0 +1,205 @@
<div class="dg-wrapper">
<div class="row">
<div class="col-2">
<h3>Formb </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>Textf</th>
<th>Numberg</th>
<th>Phoneg</th>
<th>Paragraphg</th>
<th>Passwordg</th>
<th>Textareag</th>
<th>Dateg</th>
<th>Datetimey</th>
<th>Emailg</th>
<th>toggler</th>
<th>Urlg</th>
<th>Decimalh</th>
<th>Percentages</th>
<th>recaptchad</th>
<th>Action</th> </tr>
</thead>
<tbody>
<tr *ngFor="let data of givendata?.slice()?.reverse() | searchFilter:searchFilter; let i = index">
<td>{{data.textf}}</td>
<td>{{data.numberg}}</td>
<td>{{data.phoneg}}</td>
<td (click)="goToReplaceStringparagraphg(data.paragraphg)" data-bs-toggle="modal" data-bs-target="#paragraphgModal" style="cursor: pointer; align-items: center;"><i class="bi bi-card-text"></i></td>
<td>{{data.passwordg}}</td>
<td (click)="goToReplaceStringtextareag(data.textareag)" data-bs-toggle="modal" data-bs-target="#textareagModal" style="cursor: pointer; align-items: center;"><i class="bi bi-card-text"></i></td>
<td>{{data.dateg}}</td>
<td>{{data.datetimey}}</td>
<td>{{data.emailg}}</td>
<td>{{data.toggler}}</td>
<td (click)="goToUrl(data.urlg)" style="cursor: pointer; color: rgb(108, 108, 194);">{{data.urlg}}</td>
<td>{{data.decimalh}}</td>
<td>{{data.percentages}}</td>
<td>{{data.recaptchad}}</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>
<div class="modal fade" id="paragraphgModal" 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>
<div class="modal fade" id="textareagModal" 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>

@ -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 { FormbService } from './Formb.service';
import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'app-Formb',
templateUrl: './Formb.component.html',
styleUrls: ['./Formb.component.scss']
})
export class FormbComponent 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:FormbService,
) {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(["../Formbadd"],{relativeTo:this.route});
}
goToEdit(id: any){
this.router.navigate(["../Formbedit/"+ 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,58 @@
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 FormbService {
private baseURL = "Formb/Formb" ; 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): Observable<any> {
return this.apiRequest.post(this.baseURL, data);
}
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);
}
// updateaction
}

@ -0,0 +1,205 @@
<h4 style="font-weight: 500;display: inline;"> Formb</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"> textf </label>
<input type="text" class="input" formControlName="textf" >
<div *ngIf="submitted && entryForm.controls.textf.errors" class="error_mess">
<div *ngIf="submitted && entryForm.controls.textf.errors.required" class="error_mess">*This field is Required</div>
</div>
</div>
<div class="col-md-4 col-sm-12">
<label> numberg </label>
<input class="input" type="number" formControlName="numberg" />
<div *ngIf="submitted && entryForm.controls.numberg.errors" class="error_mess">
<div *ngIf="submitted && entryForm.controls.numberg.errors.required" class="error_mess">*This field is Required</div>
</div>
</div>
<div class="col-md-4 col-sm-12">
<label> phoneg</label>
<input class="input" type="text" formControlName="phoneg" pattern="((\+)?([1-9]{2}))?[1-9]{1}[0-9]{9}$" />
<div *ngIf="entryForm.controls['phoneg'].errors" class="error_mess">
<div *ngIf="entryForm.controls['phoneg'].hasError('pattern')" class="error_mess">* Please Follow your pattern,+91 Enter 10 digit Mobile Number.
</div> </div> </div>
<div class="col-md-4 col-sm-12">
<label>paragraphg</label>
<input class="form-control" type="Text" formControlName="paragraphg" style="border: none; outline: none; height:33px !important;" />
</div>
<div class="col-md-4 col-sm-12">
<label>passwordg</label><br>
<div><input class="input" style="width: 93% !important;" [type]="newaddpHidepasswordg ? 'password': 'text'" formControlName="passwordg" autocomplete >&nbsp;
<i [attr.class]="'bi bi-'+newaddIconpasswordg" (click)="newaddChangerpasswordg()"></i></div>
</div>
<div class="col-md-4 col-sm-12">
<label>confirmpasswordg</label><br>
<input type="password" class="input" formControlName="confirmpasswordg" autocomplete >
<div *ngIf="entryForm.controls.confirmpasswordg.errors" class="error_mess">
<div *ngIf="entryForm.controls.confirmpasswordg.errors.confirmedValidator" class="error_mess">* Password and Confirm Password must be match.</div>
</div>
</div>
<div class="col-md-4 col-sm-12">
<label> textareag</label>
<textarea cols="10" rows="2" formControlName="textareag" placeholder="Textarea"> </textarea>
</div>
<div class="col-md-4 col-sm-12">
<label> dateg </label>
<input class="input" type="date" formControlName="dateg" />
</div>
<div class="col-md-4 col-sm-12">
<label for="name"> datetimey </label>
<input type="text" class="input" formControlName="datetimey" >
<div *ngIf="submitted && entryForm.controls.datetimey.errors" class="error_mess">
<div *ngIf="submitted && entryForm.controls.datetimey.errors.required" class="error_mess">*This field is Required</div>
</div>
</div>
<div class="col-md-4 col-sm-12">
<label> emailg </label>
<input class="input" type="email" formControlName="emailg" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$">
<div *ngIf="entryForm.controls['emailg'].errors" class="error_mess">
<div *ngIf="entryForm.controls['emailg'].hasError('pattern')" class="error_mess">* Email must be a valid email address
</div> </div>
</div>
<div class="col-md-4 col-sm-12">
<label class="form-check-label" for="flexSwitchCheckDefaulttoggler"> toggler</label> <br>
<div class="form-check form-switch"> <input class="form-check-input" type="checkbox" id="flexSwitchCheckDefaulttoggler" formControlName="toggler"> </div>
</div>
<div class="col-md-4 col-sm-12">
<label> urlg </label>
<input type="url" formControlName="urlg" placeholder="Enter URL" class="input" pattern="https?://.+">
<div *ngIf="entryForm.controls['urlg'].errors" class="error_mess">
<div *ngIf="entryForm.controls['urlg'].hasError('pattern')" class="error_mess"> * Please enter a valid URL.</div>
</div> </div>
<div class="col-md-4 col-sm-12">
<label> decimalh </label>
<input class="input" type="number" formControlName="decimalh" />
<div *ngIf="submitted && entryForm.controls.decimalh.errors" class="error_mess">
<div *ngIf="submitted && entryForm.controls.decimalh.errors.required" class="error_mess">*This field is Required</div>
</div>
</div>
<div class="col-md-4 col-sm-12">
<label> percentages </label>
<input class="input" type="number" formControlName="percentages" />
<div *ngIf="submitted && entryForm.controls.percentages.errors" class="error_mess">
<div *ngIf="submitted && entryForm.controls.percentages.errors.required" class="error_mess">*This field is Required</div>
</div>
</div>
<div class="col-md-4 col-sm-12">
<div><label> recaptchad</label> &nbsp;<b style="background-color: yellow;">{{ recaptchadCode }}</b> &nbsp; <button class="btn btn-icon btn-primary btn-sm" (click)="generaterecaptchad()"><i class="bi bi-arrow-clockwise"></i> </button></div>
<input type="text" formControlName="recaptchad" class="input">
<div *ngIf="submitted && entryForm.controls.recaptchad.errors.required" class="error_mess">*This field is Required</div>
<div *ngIf="submitted && entryForm.get('recaptchad').errors && entryForm.get('recaptchad').dirty" class="error_mess">
<div *ngIf="entryForm.controls['recaptchad'].hasError('recaptchadMismatch')" class="error_mess"> recaptchad not valid.</div>
</div>
</div>
</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,326 @@
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 { FormbService } from '../Formb.service';
@Component({
selector: 'app-Formbadd',
templateUrl: './Formbadd.component.html',
styleUrls: ['./Formbadd.component.scss']
})
export class FormbaddComponent implements OnInit {
public entryForm: FormGroup;
loading = false;
tableName = 'Formb';
error;
submitted=false;
constructor(private _fb: FormBuilder,
private mainservice:FormbService,
private router: Router,private accesstype:AccesstypeService,
private route: ActivatedRoute,
private toastr: ToastrService ) { }
ngOnInit(): void {
this.entryForm = this._fb.group({
textf :[null],
numberg : [null,[Validators.required]],
phoneg: ['+91'],
paragraphg :[null],
passwordg : [null],
confirmpasswordg : [null],
textareag :[null],
dateg :[null],
datetimey :[null],
emailg :[null],
toggler :[false],
urlg :[null],
decimalh : [null,[Validators.required]],
percentages : [null,[Validators.required]],
recaptchad : [null, [Validators.required,this.checkrecaptchad.bind(this)]],
}, {
validator: ConfirmedValidator('passwordg', 'confirmpasswordg')
});
this.generaterecaptchad();
}
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).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(["../Formb"], { relativeTo: this.route });
}
goback(){
this.router.navigate(["../Formb"], { relativeTo: this.route });
}
newpHidepasswordg: boolean = true;
newIconpasswordg: string = "eye";
newShapeChangerpasswordg() {
this.newpHidepasswordg = !this.newpHidepasswordg;
if(this.newpHidepasswordg){
this.newIconpasswordg = 'eye' } else { this.newIconpasswordg = 'eye-slash' }
}
newaddpHidepasswordg: boolean = true;
newaddIconpasswordg: string = "eye";
newaddChangerpasswordg() { this.newaddpHidepasswordg = !this.newaddpHidepasswordg;
if(this.newaddpHidepasswordg){ this.newaddIconpasswordg = 'eye' } else {
this.newaddIconpasswordg = 'eye-slash' } }
isValidEmail(email: string): boolean {
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
return emailPattern.test(email); }
isValidURL(url: string): boolean {
return /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/.test(url); }
recaptchadCode = '';
generaterecaptchad (): void {
const possibleCharacters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const codeLength = 6; // Change to desired length
let recaptchad= '';
for (let i = 0; i < codeLength; i++) {
const randomIndex = Math.floor(Math.random() * possibleCharacters.length);
recaptchad += possibleCharacters.charAt(randomIndex);
}
this.recaptchadCode = recaptchad;
}
checkrecaptchad(control: AbstractControl): ValidationErrors | null {
if (control.value !== this.recaptchadCode) {
return { recaptchadMismatch: true };
}
return null;
}
recaptchadMismatch = false;
}
export function ConfirmedValidator(controlName: string, matchingControlName: string){
return (formGroup: FormGroup) => {
const control = formGroup.controls[controlName];
const matchingControl = formGroup.controls[matchingControlName];
if (matchingControl.errors && !matchingControl.errors.confirmedValidator) {
return;
}
if (control.value !== matchingControl.value) {
matchingControl.setErrors({ confirmedValidator: true });
} else {
matchingControl.setErrors(null);
}
}
}

@ -0,0 +1,181 @@
<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"> textf</label>
<input type="text" class="input" name="textf" [(ngModel)]="data1.textf" >
</div>
<div class="col-md-4 col-sm-12">
<label>numberg </label>
<input class="input" type="number" [(ngModel)]="data1.numberg" name="numberg" />
</div>
<div class="col-md-4 col-sm-12">
<label> phoneg</label>
<input class="input" type="text" [(ngModel)]="data1.phoneg" name="phoneg" pattern="((\\+)?([1-9]{2}))?[1-9]{1}[0-9]{9}$" />
<div *ngIf="data1.phoneg && !isValidPhone(data1.phoneg)" class="error_mess">
* Please Follow your pattern,+91 Enter 10 digit Mobile Number.
</div> </div>
<div class="col-md-4 col-sm-12">
<label> paragraphg</label>
<input type="Text" class="form-control" style="border: none; outline: none; height:33px !important;" [(ngModel)]="data1.paragraphg" name="paragraphg" /> </div>
<div class="col-md-4 col-sm-12">
<label> passwordg</label><br>
<div><input [type]="newpHidepasswordg ? 'password': 'text'" class="clr-input" style="width: 93% !important;" [(ngModel)]="data1.passwordg" name="passwordg" autocomplete >&nbsp;
<i [attr.class]="'bi bi-'+newIconpasswordg" (click)="newShapeChangerpasswordg()"></i></div>
</div>
<div class="col-md-4 col-sm-12">
<label> textareag</label>
<textarea cols="10" rows="2" [(ngModel)]="data1.textareag" name="textareag " placeholder="Textarea"> </textarea>
</div>
<div class="col-md-4 col-sm-12">
<label>dateg </label>
<input class="input" type="date" [(ngModel)]="data1.dateg" name="dateg" />
</div>
<div class="col-md-4 col-sm-12">
<label for="name"> datetimey</label>
<input type="text" class="input" name="datetimey" [(ngModel)]="data1.datetimey" >
</div>
<div class="col-md-4 col-sm-12">
<label> emailg</label>
<input class="input" type="email"
[(ngModel)]="data1.emailg " name="emailg" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$">
<div *ngIf="data1.emailg && !isValidEmail(data1.emailg )" class="error_mess">
* Email must be a valid email address.
</div> </div>
<div class="col-md-4 col-sm-12">
<label class="form-check-label" for="flexSwitchCheckDefaulttoggler"> toggler</label> <br>
<div class="form-check form-switch"> <input class="form-check-input" type="checkbox" id="flexSwitchCheckDefaulttoggler" name="toggler" [(ngModel)]="data1.toggler"> </div>
</div>
<div class="col-md-4 col-sm-12">
<label> urlg </label>
<input type="url" name="urlg" [(ngModel)]="data1.urlg" placeholder="Enter URL" class="input" pattern="https?://.+">
<div *ngIf="!isValidURL(data1.urlg )" class="error_mess"> * Please enter a valid URL. </div> </div>
<div class="col-md-4 col-sm-12">
<label>decimalh </label>
<input class="input" type="number" [(ngModel)]="data1.decimalh" name="decimalh" />
</div>
<div class="col-md-4 col-sm-12">
<label>percentages </label>
<input class="input" type="number" [(ngModel)]="data1.percentages" name="percentages" />
</div>
<div class="col-md-4 col-sm-12">
<div><label> recaptchad</label> &nbsp;<b style="background-color: yellow;">{{ recaptchadCode }}</b> &nbsp; <button class="btn btn-icon btn-primary btn-sm" (click)="generaterecaptchad()">
<i class="bi bi-arrow-clockwise"></i> </button></div>
<input type="text" name="recaptchad" [(ngModel)]="data1.recaptchad" (ngModelChange)="checkrecaptchadEdit()" class="input">
<div *ngIf=" recaptchadMismatch" class="error_mess">
<div class="error_mess"> recaptchad not valid.</div>
</div>
</div>
</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>

@ -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,259 @@
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 { FormbService } from '../Formb.service';
@Component({
selector: 'app-Formbedit',
templateUrl: './Formbedit.component.html',
styleUrls: ['./Formbedit.component.scss']
})
export class FormbeditComponent implements OnInit {
id:number;
data1:any={};
loading = false;
tableName = 'Formb';
error;
constructor( private route:ActivatedRoute,
private mainservice:FormbService,
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);
//
this.generaterecaptchad();
}
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;
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");
}
this.router.navigate(["../../Formb"], { 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(["../../Formb"], { relativeTo: this.route });
}
isValidPhone(phone: string): boolean {
const phonePattern = /^(\+[1-9][0-9]{0,2})?[1-9][0-9]{9}$/;
return phonePattern.test(phone);
}
newpHidepasswordg: boolean = true;
newIconpasswordg: string = "eye";
newShapeChangerpasswordg() {
this.newpHidepasswordg = !this.newpHidepasswordg;
if(this.newpHidepasswordg){
this.newIconpasswordg = 'eye' } else { this.newIconpasswordg = 'eye-slash' }
}
newaddpHidepasswordg: boolean = true;
newaddIconpasswordg: string = "eye";
newaddChangerpasswordg() { this.newaddpHidepasswordg = !this.newaddpHidepasswordg;
if(this.newaddpHidepasswordg){ this.newaddIconpasswordg = 'eye' } else {
this.newaddIconpasswordg = 'eye-slash' } }
isValidEmail(email: string): boolean {
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
return emailPattern.test(email); }
isValidURL(url: string): boolean {
return /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/.test(url); }
goToUrl(val){ window.open(val) }
recaptchadCode = '';
generaterecaptchad (): void {
const possibleCharacters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const codeLength = 6; // Change to desired length
let recaptchad= '';
for (let i = 0; i < codeLength; i++) {
const randomIndex = Math.floor(Math.random() * possibleCharacters.length);
recaptchad += possibleCharacters.charAt(randomIndex);
}
this.recaptchadCode = recaptchad;
}
checkrecaptchad(control: AbstractControl): ValidationErrors | null {
if (control.value !== this.recaptchadCode) {
return { recaptchadMismatch: true };
}
return null;
}
recaptchadMismatch = false;
checkrecaptchadEdit(): void {
if (this.data1.recaptchad !== this. recaptchadCode) {
this. recaptchadMismatch = true; } else { this.recaptchadMismatch = false; } }
}

@ -1,3 +1,6 @@
import { FormbeditComponent } from './BuilderComponents/basicp1/Formb/Formbedit/Formbedit.component';
import { FormbaddComponent } from './BuilderComponents/basicp1/Formb/Formbadd/Formbadd.component';
import { FormbComponent } from './BuilderComponents/basicp1/Formb/Formb.component';
import { Component, NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
@ -103,6 +106,15 @@ const routes: Routes = [
},
// buildercomponents
{path:'Formbedit/:id',component:FormbeditComponent},
{path:'Formbadd',component:FormbaddComponent},
{path:'Formb',component:FormbComponent},
{

@ -1,3 +1,6 @@
import { FormbeditComponent } from './BuilderComponents/basicp1/Formb/Formbedit/Formbedit.component';
import { FormbaddComponent } from './BuilderComponents/basicp1/Formb/Formbadd/Formbadd.component';
import { FormbComponent } from './BuilderComponents/basicp1/Formb/Formb.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
FormbeditComponent,
FormbaddComponent,
FormbComponent,