forked from verdona/Web-app---AngularDart-2.0-and-Firebase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
verdona
committed
Aug 29, 2017
1 parent
68254fe
commit 6d810bb
Showing
176 changed files
with
48,689 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
## 0.0.1 | ||
|
||
- Initial version, created by Stagehand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Copyright (c) 2017, Dzenana. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
* Neither the name of the <organization> nor the | ||
names of its contributors may be used to endorse or promote products | ||
derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY | ||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# A web app that uses AngularDart Components | ||
|
||
Generated by Stagehand. Used by: | ||
[Get Started](https://webdev.dartlang.org/guides/get-started) with | ||
[Dart for the web](https://webdev.dartlang.org). | ||
See LICENSE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
analyzer: | ||
strong-mode: true | ||
# exclude: | ||
# - path/to/excluded/files/** | ||
|
||
# Lint rules and documentation, see http://dart-lang.github.io/linter/lints | ||
linter: | ||
rules: | ||
- cancel_subscriptions | ||
- close_sinks | ||
- hash_and_equals | ||
- iterable_contains_unrelated_type | ||
- list_remove_unrelated_type | ||
- test_types_in_equals | ||
- unrelated_type_equality_checks | ||
- valid_regexps |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Korisnik { | ||
String ime; | ||
String email; | ||
String sifra; | ||
|
||
Korisnik(this.ime, this.email, this.sifra); | ||
|
||
String toString() => '$ime'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class Korisnik { | ||
|
||
String email; | ||
String ime; | ||
String sifra; | ||
String alterEgo; | ||
String tipKorisnika; | ||
|
||
Korisnik(this.ime, this.email, this.sifra, this.tipKorisnika, | ||
[this.alterEgo]); | ||
|
||
String toString() => '$ime'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import 'package:osiguranje11082017_v3/Korisnici/korisnik.dart'; | ||
|
||
List<Korisnik> korisnici = []; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class OsiguranjeClass { | ||
String naziv; | ||
String opis; | ||
String tip; | ||
num id; | ||
String duziOpis; | ||
|
||
String toString() => '$naziv'; | ||
|
||
|
||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Komentar { | ||
num Id; | ||
String nazivCovjeka; | ||
String komentar; | ||
String datum; | ||
|
||
String toString() => '$nazivCovjeka'; | ||
|
||
Komentar(this.Id, this.nazivCovjeka, this.komentar, this.datum); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:intl/intl.dart'; | ||
import 'package:osiguranje11082017_v3/Pitanja/komentar.dart'; | ||
|
||
var now = new DateTime.now(); | ||
var formatter = new DateFormat('yyyy-MM-dd'); | ||
String formatted = formatter.format(now); | ||
|
||
List<Komentar> komentariVrijednosti = [new Komentar( | ||
1, 'Emir', 'Određuje se prema građevinskoj vrednosti nekretnine. ' | ||
'Potrebno je proceniti i utvrditi Sumu osiguranja koja bi u slučaju nastanka štetnog događaja bila dovoljna za ' | ||
'vraćanje nekretnine u prvobitno stanje.', formatted) | ||
]; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:intl/intl.dart'; | ||
import 'package:osiguranje11082017_v3/Pitanja/komentari_mock.dart'; | ||
import 'package:osiguranje11082017_v3/Pitanja/pitanje.dart'; | ||
|
||
var now = new DateTime.now(); | ||
var formatter = new DateFormat('yyyy-MM-dd'); | ||
String formatted = formatter.format(now); | ||
|
||
List<Pitanje> pitanja = [ | ||
|
||
new Pitanje( | ||
1, 'Azra', 'Kako se najčešće određuje vrednost za osiguranja imovine?', | ||
formatted, komentariVrijednosti), | ||
|
||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:osiguranje11082017_v3/Pitanja/komentar.dart'; | ||
|
||
|
||
class Pitanje { | ||
Pitanje(this.Id, this.nazivCovjeka, this.pitanje, this.datum, this.komentari); | ||
|
||
num Id; | ||
String nazivCovjeka; | ||
String pitanje; | ||
String datum; | ||
List<Komentar> komentari; | ||
|
||
String toString() => '$nazivCovjeka'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'dart:async'; | ||
import 'package:angular2/angular2.dart'; | ||
import 'package:osiguranje11082017_v3/Korisnici/korisnik.dart'; | ||
import 'package:osiguranje11082017_v3/Korisnici/korisnik_mock.dart'; | ||
import 'package:osiguranje11082017_v3/Osiguranje/osiguranja_mock.dart'; | ||
import 'package:osiguranje11082017_v3/Osiguranje/osiguranjeclass.dart'; | ||
import 'package:osiguranje11082017_v3/Pitanja/pitanja_mock.dart'; | ||
import 'package:osiguranje11082017_v3/Pitanja/pitanje.dart'; | ||
import 'package:osiguranje11082017_v3/Vijesti/Vijest.dart'; | ||
import 'package:osiguranje11082017_v3/Vijesti/vijesti_mock.dart'; | ||
|
||
|
||
@Injectable() | ||
class Service { | ||
//pitanja | ||
Future<List<Pitanje>> getPitanja() async => pitanja; | ||
|
||
Future<Pitanje> GetById(num id) async => | ||
pitanja.firstWhere((pitanje) => pitanje.Id == id); | ||
|
||
Future<int> GetMaxPitanje() async => pitanja.length; | ||
|
||
//osiguranje | ||
Future<List<OsiguranjeClass>> getOsiguranja() async => osiguranja; | ||
|
||
Future<OsiguranjeClass> GetByNameOsiguranje(String naziv) async => | ||
osiguranja.firstWhere((osiguranje) => osiguranje.naziv == naziv); | ||
|
||
Future<OsiguranjeClass> GetOsiguranjeById(num id) async => | ||
osiguranja.firstWhere((o) => o.id == id); | ||
|
||
//korisnici | ||
Future<String> getTipLogovanogKorisnika() async => | ||
korisnici.first.tipKorisnika; | ||
|
||
Future<List<Korisnik>> getKorisnici() async => korisnici; | ||
|
||
//vijesti | ||
Future<List<Vijest>> getVijesti() async => vijesti; | ||
|
||
Future<Vijest> GetVijestById(num id) async => | ||
vijesti.firstWhere((v) => v.Id == id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Vijest { | ||
num Id; | ||
String naslov; | ||
String vijest; | ||
String datum; | ||
String slika; | ||
|
||
Vijest(this.Id, this.naslov, this.vijest, this.datum, this.slika); | ||
|
||
String toString() => '$naslov'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'package:intl/intl.dart'; | ||
import 'package:osiguranje11082017_v3/Vijesti/Vijest.dart'; | ||
|
||
var now = new DateTime.now(); | ||
var formatter = new DateFormat('yyyy-MM-dd'); | ||
String formatted = formatter.format(now); | ||
|
||
List<Vijest> vijesti = [ | ||
|
||
new Vijest(1, "Izvršena isplata najveće poslijeratne štete u BiH", | ||
"Emona osiguranje d.d Sarajevo je izvršilo akontativnu isplatu u iznosu od 5.000.000 KM za štetu društva Bingo d.o.o. Tuzla na objektu u Mostaru koji je uništen u požaru. Ostatak iznosa štete će biti isplaćen nakon konačnog nalaza nadležnih organa. Tim povodom je Uprava Emona osiguranja dana 11.08.2017. godine, bila u posjeti kod osiguranika Bingo d.o.o. Tuzla, gdje je iskazano obostrano " | ||
"zadovoljstvo i spremnost na dalju poslovnu saradnju.Napominjemo da je Emona osiguranje d.d Sarajevo krajem mjeseca juna 2017.godine osiguraniku Bingo d.o.o. Tuzla već isplatilo 1 milion KM za štetu po polici kojom je bila osigurana roba u objektu.", | ||
formatted, | ||
"http://www.sarajevoosiguranje.ba/wp-content/uploads/bfi_thumb/bingo-34e9qj0xmnotk5eqy4jy80.jpg"), | ||
|
||
new Vijest(2, "Emona osiguranje zadržala lidersku poziciju", | ||
"Emona osiguranje je zadržalo lidersku poziciju na tržištu osiguranja u Bosni i Hercegovini, sa premijom od 29.220.501 KM nakon prvih šest mjeseci 2017. godine. Premije u ovoj osiguravajućoj kući su povećane za više od pet miliona KM u odnosu na prvih pet mjeseci iste godine, kada su iznosile 24 miliona KM. Portal Biznisinfo podsjeća da je na drugom mjestu oosiguravajućih društava u FBiH Uniqa osiguranje sa 29.162.928 KM ostvarenih premija u prvoj polovici ove godine. Uniqa osiguranje je prošle i početkom ove godine bilo tržišni lider, " | ||
"prije nego se Emona osiguranje vratilo na tu poziciju. Na trećem mjestu je Euroherc osiguranje s iznosom premije od 27.863.648 KM, a slijede BSO (25.131.956), Croatia (25.077.867), Triglav (22.622.501), Grawe (19.080.051), Merkur BH (14.885.058), Central (12.160.367), ASA (11.710.013), VGT (9.427.769), Zovko (9.418.943) i Camelia osiguranje (5.720.548). " | ||
"Ukupna premijera osiguravajućih društava u Federaciji za pola godine iznosi 241.482.151 KM, u odnosu na 225.012.587 iz istog perioda 2016. Najveći dioničar u Emona osiguranju je Federacija BiH sa oko 45,5 posto vlasništva.", | ||
formatted, | ||
"images/lider.jpg"), | ||
|
||
new Vijest(3, | ||
"Izvještaj o događaju koji bitno utiče na finansijsko poslovanje emitenta", | ||
"Društvo za osiguranje EMONA-OSIGURANJE d.d. Sarajevo. U skladu sa članom 4. " | ||
"Pravilnika o sadržaju, rokovima i načinu objavljivanja izvještaja emitenta objavljujemo: I Z V J E Š T A J O DOGAĐAJU KOJI BITNO UTIČE NA FINANSIJSKO POSLOVANJE EMITENTA", | ||
formatted, "images/finansijskoposlovanje.jpg"), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
// Copyright (c) 2017, Dzenana. All rights reserved. Use of this source code | ||
|
||
// is governed by a BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:convert'; | ||
import 'package:angular2/angular2.dart'; | ||
import 'package:angular2/router.dart'; | ||
import 'package:osiguranje11082017_v3/Osiguranje/osiguranjeclass.dart'; | ||
import 'package:osiguranje11082017_v3/Servis/Service.dart'; | ||
import 'package:osiguranje11082017_v3/dodajVijest_component.dart'; | ||
import 'package:osiguranje11082017_v3/forumosiguranje_component.dart'; | ||
import 'package:osiguranje11082017_v3/Korisnici/korisnik.dart'; | ||
import 'package:osiguranje11082017_v3/kontakt_component.dart'; | ||
import 'package:osiguranje11082017_v3/onama_component.dart'; | ||
import 'package:osiguranje11082017_v3/osiguranjedetalji_component.dart'; | ||
import 'package:osiguranje11082017_v3/planosiguranja_component.dart'; | ||
import 'package:osiguranje11082017_v3/pocetna_component.dart'; | ||
import 'package:firebase/firebase.dart' as fb; | ||
|
||
// AngularDart info: https://webdev.dartlang.org/angular | ||
// Components info: https://webdev.dartlang.org/components | ||
|
||
@Component( | ||
selector: 'my-app', | ||
templateUrl: 'app_component.html', | ||
directives: const[CORE_DIRECTIVES, ROUTER_DIRECTIVES], | ||
providers: const [Service, ROUTER_PROVIDERS] | ||
) | ||
@RouteConfig(const[ | ||
const Route(path: '/pocetna', | ||
name: 'Pocetna', | ||
component: PocetnaComponent, | ||
useAsDefault: true), | ||
const Route(path: '/planosigurnja', | ||
name: 'PlanOsiguranja', | ||
component: PlanOsiguranjaComponent), | ||
const Route(path: '/forum', | ||
name: 'ForumOsiguranja', | ||
component: ForumOsiguranjeComponent), | ||
const Route(path: '/onama', name: 'ONama', component: ONamaComponent), | ||
const Route(path: '/kontakt', name: 'Kontakt', component: KontaktComponent), | ||
const Route( | ||
path: '/novavijest', name: 'Vijest', component: DodajVijestComponent), | ||
const Route(path: '/vijestdetalji', | ||
name: 'OsiguranjeDetaljiComponent', | ||
component: OsiguranjeDetaljiComponent), | ||
]) | ||
class AppComponent | ||
implements OnInit { | ||
|
||
AppComponent(this._service); | ||
|
||
@Input() | ||
List<Korisnik> korisnici; | ||
|
||
List<OsiguranjeClass> osiguranjeClass; | ||
bool submitted = false; | ||
bool novaVijest = true; | ||
|
||
Service _service; | ||
Korisnik korisnik; | ||
|
||
num count = 0; | ||
var osiguranje; | ||
|
||
@override | ||
ngOnInit() async { | ||
fb.initializeApp( | ||
apiKey: "AIzaSyBoO3CklXNReACBWzacUDRIG7pWt8Ii48k", | ||
authDomain: "osiguranje-3bb86.firebaseapp.com", | ||
databaseURL: "https://osiguranje-3bb86.firebaseio.com", | ||
storageBucket: "osiguranje-3bb86.appspot.com" | ||
); | ||
fb.Database database = fb.database(); | ||
fb.DatabaseReference ref = database.ref('osiguranja'); | ||
|
||
ref.onValue.listen((e) { | ||
fb.DataSnapshot datasnapshot = e.snapshot; | ||
var osiguranja = datasnapshot.val(); | ||
List osiguranjaMapa = JSON.decode(osiguranja); | ||
|
||
for (var i = 0; i < osiguranjaMapa.length; i++) { | ||
OsiguranjeClass o = new OsiguranjeClass(); | ||
o.naziv = osiguranjaMapa[i]['naziv']; | ||
osiguranjeClass.add(o); | ||
} | ||
}); | ||
|
||
|
||
korisnici = (await _service.getKorisnici()); | ||
korisnik = new Korisnik('Prijavi se', '', '', 'user'); | ||
korisnici.add(korisnik); | ||
} | ||
|
||
PrijaviSe() { | ||
if (korisnik.email == '[email protected]') { | ||
if (submitted == false) { | ||
korisnici.clear(); | ||
} | ||
korisnik = new Korisnik('Dzenana', '[email protected]', '', 'admin'); | ||
korisnici.add(korisnik); | ||
submitted = !submitted; | ||
novaVijest = false; | ||
} | ||
|
||
if (korisnik.email == '[email protected]') { | ||
if (submitted == false) { | ||
korisnici.clear(); | ||
} | ||
korisnik = new Korisnik('Azra', '[email protected]', '', 'user'); | ||
korisnici.add(korisnik); | ||
submitted = !submitted; | ||
novaVijest = true; | ||
} | ||
} | ||
|
||
OdjaviSe() { | ||
korisnici.clear(); | ||
korisnik = new Korisnik('Prijavi se', '', '', 'user'); | ||
korisnici.add(korisnik); | ||
submitted = false; | ||
novaVijest = true; | ||
} | ||
} | ||
|
Oops, something went wrong.