build_app
This commit is contained in:
parent
36d1349e1a
commit
d9b145831f
@ -69,6 +69,12 @@ public class BuilderService {
|
||||
executeDump(true);
|
||||
|
||||
// ADD OTHER SERVICE
|
||||
addCustomMenu( "Formd", "Transcations");
|
||||
|
||||
|
||||
addCustomMenu( "Child", "Transcations");
|
||||
|
||||
|
||||
|
||||
System.out.println("dashboard and menu inserted...");
|
||||
|
||||
|
83
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Controllers/ChildController.java
Normal file
83
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Controllers/ChildController.java
Normal file
@ -0,0 +1,83 @@
|
||||
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.Child;
|
||||
import com.realnet.basicp1.Services.ChildService ;
|
||||
|
||||
|
||||
@RequestMapping(value = "/Child")
|
||||
@CrossOrigin("*")
|
||||
@RestController
|
||||
public class ChildController {
|
||||
@Autowired
|
||||
private ChildService Service;
|
||||
|
||||
@Value("${projectPath}")
|
||||
private String projectPath;
|
||||
|
||||
|
||||
|
||||
@PostMapping("/Child")
|
||||
public Child Savedata(@RequestBody Child data) {
|
||||
Child save = Service.Savedata(data) ;
|
||||
|
||||
System.out.println("data saved..." + save);
|
||||
|
||||
return save;
|
||||
}
|
||||
@PutMapping("/Child/{id}")
|
||||
public Child update(@RequestBody Child data,@PathVariable Integer id ) {
|
||||
Child update = Service.update(data,id);
|
||||
System.out.println("data update..." + update);
|
||||
return update;
|
||||
}
|
||||
// get all with pagination
|
||||
@GetMapping("/Child/getall/page")
|
||||
public Page<Child> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||
@RequestParam(value = "size", required = false) Integer size) {
|
||||
Pageable paging = PageRequest.of(page, size);
|
||||
Page<Child> get = Service.getAllWithPagination(paging);
|
||||
|
||||
return get;
|
||||
|
||||
}
|
||||
@GetMapping("/Child")
|
||||
public List<Child> getdetails() {
|
||||
List<Child> get = Service.getdetails();
|
||||
return get;
|
||||
}
|
||||
// get all without authentication
|
||||
|
||||
@GetMapping("/token/Child")
|
||||
public List<Child> getallwioutsec() {
|
||||
List<Child> get = Service.getdetails();
|
||||
return get;
|
||||
}
|
||||
@GetMapping("/Child/{id}")
|
||||
public Child getdetailsbyId(@PathVariable Integer id ) {
|
||||
Child get = Service.getdetailsbyId(id);
|
||||
return get;
|
||||
}
|
||||
@DeleteMapping("/Child/{id}")
|
||||
public void delete_by_id(@PathVariable Integer id ) {
|
||||
Service.delete_by_id(id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
123
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Controllers/FormdController.java
Normal file
123
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Controllers/FormdController.java
Normal file
@ -0,0 +1,123 @@
|
||||
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.Formd;
|
||||
import com.realnet.basicp1.Services.FormdService ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/Formd")
|
||||
@CrossOrigin("*")
|
||||
@RestController
|
||||
public class FormdController {
|
||||
@Autowired
|
||||
private FormdService Service;
|
||||
|
||||
@Value("${projectPath}")
|
||||
private String projectPath;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("/Formd")
|
||||
public Formd Savedata(@RequestBody Formd data) {
|
||||
Formd save = Service.Savedata(data) ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
System.out.println("data saved..." + save);
|
||||
|
||||
return save;
|
||||
}
|
||||
@PutMapping("/Formd/{id}")
|
||||
public Formd update(@RequestBody Formd data,@PathVariable Integer id ) {
|
||||
Formd update = Service.update(data,id);
|
||||
System.out.println("data update..." + update);
|
||||
return update;
|
||||
}
|
||||
// get all with pagination
|
||||
@GetMapping("/Formd/getall/page")
|
||||
public Page<Formd> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||
@RequestParam(value = "size", required = false) Integer size) {
|
||||
Pageable paging = PageRequest.of(page, size);
|
||||
Page<Formd> get = Service.getAllWithPagination(paging);
|
||||
|
||||
return get;
|
||||
|
||||
}
|
||||
@GetMapping("/Formd")
|
||||
public List<Formd> getdetails() {
|
||||
List<Formd> get = Service.getdetails();
|
||||
return get;
|
||||
}
|
||||
// get all without authentication
|
||||
|
||||
@GetMapping("/token/Formd")
|
||||
public List<Formd> getallwioutsec() {
|
||||
List<Formd> get = Service.getdetails();
|
||||
return get;
|
||||
}
|
||||
@GetMapping("/Formd/{id}")
|
||||
public Formd getdetailsbyId(@PathVariable Integer id ) {
|
||||
Formd get = Service.getdetailsbyId(id);
|
||||
return get;
|
||||
}
|
||||
@DeleteMapping("/Formd/{id}")
|
||||
public void delete_by_id(@PathVariable Integer id ) {
|
||||
Service.delete_by_id(id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
24
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Controllers/Formd_ListFilter1Controller.java
Normal file
24
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Controllers/Formd_ListFilter1Controller.java
Normal file
@ -0,0 +1,24 @@
|
||||
package com.realnet.basicp1.Controllers;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.realnet.basicp1.Entity.Formd_ListFilter1;
|
||||
import com.realnet.basicp1.Services.Formd_ListFilter1Service ;
|
||||
@RequestMapping(value = "/Formd_ListFilter1")
|
||||
@RestController
|
||||
public class Formd_ListFilter1Controller {
|
||||
|
||||
@Autowired
|
||||
private Formd_ListFilter1Service Service;
|
||||
|
||||
@GetMapping("/Formd_ListFilter1")
|
||||
public List<Formd_ListFilter1> getlist() {
|
||||
List<Formd_ListFilter1> get = Service.getlistbuilder();
|
||||
return get;
|
||||
}
|
||||
@GetMapping("/Formd_ListFilter11")
|
||||
public List<Formd_ListFilter1> getlistwithparam( ) {
|
||||
List<Formd_ListFilter1> get = Service.getlistbuilderparam( );
|
||||
return get;
|
||||
}
|
||||
}
|
25
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Child.java
Normal file
25
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Child.java
Normal file
@ -0,0 +1,25 @@
|
||||
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 Child extends Extension {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
private String namen;
|
||||
|
||||
|
||||
}
|
46
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Formd.java
Normal file
46
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Formd.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.realnet.basicp1.Entity;
|
||||
import lombok.*;
|
||||
import com.realnet.WhoColumn.Extension;
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import com.realnet.basicp1.Entity.Child;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
public class Formd extends Extension {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@OneToOne( cascade=CascadeType.ALL)
|
||||
private Child child;
|
||||
|
||||
private String textm;
|
||||
|
||||
private String calculatedcon;
|
||||
|
||||
|
||||
}
|
14
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Formd_ListFilter1.java
Normal file
14
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Formd_ListFilter1.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.realnet.basicp1.Entity;
|
||||
import lombok.*;
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
@Data
|
||||
public class Formd_ListFilter1 {
|
||||
|
||||
private Integer id;
|
||||
|
||||
|
||||
private String name;
|
||||
}
|
17
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Repository/ChildRepository.java
Normal file
17
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Repository/ChildRepository.java
Normal 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.Child;
|
||||
|
||||
@Repository
|
||||
public interface ChildRepository extends JpaRepository<Child, Integer> {
|
||||
}
|
27
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Repository/FormdRepository.java
Normal file
27
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Repository/FormdRepository.java
Normal file
@ -0,0 +1,27 @@
|
||||
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.Formd;
|
||||
|
||||
@Repository
|
||||
public interface FormdRepository extends JpaRepository<Formd, Integer> {
|
||||
}
|
65
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/ChildService.java
Normal file
65
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/ChildService.java
Normal file
@ -0,0 +1,65 @@
|
||||
package com.realnet.basicp1.Services;
|
||||
import com.realnet.basicp1.Repository.ChildRepository;
|
||||
import com.realnet.basicp1.Entity.Child;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 ChildService {
|
||||
@Autowired
|
||||
private ChildRepository Repository;
|
||||
@Autowired
|
||||
private AppUserServiceImpl userService;
|
||||
|
||||
public Child Savedata(Child data) {
|
||||
|
||||
|
||||
Child save = Repository.save(data);
|
||||
return save;
|
||||
}
|
||||
|
||||
|
||||
// get all with pagination
|
||||
public Page<Child> getAllWithPagination(Pageable page) {
|
||||
return Repository.findAll(page);
|
||||
}
|
||||
public List<Child> getdetails() {
|
||||
return (List<Child>) Repository.findAll();
|
||||
}
|
||||
|
||||
|
||||
public Child getdetailsbyId(Integer id) {
|
||||
return Repository.findById(id).get();
|
||||
}
|
||||
|
||||
|
||||
public void delete_by_id(Integer id) {
|
||||
Repository.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
public Child update(Child data,Integer id) {
|
||||
Child old = Repository.findById(id).get();
|
||||
old.setNamen(data.getNamen());
|
||||
|
||||
final Child test = Repository.save(old);
|
||||
return test;}
|
||||
|
||||
|
||||
public AppUser getUser() {
|
||||
AppUser user = userService.getLoggedInUser();
|
||||
return user;
|
||||
|
||||
}}
|
115
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/FormdService.java
Normal file
115
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/FormdService.java
Normal file
@ -0,0 +1,115 @@
|
||||
package com.realnet.basicp1.Services;
|
||||
import com.realnet.basicp1.Repository.FormdRepository;
|
||||
import com.realnet.basicp1.Entity.Formd;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 FormdService {
|
||||
@Autowired
|
||||
private FormdRepository Repository;
|
||||
@Autowired
|
||||
private AppUserServiceImpl userService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Formd Savedata(Formd data) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Formd save = Repository.save(data);
|
||||
return save;
|
||||
}
|
||||
|
||||
|
||||
// get all with pagination
|
||||
public Page<Formd> getAllWithPagination(Pageable page) {
|
||||
return Repository.findAll(page);
|
||||
}
|
||||
public List<Formd> getdetails() {
|
||||
return (List<Formd>) Repository.findAll();
|
||||
}
|
||||
|
||||
|
||||
public Formd getdetailsbyId(Integer id) {
|
||||
return Repository.findById(id).get();
|
||||
}
|
||||
|
||||
|
||||
public void delete_by_id(Integer id) {
|
||||
Repository.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
public Formd update(Formd data,Integer id) {
|
||||
Formd old = Repository.findById(id).get();
|
||||
old.setName(data.getName());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
old.setChild(data.getChild());
|
||||
|
||||
old.setTextm(data.getTextm());
|
||||
|
||||
old.setCalculatedcon(data.getCalculatedcon());
|
||||
|
||||
final Formd test = Repository.save(old);
|
||||
return test;}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public AppUser getUser() {
|
||||
AppUser user = userService.getLoggedInUser();
|
||||
return user;
|
||||
|
||||
}}
|
47
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/Formd_ListFilter1Service.java
Normal file
47
testabsbadv3-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/Formd_ListFilter1Service.java
Normal file
@ -0,0 +1,47 @@
|
||||
package com.realnet.basicp1.Services;
|
||||
import java.util.*;
|
||||
import com.realnet.basicp1.Repository.FormdRepository;
|
||||
import com.realnet.basicp1.Entity.Formd;
|
||||
|
||||
import com.realnet.basicp1.Entity.Formd_ListFilter1;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class Formd_ListFilter1Service {
|
||||
@Autowired
|
||||
private FormdRepository Repository;
|
||||
|
||||
|
||||
|
||||
|
||||
public List<Formd_ListFilter1> getlistbuilder() {
|
||||
List<Formd> list= Repository.findAll();
|
||||
ArrayList<Formd_ListFilter1> l = new ArrayList<>();
|
||||
for (Formd data : list) {
|
||||
{
|
||||
Formd_ListFilter1 dummy = new Formd_ListFilter1();
|
||||
dummy.setId(data.getId());
|
||||
dummy.setName(data.getName());
|
||||
l.add(dummy);
|
||||
}
|
||||
}
|
||||
return l;}
|
||||
|
||||
|
||||
|
||||
public List<Formd_ListFilter1> getlistbuilderparam( ) {
|
||||
List<Formd> list= Repository.findAll();
|
||||
ArrayList<Formd_ListFilter1> l = new ArrayList<>();
|
||||
for (Formd data : list) {
|
||||
{
|
||||
Formd_ListFilter1 dummy = new Formd_ListFilter1();
|
||||
dummy.setId(data.getId());
|
||||
dummy.setName(data.getName());
|
||||
l.add(dummy);
|
||||
}
|
||||
}
|
||||
return l;}
|
||||
}
|
4
testabsbadv3-db-d/authsec_mysql/mysql/wf_table/wf_table.sql
Executable file
4
testabsbadv3-db-d/authsec_mysql/mysql/wf_table/wf_table.sql
Executable file
@ -0,0 +1,4 @@
|
||||
CREATE TABLE db.Child(id BIGINT NOT NULL AUTO_INCREMENT, namen VARCHAR(400), PRIMARY KEY (id));
|
||||
|
||||
CREATE TABLE db.Formd(id BIGINT NOT NULL AUTO_INCREMENT, datag VARCHAR(400), onetoone VARCHAR(400), valuell VARCHAR(400), calculatedcon VARCHAR(400), name VARCHAR(400), textm VARCHAR(400), PRIMARY KEY (id));
|
||||
|
@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="dg-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<h3>Child </h3>
|
||||
</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>Namen</th>
|
||||
|
||||
<th>Action</th> </tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of givendata?.slice()?.reverse() | searchFilter:searchFilter; let i = index">
|
||||
|
||||
<td>{{data.namen}}</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;
|
||||
}
|
100
testabsbadv3-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Child/Child.component.ts
Normal file
100
testabsbadv3-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Child/Child.component.ts
Normal file
@ -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 { ChildService } from './Child.service';
|
||||
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-Child',
|
||||
templateUrl: './Child.component.html',
|
||||
styleUrls: ['./Child.component.scss']
|
||||
})
|
||||
export class ChildComponent 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:ChildService,
|
||||
) {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(["../Childadd"],{relativeTo:this.route});
|
||||
}
|
||||
goToEdit(id: any){
|
||||
this.router.navigate(["../Childedit/"+ 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');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
}
|
32
testabsbadv3-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Child/Child.service.ts
Normal file
32
testabsbadv3-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Child/Child.service.ts
Normal 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 ChildService {
|
||||
private baseURL = "Child/Child" ; 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,31 @@
|
||||
|
||||
<h4 style="font-weight: 500;display: inline;"> Child</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"> namen </label>
|
||||
<input type="text" class="input" formControlName="namen" >
|
||||
<div *ngIf="submitted && entryForm.controls.namen.errors" class="error_mess">
|
||||
<div *ngIf="submitted && entryForm.controls.namen.errors.required" class="error_mess">*This field is Required</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,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 { ChildService } from '../Child.service';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-Childadd',
|
||||
templateUrl: './Childadd.component.html',
|
||||
styleUrls: ['./Childadd.component.scss']
|
||||
})
|
||||
export class ChildaddComponent implements OnInit {
|
||||
public entryForm: FormGroup;
|
||||
|
||||
loading = false;
|
||||
tableName = 'Child';
|
||||
|
||||
error;
|
||||
submitted=false;
|
||||
|
||||
constructor(private _fb: FormBuilder,
|
||||
private mainservice:ChildService,
|
||||
private router: Router,private accesstype:AccesstypeService,
|
||||
private route: ActivatedRoute,
|
||||
|
||||
private toastr: ToastrService ) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.entryForm = this._fb.group({
|
||||
namen :[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(["../Child"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
goback(){
|
||||
this.router.navigate(["../Child"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
<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"> namen</label>
|
||||
<input type="text" class="input" name="namen" [(ngModel)]="data1.namen" >
|
||||
</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,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 { ChildService } from '../Child.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-Childedit',
|
||||
templateUrl: './Childedit.component.html',
|
||||
styleUrls: ['./Childedit.component.scss']
|
||||
})
|
||||
export class ChildeditComponent implements OnInit {
|
||||
id:number;
|
||||
data1:any={};
|
||||
loading = false;
|
||||
tableName = 'Child';
|
||||
|
||||
error;
|
||||
constructor( private route:ActivatedRoute,
|
||||
private mainservice:ChildService,
|
||||
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(["../../Child"], { 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(["../../Child"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
|
||||
}
|
115
testabsbadv3-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Formd/Formd.component.html
Normal file
115
testabsbadv3-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Formd/Formd.component.html
Normal file
@ -0,0 +1,115 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="dg-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<h3>Formd </h3>
|
||||
</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>namen</th>
|
||||
|
||||
|
||||
|
||||
|
||||
<th>Textm</th>
|
||||
|
||||
|
||||
|
||||
<th>Action</th> </tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of givendata?.slice()?.reverse() | searchFilter:searchFilter; let i = index">
|
||||
|
||||
<td>{{data.name}}</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td>{{data.child.namen}}</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td>{{data.textm}}</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;
|
||||
}
|
100
testabsbadv3-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Formd/Formd.component.ts
Normal file
100
testabsbadv3-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Formd/Formd.component.ts
Normal file
@ -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 { FormdService } from './Formd.service';
|
||||
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-Formd',
|
||||
templateUrl: './Formd.component.html',
|
||||
styleUrls: ['./Formd.component.scss']
|
||||
})
|
||||
export class FormdComponent 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:FormdService,
|
||||
) {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(["../Formdadd"],{relativeTo:this.route});
|
||||
}
|
||||
goToEdit(id: any){
|
||||
this.router.navigate(["../Formdedit/"+ 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');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
}
|
45
testabsbadv3-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Formd/Formd.service.ts
Normal file
45
testabsbadv3-front-f/authsec_angular_bootsstrap/angular-bootstrap/src/app/modules/main/BuilderComponents/basicp1/Formd/Formd.service.ts
Normal file
@ -0,0 +1,45 @@
|
||||
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 FormdService {
|
||||
private baseURL = "Formd/Formd" ; 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
getdatagAll(page?: number, size?: number): Observable<any> {
|
||||
return this.apiRequest.get("Formd_ListFilter1/Formd_ListFilter1");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// updateaction
|
||||
}
|
@ -0,0 +1,186 @@
|
||||
|
||||
<h4 style="font-weight: 500;display: inline;"> Formd</h4>
|
||||
<span class="label label-light-blue" style="display: inline;margin-left: 30px;">Add Mode</span>
|
||||
|
||||
<button class="btn btn-icon btn-primary" data-bs-toggle="modal" data-bs-target="#valueListModalvaluell" (click)="openvalueListvaluell('ADD')">V</button>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<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 for="name"> textm </label>
|
||||
<input type="text" class="input" formControlName="textm" >
|
||||
<div *ngIf="submitted && entryForm.controls.textm.errors" class="error_mess">
|
||||
<div *ngIf="submitted && entryForm.controls.textm.errors.required" class="error_mess">*This field is Required</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--Data grid field start-->
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<h3> datag</h3>
|
||||
<div style="max-width:fit-content; overflow-x:auto; max-height: 500px; overflow-y: auto;">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th *ngFor="let co of getHeadersdatag() let i=index">{{co}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let item of rowsdatag?.slice()?.reverse()">
|
||||
<td *ngFor="let key of getHeadersdatag()">{{item[key]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Data grid field end-->
|
||||
|
||||
<div style="margin-top: 30px;">
|
||||
<h4 style="display: inline;">child </h4> </div> <hr>
|
||||
<div class="row" formArrayName="child">
|
||||
|
||||
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<label> namen</label>
|
||||
<input class="clr-input" type="text" formControlName="namen" /> </div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- calculated field start -->
|
||||
<div class="row fieldWrapper">
|
||||
<div class="col-12">
|
||||
<table class="table table-noborder">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
|
||||
<th> name</th>
|
||||
|
||||
|
||||
|
||||
<th> textm</th>
|
||||
|
||||
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
<input type="text" [(ngModel)]="name" [ngModelOptions]="{standalone: true}" name="name" (input)="onInputChangecalculatedcon()" class="input" />
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
<input type="text" [(ngModel)]="textm" [ngModelOptions]="{standalone: true}" name="textm" (input)="onInputChangecalculatedcon()" class="input" />
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
<input type="text" [(ngModel)]="total" [ngModelOptions]="{standalone: true}" name="total" class="input" />"
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- calculated field end -->
|
||||
|
||||
</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>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- value List field start-->
|
||||
<div class="modal fade" id="valueListModalvaluell" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<h3 class="modal-title"><b>Select From valuell List:</b></h3>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12" style="margin-top: 8px;">
|
||||
<input id="data" type="text" placeholder="Enter search Criteria" class="input" name="searchcusttextvaluell" [(ngModel)]="searchcusttextvaluell"> </div>
|
||||
</div>
|
||||
<div style="max-height: 500px; overflow: auto;">
|
||||
<table class="table">
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
|
||||
|
||||
<th>name</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let user of customerdatavaluell?.slice()?.reverse() | filter:searchcusttextvaluell; let i = index ">
|
||||
|
||||
|
||||
|
||||
<td (click)="getcustvaluellID(user.id)" data-bs-dismiss="modal" style="color: rgb(108, 108, 194); cursor:pointer;">{{user.name}}</td>
|
||||
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
<div *ngIf="error" style="text-align: center;">{{error}}</div>
|
||||
</table></div>
|
||||
</div></div></div></div>
|
||||
<!-- value List field end-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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,358 @@
|
||||
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 { FormdService } from '../Formd.service';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-Formdadd',
|
||||
templateUrl: './Formdadd.component.html',
|
||||
styleUrls: ['./Formdadd.component.scss']
|
||||
})
|
||||
export class FormdaddComponent implements OnInit {
|
||||
public entryForm: FormGroup;
|
||||
|
||||
loading = false;
|
||||
tableName = 'Formd';
|
||||
|
||||
error;
|
||||
submitted=false;
|
||||
|
||||
constructor(private _fb: FormBuilder,
|
||||
private mainservice:FormdService,
|
||||
private router: Router,private accesstype:AccesstypeService,
|
||||
private route: ActivatedRoute,
|
||||
|
||||
private toastr: ToastrService ) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.entryForm = this._fb.group({
|
||||
name :[null],
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
child: this.initLinesForm(),
|
||||
|
||||
textm :[null],
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
this.getdatagData();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//calculated field start
|
||||
|
||||
|
||||
|
||||
this. name= '';
|
||||
|
||||
|
||||
|
||||
this. textm= '';
|
||||
|
||||
|
||||
|
||||
|
||||
this.total = '';
|
||||
|
||||
//calculated field end
|
||||
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//calculated field start
|
||||
|
||||
|
||||
this.entryForm.value.name= this.name ;
|
||||
|
||||
|
||||
|
||||
this.entryForm.value.textm= this.textm ;
|
||||
|
||||
|
||||
//calculated field end
|
||||
|
||||
|
||||
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(["../Formd"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
goback(){
|
||||
this.router.navigate(["../Formd"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
//Value List field start
|
||||
valuelistMode;
|
||||
searchcusttextvaluell :any;
|
||||
valueListModalvaluell :boolean=false;
|
||||
openvalueListvaluell(mode){
|
||||
this.modalissue.removeAllBackdrops();
|
||||
this.valueListModalvaluell=!this.valueListModalvaluell ;
|
||||
this.valuelistMode = mode;
|
||||
this.getDatavaluell();
|
||||
}
|
||||
customerdatavaluell = [];
|
||||
getDatavaluell(){
|
||||
this.mainservice.getAll().subscribe((data) => {
|
||||
console.log(data);
|
||||
this.customerdatavaluell = data;
|
||||
if(this.customerdatavaluell.length==0){
|
||||
this.error="No data Available";
|
||||
console.log(this.error)
|
||||
}
|
||||
},(error) => {
|
||||
console.log(error);
|
||||
if(error){
|
||||
this.error="Server Error";
|
||||
}
|
||||
});
|
||||
}
|
||||
cutomererror;
|
||||
clickedID:number;
|
||||
|
||||
getcustvaluellID(id:number){
|
||||
this.clickedID=id;
|
||||
console.log("clicked by id"+ id);
|
||||
this.mainservice.getbyid(id).subscribe((data) => { console.log(data);
|
||||
|
||||
|
||||
|
||||
this.entryForm.get('name').setValue(data.name);
|
||||
|
||||
|
||||
|
||||
}); this.valueListModalvaluell =false;
|
||||
} //value List field end
|
||||
|
||||
//datagrid datag filed start
|
||||
productdatag;
|
||||
rowsdatag :any[];
|
||||
getHeadersdatag () {
|
||||
this.rowsdatag = this.productdatag;
|
||||
let headers: string[] = [];
|
||||
if(this.rowsdatag ) {
|
||||
this.rowsdatag.forEach((value) => {
|
||||
Object.keys(value).forEach((key) => {
|
||||
if(!headers.find((header) => header == key)){
|
||||
headers.push(key)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return headers;
|
||||
}
|
||||
//datagrid datag filed end
|
||||
|
||||
getdatagData() {
|
||||
this.mainservice.getdatagAll().subscribe((data) => {
|
||||
console.log(data); this.productdatag = data;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
initLinesForm() { return this._fb.group({
|
||||
|
||||
|
||||
namen: [null],
|
||||
|
||||
|
||||
|
||||
}); }
|
||||
|
||||
|
||||
|
||||
|
||||
// calculated field code start
|
||||
|
||||
|
||||
name;
|
||||
|
||||
|
||||
|
||||
textm;
|
||||
|
||||
|
||||
total ;
|
||||
calculateOperators = "Concatination"
|
||||
onInputChangecalculatedcon() {
|
||||
const lastObj = 0
|
||||
const lastObjstring = ''
|
||||
|
||||
|
||||
|
||||
const name= this.name|| '';
|
||||
|
||||
const nameValue = parseFloat(this.name) || 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const textm= this.textm|| '';
|
||||
|
||||
const textmValue = parseFloat(this.textm) || 0;
|
||||
|
||||
|
||||
|
||||
if (this.calculateOperators =="Addition") {
|
||||
this.total = (
|
||||
|
||||
|
||||
nameValue +
|
||||
|
||||
|
||||
|
||||
textmValue +
|
||||
|
||||
lastObj).toString();
|
||||
}
|
||||
if (this.calculateOperators == "Subtraction") {
|
||||
this.total = (
|
||||
|
||||
|
||||
nameValue -
|
||||
|
||||
|
||||
|
||||
textmValue -
|
||||
|
||||
|
||||
lastObj).toString();
|
||||
}
|
||||
if (this.calculateOperators =="Multiplication") {
|
||||
this.total = (
|
||||
|
||||
|
||||
|
||||
nameValue *
|
||||
|
||||
|
||||
|
||||
textmValue *
|
||||
|
||||
|
||||
lastObj).toString();
|
||||
}
|
||||
if (this.calculateOperators =="Division") {
|
||||
|
||||
this.total = (
|
||||
|
||||
|
||||
nameValue /
|
||||
|
||||
|
||||
|
||||
textmValue /
|
||||
|
||||
|
||||
lastObj).toString();
|
||||
|
||||
}
|
||||
if (this.calculateOperators =="Concatination") {
|
||||
this.total =
|
||||
|
||||
|
||||
name+ ' ' +
|
||||
|
||||
|
||||
|
||||
textm+ ' ' +
|
||||
|
||||
lastObjstring
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,160 @@
|
||||
<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>
|
||||
|
||||
<button class="btn btn-icon btn-primary" data-bs-toggle="modal" data-bs-target="#valueListModalvaluell" (click)="openvalueListvaluell('EDIT')">V</button>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<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 for="name"> textm</label>
|
||||
<input type="text" class="input" name="textm" [(ngModel)]="data1.textm" >
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div style="margin-top: 30px;">
|
||||
<h4 style="display: inline;">child </h4> </div> <hr>
|
||||
<div class="row">
|
||||
|
||||
|
||||
|
||||
<div class="col-md-4 col-sm-12"> <label>namen</label>
|
||||
<input class="input" id="name" type="text" [(ngModel)]="data1.child.namen" name="namen" />
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- calculated field start -->
|
||||
<div class="row fieldWrapper">
|
||||
<div class="col-12">
|
||||
<table class="table table-noborder">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
|
||||
<th> name</th>
|
||||
|
||||
|
||||
|
||||
<th> textm</th>
|
||||
|
||||
|
||||
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
<input type="text" [(ngModel)]="name" [ngModelOptions]="{standalone: true}" name="name" (input)="onInputChangecalculatedcon()" class="input"/>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
<input type="text" [(ngModel)]="textm" [ngModelOptions]="{standalone: true}" name="textm" (input)="onInputChangecalculatedcon()" class="input"/>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
<input type="text" [(ngModel)]="total" [ngModelOptions]="{standalone: true}" name="total" class="input" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody> </table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- calculated field end -->
|
||||
|
||||
</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>
|
||||
|
||||
|
||||
|
||||
<!-- value List field start-->
|
||||
<div class="modal fade" id="valueListModalvaluell" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<h3 class="modal-title"><b>Select From valuell List:</b></h3>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12" style="margin-top: 8px;">
|
||||
<input id="data" type="text" placeholder="Enter search Criteria" class="input" name="searchcusttextvaluell" [(ngModel)]="searchcusttextvaluell"> </div>
|
||||
</div>
|
||||
<div style="max-height: 500px; overflow: auto;">
|
||||
<table class="table">
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
|
||||
|
||||
<th>name</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let user of customerdatavaluell?.slice()?.reverse() | filter:searchcusttextvaluell; let i = index ">
|
||||
|
||||
|
||||
|
||||
<td (click)="getcustvaluellID(user.id)" data-bs-dismiss="modal" style="color: rgb(108, 108, 194); cursor:pointer;">{{user.name}}</td>
|
||||
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
<div *ngIf="error" style="text-align: center;">{{error}}</div>
|
||||
</table></div>
|
||||
</div></div></div></div>
|
||||
<!-- value List field end-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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,311 @@
|
||||
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 { FormdService } from '../Formd.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-Formdedit',
|
||||
templateUrl: './Formdedit.component.html',
|
||||
styleUrls: ['./Formdedit.component.scss']
|
||||
})
|
||||
export class FormdeditComponent implements OnInit {
|
||||
id:number;
|
||||
data1:any={};
|
||||
loading = false;
|
||||
tableName = 'Formd';
|
||||
|
||||
error;
|
||||
constructor( private route:ActivatedRoute,
|
||||
private mainservice:FormdService,
|
||||
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);
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//calculated field start
|
||||
|
||||
|
||||
|
||||
this. name= '';
|
||||
|
||||
|
||||
|
||||
this. textm= '';
|
||||
|
||||
|
||||
|
||||
|
||||
this.total = '';
|
||||
|
||||
//calculated field end
|
||||
|
||||
}
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//calculated field start
|
||||
|
||||
|
||||
this.name= data.name;
|
||||
|
||||
|
||||
|
||||
this.textm= data.textm;
|
||||
|
||||
|
||||
//calculated field end
|
||||
|
||||
|
||||
console.log(this.data1);
|
||||
});
|
||||
}
|
||||
update(){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//calculated field start
|
||||
|
||||
|
||||
this.data1.name= this.name;
|
||||
|
||||
|
||||
|
||||
this.data1.textm= this.textm;
|
||||
|
||||
|
||||
this.onInputChangecalculatedcon ();
|
||||
//calculated field end
|
||||
|
||||
|
||||
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(["../../Formd"], { 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(["../../Formd"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
//Value List field start
|
||||
valuelistMode;
|
||||
searchcusttextvaluell :any;
|
||||
valueListModalvaluell :boolean=false;
|
||||
openvalueListvaluell(mode){
|
||||
this.modalissue.removeAllBackdrops();
|
||||
this.valueListModalvaluell=!this.valueListModalvaluell ;
|
||||
this.valuelistMode = mode;
|
||||
this.getDatavaluell();
|
||||
}
|
||||
customerdatavaluell = [];
|
||||
getDatavaluell(){
|
||||
this.mainservice.getAll().subscribe((data) => {
|
||||
console.log(data);
|
||||
this.customerdatavaluell = data;
|
||||
if(this.customerdatavaluell.length==0){
|
||||
this.error="No data Available";
|
||||
console.log(this.error)
|
||||
}
|
||||
},(error) => {
|
||||
console.log(error);
|
||||
if(error){
|
||||
this.error="Server Error";
|
||||
}
|
||||
});
|
||||
}
|
||||
cutomererror;
|
||||
clickedID:number;
|
||||
|
||||
getcustvaluellID(id:number){
|
||||
this.clickedID=id;
|
||||
console.log("clicked by id"+ id);
|
||||
this.mainservice.getbyid(id).subscribe((data) => { console.log(data);
|
||||
|
||||
|
||||
|
||||
this.data1.name= data.name
|
||||
|
||||
|
||||
|
||||
}); this.valueListModalvaluell =false;
|
||||
} //value List field end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// calculated field code start
|
||||
|
||||
|
||||
name;
|
||||
|
||||
|
||||
|
||||
textm;
|
||||
|
||||
|
||||
total ;
|
||||
calculateOperators = "Concatination"
|
||||
onInputChangecalculatedcon() {
|
||||
const lastObj = 0
|
||||
const lastObjstring = ''
|
||||
|
||||
|
||||
|
||||
const name= this.name|| '';
|
||||
|
||||
const nameValue = parseFloat(this.name) || 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const textm= this.textm|| '';
|
||||
|
||||
const textmValue = parseFloat(this.textm) || 0;
|
||||
|
||||
|
||||
|
||||
if (this.calculateOperators =="Addition") {
|
||||
this.total = (
|
||||
|
||||
|
||||
nameValue +
|
||||
|
||||
|
||||
|
||||
textmValue +
|
||||
|
||||
lastObj).toString();
|
||||
}
|
||||
if (this.calculateOperators == "Subtraction") {
|
||||
this.total = (
|
||||
|
||||
|
||||
nameValue -
|
||||
|
||||
|
||||
|
||||
textmValue -
|
||||
|
||||
|
||||
lastObj).toString();
|
||||
}
|
||||
if (this.calculateOperators =="Multiplication") {
|
||||
this.total = (
|
||||
|
||||
|
||||
|
||||
nameValue *
|
||||
|
||||
|
||||
|
||||
textmValue *
|
||||
|
||||
|
||||
lastObj).toString();
|
||||
}
|
||||
if (this.calculateOperators =="Division") {
|
||||
|
||||
this.total = (
|
||||
|
||||
|
||||
nameValue /
|
||||
|
||||
|
||||
|
||||
textmValue /
|
||||
|
||||
|
||||
lastObj).toString();
|
||||
|
||||
}
|
||||
if (this.calculateOperators =="Concatination") {
|
||||
this.total =
|
||||
|
||||
|
||||
name+ ' '+
|
||||
|
||||
|
||||
|
||||
textm+ ' '+
|
||||
|
||||
lastObjstring
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,3 +1,9 @@
|
||||
import { FormdeditComponent } from './BuilderComponents/basicp1/Formd/Formdedit/Formdedit.component';
|
||||
import { FormdaddComponent } from './BuilderComponents/basicp1/Formd/Formdadd/Formdadd.component';
|
||||
import { FormdComponent } from './BuilderComponents/basicp1/Formd/Formd.component';
|
||||
import { ChildeditComponent } from './BuilderComponents/basicp1/Child/Childedit/Childedit.component';
|
||||
import { ChildaddComponent } from './BuilderComponents/basicp1/Child/Childadd/Childadd.component';
|
||||
import { ChildComponent } from './BuilderComponents/basicp1/Child/Child.component';
|
||||
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
@ -103,6 +109,24 @@ const routes: Routes = [
|
||||
|
||||
},
|
||||
// buildercomponents
|
||||
{path:'Formdedit/:id',component:FormdeditComponent},
|
||||
|
||||
|
||||
{path:'Formdadd',component:FormdaddComponent},
|
||||
|
||||
|
||||
{path:'Formd',component:FormdComponent},
|
||||
|
||||
|
||||
{path:'Childedit/:id',component:ChildeditComponent},
|
||||
|
||||
|
||||
{path:'Childadd',component:ChildaddComponent},
|
||||
|
||||
|
||||
{path:'Child',component:ChildComponent},
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
@ -1,3 +1,9 @@
|
||||
import { FormdeditComponent } from './BuilderComponents/basicp1/Formd/Formdedit/Formdedit.component';
|
||||
import { FormdaddComponent } from './BuilderComponents/basicp1/Formd/Formdadd/Formdadd.component';
|
||||
import { FormdComponent } from './BuilderComponents/basicp1/Formd/Formd.component';
|
||||
import { ChildeditComponent } from './BuilderComponents/basicp1/Child/Childedit/Childedit.component';
|
||||
import { ChildaddComponent } from './BuilderComponents/basicp1/Child/Childadd/Childadd.component';
|
||||
import { ChildComponent } from './BuilderComponents/basicp1/Child/Child.component';
|
||||
|
||||
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@ -99,6 +105,24 @@ import { SearchFilterPipe } from 'src/app/pipes/search-filter.pipe';
|
||||
MenumaintanceComponent, OauthComponent, QueryComponent, SubmenuComponent, AccesstypeComponent, ModulesComponent, SessionloggerComponent, LogreaderComponent, ExceptionComponent, AuditreportComponent, AudithistoryComponent,
|
||||
|
||||
// buildercomponents
|
||||
FormdeditComponent,
|
||||
|
||||
|
||||
FormdaddComponent,
|
||||
|
||||
|
||||
FormdComponent,
|
||||
|
||||
|
||||
ChildeditComponent,
|
||||
|
||||
|
||||
ChildaddComponent,
|
||||
|
||||
|
||||
ChildComponent,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user