@christianriedl/media 1.0.193 → 1.0.195

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -94,7 +94,7 @@ export class BooksService {
94
94
  this.log.info(`Add book ${id} : ${r.result}`);
95
95
  return r.result;
96
96
  }
97
- async distributeBooks(mmPerBook = 27, maxFillPerc = 82, minRestPerc = 20) {
97
+ async distributeBooks(mmPerBook = 27, maxFillPerc = 84, minRestPerc = 20) {
98
98
  const url = `apibooks/books/distribute?mmPerBook=${mmPerBook}&marFillPerc=${maxFillPerc}&minRestPerc=${minRestPerc}`;
99
99
  const res = await this.rest.postDataEx(url);
100
100
  const status = this.rest.toStringValue(res);
package/dist/iBooks.d.ts CHANGED
@@ -41,13 +41,12 @@ export interface IBookPlace {
41
41
  hinten: boolean;
42
42
  breite: number;
43
43
  buchstaben: string;
44
- buchstaben2: string;
45
44
  zweitBuchstaben: string;
46
- zweitBuchstaben2: string;
47
45
  firstAuthorId: number;
48
46
  firstBookId: number;
49
47
  }
50
48
  export interface IPlace {
49
+ placeName: string;
51
50
  vorne: string;
52
51
  vorne2: string;
53
52
  hinten: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/media",
3
- "version": "1.0.193",
3
+ "version": "1.0.195",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -11,7 +11,6 @@
11
11
 
12
12
  interface Regal {
13
13
  faecher: IPlace[];
14
- faecher2: IPlace[];
15
14
  }
16
15
  const regalColor = "bg-brown-lighten-3";
17
16
  const doorColor = "bg-brown-darken-1";
@@ -20,7 +19,11 @@
20
19
  const regale = reactive<Regal[]>(initPlaces());
21
20
  const books = reactive<IFullBook[]>([]);
22
21
  const showBooks = ref(false);
23
- const vohi = ref("");
22
+ const mmPerBook = ref(27);
23
+ const maxFillPerc = ref(84);
24
+ const minRestPerc = ref(20);
25
+ const showDistribute = ref(false);
26
+ const placeName = ref("");
24
27
 
25
28
  start();
26
29
 
@@ -29,26 +32,20 @@
29
32
  for (let i = 0; i < 10; i++) {
30
33
  let regal: Regal = { faecher: [], faecher2: [] };
31
34
  for (let j = 0; j < 6; j++) {
32
- const fach: IPlace = { vorne: "", hinten: "", vorne2: "", hinten2: "", color: regalColor,
35
+ const fach: IPlace = { placeName: "", vorne: "", hinten: "", color: regalColor,
33
36
  hintenAuthorId: 0, hintenBookId: 0, vorneAuthorId: 0, vorneBookId: 0 };
34
37
  if (i < 8) {
35
38
  // Wohnzimmer
39
+ fach.placeName = `Wohnzimmer Regal ${i / 2 + 1}, Fach ${j + 1} ${i % 2 ? "rechts" : "links"} `;
36
40
  if ((i < 2 || i > 5) && j > 2)
37
41
  fach.color = doorColor;
38
42
  if (i >= 2 && i <= 5 && j <= 2)
39
43
  fach.color = glassColor;
40
44
  }
41
- regal.faecher.push(fach);
42
- const fach2: IPlace = { vorne: "", hinten: "", vorne2: "", hinten2: "", color: regalColor,
43
- hintenAuthorId: 0, hintenBookId: 0, vorneAuthorId: 0, vorneBookId: 0 };
44
- if (i < 8) {
45
- // Wohnzimmer
46
- if ((i < 2 || i > 5) && j > 2)
47
- fach2.color = doorColor;
48
- if (i >= 2 && i <= 5 && j <= 2)
49
- fach2.color = glassColor;
45
+ else {
46
+ fach.placeName = `Vorzimmer Regal ${i - 8 + 1}, Fach ${j + 1} `;
50
47
  }
51
- regal.faecher2.push(fach2);
48
+ regal.faecher.push(fach);
52
49
  }
53
50
  initRegale.push(regal);
54
51
  }
@@ -79,27 +76,22 @@
79
76
  fach.vorne = place.buchstaben;
80
77
  fach.vorne2 = place.zweitBuchstaben;
81
78
  }
82
- fach = regal.faecher2[place.fachVonOben - 1];
83
- if (place.hinten) {
84
- fach.hinten = place.buchstaben2;
85
- fach.hinten2 = place.zweitBuchstaben2;
86
- }
87
- else {
88
- fach.vorne = place.buchstaben2;
89
- fach.vorne2 = place.zweitBuchstaben2;
90
- }
91
79
  }
92
80
  }
93
81
  async function select (place: IPlace, hinten: boolean) {
94
82
  books.splice (0, books.length);
95
83
  if (hinten && place.hintenAuthorId && place.hintenBookId) {
96
- vohi.value = "hinten";
84
+ placeName.value = place.placeName;
85
+ if (place.placeName.startsWith ("Wohn")
86
+ placeName.value += hinten ? "hinten" : "vorne";
97
87
  const b = await booksService.getBooksFrom (place.hintenAuthorId, place.hintenBookId, place.hinten.length);
98
88
  if (b)
99
89
  books.splice (0, 0, ...b);
100
90
  }
101
91
  if (!hinten && place.vorneAuthorId && place.vorneBookId) {
102
- vohi.value = "vorne";
92
+ placeName.value = place.placeName;
93
+ if (place.placeName.startsWith ("Wohn")
94
+ placeName.value += hinten ? "hinten" : "vorne";
103
95
  const b = await booksService.getBooksFrom (place.vorneAuthorId, place.vorneBookId, place.vorne.length);
104
96
  if (b)
105
97
  books.splice (0, 0, ...b);
@@ -107,10 +99,14 @@
107
99
  showBooks.value = true;
108
100
  }
109
101
  async function distribute () {
102
+ showDistribute.value = true;
103
+ }
104
+ async function startDistribute() {
110
105
  if (!window.confirm(`Willst du wirklich die B�cher neu anordnen ?`))
111
106
  return;
112
- const result = await booksService.distributeBooks();
107
+ const result = await booksService.distributeBooks(mmPerBook.value, maxFillPerc.value, minRestPerc.value);
113
108
  alert (result);
109
+ showDistribute.value = false;
114
110
  }
115
111
  </script>
116
112
 
@@ -118,7 +114,7 @@
118
114
  <v-container fluid class="bg-office" >
119
115
  <v-row dense>
120
116
  <v-col cols="9">
121
- <h2>SOLL - WOHNZIMMER</h2>
117
+ <h2>WOHNZIMMER</h2>
122
118
  </v-col>
123
119
  <v-col cols="3">
124
120
  <h2>VORZIMMER</h2>
@@ -138,29 +134,9 @@
138
134
  <book-place v-for="m in 6" :place="regale[9].faecher[m-1]" :height="placeHeight" @select="select"></book-place>
139
135
  </v-col>
140
136
  </v-row>
141
- <v-row dense>
142
- <v-col cols="9">
143
- <h2>IST - WOHNZIMMER</h2>
144
- </v-col>
145
- <v-col cols="3">
146
- <h2>VORZIMMER</h2>
147
- </v-col>
148
- </v-row>
149
- <v-row dense>
150
- <v-col v-for="n in 8" cols="1">
151
- <book-place v-for="m in 6" :place="regale[n-1].faecher2[m-1]" :height="placeHeight" @select="select"></book-place>
152
- </v-col>
153
- <v-col cols="1"></v-col>
154
- <v-col cols="1">
155
- <book-place v-for="m in 6" :place="regale[8].faecher2[m-1]" :height="placeHeight" @select="select"></book-place>
156
- </v-col>
157
- <v-col cols="2" class="pl-2">
158
- <book-place v-for="m in 6" :place="regale[9].faecher2[m-1]" :height="placeHeight" @select="select"></book-place>
159
- </v-col>
160
- </v-row>
161
137
  <v-dialog v-model="showBooks" >
162
138
  <v-card v-if="showBooks" width="800" >
163
- <v-card-title>{{"Im Fach " + vohi}}</v-card-title>
139
+ <v-card-title>{{placeName}}</v-card-title>
164
140
  <v-card-text>
165
141
  <v-container>
166
142
  <v-row dense v-for="book in books" :key="book.bookId">
@@ -174,5 +150,29 @@
174
150
  </v-card-actions>
175
151
  </v-card>
176
152
  </v-dialog>
153
+ <v-dialog v-model="showDistribute" >
154
+ <v-card v-if="showDistribute" width="800" >
155
+ <v-card-title>Buchverteilung auf die Regale</v-card-title>
156
+ <v-card-text>
157
+ <v-container>
158
+ <v-row dense>
159
+ <v-col cols="4">
160
+ <v-text-field v-model="mmPerBook" label="mm per book" type="number" ></v-text-field>
161
+ </v-col>
162
+ <v-col cols="4">
163
+ <v-text-field v-model="maxFillPerc" label="Max fill in %" type="number" ></v-text-field>
164
+ </v-col>
165
+ <v-col cols="4">
166
+ <v-text-field v-model="minRestPerc" label="Min rest in %" type="number" ></v-text-field>
167
+ </v-col>
168
+ </v-row>
169
+ </v-container>
170
+ </v-card-text>
171
+ <v-card-actions>
172
+ <v-btn prepend-icon="$back" @click="showDistribute = false">CLOSE</v-btn>
173
+ <v-btn prepend-icon="$play" @click="startDistribute">START</v-btn>
174
+ </v-card-actions>
175
+ </v-card>
176
+ </v-dialog>
177
177
  </v-container>
178
178
  </template>