build_app

This commit is contained in:
risadmin_prod 2024-08-20 10:23:47 +00:00
parent 3a3748128a
commit 1a76b0c9b9
18 changed files with 786 additions and 0 deletions

View File

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

View File

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

View File

@ -0,0 +1,27 @@
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 Test4 extends Extension {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(length = 2000)
private String paragr;
}

View File

@ -0,0 +1,17 @@
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.Test4;
@Repository
public interface Test4Repository extends JpaRepository<Test4, Integer> {
}

View File

@ -0,0 +1,60 @@
package com.realnet.basicp1.Services;
import com.realnet.basicp1.Repository.Test4Repository;
import com.realnet.basicp1.Entity.Test4;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 Test4Service {
@Autowired
private Test4Repository Repository;
@Autowired
private AppUserServiceImpl userService;
public Test4 Savedata(Test4 data) {
Test4 save = Repository.save(data);
return save;
}
// get all with pagination
public Page<Test4> getAllWithPagination(Pageable page) {
return Repository.findAll(page);
}
public List<Test4> getdetails() {
return (List<Test4>) Repository.findAll();
}
public Test4 getdetailsbyId(Integer id) {
return Repository.findById(id).get();
}
public void delete_by_id(Integer id) {
Repository.deleteById(id);
}
public Test4 update(Test4 data,Integer id) {
Test4 old = Repository.findById(id).get();
old.setParagr(data.getParagr());
final Test4 test = Repository.save(old);
return test;}
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;
}}

View File

@ -0,0 +1,2 @@
CREATE TABLE db.Test4(id BIGINT NOT NULL AUTO_INCREMENT, Paragr VARCHAR(400), PRIMARY KEY (id));

View File

@ -0,0 +1,87 @@
<div class="dg-wrapper">
<div class="row">
<div class="col-2">
<h3>Test4 </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>Paragr</th>
<th>Action</th> </tr>
</thead>
<tbody>
<tr *ngFor="let data of givendata?.slice()?.reverse() | filter:searchFilter; let i = index">
<td (click)="goToReplaceStringparagr(data.paragr)" data-bs-toggle="modal" data-bs-target="#paragrModal" style="cursor: pointer; align-items: center;"><i class="bi bi-card-text"></i></td>
<td><i class="bi bi-pencil" style="cursor: pointer; padding-right: 10px"(click)="goToEdit(data.id)"></i><i class="bi bi-trash" style="cursor: pointer;" data-bs-toggle="modal" data-bs-target="#deleteModal" (click)="onDelete(data)"></i></td>
</tr>
</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="paragrModal" 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,105 @@
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 { Test4Service } from './Test4.service';
import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'app-Test4',
templateUrl: './Test4.component.html',
styleUrls: ['./Test4.component.scss']
})
export class Test4Component 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:Test4Service,
) {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(["../Test4add"],{relativeTo:this.route});
}
goToEdit(id: any){
this.router.navigate(["../Test4edit/"+ 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');
}
}
);
}
goToReplaceStringparagr(row){
this.modalissue.removeAllBackdrops();
this.rowSelected= row; }
}

View File

@ -0,0 +1,32 @@
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 Test4Service {
private baseURL = "Test4/Test4" ; 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,28 @@
<h4 style="font-weight: 500;display: inline;"> Test4</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>paragr</label>
<input class="form-control" type="Text" formControlName="paragr" style="border: none; outline: none; height:33px !important;" />
</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,91 @@
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 { Test4Service } from '../Test4.service';
@Component({
selector: 'app-Test4add',
templateUrl: './Test4add.component.html',
styleUrls: ['./Test4add.component.scss']
})
export class Test4addComponent implements OnInit {
public entryForm: FormGroup;
loading = false;
tableName = 'Test4';
error;
submitted=false;
constructor(private _fb: FormBuilder,
private mainservice:Test4Service,
private router: Router,private accesstype:AccesstypeService,
private route: ActivatedRoute,
private toastr: ToastrService ) { }
ngOnInit(): void {
this.entryForm = this._fb.group({
paragr :[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).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(["../Test4"], { relativeTo: this.route });
}
goback(){
this.router.navigate(["../Test4"], { relativeTo: this.route });
}
}

View File

@ -0,0 +1,24 @@
<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> paragr</label>
<input type="Text" class="form-control" style="border: none; outline: none; height:33px !important;" [(ngModel)]="data1.paragr" name="paragr" /> </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,86 @@
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 { Test4Service } from '../Test4.service';
@Component({
selector: 'app-Test4edit',
templateUrl: './Test4edit.component.html',
styleUrls: ['./Test4edit.component.scss']
})
export class Test4editComponent implements OnInit {
id:number;
data1:any={};
loading = false;
tableName = 'Test4';
error;
constructor( private route:ActivatedRoute,
private mainservice:Test4Service,
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(["../../Test4"], { 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(["../../Test4"], { relativeTo: this.route });
}
}

View File

@ -1,3 +1,6 @@
import { Test4editComponent } from './BuilderComponents/basicp1/Test4/Test4edit/Test4edit.component';
import { Test4addComponent } from './BuilderComponents/basicp1/Test4/Test4add/Test4add.component';
import { Test4Component } from './BuilderComponents/basicp1/Test4/Test4.component';
@ -159,6 +162,15 @@ const routes: Routes = [
// buildercomponents // buildercomponents
{path:'Test4edit/:id',component:Test4editComponent},
{path:'Test4add',component:Test4addComponent},
{path:'Test4',component:Test4Component},
{ path: '**', component: PageNotFoundComponent }, { path: '**', component: PageNotFoundComponent },

View File

@ -1,3 +1,6 @@
import { Test4editComponent } from './BuilderComponents/basicp1/Test4/Test4edit/Test4edit.component';
import { Test4addComponent } from './BuilderComponents/basicp1/Test4/Test4add/Test4add.component';
import { Test4Component } from './BuilderComponents/basicp1/Test4/Test4.component';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common'; 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, 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, DashboardrunnerComponent,DashrunnerallComponent,DashrunnerlineComponent, BarRunnerComponent, LineRunnerComponent, DoughnutRunnerComponent, GridRunnerComponent,PieRunnerComponent,PolarRunnerComponent,RadarRunnerComponent,ScatterRunnerComponent,TodoRunnerComponent,BubbleRunnerComponent,
// buildercomponents // buildercomponents
Test4editComponent,
Test4addComponent,
Test4Component,