re init
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
<div class="container col-12">
|
||||
<div class="row justify-content-center">
|
||||
<div class="container animate__animated animate__fadeIn">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<div class="row justify-content-center animate__animated animate__fadeIn" *ngIf="ready" >
|
||||
<div class="col col-lg-6 col-sm-12 shading" style="border: 3px solid #dcdcdc; padding: 35px; border-radius: 3px;">
|
||||
<br>
|
||||
<br>
|
||||
<div class="row text-center">
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-body animate__animated animate__fadeIn">
|
||||
<span id="line1">
|
||||
{{line1}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row text-center">
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-body animate__animated animate__fadeIn">
|
||||
<span id="line2">
|
||||
{{line2}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row text-center">
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-body animate__animated animate__fadeIn">
|
||||
<span id="line3">
|
||||
{{line3}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<div class="text-center" data-toggle="tooltip" data-placement="top" title="Save in Browser">
|
||||
<button type="button"
|
||||
class="ui circular raised icon button"
|
||||
(click)="save_instance()">
|
||||
<i class="heart icon animated pulse infinite" style="color: #C05353;"></i>
|
||||
</button>
|
||||
</div>
|
||||
<br><br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
.shading {
|
||||
-webkit-box-shadow: 1px 3px 5px -2px rgba(66, 66, 66, 1);
|
||||
-moz-box-shadow: 1px 3px 5px -2px rgba(66, 66, 66, 1);
|
||||
box-shadow: 1px 3px 5px -2px rgba(66, 66, 66, 1);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ShareComponent } from './share.component';
|
||||
|
||||
describe('ShareComponent', () => {
|
||||
let component: ShareComponent;
|
||||
let fixture: ComponentFixture<ShareComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ShareComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ShareComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,78 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { DataService } from '../data.service';
|
||||
import { environment } from '../../environments/environment';
|
||||
import axios from 'axios';
|
||||
|
||||
@Component({
|
||||
selector: 'app-share',
|
||||
templateUrl: './share.component.html',
|
||||
styleUrls: ['./share.component.scss']
|
||||
})
|
||||
export class ShareComponent implements OnInit {
|
||||
|
||||
ready = false;
|
||||
|
||||
line1: any;
|
||||
line2: any;
|
||||
line3: any;
|
||||
line_number1: any;
|
||||
line_number2: any;
|
||||
line_number3: any;
|
||||
|
||||
BASE_URL = environment.BASE_URL;
|
||||
|
||||
constructor(
|
||||
private activated_route: ActivatedRoute,
|
||||
private toastr: ToastrService,
|
||||
private data: DataService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.activated_route.params.subscribe((params) => {
|
||||
if(Object.keys(params).length > 0) {
|
||||
this.ready = true;
|
||||
this.line_number1 = params['line1'];
|
||||
this.line_number2 = params['line2'];
|
||||
this.line_number3 = params['line3'];
|
||||
axios({
|
||||
method: 'post',
|
||||
url: this.BASE_URL + '/get_instance',
|
||||
params: {
|
||||
line1: this.line_number1,
|
||||
line2: this.line_number2,
|
||||
line3: this.line_number3
|
||||
}})
|
||||
.then((ting) => {
|
||||
this.line1 = ting.data.line1;
|
||||
this.line2 = ting.data.line2;
|
||||
this.line3 = ting.data.line3;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
this.toastr.error('Server Error!', e);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async save_instance() {
|
||||
try {
|
||||
await this.data.set_item({
|
||||
line1: this.line1,
|
||||
line2: this.line2,
|
||||
line3: this.line3,
|
||||
line_number1: this.line_number1,
|
||||
line_number2: this.line_number2,
|
||||
line_number3: this.line_number3
|
||||
});
|
||||
this.toastr.success('Instance Saved !', "");
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
this.toastr.error('Unable to save instance !');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user