build_app

This commit is contained in:
risadmin_prod 2024-08-14 10:43:10 +00:00
parent 034e94c5b5
commit be898379ed
18 changed files with 943 additions and 0 deletions

View File

@ -46,6 +46,9 @@ public class BuilderService {
public void callotherService() {
// ADD OTHER SERVICE
addCustomMenu( "Name", "Transcations");

View File

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

View File

@ -0,0 +1,34 @@
package com.realnet.test13.Entity;
import lombok.*;
import com.realnet.WhoColumn.Extension;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.*;
@Entity
@Data
public class Name extends Extension {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
@Column(length = 2000)
private String description;
private boolean active;
}

View File

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

View File

@ -0,0 +1,76 @@
package com.realnet.test13.Services;
import com.realnet.test13.Repository.NameRepository;
import com.realnet.test13.Entity.Name;import java.util.List;
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 com.realnet.users.service1.AppUserServiceImpl;
import com.realnet.users.entity1.AppUser;
import org.springframework.stereotype.Service;
@Service
public class NameService {
@Autowired
private NameRepository Repository;
@Autowired
private AppUserServiceImpl userService;
public Name Savedata(Name data) {
Name save = Repository.save(data);
return save;
}
// get all with pagination
public Page<Name> getAllWithPagination(Pageable page) {
return Repository.findAll(page);
}
public List<Name> getdetails() {
return (List<Name>) Repository.findAll();
}
public Name getdetailsbyId(Integer id) {
return Repository.findById(id).get();
}
public void delete_by_id(Integer id) {
Repository.deleteById(id);
}
public Name update(Name data,Integer id) {
Name old = Repository.findById(id).get();
old.setName(data.getName());
old.setDescription(data.getDescription());
old.setActive (data.isActive());
final Name test = Repository.save(old);
return test;}
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;
}}

View File

@ -0,0 +1,2 @@
CREATE TABLE test1308-db.Name(id BIGINT NOT NULL AUTO_INCREMENT, Active VARCHAR(400), Description VARCHAR(400), Name VARCHAR(400), PRIMARY KEY (id));

View File

@ -0,0 +1,103 @@
<div class="dg-wrapper">
<div class="row">
<div class="col-2">
<h3>Name </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>Name</th>
<th>Description</th>
<th>Active</th>
<th>Action</th> </tr>
</thead>
<tbody>
<tr *ngFor="let data of givendata?.slice()?.reverse() | filter:searchFilter; let i = index">
<td>{{data.name}}</td>
<td (click)="goToReplaceStringdescription(data.description)" data-bs-toggle="modal" data-bs-target="#descriptionModal" style="cursor: pointer; align-items: center;"><i class="bi bi-card-text"></i></td>
<td>{{data.active}}</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">
<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="descriptionModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<textarea class="form-control" style="width:100%; height: 400px;" readonly>{{rowSelected}}</textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

View File

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

View File

@ -0,0 +1,109 @@
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 { NameService } from './Name.service';
import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'app-Name',
templateUrl: './Name.component.html',
styleUrls: ['./Name.component.scss']
})
export class NameComponent 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:NameService,
) {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(["../Nameadd"],{relativeTo:this.route});
}
goToEdit(id: any){
this.router.navigate(["../Nameedit/"+ 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');
}
}
);
}
goToReplaceStringdescription(row){
this.modalissue.removeAllBackdrops();
this.rowSelected= row; }
}

View File

@ -0,0 +1,36 @@
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 NameService {
private baseURL = "Name/Name" ; 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
}

View File

@ -0,0 +1,53 @@
<h4 style="font-weight: 500;display: inline;"> Name</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="col-md-4 col-sm-12">
<label> description</label>
<textarea cols="10" rows="2" formControlName="description" placeholder="Textarea"> </textarea>
</div>
<div class="col-md-4 col-sm-12">
<label class="form-check-label" for="flexSwitchCheckDefaultactive"> active</label> <br>
<div class="form-check form-switch"> <input class="form-check-input" type="checkbox" id="flexSwitchCheckDefaultactive" formControlName="active"> </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>

