build_app
This commit is contained in:
parent
e2b5940c88
commit
17a486cd04
|
@ -68,6 +68,12 @@ public class BuilderService {
|
|||
public void callotherService() {
|
||||
|
||||
// ADD OTHER SERVICE
|
||||
addCustomMenu( "Formbtest", "Transcations");
|
||||
|
||||
|
||||
addCustomMenu( "Formatest", "Transcations");
|
||||
|
||||
|
||||
|
||||
executeDump(true, "dump.sql");
|
||||
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
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.Formatest;
|
||||
import com.realnet.basicp1.Services.FormatestService ;
|
||||
@RequestMapping(value = "/Formatest")
|
||||
@CrossOrigin("*")
|
||||
@RestController
|
||||
public class FormatestController {
|
||||
@Autowired
|
||||
private FormatestService Service;
|
||||
|
||||
@Value("${projectPath}")
|
||||
private String projectPath;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("/Formatest")
|
||||
public Formatest Savedata(@RequestBody Formatest data) {
|
||||
Formatest save = Service.Savedata(data) ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
System.out.println("data saved..." + save);
|
||||
|
||||
return save;
|
||||
}
|
||||
@PutMapping("/Formatest/{id}")
|
||||
public Formatest update(@RequestBody Formatest data,@PathVariable Integer id ) {
|
||||
Formatest update = Service.update(data,id);
|
||||
System.out.println("data update..." + update);
|
||||
return update;
|
||||
}
|
||||
// get all with pagination
|
||||
@GetMapping("/Formatest/getall/page")
|
||||
public Page<Formatest> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||
@RequestParam(value = "size", required = false) Integer size) {
|
||||
Pageable paging = PageRequest.of(page, size);
|
||||
Page<Formatest> get = Service.getAllWithPagination(paging);
|
||||
|
||||
return get;
|
||||
|
||||
}
|
||||
@GetMapping("/Formatest")
|
||||
public List<Formatest> getdetails() {
|
||||
List<Formatest> get = Service.getdetails();
|
||||
return get;
|
||||
}
|
||||
// get all without authentication
|
||||
|
||||
@GetMapping("/token/Formatest")
|
||||
public List<Formatest> getallwioutsec() {
|
||||
List<Formatest> get = Service.getdetails();
|
||||
return get;
|
||||
}
|
||||
@GetMapping("/Formatest/{id}")
|
||||
public Formatest getdetailsbyId(@PathVariable Integer id ) {
|
||||
Formatest get = Service.getdetailsbyId(id);
|
||||
return get;
|
||||
}
|
||||
@DeleteMapping("/Formatest/{id}")
|
||||
public void delete_by_id(@PathVariable Integer id ) {
|
||||
Service.delete_by_id(id);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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.Formatest_ListFilter1;
|
||||
import com.realnet.basicp1.Services.Formatest_ListFilter1Service ;
|
||||
@RequestMapping(value = "/Formatest_ListFilter1")
|
||||
@RestController
|
||||
public class Formatest_ListFilter1Controller {
|
||||
|
||||
@Autowired
|
||||
private Formatest_ListFilter1Service Service;
|
||||
|
||||
@GetMapping("/Formatest_ListFilter1")
|
||||
public List<Formatest_ListFilter1> getlist() {
|
||||
List<Formatest_ListFilter1> get = Service.getlistbuilder();
|
||||
return get;
|
||||
}
|
||||
@GetMapping("/Formatest_ListFilter11")
|
||||
public List<Formatest_ListFilter1> getlistwithparam( ) {
|
||||
List<Formatest_ListFilter1> get = Service.getlistbuilderparam( );
|
||||
return get;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
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.Formbtest;
|
||||
import com.realnet.basicp1.Services.FormbtestService ;
|
||||
@RequestMapping(value = "/Formbtest")
|
||||
@CrossOrigin("*")
|
||||
@RestController
|
||||
public class FormbtestController {
|
||||
@Autowired
|
||||
private FormbtestService Service;
|
||||
|
||||
@Value("${projectPath}")
|
||||
private String projectPath;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("/Formbtest")
|
||||
public Formbtest Savedata(@RequestBody Formbtest data) {
|
||||
Formbtest save = Service.Savedata(data) ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
System.out.println("data saved..." + save);
|
||||
|
||||
return save;
|
||||
}
|
||||
@PutMapping("/Formbtest/{id}")
|
||||
public Formbtest update(@RequestBody Formbtest data,@PathVariable Integer id ) {
|
||||
Formbtest update = Service.update(data,id);
|
||||
System.out.println("data update..." + update);
|
||||
return update;
|
||||
}
|
||||
// get all with pagination
|
||||
@GetMapping("/Formbtest/getall/page")
|
||||
public Page<Formbtest> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||
@RequestParam(value = "size", required = false) Integer size) {
|
||||
Pageable paging = PageRequest.of(page, size);
|
||||
Page<Formbtest> get = Service.getAllWithPagination(paging);
|
||||
|
||||
return get;
|
||||
|
||||
}
|
||||
@GetMapping("/Formbtest")
|
||||
public List<Formbtest> getdetails() {
|
||||
List<Formbtest> get = Service.getdetails();
|
||||
return get;
|
||||
}
|
||||
// get all without authentication
|
||||
|
||||
@GetMapping("/token/Formbtest")
|
||||
public List<Formbtest> getallwioutsec() {
|
||||
List<Formbtest> get = Service.getdetails();
|
||||
return get;
|
||||
}
|
||||
@GetMapping("/Formbtest/{id}")
|
||||
public Formbtest getdetailsbyId(@PathVariable Integer id ) {
|
||||
Formbtest get = Service.getdetailsbyId(id);
|
||||
return get;
|
||||
}
|
||||
@DeleteMapping("/Formbtest/{id}")
|
||||
public void delete_by_id(@PathVariable Integer id ) {
|
||||
Service.delete_by_id(id);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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.*;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
public class Formatest extends Extension {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
private String names;
|
||||
|
||||
private String colour;
|
||||
|
||||
private String gender;
|
||||
|
||||
|
||||
|
||||
|
||||
private boolean pune;
|
||||
|
||||
|
||||
|
||||
private boolean nagpur;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.realnet.basicp1.Entity;
|
||||
import lombok.*;
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
@Data
|
||||
public class Formatest_ListFilter1 {
|
||||
|
||||
private Integer id;
|
||||
|
||||
|
||||
private String names;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
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 Formbtest extends Extension {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
private String namekk;
|
||||
|
||||
private String filetestname;
|
||||
private String filetestpath ;
|
||||
|
||||
private String imagetestname;
|
||||
private String imagetestpath ;
|
||||
|
||||
private String audiotestname;
|
||||
private String audiotestpath ;
|
||||
|
||||
private String videotestname;
|
||||
private String videotestpath ;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
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.Formatest;
|
||||
|
||||
@Repository
|
||||
public interface FormatestRepository extends JpaRepository<Formatest, Integer> {
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
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.Formbtest;
|
||||
|
||||
@Repository
|
||||
public interface FormbtestRepository extends JpaRepository<Formbtest, Integer> {
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package com.realnet.basicp1.Services;
|
||||
import com.realnet.basicp1.Repository.FormatestRepository;
|
||||
import com.realnet.basicp1.Entity.Formatest;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 FormatestService {
|
||||
@Autowired
|
||||
private FormatestRepository Repository;
|
||||
@Autowired
|
||||
private AppUserServiceImpl userService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Formatest Savedata(Formatest data) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Formatest save = Repository.save(data);
|
||||
return save;
|
||||
}
|
||||
|
||||
|
||||
// get all with pagination
|
||||
public Page<Formatest> getAllWithPagination(Pageable page) {
|
||||
return Repository.findAll(page);
|
||||
}
|
||||
public List<Formatest> getdetails() {
|
||||
return (List<Formatest>) Repository.findAll();
|
||||
}
|
||||
|
||||
|
||||
public Formatest getdetailsbyId(Integer id) {
|
||||
return Repository.findById(id).get();
|
||||
}
|
||||
|
||||
|
||||
public void delete_by_id(Integer id) {
|
||||
Repository.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
public Formatest update(Formatest data,Integer id) {
|
||||
Formatest old = Repository.findById(id).get();
|
||||
old.setNames(data.getNames());
|
||||
|
||||
old.setColour(data.getColour());
|
||||
|
||||
old.setGender(data.getGender());
|
||||
|
||||
|
||||
|
||||
old.setPune(data.isPune());
|
||||
|
||||
|
||||
|
||||
old.setNagpur(data.isNagpur());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
final Formatest test = Repository.save(old);
|
||||
return test;}
|
||||
public AppUser getUser() {
|
||||
AppUser user = userService.getLoggedInUser();
|
||||
return user;
|
||||
|
||||
}}
|
|
@ -0,0 +1,47 @@
|
|||
package com.realnet.basicp1.Services;
|
||||
import java.util.*;
|
||||
import com.realnet.basicp1.Repository.FormatestRepository;
|
||||
import com.realnet.basicp1.Entity.Formatest;
|
||||
|
||||
import com.realnet.basicp1.Entity.Formatest_ListFilter1;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class Formatest_ListFilter1Service {
|
||||
@Autowired
|
||||
private FormatestRepository Repository;
|
||||
|
||||
|
||||
|
||||
|
||||
public List<Formatest_ListFilter1> getlistbuilder() {
|
||||
List<Formatest> list= Repository.findAll();
|
||||
ArrayList<Formatest_ListFilter1> l = new ArrayList<>();
|
||||
for (Formatest data : list) {
|
||||
{
|
||||
Formatest_ListFilter1 dummy = new Formatest_ListFilter1();
|
||||
dummy.setId(data.getId());
|
||||
dummy.setNames(data.getNames());
|
||||
l.add(dummy);
|
||||
}
|
||||
}
|
||||
return l;}
|
||||
|
||||
|
||||
|
||||
public List<Formatest_ListFilter1> getlistbuilderparam( ) {
|
||||
List<Formatest> list= Repository.findAll();
|
||||
ArrayList<Formatest_ListFilter1> l = new ArrayList<>();
|
||||
for (Formatest data : list) {
|
||||
{
|
||||
Formatest_ListFilter1 dummy = new Formatest_ListFilter1();
|
||||
dummy.setId(data.getId());
|
||||
dummy.setNames(data.getNames());
|
||||
l.add(dummy);
|
||||
}
|
||||
}
|
||||
return l;}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.realnet.basicp1.Services;
|
||||
import com.realnet.basicp1.Repository.FormbtestRepository;
|
||||
import com.realnet.basicp1.Entity.Formbtest;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 FormbtestService {
|
||||
@Autowired
|
||||
private FormbtestRepository Repository;
|
||||
@Autowired
|
||||
private AppUserServiceImpl userService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Formbtest Savedata(Formbtest data) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Formbtest save = Repository.save(data);
|
||||
return save;
|
||||
}
|
||||
|
||||
|
||||
// get all with pagination
|
||||
public Page<Formbtest> getAllWithPagination(Pageable page) {
|
||||
return Repository.findAll(page);
|
||||
}
|
||||
public List<Formbtest> getdetails() {
|
||||
return (List<Formbtest>) Repository.findAll();
|
||||
}
|
||||
|
||||
|
||||
public Formbtest getdetailsbyId(Integer id) {
|
||||
return Repository.findById(id).get();
|
||||
}
|
||||
|
||||
|
||||
public void delete_by_id(Integer id) {
|
||||
Repository.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
public Formbtest update(Formbtest data,Integer id) {
|
||||
Formbtest old = Repository.findById(id).get();
|
||||
old.setNamekk(data.getNamekk());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
final Formbtest test = Repository.save(old);
|
||||
return test;}
|
||||
public AppUser getUser() {
|
||||
AppUser user = userService.getLoggedInUser();
|
||||
return user;
|
||||
|
||||
}}
|
|
@ -0,0 +1,4 @@
|
|||
CREATE TABLE db.Formatest(id BIGINT NOT NULL AUTO_INCREMENT, Names VARCHAR(400), colour VARCHAR(400), gender VARCHAR(400), city VARCHAR(400), PRIMARY KEY (id));
|
||||
|
||||
CREATE TABLE db.Formbtest(id BIGINT NOT NULL AUTO_INCREMENT, Imagetest VARCHAR(400), Namekk VARCHAR(400), videotest VARCHAR(400), audiotest VARCHAR(400), Filetest VARCHAR(400), PRIMARY KEY (id));
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<div class="dg-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<h3>Formatest </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>Names</th>
|
||||
|
||||
|
||||
<th>colour</th>
|
||||
|
||||
|
||||
<th>gender</th>
|
||||
|
||||
|
||||
|
||||
|
||||
<th>pune</th>
|
||||
|
||||
|
||||
|
||||
<th>nagpur</th>
|
||||
|
||||
|
||||
|
||||
<th>Action</th> </tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of givendata?.slice()?.reverse() | filter:searchFilter; let i = index">
|
||||
|
||||
<td>{{data.names}}</td>
|
||||
|
||||
|
||||
<td>{{data.colour}}</td>
|
||||
|
||||
|
||||
<td>{{data.gender}}</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td>{{data.pune}}</td>
|
||||
|
||||
|
||||
|
||||
<td>{{data.nagpur}}</td>
|
||||
|
||||
|
||||
|
||||
<td><i class="bi bi-pencil" style="cursor: pointer; padding-right: 10px"(click)="goToEdit(data.id)"></i><i class="bi bi-trash" style="cursor: pointer;" data-bs-toggle="modal" data-bs-target="#deleteModal" (click)="onDelete(data)"></i></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" data-bs-backdrop="false">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" *ngIf="rowSelected.id">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Delete</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are You Sure Want to delete?</p>
|
||||
<h2 class="heading">{{rowSelected.id}}</h2>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" (click)="delete(rowSelected.id)">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
.delete,.heading{
|
||||
text-align: center;
|
||||
color: red;
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
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 { FormatestService } from './Formatest.service';
|
||||
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-Formatest',
|
||||
templateUrl: './Formatest.component.html',
|
||||
styleUrls: ['./Formatest.component.scss']
|
||||
})
|
||||
export class FormatestComponent 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:FormatestService,
|
||||
) {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(["../Formatestadd"],{relativeTo:this.route});
|
||||
}
|
||||
goToEdit(id: any){
|
||||
this.router.navigate(["../Formatestedit/"+ id], { relativeTo: this.route });
|
||||
}
|
||||
onDelete(row) {
|
||||
this.rowSelected = row;
|
||||
this.modaldelete=true;
|
||||
}
|
||||
|
||||
delete(id)
|
||||
{
|
||||
this.modaldelete = false;
|
||||
console.log("in delete "+id);
|
||||
this.mainservice.deleteusr(id).subscribe(
|
||||
(data) => {
|
||||
console.log(data);
|
||||
this.ngOnInit();
|
||||
if (data == null || data) {
|
||||
this.toastr.success('Deleted successfully');
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
console.log('Error in adding data...',+error);
|
||||
if(error){
|
||||
this.toastr.error('Not Deleted Data Getting Some Error');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
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 FormatestService {
|
||||
private baseURL = "Formatest/Formatest" ; 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,109 @@
|
|||
|
||||
<h4 style="font-weight: 500;display: inline;"> Formatest</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"> names </label>
|
||||
<input type="text" class="input" formControlName="names" >
|
||||
<div *ngIf="submitted && entryForm.controls.names.errors" class="error_mess">
|
||||
<div *ngIf="submitted && entryForm.controls.names.errors.required" class="error_mess">*This field is Required</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<label>colour </label>
|
||||
<select formControlName="colour">
|
||||
<option [value]="null">Select colour </option>
|
||||
|
||||
|
||||
<option> red </option>
|
||||
|
||||
|
||||
|
||||
<option> pink </option>
|
||||
|
||||
|
||||
|
||||
<option> black </option>
|
||||
|
||||
|
||||
</select></div>
|
||||
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<label>gender</label>
|
||||
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" formControlName="gender" id="flexRadioDefaultf" (change)="updategender('f')" [checked]="entryForm.get('gender').value === 'f'">
|
||||
<label class="form-check-label" for="flexRadioDefaultf"> f </label>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" formControlName="gender" id="flexRadioDefaultm" (change)="updategender('m')" [checked]="entryForm.get('gender').value === 'm'">
|
||||
<label class="form-check-label" for="flexRadioDefaultm"> m </label>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- multiselect checkbox field start -->
|
||||
<div class="col-md-4 col-sm-12" style="max-height: 150px; overflow: auto;">
|
||||
<label> city</label>
|
||||
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="pune" formControlName="pune" >
|
||||
<label class="form-check-label" for="pune">pune</label>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="nagpur" formControlName="nagpur" >
|
||||
<label class="form-check-label" for="nagpur">nagpur</label>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- multiselect checkbox field end -->
|
||||
|
||||
</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,142 @@
|
|||
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 { FormatestService } from '../Formatest.service';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-Formatestadd',
|
||||
templateUrl: './Formatestadd.component.html',
|
||||
styleUrls: ['./Formatestadd.component.scss']
|
||||
})
|
||||
export class FormatestaddComponent implements OnInit {
|
||||
public entryForm: FormGroup;
|
||||
|
||||
loading = false;
|
||||
tableName = 'Formatest';
|
||||
|
||||
error;
|
||||
submitted=false;
|
||||
|
||||
constructor(private _fb: FormBuilder,
|
||||
private mainservice:FormatestService,
|
||||
private router: Router,private accesstype:AccesstypeService,
|
||||
private route: ActivatedRoute,
|
||||
|
||||
private toastr: ToastrService ) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.entryForm = this._fb.group({
|
||||
names :[null],
|
||||
|
||||
colour :[null],
|
||||
|
||||
gender :[null],
|
||||
|
||||
|
||||
|
||||
pune:[false],
|
||||
|
||||
|
||||
|
||||
nagpur:[false],
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
givendata;
|
||||
getData(){
|
||||
this.mainservice.getAll().subscribe((data) => {
|
||||
console.log(data);
|
||||
this.givendata = data;
|
||||
},(error) => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
onSubmit(){
|
||||
this.submitted=true
|
||||
if (this.entryForm.invalid) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(this.entryForm.value);
|
||||
this.mainservice.create(this.entryForm.value).subscribe(data => {
|
||||
console.log(data)
|
||||
if (data || data.status >= 200 && data.status <= 299) {
|
||||
this.toastr.success("Added Successfully");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
(error) => {
|
||||
console.log(error);
|
||||
if (error.status >= 200 && error.status <= 299) {
|
||||
// this.toastr.success("Added Succesfully");
|
||||
}
|
||||
if (error.status >= 400 && error.status <= 499) {
|
||||
this.toastr.error("Not Added");
|
||||
}
|
||||
if (error.status >= 500 && error.status <= 599) {
|
||||
this.toastr.error("Not Added");
|
||||
}
|
||||
});
|
||||
this.router.navigate(["../Formatest"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
goback(){
|
||||
this.router.navigate(["../Formatest"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
|
||||
|
||||
updategender (gender : string): void {
|
||||
this.entryForm.get('gender').setValue(gender); };
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
<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"> names</label>
|
||||
<input type="text" class="input" name="names" [(ngModel)]="data1.names" >
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<label> colour </label>
|
||||
<select name="colour" [(ngModel)]="data1.colour">
|
||||
<option [value]="null">Selectcolour
|
||||
</option>
|
||||
|
||||
|
||||
|
||||
<option> red </option>
|
||||
|
||||
|
||||
|
||||
|
||||
<option> pink </option>
|
||||
|
||||
|
||||
|
||||
|
||||
<option> black </option>
|
||||
|
||||
|
||||
|
||||
</select> </div>
|
||||
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<label>gender</label>
|
||||
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="gender" id="flexRadioDefaultf" (change)="updategenderEdit('f')" [checked]="data1.gender === 'f'">
|
||||
<label class="form-check-label" for="flexRadioDefaultf"> f </label>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="gender" id="flexRadioDefaultm" (change)="updategenderEdit('m')" [checked]="data1.gender === 'm'">
|
||||
<label class="form-check-label" for="flexRadioDefaultm"> m </label>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- multiselect checkbox field start -->
|
||||
<div class="col-md-4 col-sm-12" style="max-height: 150px; overflow: auto;">
|
||||
<label> city </label>
|
||||
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="pune" name="pune" [(ngModel)]="data1.pune">
|
||||
<label class="form-check-label" for="pune">pune</label>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="nagpur" name="nagpur" [(ngModel)]="data1.nagpur">
|
||||
<label class="form-check-label" for="nagpur">nagpur</label>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- multiselect checkbox field end -->
|
||||
|
||||
</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,116 @@
|
|||
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 { FormatestService } from '../Formatest.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-Formatestedit',
|
||||
templateUrl: './Formatestedit.component.html',
|
||||
styleUrls: ['./Formatestedit.component.scss']
|
||||
})
|
||||
export class FormatesteditComponent implements OnInit {
|
||||
id:number;
|
||||
data1:any={};
|
||||
loading = false;
|
||||
tableName = 'Formatest';
|
||||
|
||||
error;
|
||||
constructor( private route:ActivatedRoute,
|
||||
private mainservice:FormatestService,
|
||||
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(["../../Formatest"], { 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(["../../Formatest"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
|
||||
|
||||
updategenderEdit(gender : string): void { this.data1.gender = gender }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<div class="dg-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<h3>Formbtest </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>Namekk</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th>audiotest</th>
|
||||
|
||||
|
||||
<th>videotest</th>
|
||||
|
||||
<th>Action</th> </tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of givendata?.slice()?.reverse() | filter:searchFilter; let i = index">
|
||||
|
||||
<td>{{data.namekk}}</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td>{{data.audiotestname}}</td>
|
||||
|
||||
|
||||
<td>{{data.videotestname}}</td>
|
||||
|
||||
<td><i class="bi bi-pencil" style="cursor: pointer; padding-right: 10px"(click)="goToEdit(data.id)"></i><i class="bi bi-trash" style="cursor: pointer;" data-bs-toggle="modal" data-bs-target="#deleteModal" (click)="onDelete(data)"></i></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" data-bs-backdrop="false">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" *ngIf="rowSelected.id">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Delete</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are You Sure Want to delete?</p>
|
||||
<h2 class="heading">{{rowSelected.id}}</h2>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" (click)="delete(rowSelected.id)">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
.delete,.heading{
|
||||
text-align: center;
|
||||
color: red;
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
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 { FormbtestService } from './Formbtest.service';
|
||||
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-Formbtest',
|
||||
templateUrl: './Formbtest.component.html',
|
||||
styleUrls: ['./Formbtest.component.scss']
|
||||
})
|
||||
export class FormbtestComponent 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:FormbtestService,
|
||||
) {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(["../Formbtestadd"],{relativeTo:this.route});
|
||||
}
|
||||
goToEdit(id: any){
|
||||
this.router.navigate(["../Formbtestedit/"+ id], { relativeTo: this.route });
|
||||
}
|
||||
onDelete(row) {
|
||||
this.rowSelected = row;
|
||||
this.modaldelete=true;
|
||||
}
|
||||
|
||||
delete(id)
|
||||
{
|
||||
this.modaldelete = false;
|
||||
console.log("in delete "+id);
|
||||
this.mainservice.deleteusr(id).subscribe(
|
||||
(data) => {
|
||||
console.log(data);
|
||||
this.ngOnInit();
|
||||
if (data == null || data) {
|
||||
this.toastr.success('Deleted successfully');
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
console.log('Error in adding data...',+error);
|
||||
if(error){
|
||||
this.toastr.error('Not Deleted Data Getting Some Error');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
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 FormbtestService {
|
||||
private baseURL = "Formbtest/Formbtest" ; constructor(private http: HttpClient, private apiRequest:ApiRequestService) { }
|
||||
getAll(page?: number, size?: number): Observable<any> {
|
||||
return this.apiRequest.get(this.baseURL);
|
||||
}
|
||||
getbyid(id: number): Observable<any> {
|
||||
const _http = this.baseURL + "/" + id;
|
||||
return this.apiRequest.get(_http);
|
||||
}
|
||||
create(data: any, file: any): Observable<any> {
|
||||
const formData = new FormData();
|
||||
formData.append('data', JSON.stringify(data));
|
||||
formData.append('file', file);
|
||||
return this.apiRequest.postFormData(this.baseURL, formData);
|
||||
}
|
||||
|
||||
updatenew(id: number, data: any): Observable<any> {
|
||||
const _http = this.baseURL + "/" + id;
|
||||
return this.apiRequest.put(_http, data);
|
||||
}
|
||||
deleteusr(id: number): Observable<any> {
|
||||
const _http = this.baseURL + "/" + id;
|
||||
return this.apiRequest.delete(_http);
|
||||
}
|
||||
|
||||
|
||||
uploadfilefiletest(ref:any, Formbtest:any, file:any): Observable<any>{
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Formbtest}`, formData);
|
||||
}
|
||||
|
||||
uploadfilegetByIdfiletest(ref:any, Formbtest:any,): Observable<any> {
|
||||
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Formbtest}`);
|
||||
}
|
||||
|
||||
|
||||
uploadfiledeletefiletest(id: number): Observable<any> {
|
||||
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
|
||||
}
|
||||
|
||||
uploadImagetest(ref:any, Formbtest:any, file:any): Observable<any>{
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Formbtest}`, formData);
|
||||
}
|
||||
|
||||
uploadImagetestgetById(ref:any, Formbtest:any,): Observable<any> {
|
||||
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Formbtest}`);
|
||||
}
|
||||
|
||||
|
||||
uploadImagetestdelete(id: number): Observable<any> {
|
||||
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
|
||||
}
|
||||
|
||||
uploadAudiotest(ref:any, Formbtest:any, file:any): Observable<any>{
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Formbtest}`, formData);
|
||||
}
|
||||
|
||||
uploadAudiotestgetById(ref:any, Formbtest:any,): Observable<any> {
|
||||
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Formbtest}`);
|
||||
}
|
||||
|
||||
|
||||
uploadAudiotestdelete(id: number): Observable<any> {
|
||||
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
|
||||
}
|
||||
|
||||
uploadVideotest(ref:any, Formbtest:any, file:any): Observable<any>{
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Formbtest}`, formData);
|
||||
}
|
||||
|
||||
uploadVideotestgetById(ref:any, Formbtest:any,): Observable<any> {
|
||||
return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Formbtest}`);
|
||||
}
|
||||
|
||||
|
||||
uploadVideotestdelete(id: number): Observable<any> {
|
||||
return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
|
||||
}
|
||||
|
||||
// updateaction
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
|
||||
<h4 style="font-weight: 500;display: inline;"> Formbtest</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"> namekk </label>
|
||||
<input type="text" class="input" formControlName="namekk" >
|
||||
<div *ngIf="submitted && entryForm.controls.namekk.errors" class="error_mess">
|
||||
<div *ngIf="submitted && entryForm.controls.namekk.errors.required" class="error_mess">*This field is Required</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<label>audiotest</label><br>
|
||||
<input type="file"accept="audio/*" (change)="onFileChanged($event)"/>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<label>videotest</label><br>
|
||||
<input type="file" accept="video/mp4,video/x-m4v,video/*" (change)="onFileChanged($event)"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<h6> List of filetest</h6>
|
||||
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th> File</th>
|
||||
<th>File Name</th>
|
||||
<th>Preview</th>
|
||||
<th>Cancel</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody >
|
||||
<tr *ngFor="let attach of FileDatafiletest; let i=index">
|
||||
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
|
||||
<td><input type="file" (change)="onFileChangedfiletest($event, i)" accept = "application/pdf,.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" /><!--accept=".pdf,.doc,.docx,.jpg,.msg"-->
|
||||
</td>
|
||||
<td>{{attach.uploadedfile_name}}</td>
|
||||
<td > <img [src]="attach.filePreview" alt="File Preview" [ngModelOptions]="{standalone: true}" name="filePreview" width="100px" height="100px"></td>
|
||||
<td>
|
||||
<a (click)="deleteRowfiletest(i)">
|
||||
<i class="bi bi-trash is-error"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesfiletest()">
|
||||
<i class="bi bi-plus"></i>
|
||||
</button>
|
||||
|
||||
</table> </div>
|
||||
|
||||
<h6> List of imagetest</h6>
|
||||
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th> File</th>
|
||||
<th>File Name</th>
|
||||
<th>Preview</th>
|
||||
<th>Cancel</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody >
|
||||
<tr *ngFor="let attach of FileDataimagetest; let i=index">
|
||||
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
|
||||
<td><input type="file" (change)="onFileChangedimagetest($event, i)" accept="image/*" /><!--accept=".pdf,.doc,.docx,.jpg,.msg"-->
|
||||
</td>
|
||||
<td>{{attach.uploadedfile_name}}</td>
|
||||
<td > <img [src]="attach.filePreview" alt="File Preview" [ngModelOptions]="{standalone: true}" name="filePreview" width="100px" height="100px"></td>
|
||||
<td>
|
||||
<a (click)="deleteRowimagetest(i)">
|
||||
<i class="bi bi-trash is-error"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesimagetest()">
|
||||
<i class="bi bi-plus"></i>
|
||||
</button>
|
||||
|
||||
</table> </div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline" (click)="goback()">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary" (click)="onSubmit()">ADD</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
input[type=text],[type=date],[type=password],[type=number],[type=email],[type=url],[type=datetime-local],textarea {
|
||||
width: 100%;
|
||||
padding: 5px 20px;
|
||||
// margin: 3px 0;
|
||||
background-color:rgb(255, 255, 255);
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.required-field{
|
||||
color: red;
|
||||
font-size: 18px;
|
||||
|
||||
}
|
||||
.green{
|
||||
background-color: rgb(156, 231, 156);
|
||||
color: black;
|
||||
}
|
||||
.blue{
|
||||
background-color: #57abcf;//rgb(82, 87, 161);
|
||||
color: black;
|
||||
}
|
||||
.td-title {
|
||||
text-align: center;
|
||||
width: 150px;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
background-color: rgba(63, 122, 231, 0.863);
|
||||
//color: rgb(24, 13, 13);
|
||||
}
|
||||
th{
|
||||
background-color:rgb(170, 169, 169);
|
||||
font-weight: bold;
|
||||
}
|
||||
.td-content{
|
||||
text-align: left;
|
||||
}
|
||||
.delete,.heading{
|
||||
text-align: center;
|
||||
color: red;
|
||||
}
|
||||
.section p {
|
||||
background-color: rgb(206, 201, 201);
|
||||
padding: 10px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
select{
|
||||
width: 100%;
|
||||
padding: 5px 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
|
||||
input.ng-invalid.ng-touched {
|
||||
border-color: red;
|
||||
}
|
||||
|
||||
.error_mess {
|
||||
color: red;
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
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 { FormbtestService } from '../Formbtest.service';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-Formbtestadd',
|
||||
templateUrl: './Formbtestadd.component.html',
|
||||
styleUrls: ['./Formbtestadd.component.scss']
|
||||
})
|
||||
export class FormbtestaddComponent implements OnInit {
|
||||
public entryForm: FormGroup;
|
||||
|
||||
loading = false;
|
||||
tableName = 'Formbtest';
|
||||
|
||||
error;
|
||||
submitted=false;
|
||||
|
||||
constructor(private _fb: FormBuilder,
|
||||
private mainservice:FormbtestService,
|
||||
private router: Router,private accesstype:AccesstypeService,
|
||||
private route: ActivatedRoute,
|
||||
|
||||
private toastr: ToastrService ) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.entryForm = this._fb.group({
|
||||
namekk :[null],
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
givendata;
|
||||
getData(){
|
||||
this.mainservice.getAll().subscribe((data) => {
|
||||
console.log(data);
|
||||
this.givendata = data;
|
||||
},(error) => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
onSubmit(){
|
||||
this.submitted=true
|
||||
if (this.entryForm.invalid) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(this.entryForm.value);
|
||||
this.mainservice.create(this.entryForm.value, this.selectedvideotest).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(["../Formbtest"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
goback(){
|
||||
this.router.navigate(["../Formbtest"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
filePreviewfiletest: string | ArrayBuffer | null = null;
|
||||
FileDatafiletest: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
|
||||
selectedfiletest: File[]=[];
|
||||
public onFileChangedfiletest(event, index) {
|
||||
const files = event.target.files;
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
this.FileDatafiletest[index].uploadedfile_name = files[i].name;
|
||||
this.selectedfiletest.push(files[i]);
|
||||
if (file.type.startsWith('image/')) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
// Set the file preview source
|
||||
const filePreview = e.target?.result as string;
|
||||
this.FileDatafiletest[index] = {
|
||||
...this.FileDatafiletest[index], // Preserve existing properties
|
||||
filePreview: filePreview // Update only the filePreview property
|
||||
};
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
onAddLinesfiletest(){
|
||||
this.FileDatafiletest.push({
|
||||
uploadedfile_name: "",
|
||||
filePreview: "",
|
||||
// f3: "",
|
||||
});
|
||||
}
|
||||
|
||||
deleteRowfiletest(index,id) {
|
||||
this.FileDatafiletest.splice(index, 1);
|
||||
|
||||
if(id){
|
||||
this.mainservice.uploadfiledelete(id).subscribe(data =>{
|
||||
console.log(data);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
filePreviewimagetest: string | ArrayBuffer | null = null;
|
||||
FileDataimagetest: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
|
||||
selectedimagetest: File[]=[];
|
||||
public onFileChangedimagetest(event, index) {
|
||||
const files = event.target.files;
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
this.FileDataimagetest[index].uploadedfile_name = files[i].name;
|
||||
this.selectedimagetest.push(files[i]);
|
||||
if (file.type.startsWith('image/')) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
// Set the file preview source
|
||||
const filePreview = e.target?.result as string;
|
||||
this.FileDataimagetest[index] = {
|
||||
...this.FileDataimagetest[index], // Preserve existing properties
|
||||
filePreview: filePreview // Update only the filePreview property
|
||||
};
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
onAddLinesimagetest(){
|
||||
this.FileDataimagetest.push({
|
||||
uploadedfile_name: "",
|
||||
filePreview: "",
|
||||
// f3: "",
|
||||
});
|
||||
}
|
||||
|
||||
deleteRowimagetest(index,id) {
|
||||
this.FileDataimagetest.splice(index, 1);
|
||||
|
||||
if(id){
|
||||
this.mainservice.uploadfiledelete(id).subscribe(data =>{
|
||||
console.log(data);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
selectedaudiotest: File[]=[]; public onFileChanged(event) {
|
||||
console.log(event);
|
||||
this.selectedaudiotest = event.target.files[0];
|
||||
}
|
||||
|
||||
selectedvideotest: File[]=[]; public onFileChanged(event) {
|
||||
console.log(event);
|
||||
this.selectedvideotest = event.target.files[0];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
<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"> namekk</label>
|
||||
<input type="text" class="input" name="namekk" [(ngModel)]="data1.namekk" >
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<h6> List of filetest</h6>
|
||||
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th> File</th>
|
||||
<th>File Name</th>
|
||||
<th>Preview</th>
|
||||
<th>Cancel</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody >
|
||||
<tr *ngFor="let attach of FileDatafiletest; let i=index">
|
||||
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
|
||||
<td><input type="file" (change)="onFileChangedfiletest($event, i)" accept = "application/pdf,.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
|
||||
</td>
|
||||
<td>{{attach.uploadedfile_name}}</td>
|
||||
<td > <img [src]="attach.filePreview" alt="File Preview" [ngModelOptions]="{standalone: true}" name="filePreview" width="100px" height="100px"></td>
|
||||
<td>
|
||||
<i class="bi bi-trash is-error" data-bs-toggle="modal" data-bs-target="#filetestdeleteModal" (click)="deleteRowfiletest(i,attach.id)" style="cursor: pointer;">
|
||||
</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesfiletest()">
|
||||
<i class="bi bi-plus"></i>
|
||||
</button>
|
||||
|
||||
</table> </div>
|
||||
|
||||
<h6> List of imagetest</h6>
|
||||
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th> File</th>
|
||||
<th>File Name</th>
|
||||
<th>Preview</th>
|
||||
<th>Cancel</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody >
|
||||
<tr *ngFor="let attach of FileDataimagetest; let i=index">
|
||||
<td style="width: 70px;"><input type="text" class="input" value={{i+1}} [readonly]="true"> </td>
|
||||
<td><input type="file" (change)="onFileChangedimagetest($event, i)" accept="image/*" />
|
||||
</td>
|
||||
<td>{{attach.uploadedfile_name}}</td>
|
||||
<td > <img [src]="attach.filePreview" alt="File Preview" [ngModelOptions]="{standalone: true}" name="filePreview" width="100px" height="100px"></td>
|
||||
<td>
|
||||
<i class="bi bi-trash is-error" data-bs-toggle="modal" data-bs-target="#imagetestdeleteModal" (click)="deleteRowimagetest(i,attach.id)" style="cursor: pointer;">
|
||||
</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
<button type="button" class="btn btn-primary button1" style="margin-left: 20px;" (click)="onAddLinesimagetest()">
|
||||
<i class="bi bi-plus"></i>
|
||||
</button>
|
||||
|
||||
</table> </div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline" (click)="goback()">Close</button>
|
||||
<button type="button" class="btn btn-primary" (click)="update()">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="modal fade" id="filetestdeleteModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" *ngIf="rowSelected.id">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Delete</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are You Sure Want to delete?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" (click)="deletefiletest(rowSelected.index,rowSelected.id)">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="imagetestdeleteModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" *ngIf="rowSelected.id">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Delete</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are You Sure Want to delete?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" (click)="deleteimagetest(rowSelected.index,rowSelected.id)">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
input[type=text],[type=date],[type=password],[type=number],[type=email],[type=url],[type=datetime-local],textarea {
|
||||
width: 100%;
|
||||
padding: 5px 20px;
|
||||
// margin: 3px 0;
|
||||
background-color:rgb(255, 255, 255);
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.required-field{
|
||||
color: red;
|
||||
font-size: 18px;
|
||||
|
||||
}
|
||||
.green{
|
||||
background-color: rgb(156, 231, 156);
|
||||
color: black;
|
||||
}
|
||||
.blue{
|
||||
background-color: #57abcf;//rgb(82, 87, 161);
|
||||
color: black;
|
||||
}
|
||||
.td-title {
|
||||
text-align: center;
|
||||
width: 150px;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
background-color: rgba(63, 122, 231, 0.863);
|
||||
//color: rgb(24, 13, 13);
|
||||
}
|
||||
th{
|
||||
background-color:rgb(170, 169, 169);
|
||||
font-weight: bold;
|
||||
}
|
||||
.td-content{
|
||||
text-align: left;
|
||||
}
|
||||
.delete,.heading{
|
||||
text-align: center;
|
||||
color: red;
|
||||
}
|
||||
.section p {
|
||||
background-color: rgb(206, 201, 201);
|
||||
padding: 10px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
select{
|
||||
width: 100%;
|
||||
padding: 5px 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
|
@ -0,0 +1,242 @@
|
|||
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 { FormbtestService } from '../Formbtest.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-Formbtestedit',
|
||||
templateUrl: './Formbtestedit.component.html',
|
||||
styleUrls: ['./Formbtestedit.component.scss']
|
||||
})
|
||||
export class FormbtesteditComponent implements OnInit {
|
||||
id:number;
|
||||
data1:any={};
|
||||
loading = false;
|
||||
tableName = 'Formbtest';
|
||||
|
||||
error;
|
||||
constructor( private route:ActivatedRoute,
|
||||
private mainservice:FormbtestService,
|
||||
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;
|
||||
|
||||
|
||||
this.selectedfiletest = [];
|
||||
this.mainservice.uploadfilegetById(data.id,this.tableName).subscribe(uploaddata =>{
|
||||
console.log(uploaddata);
|
||||
this.FileDatafiletest = uploaddata;
|
||||
|
||||
})
|
||||
|
||||
this.selectedimagetest = [];
|
||||
this.mainservice.uploadfilegetById(data.id,this.tableName).subscribe(uploaddata =>{
|
||||
console.log(uploaddata);
|
||||
this.FileDataimagetest = uploaddata;
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(this.data1);
|
||||
});
|
||||
}
|
||||
update(){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(this.data1);
|
||||
this.mainservice.updatenew(this.id,this.data1).subscribe((data)=>{
|
||||
console.log(data); if (data || data.status >= 200 && data.status <= 299) {
|
||||
this.toastr.success("Update Successfully");
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (let i = 0; i < this.selectedfiletest.length; i++){
|
||||
|
||||
this.mainservice.uploadfile(data.id,this.tableName,this.selectedfiletest[i]).subscribe(uploaddata =>{
|
||||
console.log(uploaddata);
|
||||
})
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.selectedimagetest.length; i++){
|
||||
|
||||
this.mainservice.uploadfile(data.id,this.tableName,this.selectedimagetest[i]).subscribe(uploaddata =>{
|
||||
console.log(uploaddata);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.router.navigate(["../../Formbtest"], { 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(["../../Formbtest"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
filePreviewfiletest: string | ArrayBuffer | null = null;
|
||||
FileDatafiletest: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
|
||||
selectedfiletest: File[]=[];
|
||||
public onFileChangedfiletest(event, index) {
|
||||
const files = event.target.files;
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
this.FileDatafiletest[index].uploadedfile_name = files[i].name;
|
||||
this.selectedfiletest.push(files[i]);
|
||||
if (file.type.startsWith('image/')) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
// Set the file preview source
|
||||
const filePreview = e.target?.result as string;
|
||||
this.FileDatafiletest[index] = {
|
||||
...this.FileDatafiletest[index], // Preserve existing properties
|
||||
filePreview: filePreview // Update only the filePreview property
|
||||
};
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
onAddLinesfiletest(){
|
||||
this.FileDatafiletest.push({
|
||||
uploadedfile_name: "",
|
||||
filePreview: "",
|
||||
// f3: "",
|
||||
});
|
||||
}
|
||||
rowSelected :any= {};
|
||||
deleteRowfiletest(index,id) {
|
||||
this.modalissue.removeAllBackdrops();
|
||||
const row:any = {
|
||||
index: index,
|
||||
id: id
|
||||
}
|
||||
this.rowSelected = row;
|
||||
}
|
||||
|
||||
deletefiletest(index,id) {
|
||||
this.FileDatafiletest.splice(index, 1);
|
||||
|
||||
if(id){
|
||||
this.mainservice.uploadfiledelete(id).subscribe(data =>{
|
||||
console.log(data);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
filePreviewimagetest: string | ArrayBuffer | null = null;
|
||||
FileDataimagetest: {uploadedfile_name?:any, filePreview: string | ArrayBuffer | null }[] = []; // Initialize the array
|
||||
selectedimagetest: File[]=[];
|
||||
public onFileChangedimagetest(event, index) {
|
||||
const files = event.target.files;
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
this.FileDataimagetest[index].uploadedfile_name = files[i].name;
|
||||
this.selectedimagetest.push(files[i]);
|
||||
if (file.type.startsWith('image/')) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
// Set the file preview source
|
||||
const filePreview = e.target?.result as string;
|
||||
this.FileDataimagetest[index] = {
|
||||
...this.FileDataimagetest[index], // Preserve existing properties
|
||||
filePreview: filePreview // Update only the filePreview property
|
||||
};
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
onAddLinesimagetest(){
|
||||
this.FileDataimagetest.push({
|
||||
uploadedfile_name: "",
|
||||
filePreview: "",
|
||||
// f3: "",
|
||||
});
|
||||
}
|
||||
rowSelected :any= {};
|
||||
deleteRowimagetest(index,id) {
|
||||
this.modalissue.removeAllBackdrops();
|
||||
const row:any = {
|
||||
index: index,
|
||||
id: id
|
||||
}
|
||||
this.rowSelected = row;
|
||||
}
|
||||
|
||||
deleteimagetest(index,id) {
|
||||
this.FileDataimagetest.splice(index, 1);
|
||||
|
||||
if(id){
|
||||
this.mainservice.uploadfiledelete(id).subscribe(data =>{
|
||||
console.log(data);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,3 +1,9 @@
|
|||
import { FormbtesteditComponent } from './BuilderComponents/basicp1/Formbtest/Formbtestedit/Formbtestedit.component';
|
||||
import { FormbtestaddComponent } from './BuilderComponents/basicp1/Formbtest/Formbtestadd/Formbtestadd.component';
|
||||
import { FormbtestComponent } from './BuilderComponents/basicp1/Formbtest/Formbtest.component';
|
||||
import { FormatesteditComponent } from './BuilderComponents/basicp1/Formatest/Formatestedit/Formatestedit.component';
|
||||
import { FormatestaddComponent } from './BuilderComponents/basicp1/Formatest/Formatestadd/Formatestadd.component';
|
||||
import { FormatestComponent } from './BuilderComponents/basicp1/Formatest/Formatest.component';
|
||||
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
@ -103,6 +109,24 @@ const routes: Routes = [
|
|||
|
||||
},
|
||||
// buildercomponents
|
||||
{path:'Formbtestedit/:id',component:FormbtesteditComponent},
|
||||
|
||||
|
||||
{path:'Formbtestadd',component:FormbtestaddComponent},
|
||||
|
||||
|
||||
{path:'Formbtest',component:FormbtestComponent},
|
||||
|
||||
|
||||
{path:'Formatestedit/:id',component:FormatesteditComponent},
|
||||
|
||||
|
||||
{path:'Formatestadd',component:FormatestaddComponent},
|
||||
|
||||
|
||||
{path:'Formatest',component:FormatestComponent},
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
import { FormbtesteditComponent } from './BuilderComponents/basicp1/Formbtest/Formbtestedit/Formbtestedit.component';
|
||||
import { FormbtestaddComponent } from './BuilderComponents/basicp1/Formbtest/Formbtestadd/Formbtestadd.component';
|
||||
import { FormbtestComponent } from './BuilderComponents/basicp1/Formbtest/Formbtest.component';
|
||||
import { FormatesteditComponent } from './BuilderComponents/basicp1/Formatest/Formatestedit/Formatestedit.component';
|
||||
import { FormatestaddComponent } from './BuilderComponents/basicp1/Formatest/Formatestadd/Formatestadd.component';
|
||||
import { FormatestComponent } from './BuilderComponents/basicp1/Formatest/Formatest.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
|
||||
FormbtesteditComponent,
|
||||
|
||||
|
||||
FormbtestaddComponent,
|
||||
|
||||
|
||||
FormbtestComponent,
|
||||
|
||||
|
||||
FormatesteditComponent,
|
||||
|
||||
|
||||
FormatestaddComponent,
|
||||
|
||||
|
||||
FormatestComponent,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue