Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {Col, Button, Form, FormGroup, Label} from 'react-bootstrap';
- import {CountyService, UserService, getCounties} from "../../services";
- import {Component} from 'react';
- import * as React from 'react';
- import {Alert} from "../../widgets";
- import ReactDOM from 'react-dom';
- import {County} from "../../classTypes";
- import DropdownButton from "react-bootstrap/es/DropdownButton";
- import MenuItem from "react-bootstrap/es/MenuItem";
- import Grid from "react-bootstrap/es/Grid";
- import {FormControl, PageHeader} from "react-bootstrap";
- import Checkbox from "react-bootstrap/es/Checkbox";
- import Select from "react-select";
- let countyService = new CountyService();
- let userService = new UserService();
- interface State{
- mail: string;
- firstName: string;
- lastName: string;
- password: string;
- password2: string;
- typeName: string;
- phone: string;
- points: number;
- countyId: number;
- countyName: string;
- active: number;
- isLoaded: boolean;
- }
- interface Props{
- match: Object,
- }
- /*class BindDropDown extends Component {
- constructor(props) {
- super(props);
- this.state = {
- choosen: {name: "Bergen", countyId: 1},
- values:[
- {name: "Bergen", countyId: 1}
- //{ name: this.county.name, countyId: this.county.countyId}
- ]
- }
- this.handleChangeCounty = this.handleChangeCounty.bind(this)
- }
- handleChangeCounty(e: Object){
- console.log(this.state.choosen.countyId)
- this.setState({
- choosen: JSON.parse(e.target.value)
- })
- };
- componentWillMount() {
- var arr = [];
- countyService
- .getCounties()
- .then(county2 => {
- county2.map(e => {
- var elem = {
- name: e.name,
- countyId: e.countyId
- };
- arr = arr.concat(elem)
- });
- this.setState({
- values: arr
- })
- })
- //this.state.countyName.push(this.state.county.name)})
- .catch((error: Error)=>Alert.danger(error.message))
- }
- render(){
- let optionTemplate = this.state.values.map(v => {
- var data = {name: v.name, countyId: v.countyId}
- return(<option key={v.countyId} value={JSON.stringify(data)}> {v.name}</option>)
- });
- return (
- <label>
- Velg Kommune:
- <select value={this.state.values.countyId} onChange={this.handleChangeCounty}>
- {optionTemplate}
- </select>
- </label>
- )
- }
- }*/
- export class RegisterUser extends Component<Props, State>{
- /*state = {
- mail: "",
- firstName: "",
- lastName: "",
- postnumber: 0,
- password: "",
- password2: "",
- typeName: "",
- phone: 0,
- points: 0,
- active: 0,
- isLoaded: false,
- };*/
- constructor(props) {
- super(props);
- this.state = {
- mail: "",
- firstName: "",
- lastName: "",
- postnumber: 0,
- password: "",
- password2: "",
- typeName: "",
- phone: "",
- points: 0,
- active: 0,
- isLoaded: false,
- choosen: {label: "Bergen", countyId: 1},
- values:[
- {label: "Bergen", countyId: 1}
- //{ name: this.county.name, countyId: this.county.countyId}
- ]
- }
- this.handleChangeCounty = this.handleChangeCounty.bind(this)
- }
- handleChangeCounty(e: Object){
- this.setState({
- choosen: JSON.parse(e.value)
- })
- };
- componentWillMount() {
- var arr = [];
- countyService
- .getCounties()
- .then(county2 => {
- county2.map(e => {
- var elem = {
- name: e.name,
- countyId: e.countyId
- };
- arr = arr.concat(elem)
- });
- this.setState({
- values: arr
- })
- })
- //this.state.countyName.push(this.state.county.name)})
- .catch((error: Error)=>Alert.danger(error.message))
- }
- handleStringChange = (name: string) =>(event:SyntheticEvent<HTMLInputElement>)=>{
- this.setState({
- // $FlowFixMe
- [name]:event.target.value,
- })
- };
- handleNumberChange = (value: number) =>(event:SyntheticEvent<HTMLInputElement>)=>{
- this.setState({
- // $FlowFixMe
- [value]:event.target.value,
- })
- };
- /*;*/
- /*;*/
- /*let optionTemplate = this.state.values.map(v => {
- var data = {label: v.name, countyId: v.countyId}
- return( <Select
- placeholder={"Hjemmekommune"}
- name="colors"
- options={optiontem}
- className="basic-multi-select"
- classNamePrefix="select"
- />)})*/
- render(){
- let optionTemplate = this.state.values.map(v => {
- const data = {label: v.name, value: v.countyId, countyId: v.countyId};
- return(data)
- });
- return(
- <Grid>
- <Col md={3}></Col>
- <Col md={6}>
- <Form horizontal>
- <FormGroup controlId="formHorizontalEmail">
- <FormGroup>
- <FormGroup>
- <Col md={3}></Col>
- <Col md={6}>
- <PageHeader>
- Registrer bruker
- </PageHeader>
- </Col>
- <Col md={3}></Col>
- </FormGroup>
- <Col md={6}>
- <FormGroup>
- <FormControl type="text" value={this.state.firstName} placeholder="Fornavn"
- onChange={this.handleStringChange("firstName")}
- />
- </FormGroup>
- </Col>
- <Col md={6}>
- <FormGroup>
- <FormControl type="text" value={this.state.lastName} placeholder="Etternavn"
- onChange={this.handleStringChange("lastName")}/>
- </FormGroup>
- </Col>
- <Col md={6}>
- <FormGroup>
- <FormControl type="number" value={this.state.phone} placeholder="Telefonnummer"
- onChange={this.handleStringChange("phone")}
- />
- </FormGroup>
- </Col>
- <Col md={6}>
- <FormGroup>
- <FormControl type="text" value={this.state.mail} placeholder="Epost"
- onChange={this.handleStringChange("mail")}/>
- </FormGroup>
- </Col>
- <Col md={6}>
- <FormGroup>
- <FormControl type="password" value={this.state.password} placeholder="Passord"
- onChange={this.handleStringChange("password")}
- />
- </FormGroup>
- </Col>
- <Col md={6}>
- <FormGroup>
- <FormControl type="password" value={this.state.password2} placeholder="Gjenta passord"
- onChange={this.handleStringChange("password2")}/>
- </FormGroup>
- </Col>
- </FormGroup>
- <FormGroup>
- <Col md={4}>
- <FormGroup>
- <Label>
- Hjemmekommune
- </Label>
- </FormGroup>
- <FormGroup>
- <Select
- placeholder={"Hjemmekommune"}
- name="colors"
- options={optionTemplate}
- className="basic-multi-select"
- classNamePrefix="select"
- onChange={this.handleChangeCounty}
- />
- </FormGroup>
- </Col>
- <Col md={4}>
- <FormGroup>
- <Label>Velg kommuner du vil følge</Label>
- </FormGroup>
- <FormGroup>
- <Checkbox inline>Oslo</Checkbox><Checkbox>Trondheim</Checkbox><Checkbox>Bergen</Checkbox>
- </FormGroup>
- </Col>
- <Col md={4}>
- <FormGroup>
- <Label>Velg arbeidsområder</Label>
- </FormGroup>
- <FormGroup>
- <Checkbox inline>Vann og avløp</Checkbox><Checkbox>Veiarbeid</Checkbox><Checkbox>Strømbrudd</Checkbox>
- </FormGroup>
- </Col>
- </FormGroup>
- <FormGroup>
- <Col md={4}/>
- <Col md ={4}>
- <Button type="button" onClick={this.checkMail}>Registrer</Button>
- </Col>
- <Col md={4}>
- </Col>
- </FormGroup>
- </FormGroup>
- </Form>
- </Col>
- <Col md={3}></Col>
- </Grid>
- );
- }
- checkMail = () =>{
- var validator = require("email-validator");
- if(!(validator.validate(this.state.mail))){
- Alert.warning("Eposten eksisterer ikke")
- }else{
- this.register();
- }
- }
- checkPass = () => {
- if (this.state.password !== this.state.password2) {
- console.log("To ulike passord");
- Alert.warning("Du skrev to ulike passord");
- }
- else {
- let decimal = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,15}$/;
- if(this.state.password.match(decimal))
- {
- this.register();
- }
- else
- {
- Alert.warning('Password has to be between 8 to 15 characters which contain at least one lowercase letter, one uppercase letter, one numeric digit, and one special character')
- }
- }
- }
- register = () => {
- console.log("test", this.state);
- const newUser = {
- mail: this.state.mail,
- firstName: this.state.firstName,
- lastName: this.state.lastName,
- password: this.state.password,
- phone: this.state.phone,
- countyId: this.state.choosen,
- };
- console.log("county", this.state.choosen)
- userService
- .addUser(newUser)
- .then(user =>(this.state = user)).then(Alert.success("Bruker registrert"))
- .catch((error: Error)=>Alert.danger(error.message))
- }
- }
- /*
- * <DropdownButton title="Hjemmekommune">
- value={this.state.countyName}
- onChange={(e)=>this.handleChangeCounty(e)}>
- {this.state.countyName.map((r, i) => {
- return <option key={i} value={r}>{r}
- </option>
- })
- }
- </DropdownButton>
- checkPass(){
- console.log(state);
- if(this.state.password==this.state.password2){
- this.register();
- Alert.success();
- }else{
- Alert.warning();
- }
- }
- */
- import {CountyService, UserService} from "../../services";
- import {Component} from 'react';
- import * as React from 'react';
- import {Alert} from "../../widgets";
- import ReactDOM from 'react-dom';
- import {County} from "../../classTypes";
- import DropdownButton from "react-bootstrap/es/DropdownButton";
- import MenuItem from "react-bootstrap/es/MenuItem";
- import Row from "react-bootstrap/es/Row";
- import Col from "react-bootstrap/es/Col";
- import Button from "react-bootstrap/es/Button";
- import FormGroup from "react-bootstrap/es/FormGroup";
- import {Form, FormControl, Label, PageHeader} from 'react-bootstrap';
- import ControlLabel from "react-bootstrap/es/ControlLabel";
- import Grid from "react-bootstrap/es/Grid";
- import Checkbox from "react-bootstrap/es/Checkbox";
- import Select from "react-select";
- let countyService = new CountyService();
- let userService = new UserService();
- /*interface State{
- companyName: string;
- category: Array<Object>;
- mail: string;
- firstName: string;
- lastName: string;
- address: string;
- postNumber: string;
- password: string;
- password2: string;
- typeName: string;
- phone: string;
- points: number;
- countyId: number;
- countyName: string;
- description: string;
- orgNumber: number;
- active: number;
- isLoaded: boolean;
- }
- interface Props{
- match: Object,
- }*/
- export class RegisterCompany extends Component<Props, State>{
- constructor(props) {
- super(props);
- this.state = {
- companyName: "",
- category: [],
- mail: "",
- firstName: "",
- lastName: "",
- address: "",
- postNumber: "",
- password: "",
- password2: "",
- typeName: "",
- phone: "",
- points: 0,
- active: 0,
- isLoaded: false,
- choosen: {name: "Bergen", countyId: 1},
- values:[
- {name: "Bergen", countyId: 1}
- //{ name: this.county.name, countyId: this.county.countyId}
- ],
- description: "",
- orgNumber: ""
- };
- this.handleChangeCounty = this.handleChangeCounty.bind(this)
- }
- handleChangeCounty(e: Object){
- this.setState({
- choosen: JSON.parse(e.value)
- })
- };
- componentWillMount() {
- var arr = [];
- countyService
- .getCounties()
- .then(county2 => {
- county2.map(e => {
- var elem = {
- name: e.name,
- countyId: e.countyId
- };
- arr = arr.concat(elem)
- });
- this.setState({
- values: arr
- })
- })
- //this.state.countyName.push(this.state.county.name)})
- .catch((error: Error)=>Alert.danger(error.message))
- }
- handleStringChange = (name: string) =>(event:SyntheticEvent<HTMLInputElement>)=>{
- this.setState({
- // $FlowFixMe
- [name]:event.target.value,
- })
- };
- handleNumberChange = (value: number) =>(event:SyntheticEvent<HTMLInputElement>)=>{
- this.setState({
- // $FlowFixMe
- [value]:event.target.value,
- })
- };
- render(){
- let optionTemplate = this.state.values.map(v => {
- const data = {label: v.name, value: v.countyId, countyId: v.countyId};
- return(data)
- });
- return(
- <Grid>
- <Col md={3}></Col>
- <Col md={6}>
- <Form horizontal>
- <FormGroup controlId="formHorizontalEmail">
- <FormGroup>
- <Col md={3}></Col>
- <Col md={6}>
- <PageHeader>
- Registrer bedrift
- </PageHeader>
- </Col>
- <Col md={3}></Col>
- </FormGroup>
- <FormGroup>
- <Col md={6}>
- <FormGroup>
- <FormControl type="text" value={this.state.firstName} placeholder="Fornavn"
- onChange={this.handleStringChange("firstName")}
- />
- </FormGroup>
- </Col>
- <Col md={6}>
- <FormGroup>
- <FormControl type="text" value={this.state.lastName} placeholder="Etternavn"
- onChange={this.handleStringChange("lastName")}/>
- </FormGroup>
- </Col>
- </FormGroup>
- <FormGroup>
- <Col md={6}>
- <FormGroup>
- <FormControl type="text" value={this.state.address} placeholder="Addresse"
- onChange={this.handleStringChange("address")}
- />
- </FormGroup>
- </Col>
- <Col md={6}>
- <FormGroup>
- <FormControl type="number" value={this.state.postNumber} placeholder="Postnummer"
- onChange={this.handleNumberChange("postNumber")}/>
- </FormGroup>
- </Col>
- </FormGroup>
- <FormGroup>
- <Col md={6}>
- <FormGroup>
- <FormControl type="text" value={this.state.companyName} placeholder="Bedriftens navn"
- onChange={this.handleStringChange("companyName")}
- />
- </FormGroup>
- </Col>
- {' '}
- <Col md={6}>
- <FormGroup>
- <FormControl type="number" value={this.state.phone} placeholder="Telefonnummer"
- onChange={this.handleStringChange("phone")}
- />
- </FormGroup>
- </Col>
- </FormGroup>
- <FormGroup>
- <Col md={6}>
- <FormGroup>
- <FormControl type="text" value={this.state.mail} placeholder="Epost"
- onChange={this.handleStringChange("mail")}/>
- </FormGroup>
- </Col>
- <Col md={6}>
- <FormGroup>
- <FormControl type="text" value={this.state.mail} placeholder="Organisasjonsnummer"
- onChange={this.handleStringChange("orgNumber")}/>
- </FormGroup>
- </Col>
- </FormGroup>
- <FormGroup>
- <Col md={6}>
- <FormGroup>
- <FormControl type="password" value={this.state.password} placeholder="Passord"
- onChange={this.handleStringChange("password")}
- />
- </FormGroup>
- </Col>
- <Col md={6}>
- <FormGroup>
- <FormControl type="password" value={this.state.password2} placeholder="Gjenta passord"
- onChange={this.handleStringChange("password2")}/>
- </FormGroup>
- </Col>
- </FormGroup>
- <FormGroup>
- <Col md={4}>
- <FormGroup>
- <Label>
- Hjemmekommune
- </Label>
- </FormGroup>
- <FormGroup>
- <Select
- placeholder={"Hjemmekommune"}
- name="colors"
- options={optionTemplate}
- className="basic-multi-select"
- classNamePrefix="select"
- onChange={this.handleChangeCounty}
- />
- </FormGroup>
- </Col>
- <Col md={4}>
- <FormGroup>
- <Select
- placeholder={"Kommuner å følge"}
- isMulti
- name="colors"
- options={optionTemplate}
- className="basic-multi-select"
- classNamePrefix="select"
- />
- </FormGroup>
- </Col>
- <Col md={4}> /*Ikke gjør noe med det her enda, vi kan vente å se hvor god tid vi får*/
- <FormGroup>
- <Label>Velg arbeidsområder</Label>
- </FormGroup>
- <FormGroup>
- <Checkbox inline>Vann og avløp</Checkbox><Checkbox>Veiarbeid</Checkbox><Checkbox>Strømbrudd</Checkbox>
- </FormGroup>
- </Col>
- </FormGroup>
- <FormGroup>
- <Col md={4}/>
- <Col md ={4}>
- <Button type="button" onClick={this.checkMail}>Registrer</Button>
- </Col>
- <Col md={4}>
- </Col>
- </FormGroup>
- </FormGroup>
- </Form>
- </Col>
- <Col md={3}></Col>
- </Grid>
- );
- }
- checkMail = () =>{
- var validator = require("email-validator");
- if(!(validator.validate(this.state.mail))){
- Alert.warning("Eposten eksisterer ikke")
- }else{
- this.register();
- }
- }
- checkPass = () => {
- if (this.state.password !== this.state.password2) {
- console.log("To ulike passord");
- Alert.warning("Du skrev to ulike passord");
- }
- else {
- let decimal = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,15}$/;
- if(this.state.password.match(decimal))
- {
- this.register();
- }
- else
- {
- Alert.warning('Password has to be between 8 to 15 characters which contain at least one lowercase letter, one uppercase letter, one numeric digit, and one special character')
- }
- }
- }
- register = () => {
- console.log("test", this.state);
- var mail = this.state.mail
- var firstName = this.state.firstName
- var lastName = this.state.lastName
- var password = this.state.password
- var phone = this.state.phone
- var countyId = this.state.choosen.countyId
- console.log("county", countyId)
- userService
- .addUser(this.state.mail, this.state.firstName, this.state.lastName, this.state.password, this.state.phone, this.state.choosen.countyId)
- .then(user =>(this.state = user)).then(Alert.success("Bruker registrert"))
- .catch((error: Error)=>Alert.danger(error.message))
- };
- }
- /*{' '}
- <FormGroup>
- <Col>
- <Input type="text" value={this.state.lastName} placeholder="Etternavn"
- onChange={this.handleStringChange("lastName")}
- />
- </Col>
- </FormGroup>
- {' '}
- </Row>
- <Row>
- <FormGroup>
- <Col>
- <Input type="text" value={this.state.phone} placeholder="Telefonnummer"
- onChange={this.handleNumberChange("phone")}
- />
- </Col>
- </FormGroup>
- </Row>
- <Row>
- <FormGroup>
- <Col>
- <label>
- Velg Kommune:
- <select value={this.state.values.countyId} onChange={this.handleChangeCounty}>
- {optionTemplate}
- </select>
- </label>
- </Col>
- </FormGroup>
- </Row>
- <Row>
- <FormGroup>
- <Col sm="12">
- <Input type="text" value={this.state.mail} placeholder="Epost"
- onChange={this.handleStringChange("mail")}
- />
- </Col>
- </FormGroup>
- </Row>
- <Row>
- <FormGroup>
- <Col>
- <Input type="text" value={this.state.password} placeholder="Passord"
- onChange={this.handleStringChange("password")}
- />
- </Col>
- </FormGroup>
- {' '}
- <FormGroup>
- <Col>
- <Input type="text" value={this.state.password2} placeholder="Gjenta passord"
- onChange={this.handleStringChange("password2")}
- />
- </Col>
- </FormGroup>
- {' '}
- </Row>*/
- // @flow
- import axios from 'axios';
- import {User, Issue, Category, Category2, Category3, Company, Event, Type, County} from "./classTypes";
- axios.interceptors.response.use(response => response.data);
- export class UserService {
- addUser(newUser: User): Promise<Response> {
- return axios.post('/add_user', newUser);
- }//end method
- getUserLogin(email: string): Promise<string[]>{
- return axios.get('/verify_user/' + email);
- }//end method
- getUser(mail: string): Promise<User>{
- return axios.get('/user/get_user/' + mail);
- }//end method
- login(userMail: Object<JSON>): Promise<void>{
- return axios.post('/login/', userMail);
- }//end method
- getMyIssues(userMail: string): Promise<JSON>{
- return axios.get('/user/getMyIssues/' + userMail);
- }//end method
- }//end class
- export class CategoryService {
- getCategory1(): Promise<Category[]> {
- return axios.get('/get_category1');
- }
- getCategory2(): Promise<Category2[]>{
- return axios.get('/get_category2');
- }
- getCategory3(): Promise<Category3[]>{
- return axios.get('/get_category3');
- }
- }
- export class CountyService{
- getCounties(): Promise<County[]>{
- return axios.get('/getCounties');
- }
- }
- export class MyPage{
- }
- export function getAllCounties(usermail:string): Promise<County[]> {
- return axios.get('/getAllCountiesMinusUsers/'+ usermail);
- }
- export function getUsersCounties(usermail: string): Promise<County[]>{
- return axios.get('/getSubscribedCounties/'+ usermail);
- }
- export function deleteSubscription(usermail: string){
- return axios.delete('/deleteAllSubscribedCounties/'+ usermail);
- }
- export function addSubscription(json: Object){
- return axios.post('/addSubscription', json);
- }
- // @flow
- import {Dao} from "../dao";
- const bcrypt = require('bcrypt-nodejs'); //to hash password
- export class UserDao extends Dao {
- addUser(json: Object,hashed:string, callback: Function) {
- let val = [json.mail, json.firstName, json.lastName, hashed, json.phone, json.countyId];
- super.query(
- "insert into user (mail, firstName, lastName, password, typeName, phone, points, countyId, active) values(?, ?, ?, ?, 'Private', ?, 0, ?, 1)",
- val,
- callback);
- }//end method
- getUserLogin(userMail: string, callback: Function) {
- super.query("select mail, password, typeName from user where mail=? ", [userMail], callback);
- }//end method
- getUser(userMail: string, callback: Function) {
- super.query("select * from user where mail=? ", [userMail], callback);
- }//end method}
- getIssuesForOneUser(userMail: string, callback: Function){
- super.query("select categoryId, issues.active, issueId, userMail, latitude, longitude, text, pic, " +
- "date, statusName, countyId, name as 'category', priority from issues " +
- "natural join category where userMail='per@usermail.com' and active=1", [userMail], callback);
- }//end method
- }
- // @flow
- export class User {
- mail: string;
- firstName: string;
- lastName: string;
- password: string;
- typeName: string;
- phone: string;
- points: number;
- countyId: number;
- active: number;
- constructor(mail: string, firstName: string, lastName: string, typeName: string, phone: string, points: number, countyId: number, active: number) {
- this.mail = mail;
- this.firstName = firstName;
- this.lastName = lastName;
- this.typeName = typeName;
- this.phone = phone;
- this.points = points;
- this.countyId = countyId;
- this.active = active;
- }
- }
- export class Issue {
- issueId: number;
- userMail: string;
- latitude: number;
- longitude: number;
- text: string;
- pic: string;
- date: string;
- statusName: string;
- categoryId: number;
- countyId: number;
- constructor(issueId: number, userMail: string, latitude: number, longitude: number, text: string, pic: string, date: string, statusName: string, categoryId: number, countyId: number, active: number) {
- this.issueId = issueId;
- this.userMail = userMail;
- this.latitude = latitude;
- this.longitude = longitude;
- this.text = text;
- this.pic = pic;
- this.date = date;
- this.statusName = statusName;
- this.categoryId = categoryId;
- this.countyId = countyId;
- this.active = active;
- }
- }
- export class Type {
- typeName: string;
- active: number;
- constructor(typeName: string, active: number) {
- this.typeName = typeName;
- this.active = active;
- }
- }
- export class Company extends Type {
- companyMail: string;
- companyName: string;
- description: string;
- constructor(
- typeName: string,
- active: number,
- companyMail: string,
- companyName: string,
- description: string
- ) {
- super(typeName, active);
- this.companyMail = companyMail;
- this.companyName = companyName;
- this.description = description;
- }
- }
- export class Category {
- categoryId: number;
- name: string;
- priority: number;
- active: number;
- constructor(
- categoryId: number,
- name: string,
- priority: number,
- active: number
- ) {
- this.categoryId = categoryId;
- this.name = name;
- this.priority = priority;
- this.active = active;
- }
- }
- export class Category2 extends Category {
- category2Id: number;
- constructor(categoryId: number, category2Id: number, name: string, priority: number, active: number) {
- // noinspection JSAnnotator
- this.category2Id = categoryId;
- super(category2Id, name, priority, active);
- }
- }
- export class Category3 extends Category {
- category2Id: number;
- constructor(categoryId2: number, categoryId3: number, name: string, priority: number, active: number) {
- // noinspection JSAnnotator
- this.category2Id = categoryId2;
- super(categoryId3, name, priority, active);
- }
- }
- export class Event {
- eventId: number;
- title: string;
- text: string;
- date: string;
- userMail: string;
- active: number;
- constructor(
- eventId: number,
- title: string,
- text: string,
- date: string,
- userMail: string,
- active: number
- ) {
- this.eventId = eventId;
- this.title = title;
- this.text = text;
- this.date = date;
- this.userMail = userMail;
- this.active = active;
- }
- }
- export class Status{
- progressBar: String;
- progress: number;
- constructor(status: string){
- //if issue is registered
- if(status === 'Registered'){
- this.progressBar= "info";
- this.progress = 100;
- //if issue is under processing
- }else if(status === 'In progress'){
- this.progressBar ="warning";
- this.progress = 50;
- //if issue is resolved
- }else{
- this.progressBar = "success";
- this.progress = 100;
- }//end condition
- }//end constructor
- }/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement