@christianriedl/media 1.0.190 → 1.0.192

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.
@@ -8,6 +8,7 @@ export declare class BooksService implements IBooksService {
8
8
  user: string;
9
9
  log: ILogger;
10
10
  cachedAuthors?: IAuthorShort[];
11
+ cachedPlaces?: IBookPlace[];
11
12
  categories: string[];
12
13
  flags: string[];
13
14
  selectedAuthorId: number;
@@ -20,8 +21,10 @@ export declare class BooksService implements IBooksService {
20
21
  deleteAuthor(id: number): Promise<boolean>;
21
22
  getBooks(authorId?: number, bookId?: number): Promise<IBook[]>;
22
23
  getFullBooks(surName?: string, givenName?: string, title?: string, flags?: string, minRating?: number): Promise<IFullBook[]>;
24
+ getBooksFrom(startAuthorId: number, startBookId?: number, count?: number): Promise<IFullBook[]>;
23
25
  getBookPlaces(): Promise<IBookPlace[]>;
24
26
  addBook(book: IBook): Promise<number>;
25
27
  updateBook(book: IBook): Promise<boolean>;
26
28
  deleteBook(id: number): Promise<boolean>;
29
+ distributeBooks(mmPerBook?: number, maxFillPerc?: number, minRestPerc?: number): Promise<string>;
27
30
  }
@@ -5,6 +5,7 @@ export class BooksService {
5
5
  user;
6
6
  log;
7
7
  cachedAuthors;
8
+ cachedPlaces;
8
9
  categories;
9
10
  flags;
10
11
  selectedAuthorId;
@@ -14,8 +15,8 @@ export class BooksService {
14
15
  this.rest = rest;
15
16
  this.user = user;
16
17
  this.mediaUrl = rest.serviceUrl;
17
- this.categories = ["Literatur", "Geschichte", "Philosophie", "Naturwissenschaft"];
18
- this.flags = ["liesC", "liesH", "ausgeborgt"];
18
+ this.categories = ["Literatur", "Geschichte", "Philosophie", "Naturwissenschaft", "Reisen"];
19
+ this.flags = ["liesC", "liesH", "ausgeborgt", "neuesFach"];
19
20
  this.selectedAuthorId = 0;
20
21
  this.selectedBookId = 0;
21
22
  }
@@ -61,10 +62,17 @@ export class BooksService {
61
62
  const info = await this.rest.getData('apibooks/books/full', { surName, givenName, title, flags, minRating });
62
63
  return info.result;
63
64
  }
64
- async getBookPlaces() {
65
- const info = await this.rest.getData('apibooks/books/places');
65
+ async getBooksFrom(startAuthorId, startBookId, count) {
66
+ const info = await this.rest.getData('apibooks/books/from', { startAuthorId, startBookId, count });
66
67
  return info.result;
67
68
  }
69
+ async getBookPlaces() {
70
+ if (!this.cachedPlaces) {
71
+ const info = await this.rest.getData('apibooks/books/places');
72
+ this.cachedPlaces = info.result;
73
+ }
74
+ return this.cachedPlaces;
75
+ }
68
76
  async addBook(book) {
69
77
  const url = `apibooks/books`;
70
78
  const res = await this.rest.postDataEx(url, book);
@@ -86,5 +94,12 @@ export class BooksService {
86
94
  this.log.info(`Add book ${id} : ${r.result}`);
87
95
  return r.result;
88
96
  }
97
+ async distributeBooks(mmPerBook = 27, maxFillPerc = 82, minRestPerc = 20) {
98
+ const url = `apibooks/books/distribute?mmPerBook=${mmPerBook}&marFillPerc=${maxFillPerc}&minRestPerc=${minRestPerc}`;
99
+ const res = await this.rest.postDataEx(url);
100
+ const r = res.result;
101
+ this.log.info(`Distribute booka : ${r.result}`);
102
+ return r.result;
103
+ }
89
104
  }
90
105
  //# sourceMappingURL=booksService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"booksService.js","sourceRoot":"","sources":["../src/booksService.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,cAAc,GAAqC,MAAM,CAAC,WAAW,CAAC,CAAC;AACpF,MAAM,OAAO,YAAY;IACrB,IAAI,CAAQ;IACZ,QAAQ,CAAS;IACjB,IAAI,CAAS;IACb,GAAG,CAAU;IACb,aAAa,CAAkB;IAC/B,UAAU,CAAW;IACrB,KAAK,CAAW;IAChB,gBAAgB,CAAS;IACzB,cAAc,CAAS;IACvB,YAAY,IAAW,EAAE,IAAY,EAAE,UAAuB,EAAE,GAAY;QACxE,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,I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,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,CAAA;QAC7C,OAAO,CAAC,CAAC,MAAM,CAAC;IACpB,CAAC;IACD,KAAK,CAAC,eAAe,CAAC,YAAoB,EAAE,EAAE,cAAsB,EAAE,EAAE,cAAsB,EAAE;QAC5F,MAAM,GAAG,GAAG,uCAAuC,SAAS,gBAAgB,WAAW,gBAAgB,WAAW,EAAE,CAAC;QACrH,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAA4B,GAAG,CAAC,CAAC;QACvE,MAAM,CAAC,GAAG,GAAG,CAAC,MAA8B,CAAC;QAC7C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,MAAM,EAAE,CAAC,CAAA;QAC/C,OAAO,CAAC,CAAC,MAAM,CAAC;IACpB,CAAC;CACJ"}
package/dist/iBooks.d.ts CHANGED
@@ -44,6 +44,8 @@ export interface IBookPlace {
44
44
  buchstaben2: string;
45
45
  zweitBuchstaben: string;
46
46
  zweitBuchstaben2: string;
47
+ firstAuthorId: number;
48
+ firstBookId: number;
47
49
  }
48
50
  export interface IPlace {
49
51
  vorne: string;
@@ -51,6 +53,10 @@ export interface IPlace {
51
53
  hinten: string;
52
54
  hinten2: string;
53
55
  color: string;
56
+ hintenAuthorId: number;
57
+ hintenBookId: number;
58
+ vorneAuthorId: number;
59
+ vorneBookId: number;
54
60
  }
55
61
  export interface IBooksService {
56
62
  categories: string[];
@@ -67,5 +73,7 @@ export interface IBooksService {
67
73
  updateBook(book: IBook): Promise<boolean>;
68
74
  deleteBook(id: number): Promise<boolean>;
69
75
  getFullBooks(surName?: string, givenName?: string, title?: string, flags?: string, minRating?: number): Promise<IFullBook[]>;
76
+ getBooksFrom(startAuthorId: number, startBookId?: number, count?: number): Promise<IFullBook[]>;
70
77
  getBookPlaces(): Promise<IBookPlace[]>;
78
+ distributeBooks(mmPerBook?: number, maxFillPerc?: number, minRestPerc?: number): Promise<string>;
71
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/media",
3
- "version": "1.0.190",
3
+ "version": "1.0.192",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -7,6 +7,7 @@
7
7
  const emits = defineEmits<{
8
8
  (e: 'selectbook', id: number, func: () => void): void,
9
9
  (e: 'deletebook', id: number): void,
10
+ (e: 'showplace', id: number): void,
10
11
  (e: 'savebook', book: IBook): void
11
12
  }>();
12
13
 
@@ -47,6 +48,9 @@
47
48
  emits("savebook", book);
48
49
  showSave.value = false;
49
50
  }
51
+ function onShowPlace () {
52
+ emits("showplace", book.id);
53
+ }
50
54
  function fieldChanged () {
51
55
  showSave.value = true;
52
56
  }
@@ -83,6 +87,7 @@
83
87
  </v-col>
84
88
  <v-col cols="2">
85
89
  <v-btn v-if="showSave" icon="$save" :class="classObject" :disabled="props.readonly" @click="onSave"></v-btn>
90
+ <v-btn v-else icon="$gps" :class="classObject" @click="onShowPlace"></v-btn>
86
91
  <v-btn v-if="showDelete" icon="$delete" :class="classObject" :disabled="props.readonly" @click="onDelete"></v-btn>
87
92
  </v-col>
88
93
  </v-row>
@@ -2,16 +2,26 @@
2
2
  import { StyleValue } from 'vue';
3
3
  import { IPlace } from '@christianriedl/media';
4
4
  const props = defineProps<{ place: IPlace, height: number }>();
5
+ const emits = defineEmits<{
6
+ (e: 'select', place: IPlace, hinten: boolean): void
7
+ }>();
5
8
  const place: IPlace = props.place;
6
9
  const heightStyle: StyleValue = { height: props.height + "px" };
10
+
11
+ function selectVorne () {
12
+ emits('select', place, false);
13
+ }
14
+ function selectHinten () {
15
+ emits('select', place, true);
16
+ }
7
17
  </script>
8
18
 
9
19
  <template>
10
20
  <v-row dense :class="[place.color,'place']" :style="heightStyle" >
11
- <v-col v-if="place.vorne" cols="12" >
21
+ <v-col v-if="place.vorne" cols="12" @click="selectVorne">
12
22
  <p class="vorne">{{place.vorne}}<br>{{place.vorne2}}</p>
13
23
  </v-col>
14
- <v-col v-if="place.hinten" cols="12" >
24
+ <v-col v-if="place.hinten" cols="12" @click="selectHinten" >
15
25
  <p class="hinten">{{place.hinten}}<br>{{place.hinten2}}</p>
16
26
  </v-col>
17
27
  </v-row>
@@ -213,6 +213,31 @@
213
213
  alert ('UpdateBook - error');
214
214
  }
215
215
  }
216
+ async function showPlace (bookId: number) {
217
+ const places = await booksService.getBookPlaces();
218
+ const firstLetter = currentAuthor.surName.substring(0,1);
219
+ for (let i = 0; i < places.length; i++) {
220
+ const place = places[i];
221
+ if (place.buchstaben.includes(firstLetter) && place.firstAuthorId && place.firstBookId) {
222
+ const books = await booksService.getBooksFrom (place.firstAuthorId, place.firstBookId, place.buchstaben.length);
223
+ if (books) {
224
+ for (let j = 0; j < books.length; j++) {
225
+ const book = books[j];
226
+ if (book.authorId == currentAuthor.id && book.bookId == bookId) {
227
+ // Found !!
228
+ let text = `GEFUNDEN : ${place.vorzimmer ? "Vorzimmer" : "Wohnzimmer"} ${place.regalVonLinks}. Regal von links, ${place.fachVonOben}. Fach von oben, \n`;
229
+ if (!place.vorzimmer)
230
+ text += `${place.rechts ? "rechts" : "links"} ${place.hinten ? "hinten": "vorne" }, `;
231
+ text += `${j + 1}. Buch von links`;
232
+ alert (text);
233
+ return;
234
+ }
235
+ }
236
+ }
237
+ }
238
+ }
239
+ alert ("NICHT GEFUNDEN !!");
240
+ }
216
241
  function checkAuthor (author: IAuthor): boolean {
217
242
  if (!author.surName || !author.givenName) {
218
243
  alert("Vor oder Nachname fehlt !");
@@ -451,8 +476,12 @@
451
476
  <v-btn v-if="showAddBookLine" class="bg-office" @click="cancelAddNewBook" :disabled="readonly" icon="$cancel"></v-btn>
452
477
  </v-col>
453
478
  </v-row>
454
- <book-line v-if="showAddBookLine" :book="newBook" :flags="booksService.flags" :add="true" :allbooks="allBooks" :readonly="readonly" :ismobile="isMobile" @selectbook="selectBook" @deletebook="deleteBook" @savebook="saveBook"></book-line>
455
- <book-line v-for="book in currentAuthor.books" :key="book.id" :book="book" :flags="booksService.flags" :readonly="readonly" :selected="selectedBook == book" :ismobile="isMobile" @selectbook="selectBook" @deletebook="deleteBook" @savebook="saveBook"></book-line>
479
+ <book-line v-if="showAddBookLine" :book="newBook" :flags="booksService.flags" :add="true" :allbooks="allBooks" :readonly="readonly"
480
+ :ismobile="isMobile" @selectbook="selectBook" @deletebook="deleteBook" @savebook="saveBook">
481
+ </book-line>
482
+ <book-line v-for="book in currentAuthor.books" :key="book.id" :book="book" :flags="booksService.flags" :readonly="readonly"
483
+ :selected="selectedBook == book" :ismobile="isMobile" @selectbook="selectBook" @deletebook="deleteBook" @savebook="saveBook" @showplace="showPlace">
484
+ </book-line>
456
485
  <v-textarea v-if="showSelectedBook" clearable auto-grow variant="outlined" label="Beschreibung" :disabled="isMobile" class="bg-office pt-2" v-model="selectedBook.description" @update:modelValue="descriptionChanged">
457
486
  </v-textarea>
458
487
  <v-textarea v-if="showSelectedBook" clearable auto-grow variant="outlined" label="Kommentar" :disabled="isMobile" class="bg-office" v-model="selectedBook.comment" @update:modelValue="descriptionChanged">
@@ -4,8 +4,10 @@
4
4
  import { BooksService, getBooksSymbol, IAuthorShort, IAuthor, IFullBook, IPlace } from '@christianriedl/media';
5
5
  import BookPlace from '../components/BookPlace.vue';
6
6
 
7
+ const appState = inject(appStateSymbol)!;
7
8
  const getBooksService = inject(getBooksSymbol)!;
8
9
  const booksService = getBooksService() as BooksService;
10
+ const isAdmin = !!(appState.scopes & EScope.Admin);
9
11
 
10
12
  interface Regal {
11
13
  faecher: IPlace[];
@@ -16,6 +18,9 @@
16
18
  const glassColor = "bg-blue-grey-lighten-1";
17
19
  const placeHeight = ref(120);
18
20
  const regale = reactive<Regal[]>(initPlaces());
21
+ const books = reactive<IFullBook[]>([]);
22
+ const showBooks = ref(false);
23
+ const vohi = ref("");
19
24
 
20
25
  start();
21
26
 
@@ -24,7 +29,8 @@
24
29
  for (let i = 0; i < 10; i++) {
25
30
  let regal: Regal = { faecher: [], faecher2: [] };
26
31
  for (let j = 0; j < 6; j++) {
27
- const fach: IPlace = { vorne: "", hinten: "", vorne2: "", hinten2: "", color: regalColor };
32
+ const fach: IPlace = { vorne: "", hinten: "", vorne2: "", hinten2: "", color: regalColor,
33
+ hintenAuthorId: 0, hintenBookId: 0, vorneAuthorId: 0, vorneBookId: 0 };
28
34
  if (i < 8) {
29
35
  // Wohnzimmer
30
36
  if ((i < 2 || i > 5) && j > 2)
@@ -33,7 +39,8 @@
33
39
  fach.color = glassColor;
34
40
  }
35
41
  regal.faecher.push(fach);
36
- const fach2: IPlace = { vorne: "", hinten: "", vorne2: "", hinten2: "", color: regalColor };
42
+ const fach2: IPlace = { vorne: "", hinten: "", vorne2: "", hinten2: "", color: regalColor,
43
+ hintenAuthorId: 0, hintenBookId: 0, vorneAuthorId: 0, vorneBookId: 0 };
37
44
  if (i < 8) {
38
45
  // Wohnzimmer
39
46
  if ((i < 2 || i > 5) && j > 2)
@@ -61,10 +68,14 @@
61
68
  }
62
69
  let fach = regal.faecher[place.fachVonOben - 1];
63
70
  if (place.hinten) {
71
+ fach.hintenAuthorId = place.firstAuthorId;
72
+ fach.hintenBookId = place.firstBookId;
64
73
  fach.hinten = place.buchstaben;
65
74
  fach.hinten2 = place.zweitBuchstaben;
66
75
  }
67
76
  else {
77
+ fach.vorneAuthorId = place.firstAuthorId;
78
+ fach.vorneBookId = place.firstBookId;
68
79
  fach.vorne = place.buchstaben;
69
80
  fach.vorne2 = place.zweitBuchstaben;
70
81
  }
@@ -79,6 +90,28 @@
79
90
  }
80
91
  }
81
92
  }
93
+ async function select (place: IPlace, hinten: boolean) {
94
+ books.splice (0, books.length);
95
+ if (hinten && place.hintenAuthorId && place.hintenBookId) {
96
+ vohi.value = "hinten";
97
+ const b = await booksService.getBooksFrom (place.hintenAuthorId, place.hintenBookId, place.hinten.length);
98
+ if (b)
99
+ books.splice (0, 0, ...b);
100
+ }
101
+ if (!hinten && place.vorneAuthorId && place.vorneBookId) {
102
+ vohi.value = "vorne";
103
+ const b = await booksService.getBooksFrom (place.vorneAuthorId, place.vorneBookId, place.vorne.length);
104
+ if (b)
105
+ books.splice (0, 0, ...b);
106
+ }
107
+ showBooks.value = true;
108
+ }
109
+ async function distribute () {
110
+ if (!window.confirm(`Willst du wirklich die B�cher neu anordnen ?`))
111
+ return;
112
+ const result = await booksService.distributeBooks();
113
+ alert (result);
114
+ }
82
115
  </script>
83
116
 
84
117
  <template>
@@ -93,14 +126,16 @@
93
126
  </v-row>
94
127
  <v-row dense>
95
128
  <v-col v-for="n in 8" cols="1">
96
- <book-place v-for="m in 6" :place="regale[n-1].faecher[m-1]" :height="placeHeight" ></book-place>
129
+ <book-place v-for="m in 6" :place="regale[n-1].faecher[m-1]" :height="placeHeight" @select="select" ></book-place>
130
+ </v-col>
131
+ <v-col cols="1">
132
+ <v-btn v-if="isAdmin" @click="distribute">DISTRIBUTE</v-btn>
97
133
  </v-col>
98
- <v-col cols="1"></v-col>
99
134
  <v-col cols="1">
100
- <book-place v-for="m in 6" :place="regale[8].faecher[m-1]" :height="placeHeight" ></book-place>
135
+ <book-place v-for="m in 6" :place="regale[8].faecher[m-1]" :height="placeHeight" @select="select"></book-place>
101
136
  </v-col>
102
137
  <v-col cols="2" class="pl-2">
103
- <book-place v-for="m in 6" :place="regale[9].faecher[m-1]" :height="placeHeight" ></book-place>
138
+ <book-place v-for="m in 6" :place="regale[9].faecher[m-1]" :height="placeHeight" @select="select"></book-place>
104
139
  </v-col>
105
140
  </v-row>
106
141
  <v-row dense>
@@ -113,15 +148,31 @@
113
148
  </v-row>
114
149
  <v-row dense>
115
150
  <v-col v-for="n in 8" cols="1">
116
- <book-place v-for="m in 6" :place="regale[n-1].faecher2[m-1]" :height="placeHeight" ></book-place>
151
+ <book-place v-for="m in 6" :place="regale[n-1].faecher2[m-1]" :height="placeHeight" @select="select"></book-place>
117
152
  </v-col>
118
153
  <v-col cols="1"></v-col>
119
154
  <v-col cols="1">
120
- <book-place v-for="m in 6" :place="regale[8].faecher2[m-1]" :height="placeHeight" ></book-place>
155
+ <book-place v-for="m in 6" :place="regale[8].faecher2[m-1]" :height="placeHeight" @select="select"></book-place>
121
156
  </v-col>
122
157
  <v-col cols="2" class="pl-2">
123
- <book-place v-for="m in 6" :place="regale[9].faecher2[m-1]" :height="placeHeight" ></book-place>
158
+ <book-place v-for="m in 6" :place="regale[9].faecher2[m-1]" :height="placeHeight" @select="select"></book-place>
124
159
  </v-col>
125
160
  </v-row>
161
+ <v-dialog v-model="showBooks" >
162
+ <v-card v-if="showBooks" width="800" >
163
+ <v-card-title>{{"Im Fach " + vohi}}</v-card-title>
164
+ <v-card-text>
165
+ <v-container>
166
+ <v-row dense v-for="book in books" :key="book.bookId">
167
+ <v-col cols="5"><p class="font-weight-medium">{{book.givenName + ' ' + book.surName}}</p></v-col>
168
+ <v-col cols="7"><p>{{book.title}}</p></v-col>
169
+ </v-row>
170
+ </v-container>
171
+ </v-card-text>
172
+ <v-card-actions>
173
+ <v-btn prepend-icon="$back" @click="showBooks = false">CLOSE</v-btn>
174
+ </v-card-actions>
175
+ </v-card>
176
+ </v-dialog>
126
177
  </v-container>
127
178
  </template>