<eg-link-table-link i18n-label label="Shelving Location Groups"
url="/eg/staff/admin/local/asset/copy_location_group"></eg-link-table-link>
<eg-link-table-link i18n-label label="Shelving Location Order"
- url="/eg/staff/admin/local/asset/copy_location_order"></eg-link-table-link>
+ routerLink="/staff/admin/local/asset/copy_location_order"></eg-link-table-link>
<eg-link-table-link i18n-label label="Shelving Locations Editor"
routerLink="/staff/admin/local/asset/copy_location"></eg-link-table-link>
<eg-link-table-link i18n-label label="Item Tags"
import {AddressAlertComponent} from './address-alert.component';
import {AdminCarouselComponent} from './admin-carousel.component';
import {StandingPenaltyComponent} from './standing-penalty.component';
-import {CopyLocationOrderComponent} from './copy-location-order.component';
-import {TableListComponent} from './share/table-list.component';
-import {CardComponent} from './share/card.component';
@NgModule({
declarations: [
AdminLocalSplashComponent,
AddressAlertComponent,
AdminCarouselComponent,
- StandingPenaltyComponent,
- CopyLocationOrderComponent,
- TableListComponent,
- CardComponent
+ StandingPenaltyComponent
],
imports: [
AdminCommonModule,
+++ /dev/null
-<div (mouseup)="disableMouseUp()" (mouseleave)="disableMouseUp()" [style.height.vh]="100">\r
- <eg-staff-banner bannerText="Shelving Location Order" i18n-bannerText>\r
- </eg-staff-banner>\r
- <div>\r
- <h3>Context Org Unit</h3>\r
- <div [style.width.%]="30">\r
- <eg-org-select domId="acpl" [applyDefault]="true" (onChange)="onChange($event)"></eg-org-select> \r
- </div>\r
- </div> \r
- <p>To move an item, drag it up or down with the mouse.</p>\r
- <ng-container *ngIf="locations && locations.length>0">\r
- <table-list \r
- [content_list]="locations" \r
- [is_mouse_down]="detect_mouse_down"\r
- (saveContent)="applyChanges($event)"\r
- (toggleDragAndDrop)="toggleDragAndDrop($event)" \r
- (nodeIsSelected)="displaySelectedNode($event)" (detectMousePosition)="onMouseDown($event)"></table-list>\r
- </ng-container>\r
- <div *ngIf="detect_mouse_down && detect_mouse"\r
- [ngStyle]="position_styling" \r
- [style.top.px]="mouse_y_position+25" \r
- [style.left.px]="mouse_x_position-75" >{{selected_node.name}} ({{selected_node.shortname}})</div>\r
-</div>
\ No newline at end of file
+++ /dev/null
-import {Component, OnInit, HostListener} from '@angular/core';\r
-import {PcrudService} from '@eg/core/pcrud.service';\r
-import {AuthService} from '@eg/core/auth.service';\r
-import {ToastService} from '@eg/share/toast/toast.service';\r
-import { IdlService } from '@eg/core/idl.service';\r
-\r
-\r
-\r
-class Category {\r
- name:string;\r
- owning_lib:string;\r
- shortname:string;\r
- unhashed_element:any;\r
-}\r
-\r
-@Component({\r
- templateUrl: './copy-location-order.component.html'\r
-})\r
-\r
-export class CopyLocationOrderComponent implements OnInit {\r
- orders:any;\r
- locations:any;\r
- id_log=[];\r
- lib_tree=[];\r
- active_libraries=[];\r
- mouse_x_position:number; \r
- mouse_y_position:number;\r
- detect_mouse_down=false;\r
- detect_mouse = false;\r
- selected_node:any;\r
-\r
- position_styling={\r
- backgroundColor:"white",\r
- boxShadow:"5px 4px 10px 2px #5B5A5A",\r
- textAlign:"center",\r
- padding:"3px",\r
- width:'80px',\r
- position:'fixed',\r
- }\r
-\r
- constructor(\r
- private pcrud: PcrudService,\r
- private idl: IdlService,\r
- private toast: ToastService, \r
- private auth: AuthService,\r
- ) {\r
- }\r
-\r
- ngOnInit() {\r
- //this.createTree(); \r
- //this.filterGrid(this.auth.user().ws_ou());\r
- };\r
-\r
- detectMouseLeave(){\r
- this.detect_mouse=false;\r
- }\r
-\r
- toggleDragAndDrop(toggle){\r
-\r
- this.detect_mouse=toggle;\r
- }\r
-\r
- disableMouseUp(){ \r
- this.detect_mouse_down=false;\r
- }\r
- onMouseDown(is_mouse_down){\r
- this.detect_mouse_down=is_mouse_down;\r
- }\r
- \r
-\r
- displaySelectedNode(node){\r
- this.selected_node=node;\r
- }\r
-\r
- /**\r
- * Initializes the search for the library tree and the array of the library locations.\r
- * @param org The authorized user passed in during initialization.\r
- */\r
- filterGrid(org) {\r
- // fetch the locations and order entries\r
- if(!this.orders) {\r
- this.pcrud.search('acplo', {org : org}, {order_by : {acplo : 'position'}})\r
- .subscribe(elements => console.log("Order",elements));\r
- this.mappingLocation();\r
- }\r
- }\r
-\r
-\r
- /**\r
- * Maps the values of the specified category to an array of objects, whose keys hold the necessary values.\r
- */\r
- mappingLocation(){ \r
- this.locations=[];\r
- this.pcrud.search('acpl',\r
- {owning_lib:this.id_log, deleted : 'f'}\r
- ).subscribe(element => {\r
- var categ = new Category();\r
- var unhashed_element=element;\r
- var hashed_element = this.idl.toHash(element, false);\r
- var found_library = this.findLibrary(hashed_element.owning_lib)\r
- categ.name=hashed_element.name;\r
- categ.owning_lib= found_library.name;\r
- categ.shortname=found_library.shortname;\r
- categ.unhashed_element=unhashed_element;\r
- this.locations.push(categ);\r
- });\r
- this.id_log=[];\r
- }\r
-\r
- /**\r
- * Finds the Library name, using the library id.\r
- * @param lib_id The id that is to be used to find the name.\r
- */\r
- findLibrary(lib_id){\r
- var lib_name;\r
- this.active_libraries.forEach(library=>{\r
- if(library.id==lib_id){\r
- lib_name= {\r
- name:library.name,\r
- shortname:library.shortname\r
- };\r
- }\r
- })\r
- return lib_name;\r
- }\r
-\r
- /**\r
- * Starts from parent, logs id, looks for a specific key, checks to see if it has any children. If so\r
- * rinse repeat.\r
- * @param parent_node The uppermost parent node. \r
- */\r
- nodeTrailing(parent_node){\r
- this.findParent(parent_node);\r
- }\r
-\r
- /**\r
- * Creates a tree of the different library branches\r
- * @param node The parent node, of which, the branches 'branch out'\r
- */\r
- createBranch(node){\r
- this.lib_tree.push(node);\r
- node.children.forEach(child => {\r
- this.createBranch(child);\r
- });\r
- }\r
-\r
- /**\r
- * Checks if the node passed in has a parent node. If so, follow that branch, while saving the child nodes,\r
- * until the root node is found.\r
- * @param node The node that is to be checked for a parent.\r
- */\r
- findParent(node){\r
- this.id_log.push(node.id);\r
- this.active_libraries.push(node);\r
- var filteredTree= this.lib_tree.filter(branch=> branch.ou_type.depth<=(node.ou_type.depth-1)); //Creates a filtered branch\r
- filteredTree.forEach(branch =>{\r
- if\r
- (\r
- ( branch.id==node.parent_ou)\r
- && this.isChild(branch.children, node)\r
- )\r
- {\r
- this.findParent(branch);\r
- }\r
- })\r
- }\r
-\r
- /**\r
- * Using the given parameters, checks if the 'node' passed is the parent of the 'children' parameter passed in.\r
- * @param children The array of children nodes that is to be checked.\r
- * @param node The assumed parent node.\r
- */\r
- isChild(children, node){\r
- var names_are_equal = false;\r
- children.forEach(child => {\r
- if(child.shortname==node.shortname){\r
- names_are_equal= true;\r
- } \r
- })\r
- return names_are_equal;\r
- }\r
-\r
- onChange(object){\r
- if(this.lib_tree.length==0){\r
- this.createBranch(this.idl.toHash(object, false));\r
- }\r
- this.nodeTrailing(this.idl.toHash(object, false))\r
- this.mappingLocation();\r
- }\r
-\r
- applyChanges(new_locations){\r
- var library_locations=[];\r
- new_locations.forEach(element => {\r
- library_locations.push(element.unhashed_element) \r
- });\r
- var library =this.pcrud.update(library_locations); \r
- \r
- console.log(library.subscribe(object=> console.log(object))) \r
- }\r
- \r
- @HostListener('mousemove', ['$event'])\r
- mouseMove($event: MouseEvent) {\r
- this.mouse_y_position=$event.clientY;\r
- this.mouse_x_position=$event.clientX;\r
- }\r
-\r
-\r
-}\r
-\r
--- /dev/null
+<div (mouseup)="disableMouseUp()" (mouseleave)="disableMouseUp()" [style.height.vh]="100">
+ <eg-staff-banner bannerText="Shelving Location Order" i18n-bannerText>
+ </eg-staff-banner>
+ <div>
+ <h3>Context Org Unit</h3>
+ <div [style.width.%]="30">
+ <eg-org-select domId="acpl" [applyDefault]="true" (onChange)="onChange($event)"></eg-org-select>
+ </div>
+ </div>
+ <p>To move an item, drag it up or down with the mouse.</p>
+ <ng-container *ngIf="locations && locations.length>0">
+ <table-list
+ [content_list]="locations"
+ [is_mouse_down]="detect_mouse_down"
+ (saveContent)="applyChanges($event)"
+ (toggleDragAndDrop)="toggleDragAndDrop($event)"
+ (nodeIsSelected)="displaySelectedNode($event)" (detectMousePosition)="onMouseDown($event)"></table-list>
+ </ng-container>
+ <div *ngIf="detect_mouse_down && detect_mouse"
+ [ngStyle]="position_styling"
+ [style.top.px]="mouse_y_position+25"
+ [style.left.px]="mouse_x_position-75" >{{selected_node.name}} ({{selected_node.shortname}})</div>
+</div>
\ No newline at end of file
--- /dev/null
+import {Component, OnInit, HostListener} from '@angular/core';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {AuthService} from '@eg/core/auth.service';
+import {ToastService} from '@eg/share/toast/toast.service';
+import { IdlService } from '@eg/core/idl.service';
+
+class Category {
+ name:string;
+ owning_lib:string;
+ shortname:string;
+ unhashed_element:any;
+}
+
+@Component({
+ templateUrl: './copy-location-order.component.html'
+})
+
+export class CopyLocationOrderComponent implements OnInit {
+ orders:any;
+ locations:any;
+ id_log=[];
+ lib_tree=[];
+ active_libraries=[];
+ mouse_x_position:number;
+ mouse_y_position:number;
+ detect_mouse_down=false;
+ detect_mouse = false;
+ selected_node:any;
+
+ position_styling={
+ backgroundColor:"white",
+ boxShadow:"5px 4px 10px 2px #5B5A5A",
+ textAlign:"center",
+ padding:"3px",
+ width:'80px',
+ position:'fixed',
+ }
+
+ constructor(
+ private pcrud: PcrudService,
+ private idl: IdlService,
+ private toast: ToastService,
+ private auth: AuthService,
+ ) {
+ }
+
+ ngOnInit() {
+ //this.createTree();
+ //this.filterGrid(this.auth.user().ws_ou());
+ };
+
+ detectMouseLeave(){
+ this.detect_mouse=false;
+ }
+
+ toggleDragAndDrop(toggle){
+
+ this.detect_mouse=toggle;
+ }
+
+ disableMouseUp(){
+ this.detect_mouse_down=false;
+ }
+ onMouseDown(is_mouse_down){
+ this.detect_mouse_down=is_mouse_down;
+ }
+
+
+ displaySelectedNode(node){
+ this.selected_node=node;
+ }
+
+ /**
+ * Initializes the search for the library tree and the array of the library locations.
+ * @param org The authorized user passed in during initialization.
+ */
+ filterGrid(org) {
+ // fetch the locations and order entries
+ if(!this.orders) {
+ this.pcrud.search('acplo', {org : org}, {order_by : {acplo : 'position'}})
+ .subscribe(elements => console.log("Order",elements));
+ this.mappingLocation();
+ }
+ }
+
+
+ /**
+ * Maps the values of the specified category to an array of objects, whose keys hold the necessary values.
+ */
+ mappingLocation(){
+ this.locations=[];
+ this.pcrud.search('acpl',
+ {owning_lib:this.id_log, deleted : 'f'}
+ ).subscribe(element => {
+ var categ = new Category();
+ var unhashed_element=element;
+ var hashed_element = this.idl.toHash(element, false);
+ var found_library = this.findLibrary(hashed_element.owning_lib)
+ categ.name=hashed_element.name;
+ categ.owning_lib= found_library.name;
+ categ.shortname=found_library.shortname;
+ categ.unhashed_element=unhashed_element;
+ this.locations.push(categ);
+ });
+ this.id_log=[];
+ }
+
+ /**
+ * Finds the Library name, using the library id.
+ * @param lib_id The id that is to be used to find the name.
+ */
+ findLibrary(lib_id){
+ var lib_name;
+ this.active_libraries.forEach(library=>{
+ if(library.id==lib_id){
+ lib_name= {
+ name:library.name,
+ shortname:library.shortname
+ };
+ }
+ })
+ return lib_name;
+ }
+
+ /**
+ * Starts from parent, logs id, looks for a specific key, checks to see if it has any children. If so
+ * rinse repeat.
+ * @param parent_node The uppermost parent node.
+ */
+ nodeTrailing(parent_node){
+ this.findParent(parent_node);
+ }
+
+ /**
+ * Creates a tree of the different library branches
+ * @param node The parent node, of which, the branches 'branch out'
+ */
+ createBranch(node){
+ this.lib_tree.push(node);
+ node.children.forEach(child => {
+ this.createBranch(child);
+ });
+ }
+
+ /**
+ * Checks if the node passed in has a parent node. If so, follow that branch, while saving the child nodes,
+ * until the root node is found.
+ * @param node The node that is to be checked for a parent.
+ */
+ findParent(node){
+ this.id_log.push(node.id);
+ this.active_libraries.push(node);
+ var filteredTree= this.lib_tree.filter(branch=> branch.ou_type.depth<=(node.ou_type.depth-1)); //Creates a filtered branch
+ filteredTree.forEach(branch =>{
+ if
+ (
+ ( branch.id==node.parent_ou)
+ && this.isChild(branch.children, node)
+ )
+ {
+ this.findParent(branch);
+ }
+ })
+ }
+
+ /**
+ * Using the given parameters, checks if the 'node' passed is the parent of the 'children' parameter passed in.
+ * @param children The array of children nodes that is to be checked.
+ * @param node The assumed parent node.
+ */
+ isChild(children, node){
+ var names_are_equal = false;
+ children.forEach(child => {
+ if(child.shortname==node.shortname){
+ names_are_equal= true;
+ }
+ })
+ return names_are_equal;
+ }
+
+ onChange(object){
+ if(this.lib_tree.length==0){
+ this.createBranch(this.idl.toHash(object, false));
+ }
+ this.nodeTrailing(this.idl.toHash(object, false))
+ this.mappingLocation();
+ }
+
+ applyChanges(new_locations){
+ var library_locations=[];
+ new_locations.forEach(element => {
+ library_locations.push(element.unhashed_element)
+ });
+ var library =this.pcrud.update(library_locations);
+
+ console.log(library.subscribe(object=> console.log(object)))
+ }
+
+ @HostListener('mousemove', ['$event'])
+ mouseMove($event: MouseEvent) {
+ this.mouse_y_position=$event.clientY;
+ this.mouse_x_position=$event.clientX;
+ }
+
+
+}
+
--- /dev/null
+import {NgModule} from '@angular/core';
+import {RouterModule, Routes} from '@angular/router';
+import {CopyLocationOrderComponent} from './copy-location-order.component';
+
+const routes: Routes = [{
+ path: '',
+ component: CopyLocationOrderComponent
+}];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule]
+})
+
+export class CopyLocationRoutingModule {}
\ No newline at end of file
--- /dev/null
+import {NgModule} from '@angular/core';
+import {AdminCommonModule} from '@eg/staff/admin/common.module';
+import {TreeModule} from '@eg/share/tree/tree.module';
+import {CopyLocationRoutingModule} from './copy-location-routing.module';
+import {CopyLocationOrderComponent} from './copy-location-order.component';
+import {TableListComponent} from '@eg/staff/admin/local/share/table-list.component';
+import {CardComponent} from '@eg/staff/admin/local/share/card.component';
+
+ @NgModule({
+ declarations: [
+ CopyLocationOrderComponent,
+ TableListComponent,
+ CardComponent
+ ],
+ imports: [
+ AdminCommonModule,
+ CopyLocationRoutingModule,
+ TreeModule
+ ],
+ exports: [
+ ],
+ providers: [
+ ]
+})
+
+export class CopyLocationModule {
+}
\ No newline at end of file
import {AddressAlertComponent} from './address-alert.component';
import {AdminCarouselComponent} from './admin-carousel.component';
import {StandingPenaltyComponent} from './standing-penalty.component';
-import {CopyLocationOrderComponent} from './copy-location-order.component';
const routes: Routes = [{
path: 'splash',
component: StandingPenaltyComponent
}, {
path: 'asset/copy_location_order',
- component: CopyLocationOrderComponent
+ loadChildren: '@eg/staff/admin/local/copy-location/copy-location.module#CopyLocationModule'
}, {
path: ':schema/:table',
component: BasicAdminPageComponent
-\r
-\r
<div \r
(mouseenter)="onMouseEnter()" \r
(mouseleave)="onMouseLeave()"\r
-\r
import {Component, OnInit, Input,Output, EventEmitter, ViewChild} from '@angular/core';\r
\r
@Component({\r
-\r
-\r
<div [ngStyle]="table_container">\r
<div [ngStyle]="card_container" (mouseleave)="onMouseLeave()" (mouseenter)="onMouseEnter()"> \r
<button class="btn btn-lg" (click)="applyChanges()" [ngStyle]="button_style">Apply Changes?</button>\r
</div>\r
<div>\r
</div>\r
-</div>\r
+</div>
\ No newline at end of file
-\r
import {Component, OnInit, Input,Output,EventEmitter} from '@angular/core';\r
\r
/**\r