View File

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

View File

@ -0,0 +1,119 @@
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 { NameService } from '../Name.service';
@Component({
selector: 'app-Nameadd',
templateUrl: './Nameadd.component.html',
styleUrls: ['./Nameadd.component.scss']
})
export class NameaddComponent implements OnInit {
public entryForm: FormGroup;
loading = false;
tableName = 'Name';
error;
submitted=false;
constructor(private _fb: FormBuilder,
private mainservice:NameService,
private router: Router,private accesstype:AccesstypeService,
private route: ActivatedRoute,
private toastr: ToastrService ) { }
ngOnInit(): void {
this.entryForm = this._fb.group({
name :[null],
description :[null],
active :[false],
});
}
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(["../Name"], { relativeTo: this.route });
}
goback(){
this.router.navigate(["../Name"], { relativeTo: this.route });
}
}

View File

@ -0,0 +1,49 @@
<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 class="col-md-4 col-sm-12">
<label> description</label>
<textarea cols="10" rows="2" [(ngModel)]="data1.description" name="description " placeholder="Textarea"> </textarea>
</div>
<div class="col-md-4 col-sm-12">
<label class="form-check-label" for="flexSwitchCheckDefaultactive"> active</label> <br>
<div class="form-check form-switch"> <input class="form-check-input" type="checkbox" id="flexSwitchCheckDefaultactive" name="active" [(ngModel)]="data1.active"> </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>

View File

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

View File

@ -0,0 +1,106 @@
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 { NameService } from '../Name.service';
@Component({
selector: 'app-Nameedit',
templateUrl: './Nameedit.component.html',
styleUrls: ['./Nameedit.component.scss']
})
export class NameeditComponent implements OnInit {
id:number;
data1:any={};
loading = false;
tableName = 'Name';
error;
constructor( private route:ActivatedRoute,
private mainservice:NameService,
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);
//
}
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(["../../Name"], { 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(["../../Name"], { relativeTo: this.route });
}
}

View File

@ -1,3 +1,6 @@
import { NameeditComponent } from './BuilderComponents/test13/Name/Nameedit/Nameedit.component';
import { NameaddComponent } from './BuilderComponents/test13/Name/Nameadd/Nameadd.component';
import { NameComponent } from './BuilderComponents/test13/Name/Name.component';
@ -159,6 +162,15 @@ const routes: Routes = [
// buildercomponents
{path:'Nameedit/:id',component:NameeditComponent},
{path:'Nameadd',component:NameaddComponent},
{path:'Name',component:NameComponent},
{ path: '**', component: PageNotFoundComponent },

View File

@ -1,3 +1,6 @@
import { NameeditComponent } from './BuilderComponents/test13/Name/Nameedit/Nameedit.component';
import { NameaddComponent } from './BuilderComponents/test13/Name/Nameadd/Nameadd.component';
import { NameComponent } from './BuilderComponents/test13/Name/Name.component';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
@ -108,6 +111,15 @@ import { BubbleRunnerComponent } from './builder/dashboardrunner/dashrunnerline/
DoughnutChartComponent, LineChartComponent, RadarChartComponent, BarChartComponent, BubbleChartComponent, DynamicChartComponent, ScatterChartComponent, PolarChartComponent, PieChartComponent, FinancialChartComponent, ToDoChartComponent,GridViewComponent,
DashboardrunnerComponent,DashrunnerallComponent,DashrunnerlineComponent, BarRunnerComponent, LineRunnerComponent, DoughnutRunnerComponent, GridRunnerComponent,PieRunnerComponent,PolarRunnerComponent,RadarRunnerComponent,ScatterRunnerComponent,TodoRunnerComponent,BubbleRunnerComponent,
// buildercomponents
NameeditComponent,
NameaddComponent,
NameComponent,