Advertisement
Guest User

Untitled

a guest
Jan 9th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. warehause.ts
  2. ==========================================
  3. import { Component, OnInit } from '@angular/core';
  4. import { ArticleService } from '../../services/article.service'
  5. import { SelectMultipleControlValueAccessor } from '@angular/forms';
  6. import { element } from '@angular/core/src/render3';
  7.  
  8. @Component({
  9.   selector: 'app-warehause',
  10.   templateUrl: './warehause.component.html',
  11.   styleUrls: ['./warehause.component.css']
  12. })
  13. export class WarehauseComponent implements OnInit {
  14.  
  15.   public warehause:any;
  16.   public warehause2:any;
  17.   public sectorWidth:number = 10;
  18.   public sectorHeight:number = 15;
  19.   Arr = Array;
  20.   num:number = 10;
  21.   input = 'ijkk';
  22.   timer;
  23.   hoveredElemSector;
  24.   hoveredElemNumber;
  25.  
  26.   constructor(private warehauseService: ArticleService) { }
  27.  
  28.   ngOnInit() {
  29.     this.warehauseService.getAll('9').subscribe(data => {
  30.       this.warehause = data;
  31.     });
  32.     document.getElementById('#divek');
  33.     debugger
  34.   }
  35.  
  36.   displayContentInCart(compartment, num, sec){
  37.     debugger
  38.    
  39.     this.timer = setTimeout(() =>
  40.     {
  41.       let elm = document.getElementById("cart");
  42.    
  43.       elm.style.top =  String(compartment.pageY - 250) + "px";
  44.       elm.style.left = String(compartment.pageX - 100) + "px";
  45.       elm.style.visibility = "visible"
  46.       this.hoveredElemSector = sec;
  47.       this.hoveredElemNumber = num;
  48.     },
  49.     700);
  50.   }
  51.  
  52.   unvisibleCart(){
  53.     let elm = document.getElementById("cart");
  54.     elm.style.visibility = "hidden"
  55.     clearTimeout(this.timer)
  56.     this.hoveredElemSector = undefined;
  57.     this.hoveredElemNumber = undefined;
  58.  
  59.   }
  60.  
  61.  
  62. }
  63.  
  64. warehause.html
  65. ==========================================
  66.  
  67. <div class="background">
  68. <!!=:=><b>Mapa magazynu sektor A</b></div>
  69. <div class = "container pt-2" style = "text-align:center; background-color:transparent; min-height:90vh; height:100%">
  70.  
  71.   <div *ngFor = "let k of Arr(sectorHeight); let j = index;">
  72.     <div style="text-align: center" *ngFor = "let k of Arr(sectorWidth).fill(1); let i = index">
  73.       <div class="asd" routerLink="/detail/{{1 + j*sectorWidth + i}}" style = "cursor: pointer;width: 9.7%; height: 40px;
  74.        margin-left:0.25%; margin-bottom:4px; float:left" (mouseenter)="displayContentInCart($event,1 + j*sectorWidth + i, 'sectorA')"
  75.         (mouseleave)="unvisibleCart()">{{1 + j*sectorWidth + i}}</div>
  76.     </div>
  77.   </div>
  78.  
  79.   <button style = "margin-left:10px" class="btn btn-warning">Bootstrap Button</button>
  80.   <div>
  81.  
  82. </div>
  83.  
  84. <div id="cart" class = "card" style="background-color: rgb(227, 240, 227); width:150px;height:250px; ">
  85. Sektor: {{hoveredElemSector}}
  86. <br>
  87. Numer skrytki: {{hoveredElemNumber}}
  88. </div>
  89.  
  90. warehause.css
  91. ===========================================================
  92. #div2, #div4, #div6 {
  93.   padding: 50px;
  94.   position: absolute;
  95.   border: 1px solid black;
  96.   background-color: red;
  97.   background: rgba(100,100,100,0.5);
  98.   -webkit-transform-style: preserve-3d; /* Safari 3-8  */
  99.   -webkit-transform: rotateX(45deg); /* Safari 3-8  */
  100.   transform-style: preserve-3d;
  101.   transform: rotateX(45deg);
  102. }
  103.  
  104. #div3 {
  105.   position: relative;
  106.   height: 150px;
  107.   width: 150px;
  108.   margin-left: 60px;
  109.   border: 1px solid blue;
  110.   -webkit-perspective: 100px; /* Safari 4-8  */
  111.   -webkit-perspective-origin: bottom right; /* Safari 4-8  */
  112.   perspective: 100px;
  113.   perspective-origin: bottom right;
  114. }
  115.  
  116. #div5 {
  117.   position: relative;
  118.   height: 150px;
  119.   width: 150px;
  120.   margin-left: 60px;
  121.   border: 1px solid blue;
  122.   -webkit-perspective: 100px; /* Safari 4-8  */
  123.   -webkit-perspective-origin: -90%; /* Safari 4-8  */
  124.   perspective: 100px;
  125.   perspective-origin: right;
  126. }
  127.  
  128. .background{
  129.   background-image: url("../../../assets/footer_lodyas.png");
  130. }
  131.  
  132. .card{
  133.   position: absolute;
  134.   left: 100px;
  135.   top: 150px;
  136.   visibility: hidden;
  137. }
  138.  
  139. .asd{
  140.   background-color: green;
  141. }
  142.  
  143. .asd:hover{
  144.   background-color: red;
  145. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement