mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
Remove appfest related content
This commit is contained in:
parent
08ed283e64
commit
4a0c6e6e29
@ -1,49 +0,0 @@
|
||||
.upload-border {
|
||||
position: relative;
|
||||
height: 200px;
|
||||
width: 200px;
|
||||
padding: 5px 5px
|
||||
}
|
||||
|
||||
.drag-area {
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
border: 1px solid #888888;
|
||||
}
|
||||
|
||||
.image-cell{
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50px;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
margin-left: -50px;
|
||||
border: 3px #1c597f solid;
|
||||
z-index: 99;
|
||||
margin-top: 45px;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
|
||||
}
|
||||
|
||||
.container-title-details{
|
||||
background-color: #1c597f;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.title-details {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.user-image-wrap{
|
||||
background-color: #1c597f;
|
||||
text-align: center;
|
||||
height: 60px;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
|
||||
}
|
||||
|
||||
.upload-photo-button{
|
||||
text-align: center;
|
||||
height: 50px;
|
||||
margin-top: 35px;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
<div class="mdl-card__title title container-title-details">
|
||||
<h2 class="mdl-card__title-text title-details">Create Patient</h2>
|
||||
</div>
|
||||
<div class="user-image-wrap">
|
||||
<img class="image-cell"
|
||||
src="{{imgSrc}}">
|
||||
</div>
|
||||
<div class="upload-photo-button">
|
||||
<alfresco-upload-button [showUdoNotificationBar]="true"
|
||||
[uploaddirectory]="'Shared'"
|
||||
[currentFolderPath]="'Shared'"
|
||||
[uploadFolders]="false"
|
||||
[multipleFiles]="false"
|
||||
[acceptedFilesType]="'.jpg,.gif,.png,.svg'"
|
||||
[staticTitle]="'Upload Picture'"
|
||||
(onSuccess)="fileUploaded($event)">
|
||||
</alfresco-upload-button>
|
||||
</div>
|
||||
<activiti-form [formName]="'Health_User_Form'" (saveOption)='saveMetadata($event)' [data]="metadata" [showTitle]="false"
|
||||
[showRefreshButton]="false" ></activiti-form>
|
@ -1,101 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
import { FormService, ActivitiForm } from 'ng2-activiti-form';
|
||||
import { Router } from '@angular/router';
|
||||
import { NotificationService } from '../../services/notification.service';
|
||||
import { ALFRESCO_ULPOAD_COMPONENTS } from 'ng2-alfresco-upload';
|
||||
|
||||
declare let __moduleName: string;
|
||||
declare let AlfrescoApi: any;
|
||||
|
||||
@Component({
|
||||
moduleId: __moduleName,
|
||||
selector: 'createpatient-component',
|
||||
templateUrl: './createpatient.component.html',
|
||||
styleUrls: ['./createpatient.component.css'],
|
||||
providers: [FormService],
|
||||
directives: [ALFRESCO_ULPOAD_COMPONENTS, ActivitiForm]
|
||||
})
|
||||
export class CreatePatientComponent {
|
||||
|
||||
currentPath: string = '/Sites/swsdp/documentLibrary';
|
||||
|
||||
metadata: any = {};
|
||||
|
||||
photoNode: string = "";
|
||||
|
||||
imgSrc: string = "app/img/anonymous.gif";
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService, private router: Router,
|
||||
private notificationService: NotificationService,
|
||||
private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
}
|
||||
|
||||
public fileUploaded(data) {
|
||||
if (data && data.value) {
|
||||
this.photoNode = data.value.entry.id;
|
||||
this.imgSrc = this.alfrescoSettingsService.ecmHost + '/alfresco/api/-default-/public/alfresco/versions/1/nodes/' + data.value.entry.id + '/content?attachment=false';
|
||||
console.log(this.photoNode);
|
||||
}
|
||||
}
|
||||
|
||||
saveMetadata(data: any) {
|
||||
let name = '';
|
||||
if (!this.photoNode) {
|
||||
name = this.generateUuid();
|
||||
} else {
|
||||
name = this.photoNode;
|
||||
}
|
||||
|
||||
let body = {
|
||||
name: name,
|
||||
nodeType: 'hc:patientFolder',
|
||||
properties: {},
|
||||
relativePath: this.currentPath
|
||||
};
|
||||
|
||||
for (var key in data) {
|
||||
if (data[key]) {
|
||||
body.properties['hc:' + key] = data[key];
|
||||
}
|
||||
}
|
||||
let opts = {};
|
||||
|
||||
let self = this;
|
||||
this.authService.getAlfrescoApi().nodes.addNode('-root-', body, opts).then(
|
||||
(data) => {
|
||||
console.log('The folder created', data);
|
||||
self.router.navigate(['/patients']);
|
||||
this.notificationService.sendNotification('User Created');
|
||||
},
|
||||
(err) => {
|
||||
window.alert('See console output for error details');
|
||||
console.log(err);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private generateUuid() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class PatientModel {
|
||||
folderName: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
doctor: string;
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
.image-cell{
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50px;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
margin-left: -50px;
|
||||
border: 3px #1c597f solid;
|
||||
z-index: 99;
|
||||
margin-top: 45px;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
|
||||
}
|
||||
|
||||
.container-title-details{
|
||||
background-color: #1c597f;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.title-details {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.user-image-wrap{
|
||||
background-color: #1c597f;
|
||||
text-align: center;
|
||||
height: 60px;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<div class="mdl-card__title title container-title-details">
|
||||
<h2 class="mdl-card__title-text title-details">Patient Details</h2>
|
||||
</div>
|
||||
<div class="user-image-wrap">
|
||||
<img class="image-cell"
|
||||
src="{{alfrescoSettingsService.ecmHost}}/alfresco/api/-default-/public/alfresco/versions/1/nodes/{{photoNodeId}}/content?attachment=false&alf_ticket={{ticket}}">
|
||||
</div>
|
||||
<activiti-form
|
||||
[readOnly]="true"
|
||||
[formName]="'Health_User_Form'"
|
||||
[data]="metadata"
|
||||
[showTitle]="false"
|
||||
[showRefreshButton]="false">
|
||||
</activiti-form>
|
@ -1,82 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
import { FormService, ActivitiForm } from 'ng2-activiti-form';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs/Rx';
|
||||
|
||||
declare let __moduleName: string;
|
||||
declare let AlfrescoApi: any;
|
||||
|
||||
@Component({
|
||||
moduleId: __moduleName,
|
||||
selector: 'patient-details',
|
||||
templateUrl: './patientdetails.component.html',
|
||||
styleUrls: ['./patientdetails.component.css'],
|
||||
providers: [FormService],
|
||||
directives: [ActivitiForm]
|
||||
})
|
||||
export class PatientDetailsComponent implements OnInit, OnDestroy {
|
||||
|
||||
private sub: Subscription;
|
||||
|
||||
currentPath: string = '/Sites/swsdp/documentLibrary';
|
||||
|
||||
metadata: any = {};
|
||||
|
||||
nodeId: string;
|
||||
|
||||
photoNodeId: string;
|
||||
|
||||
ticket: string = localStorage.getItem('ticket-ECM');
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private authService: AlfrescoAuthenticationService,
|
||||
public alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.route.params.subscribe(params => {
|
||||
this.retriveNodeMetadataFromEcm(params['id']);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.sub) {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
private retriveNodeMetadataFromEcm(nodeId: string): void{
|
||||
var self = this;
|
||||
this.nodeId = nodeId;
|
||||
this.authService.getAlfrescoApi().nodes.getNodeInfo(this.nodeId).then(function (data) {
|
||||
console.log(data.properties);
|
||||
self.photoNodeId = data.name;
|
||||
for (var key in data.properties) {
|
||||
console.log(key + ' => ' + data[key]);
|
||||
self.metadata [key.replace('hc:','')] = data.properties[key];
|
||||
}
|
||||
|
||||
}, function (error) {
|
||||
console.log('This node does not exist');
|
||||
});
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
.container {
|
||||
/*margin: 10px;*/
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 640px) {
|
||||
.container {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.patients-debug-container {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.patients-debug-container .debug-toggle-text {
|
||||
padding-left: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.patients-debug-container .debug-toggle-text:hover {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
alfresco-document-list >>> .image-cell {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
cursor: default;
|
||||
border: 2px solid #aaaaaa;
|
||||
border-radius: 30px;
|
||||
}
|
||||
|
||||
alfresco-document-list >>> .mdl-data-table {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
.image-cell{
|
||||
background-color: #ffffff;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50px;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 17px;
|
||||
margin-left: -50px;
|
||||
border: 3px #1c597f solid;
|
||||
z-index: 99;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
|
||||
}
|
||||
|
||||
.container-title-details{
|
||||
background-color: #1c597f;
|
||||
color: #ffffff;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
|
||||
}
|
||||
|
||||
.title-details {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.user-image-wrap{
|
||||
background-color: #1c597f;
|
||||
text-align: center;
|
||||
height: 64px;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 840px) {
|
||||
#tags {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
@ -1,218 +0,0 @@
|
||||
<div class="mdl-grid">
|
||||
<div class="mdl-cell mdl-cell--2-col mdl-shadow--2dp" id="tags">
|
||||
<div class="mdl-card__title title container-title-details">
|
||||
<h2 class="mdl-card__title-text title-details">Tags</h2>
|
||||
</div>
|
||||
<ul class="mdl-list">
|
||||
<li *ngFor="let filter of tagFilters" class="mdl-list__item">
|
||||
<span class="mdl-list__item-primary-content">
|
||||
<label [attr.for]="'chk-' + filter.id"
|
||||
class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect"
|
||||
[class.is-checked]="filter.isSelected">
|
||||
<input type="checkbox"
|
||||
[attr.id]="'chk-' + filter.id"
|
||||
class="mdl-checkbox__input"
|
||||
[(ngModel)]="filter.isSelected"
|
||||
(change)="onFilterChanged($event)">
|
||||
<span class="mdl-checkbox__label">{{filter.tag}}</span>
|
||||
</label>
|
||||
</span>
|
||||
<!--<span class="mdl-list__item-secondary-action">(0)</span>-->
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="mdl-cell mdl-shadow--2dp"
|
||||
[class.mdl-cell--10-col]="!selectedNodeProperties"
|
||||
[class.mdl-cell--8-col]="selectedNodeProperties">
|
||||
<div style="padding-bottom: 4px;">
|
||||
<button
|
||||
class="mdl-button mdl-js-button mdl-button--icon"
|
||||
(click)="documentList.currentFolderPath = '/Sites/swsdp/documentLibrary';">
|
||||
<i class="material-icons">home</i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="container">
|
||||
<alfresco-upload-drag-area
|
||||
[showUploadDialog]="true"
|
||||
[currentFolderPath]="currentPath"
|
||||
[uploaddirectory]=""
|
||||
(onSuccess)="documentList.reload()">
|
||||
<alfresco-document-list
|
||||
#documentList
|
||||
[currentFolderPath]="currentPath"
|
||||
[contextMenuActions]="true"
|
||||
[contentActions]="true"
|
||||
[rowFilter]="tagFilter"
|
||||
[imageResolver]="folderImageResolver"
|
||||
(preview)="showFile($event)"
|
||||
(folderChange)="onFolderChanged($event)"
|
||||
(nodeClick)="onNodeClicked($event)">
|
||||
<empty-folder-content>
|
||||
<template>
|
||||
<div style="text-align: center">
|
||||
<h2>No patient data available.</h2>
|
||||
<p>
|
||||
<img src="/app/img/users.png" style="width: 200px;">
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</empty-folder-content>
|
||||
<!--
|
||||
<content-columns>
|
||||
<content-column key="name" type="image"></content-column>
|
||||
<content-column
|
||||
title="First Name"
|
||||
key="properties.hc:firstName"
|
||||
sortable="true"
|
||||
class="desktop-only">
|
||||
</content-column>
|
||||
<content-column
|
||||
title="Last Name"
|
||||
key="properties.hc:lastName"
|
||||
sortable="true"
|
||||
class="desktop-only">
|
||||
</content-column>
|
||||
<content-column
|
||||
title="Doctor"
|
||||
key="properties.hc:doctor"
|
||||
sortable="true"
|
||||
class="desktop-only">
|
||||
</content-column>
|
||||
<content-column
|
||||
title="{{'DOCUMENT_LIST.COLUMNS.CREATED_ON' | translate}}"
|
||||
key="createdAt"
|
||||
type="date"
|
||||
format="shortDate"
|
||||
sortable="true"
|
||||
class="desktop-only">
|
||||
</content-column>
|
||||
</content-columns>
|
||||
-->
|
||||
<content-actions>
|
||||
<!-- folder actions -->
|
||||
<content-action
|
||||
target="folder"
|
||||
title="View details"
|
||||
(execute)="patientDetails($event)">
|
||||
</content-action>
|
||||
<content-action *ngIf="isAdmin()"
|
||||
target="folder"
|
||||
title="Schedule an appointment"
|
||||
(execute)="scheduleAppointment($event)">
|
||||
</content-action>
|
||||
<content-action target="folder"
|
||||
title="Add tag"
|
||||
(execute)="addTag($event)">
|
||||
</content-action>
|
||||
<content-action *ngIf="isAdmin()"
|
||||
target="folder"
|
||||
title="{{'DOCUMENT_LIST.ACTIONS.FOLDER.DELETE' | translate}}"
|
||||
handler="delete">
|
||||
</content-action>
|
||||
<!-- document actions -->
|
||||
<content-action
|
||||
target="document"
|
||||
title="{{'DOCUMENT_LIST.ACTIONS.DOCUMENT.DOWNLOAD' | translate}}"
|
||||
handler="download">
|
||||
</content-action>
|
||||
<content-action *ngIf="isAdmin()"
|
||||
target="document"
|
||||
title="{{'DOCUMENT_LIST.ACTIONS.DOCUMENT.DELETE' | translate}}"
|
||||
handler="delete">
|
||||
</content-action>
|
||||
</content-actions>
|
||||
</alfresco-document-list>
|
||||
<alfresco-pagination
|
||||
[provider]="documentList.data"
|
||||
[supportedPageSizes]="[5, 10, 15, 20]">
|
||||
</alfresco-pagination>
|
||||
</alfresco-upload-drag-area>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="selectedNodeProperties" class="mdl-cell mdl-cell--2-col mdl-shadow--2dp">
|
||||
<div class="user-image-wrap">
|
||||
<img _ngcontent-ksd-12="" class="image-cell" onerror="this.onerror=null;this.src='app/img/anonymous.gif';"
|
||||
[src]="detailsAvatarImage">
|
||||
</div>
|
||||
<ul class="mdl-list">
|
||||
<li *ngFor="let prop of selectedNodeProperties" class="mdl-list__item mdl-list__item--two-line">
|
||||
<span class="mdl-list__item-primary-content">
|
||||
<span [title]="prop.fullName">{{prop.name}}</span>
|
||||
<span class="mdl-list__item-sub-title">{{prop.value}}</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Example for creating a custom folder type with properties -->
|
||||
<!--
|
||||
<div class="mdl-grid">
|
||||
<div class="md-cell mdl-cell--12-col">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="patient-folderName" [(ngModel)]="newPatient.folderName">
|
||||
<label class="mdl-textfield__label" for="patient-folderName">Folder Name</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-cell mdl-cell--12-col">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="patient-firstName" [(ngModel)]="newPatient.firstName">
|
||||
<label class="mdl-textfield__label" for="patient-firstName">First Name</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-cell mdl-cell--12-col">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="patient-lastName" [(ngModel)]="newPatient.lastName">
|
||||
<label class="mdl-textfield__label" for="patient-lastName">Last Name</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-cell mdl-cell--12-col">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="patient-doctor" [(ngModel)]="newPatient.doctor">
|
||||
<label class="mdl-textfield__label" for="patient-doctor">Doctor</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mdl-cell mdl-cell--12-col">
|
||||
<button
|
||||
class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect"
|
||||
(click)="onCreateNewPatientClick()">
|
||||
Create Patient
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<dialog class="mdl-dialog">
|
||||
<h4 class="mdl-dialog__title">Set Tags</h4>
|
||||
<div class="mdl-dialog__content">
|
||||
<div class="md-cell mdl-cell--12-col">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="node-tags" >
|
||||
<label class="mdl-textfield__label" for="node-tags">Tags</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mdl-dialog__actions">
|
||||
<button type="button" class="mdl-button save">Save</button>
|
||||
<button type="button" class="mdl-button close">Close</button>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<!--
|
||||
For debugging and data visualisation purposes,
|
||||
will be removed during future revisions
|
||||
-->
|
||||
|
||||
|
||||
<context-menu-holder></context-menu-holder>
|
||||
|
||||
<alfresco-viewer [(showViewer)]="fileShowed"
|
||||
[urlFile]="urlFile"
|
||||
[fileName]="fileName"
|
||||
[mimeType]="mimeType"
|
||||
[overlayMode]="true">
|
||||
<div class="mdl-spinner mdl-js-spinner is-active"></div>
|
||||
</alfresco-viewer>
|
||||
|
||||
<file-uploading-dialog #fileDialog></file-uploading-dialog>
|
@ -1,402 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnInit, ViewChild, ChildNode } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import {
|
||||
PaginationComponent,
|
||||
DataColumn,
|
||||
DataRow,
|
||||
ObjectDataColumn
|
||||
} from 'ng2-alfresco-datatable';
|
||||
import {
|
||||
DOCUMENT_LIST_DIRECTIVES,
|
||||
DOCUMENT_LIST_PROVIDERS,
|
||||
DocumentList,
|
||||
ShareDataRow,
|
||||
RowFilter,
|
||||
MinimalNodeEntity,
|
||||
ImageResolver
|
||||
} from 'ng2-alfresco-documentlist';
|
||||
import {
|
||||
MDL,
|
||||
AlfrescoContentService,
|
||||
CONTEXT_MENU_DIRECTIVES,
|
||||
AlfrescoPipeTranslate,
|
||||
AlfrescoSettingsService
|
||||
} from 'ng2-alfresco-core';
|
||||
import { ALFRESCO_ULPOAD_COMPONENTS } from 'ng2-alfresco-upload';
|
||||
import { VIEWERCOMPONENT } from 'ng2-alfresco-viewer';
|
||||
import { FormService } from 'ng2-activiti-form';
|
||||
import { PatientModel } from './patient.model';
|
||||
import { TagModel, TagCache, TagFilter } from './tag.model';
|
||||
import { TagService } from './tag.service';
|
||||
|
||||
declare let __moduleName: string;
|
||||
|
||||
@Component({
|
||||
moduleId: __moduleName,
|
||||
selector: 'patients-component',
|
||||
templateUrl: './patients.component.html',
|
||||
styleUrls: ['./patients.component.css'],
|
||||
directives: [
|
||||
DOCUMENT_LIST_DIRECTIVES,
|
||||
MDL,
|
||||
ALFRESCO_ULPOAD_COMPONENTS,
|
||||
VIEWERCOMPONENT,
|
||||
CONTEXT_MENU_DIRECTIVES,
|
||||
PaginationComponent
|
||||
],
|
||||
providers: [DOCUMENT_LIST_PROVIDERS, FormService, TagService],
|
||||
pipes: [AlfrescoPipeTranslate]
|
||||
})
|
||||
export class PatientsComponent implements OnInit {
|
||||
|
||||
private DEFAULT_PATH: string = '/Sites/swsdp/documentLibrary';
|
||||
|
||||
currentPath: string = this.DEFAULT_PATH;
|
||||
|
||||
urlFile: string;
|
||||
fileName: string;
|
||||
mimeType: string;
|
||||
fileShowed: boolean = false;
|
||||
|
||||
acceptedFilesType: string = '.jpg,.pdf,.js';
|
||||
|
||||
@ViewChild(DocumentList)
|
||||
documentList: DocumentList;
|
||||
|
||||
newPatient: PatientModel;
|
||||
debugMode: boolean = false;
|
||||
|
||||
tags: TagCache = {};
|
||||
tagFilters: TagFilter[] = [];
|
||||
selectedNode: MinimalNodeEntity;
|
||||
selectedNodeProperties: NodePropertyModel[] = [];
|
||||
selectedNodePropertiesName: string;
|
||||
tagFilter: RowFilter;
|
||||
folderImageResolver: ImageResolver;
|
||||
ticket: string = localStorage.getItem('ticket-ECM');
|
||||
ecmHost: string;
|
||||
detailsAvatarImage: string;
|
||||
isVisitFolder: boolean = false;
|
||||
private patientLayout: DataColumn[] = [];
|
||||
private fileLayout: DataColumn[] = [];
|
||||
emptyimgSrc: string = "app/img/anonymous.gif";
|
||||
|
||||
constructor(private contentService: AlfrescoContentService,
|
||||
private router: Router,
|
||||
private tagService: TagService,
|
||||
private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
this.newPatient = new PatientModel();
|
||||
this.ecmHost = alfrescoSettingsService.ecmHost;
|
||||
this.tagFilter = (row: ShareDataRow) => {
|
||||
let selectedTags = this.tagFilters
|
||||
.filter(f => f.isSelected)
|
||||
.map(f => f.id);
|
||||
|
||||
if (selectedTags.length > 0) {
|
||||
let properties = row.node.entry.properties;
|
||||
if (properties) {
|
||||
let tags = properties['cm:taggable'];
|
||||
if (tags && tags instanceof Array && tags.length > 0) {
|
||||
|
||||
let result = false;
|
||||
|
||||
for (let i = 0; i < selectedTags.length; i++) {
|
||||
if (tags.indexOf(selectedTags[i]) > -1) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
this.folderImageResolver = (row: DataRow, col: DataColumn) => {
|
||||
let isFolder = <boolean> row.getValue('isFolder');
|
||||
if (isFolder) {
|
||||
let value = row.getValue(col.key);
|
||||
return this.alfrescoSettingsService.ecmHost + `/alfresco/api/-default-/public/alfresco/versions/1/nodes/` +
|
||||
value + '/content?attachment=false&alf_ticket=' + this.ticket;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this.patientLayout = this.getPatientLayout();
|
||||
this.fileLayout = this.getFileLayout();
|
||||
}
|
||||
|
||||
isAdmin() {
|
||||
if (localStorage.getItem(`username`) === 'admin') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
resetFilters() {
|
||||
if (this.tagFilters && this.tagFilters.length > 0) {
|
||||
this.tagFilters.map(f => f.isSelected = false);
|
||||
this.documentList.reload();
|
||||
}
|
||||
}
|
||||
|
||||
patientDetails(event: any) {
|
||||
this.router.navigate(['/patientdetails', event.value.entry.id]);
|
||||
}
|
||||
|
||||
showFile(event) {
|
||||
if (event.value.entry.isFile) {
|
||||
this.fileName = event.value.entry.name;
|
||||
this.mimeType = event.value.entry.content.mimeType;
|
||||
this.urlFile = this.contentService.getContentUrl(event.value);
|
||||
this.fileShowed = true;
|
||||
} else {
|
||||
this.fileShowed = false;
|
||||
}
|
||||
}
|
||||
|
||||
onFolderChanged(event?: any) {
|
||||
if (event) {
|
||||
this.selectedNode = null;
|
||||
this.selectedNodeProperties = null;
|
||||
|
||||
|
||||
this.currentPath = event.path;
|
||||
this.loadTags();
|
||||
if (this.currentPath === this.DEFAULT_PATH) {
|
||||
this.folderImageResolver = (row: DataRow, col: DataColumn) => {
|
||||
let isFolder = <boolean> row.getValue('isFolder');
|
||||
if (isFolder) {
|
||||
let value = row.getValue(col.key);
|
||||
return this.alfrescoSettingsService.ecmHost + `/alfresco/api/-default-/public/alfresco/versions/1/nodes/` +
|
||||
value + '/content?attachment=false&alf_ticket=' + this.ticket;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
this.documentList.data.setColumns(this.patientLayout);
|
||||
this.isVisitFolder = false;
|
||||
} else {
|
||||
this.documentList.data.setColumns(this.fileLayout);
|
||||
this.folderImageResolver = (row: DataRow, col: DataColumn) => {
|
||||
return 'app/img/checklist.svg';
|
||||
};
|
||||
this.isVisitFolder = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
// this.loadTags();
|
||||
}
|
||||
|
||||
onNodeClicked(event?: any) {
|
||||
console.log(event);
|
||||
if (event && event.value) {
|
||||
this.selectedNodeProperties = null;
|
||||
this.selectedNode = <MinimalNodeEntity> event.value;
|
||||
this.selectedNodePropertiesName = event.value.entry.name;
|
||||
if(this.isVisitFolder){
|
||||
this.detailsAvatarImage = 'app/img/checklist.svg';
|
||||
}else{
|
||||
this.detailsAvatarImage = this.ecmHost + '/alfresco/api/-default-/public/alfresco/versions/1/nodes/' + this.selectedNodePropertiesName + '/content?attachment=false&alf_ticket=' + this.ticket;
|
||||
}
|
||||
if (this.selectedNode) {
|
||||
this.selectedNodeProperties = this.getNodeProperties(this.selectedNode);
|
||||
console.log(this.selectedNodeProperties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onFilterChanged(event) {
|
||||
setTimeout(() => {
|
||||
this.documentList.reload();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
addTag(event){
|
||||
let self = this;
|
||||
let nodeId = event.value.entry.id;
|
||||
let dialog = document.querySelector('dialog');
|
||||
if (! dialog.showModal) {
|
||||
dialogPolyfill.registerDialog(dialog);
|
||||
}
|
||||
dialog.showModal();
|
||||
dialog.querySelector('.close').addEventListener('click', function() {
|
||||
dialog.close();
|
||||
});
|
||||
dialog.querySelector('.save').addEventListener('click', function() {
|
||||
self.setNodeTags(nodeId, dialog.querySelector('#node-tags').value);
|
||||
dialog.close();
|
||||
});
|
||||
}
|
||||
|
||||
setNodeTags(nodeId: string, value: string) {
|
||||
if (nodeId && value) {
|
||||
let tags = value.split(',').map(val => {
|
||||
return {
|
||||
tag: val.trim()
|
||||
}
|
||||
});
|
||||
|
||||
this.tagService.addTags(nodeId, tags).then(
|
||||
data => {
|
||||
console.log(data);
|
||||
// TODO: share seems to have issues with returning newly created tags
|
||||
// it sometimes takes several seconds for changes to global tags to propagate
|
||||
// and become visible
|
||||
/*
|
||||
this.getTags().then(
|
||||
res => {
|
||||
console.log('after tags updated');
|
||||
console.log(res);
|
||||
this.tags = res || [];
|
||||
this.documentList.reload();
|
||||
},
|
||||
this.handleError
|
||||
);
|
||||
*/
|
||||
},
|
||||
this.handleError
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scheduleAppointment(event?: any) {
|
||||
this.router.navigate(['/startvisit', event.value.entry.id]);
|
||||
}
|
||||
|
||||
private getNodeProperties(node: MinimalNodeEntity): NodePropertyModel[] {
|
||||
let result = [];
|
||||
|
||||
if (node && node.entry && node.entry.properties) {
|
||||
let props = node.entry.properties;
|
||||
Object.keys(props).forEach(key => {
|
||||
result.push(new NodePropertyModel(key, props[key]));
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private loadTags() {
|
||||
this.tagService.getTags().then(
|
||||
(tags: TagModel[]) => {
|
||||
this.tagFilters = tags.map((tag) => new TagFilter(tag.id, tag.tag));
|
||||
tags.forEach(tag => this.tags[tag.id] = tag);
|
||||
},
|
||||
this.handleError
|
||||
);
|
||||
}
|
||||
|
||||
private handleError(err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
private getPatientLayout(): DataColumn[] {
|
||||
return [
|
||||
new ObjectDataColumn({
|
||||
key: 'name',
|
||||
type: 'image'
|
||||
}),
|
||||
new ObjectDataColumn({
|
||||
title: 'First Name',
|
||||
key: 'properties.hc:firstName',
|
||||
sortable: true,
|
||||
cssClass: 'desktop-only'
|
||||
}),
|
||||
new ObjectDataColumn({
|
||||
title: 'Last Name',
|
||||
key: 'properties.hc:lastName',
|
||||
sortable: true,
|
||||
cssClass: 'desktop-only'
|
||||
}),
|
||||
new ObjectDataColumn({
|
||||
title: 'Doctor',
|
||||
key: 'properties.hc:doctor',
|
||||
sortable: true,
|
||||
cssClass: 'desktop-only'
|
||||
}),
|
||||
new ObjectDataColumn({
|
||||
title: 'Created On',
|
||||
key: 'createdAt',
|
||||
type: 'date',
|
||||
format: 'shortDate',
|
||||
sortable: true,
|
||||
cssClass: 'desktop-only'
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
private getFileLayout(): DataColumn[] {
|
||||
return [
|
||||
new ObjectDataColumn({
|
||||
key: '$thumbnail',
|
||||
type: 'image'
|
||||
}),
|
||||
new ObjectDataColumn({
|
||||
title: 'Display Name',
|
||||
key: 'name',
|
||||
sortable: true,
|
||||
cssClass: 'full-width ellipsis-cell'
|
||||
}),
|
||||
new ObjectDataColumn({
|
||||
title: 'Created By',
|
||||
key: 'createdByUser.displayName',
|
||||
sortable: true,
|
||||
cssClass: 'desktop-only'
|
||||
}),
|
||||
new ObjectDataColumn({
|
||||
title: 'Created On',
|
||||
key: 'createdAt',
|
||||
type: 'date',
|
||||
format: 'shortDate',
|
||||
sortable: true,
|
||||
cssClass: 'desktop-only'
|
||||
})
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
class NodePropertyModel {
|
||||
|
||||
prefix: string;
|
||||
name: string;
|
||||
value: string;
|
||||
fullName: string;
|
||||
|
||||
constructor(name: string, value: string) {
|
||||
this.fullName = name;
|
||||
this.name = name;
|
||||
if (name) {
|
||||
let idx = name.indexOf(':');
|
||||
if (idx > -1) {
|
||||
this.prefix = name.substring(0, idx);
|
||||
this.name = name.substring(idx + 1);
|
||||
}
|
||||
}
|
||||
this.value = value;
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class TagModel {
|
||||
id: string;
|
||||
tag: string;
|
||||
|
||||
constructor(id: string, tag: string) {
|
||||
this.id = id;
|
||||
this.tag = tag;
|
||||
}
|
||||
}
|
||||
|
||||
export interface TagCache {
|
||||
[key: string]: TagModel;
|
||||
}
|
||||
|
||||
export class TagFilter extends TagModel {
|
||||
count: number = 0;
|
||||
isSelected: boolean = false;
|
||||
|
||||
constructor(id: string, tag: string) {
|
||||
super(id, tag);
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
||||
import { TagModel } from './tag.model';
|
||||
|
||||
@Injectable()
|
||||
export class TagService {
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService) {}
|
||||
|
||||
getTags(): Promise<TagModel[]> {
|
||||
return new Promise<TagModel[]>((resolve, reject) => {
|
||||
this.authService.getAlfrescoApi().core.tagsApi.getTags({}).then(
|
||||
data => {
|
||||
let entries = data.list.entries || [];
|
||||
let tags = entries.map(obj => <TagModel> obj.entry);
|
||||
resolve(tags);
|
||||
},
|
||||
err => reject(err)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
addTags(nodeId: string, tags: { tag: string }[]): Promise<any> {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
this.authService.getAlfrescoApi().core.tagsApi.addTag(nodeId, tags).then(
|
||||
data => resolve(data),
|
||||
err => reject(err)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
export interface Process {
|
||||
category: string;
|
||||
deploymentId: string;
|
||||
description: string;
|
||||
hasStartForm: boolean;
|
||||
id: string;
|
||||
key: string;
|
||||
name: string;
|
||||
tenantId: string;
|
||||
version: number;
|
||||
metaDataValues: any[];
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Response, Http, Headers, RequestOptions } from '@angular/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
|
||||
import { Process } from './process.data';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class ProcessService {
|
||||
|
||||
constructor(private http: Http,
|
||||
private authService: AlfrescoAuthenticationService,
|
||||
private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
}
|
||||
|
||||
getDeployedApplications(name: string): Observable<Process[]> {
|
||||
let url = `${this.alfrescoSettingsService.bpmHost}/activiti-app/api/enterprise/runtime-app-definitions`;
|
||||
let options = this.getRequestOptions();
|
||||
return this.http
|
||||
.get(url, options)
|
||||
.map((response: Response) => response.json().data.find(p => p.name === name))
|
||||
.do(data => console.log('Application: ' + JSON.stringify(data)))
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
|
||||
getProcessDefinitions(): Observable<Process[]> {
|
||||
let url = `${this.alfrescoSettingsService.bpmHost}/activiti-app/api/enterprise/process-definitions`;
|
||||
let options = this.getRequestOptions();
|
||||
return this.http
|
||||
.get(url, options)
|
||||
.map((response: Response) => <Process[]> response.json())
|
||||
.do(data => console.log('All: ' + JSON.stringify(data)))
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getProcessDefinitionByApplication(application: any): Observable<Process> {
|
||||
return this.getProcessDefinitions()
|
||||
.map((processes: Process[]) => <Process> processes.data.find(p => p.deploymentId === application.deploymentId));
|
||||
}
|
||||
|
||||
getStartFormForProcess(processDefinitionId: string): Observable<any> {
|
||||
let url = `${this.alfrescoSettingsService.bpmHost}/activiti-app/api/enterprise/process-definitions/${processDefinitionId}/start-form`;
|
||||
let options = this.getRequestOptions();
|
||||
return this.http
|
||||
.get(url, options)
|
||||
.map((response: Response) => response.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
startProcessByID(processDefinitionId: string, processName: string): void {
|
||||
let url = `${this.alfrescoSettingsService.bpmHost}/activiti-app/api/enterprise/process-instances`;
|
||||
let options = this.getRequestOptions();
|
||||
let body = JSON.stringify({processDefinitionId: processDefinitionId, name: processName});
|
||||
console.log(body);
|
||||
return this.http
|
||||
.post(url, body, options)
|
||||
.map(this.toJson)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getTaskIdFromProcessID(processDefinitionId: string, appDefinitionId: string, processInstanceId: string): Observable<any> {
|
||||
let url = `${this.alfrescoSettingsService.bpmHost}/activiti-app/api/enterprise/tasks/query`;
|
||||
let options = this.getRequestOptions();
|
||||
let body = JSON.stringify({
|
||||
processDefinitionId: processDefinitionId,
|
||||
appDefinitionId: appDefinitionId,
|
||||
processInstanceId: processInstanceId
|
||||
});
|
||||
console.log(body);
|
||||
return this.http
|
||||
.post(url, body, options)
|
||||
.map(this.toJson)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
|
||||
private getHeaders(): Headers {
|
||||
return new Headers({
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': this.authService.getTicket('BPM')
|
||||
});
|
||||
}
|
||||
|
||||
private getRequestOptions(): RequestOptions {
|
||||
let headers = this.getHeaders();
|
||||
return new RequestOptions({headers: headers});
|
||||
}
|
||||
|
||||
private toJson(res: Response) {
|
||||
let body = res.json();
|
||||
return body || {};
|
||||
}
|
||||
|
||||
private handleError(error: any) {
|
||||
console.log("ERROR");
|
||||
let errMsg = (error.message) ? error.message :
|
||||
error.status ? `${error.status} - ${error.statusText}` : 'Server error';
|
||||
console.error(errMsg);
|
||||
return Observable.throw(errMsg);
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
.image-cell{
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50px;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
margin-left: -50px;
|
||||
border: 3px #1c597f solid;
|
||||
z-index: 99;
|
||||
margin-top: 45px;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
|
||||
}
|
||||
|
||||
.container-title-details{
|
||||
background-color: #1c597f;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.title-details {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.user-image-wrap{
|
||||
background-color: #1c597f;
|
||||
text-align: center;
|
||||
height: 60px;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
|
||||
}
|
||||
|
||||
.upload-photo-button{
|
||||
text-align: center;
|
||||
height: 50px;
|
||||
margin-top: 35px;
|
||||
}
|
||||
.wrap-form{
|
||||
margin-top: 35px;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<div class="mdl-card__title title container-title-details">
|
||||
<h2 class="mdl-card__title-text title-details">Schedule Appointment</h2>
|
||||
</div>
|
||||
<div class="user-image-wrap">
|
||||
<img class="image-cell"
|
||||
src="app/img/createvisit.jpg">
|
||||
</div>
|
||||
<div class="wrap-form ">
|
||||
<activiti-form [taskId]="taskId" [data]="metadata" [showRefreshButton]="false" (completeOption)='saveData($event)' [showTitle]="false"></activiti-form>
|
||||
</div>
|
@ -1,134 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs/Rx';
|
||||
import { ProcessService } from './process.service';
|
||||
import { Process } from './process.data';
|
||||
|
||||
import { FormService, ActivitiForm } from 'ng2-activiti-form';
|
||||
import { NotificationService } from '../../services/notification.service';
|
||||
|
||||
declare let __moduleName: string;
|
||||
declare let AlfrescoApi: any;
|
||||
|
||||
@Component({
|
||||
moduleId: __moduleName,
|
||||
selector: 'start-visit-component',
|
||||
templateUrl: './start-visit.component.html',
|
||||
styleUrls: ['./start-visit.component.css'],
|
||||
providers: [ProcessService, FormService],
|
||||
directives: [ActivitiForm]
|
||||
})
|
||||
|
||||
export class StartVisitComponent {
|
||||
|
||||
private sub: Subscription;
|
||||
|
||||
currentPath: string = '/Sites/swsdp/documentLibrary';
|
||||
|
||||
metadata: any = {};
|
||||
|
||||
nodeId: string;
|
||||
|
||||
nodeName: string;
|
||||
|
||||
errorMessage: string;
|
||||
|
||||
processName: string = "TEST";
|
||||
|
||||
process: Process;
|
||||
|
||||
taskId: string;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private processService: ProcessService,
|
||||
private authService: AlfrescoAuthenticationService,
|
||||
private notificationService: NotificationService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.route.params.subscribe(params => {
|
||||
this.retriveNodeMetadataFromEcm(params['id']);
|
||||
});
|
||||
|
||||
|
||||
let self = this;
|
||||
this.processService.getDeployedApplications("Visit").subscribe(
|
||||
application => {
|
||||
console.log("I'm the application hello", application);
|
||||
this.processService.getProcessDefinitionByApplication(application).subscribe(
|
||||
process => {
|
||||
console.log("this is the process", process);
|
||||
self.processService.startProcessByID(process.id, process.name).subscribe(
|
||||
startedProcess => {
|
||||
console.log(startedProcess);
|
||||
this.processService.getTaskIdFromProcessID(process.id, application.id, startedProcess.id).subscribe(
|
||||
response => {
|
||||
console.log(response.data[0].id);
|
||||
self.taskId = response.data[0].id;
|
||||
},
|
||||
error => {
|
||||
console.log(error)
|
||||
}
|
||||
);
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
},
|
||||
error => this.errorMessage = <any>error
|
||||
);
|
||||
console.log(application);
|
||||
},
|
||||
error => this.errorMessage = <any>error
|
||||
);
|
||||
}
|
||||
|
||||
public saveData(){
|
||||
this.router.navigate(['/patients']);
|
||||
this.notificationService.sendNotification('New Visit Created');
|
||||
}
|
||||
|
||||
private retriveNodeMetadataFromEcm(nodeId: string): void {
|
||||
var self = this;
|
||||
this.nodeId = nodeId;
|
||||
this.authService.getAlfrescoApi().nodes.getNodeInfo(this.nodeId).then(function (data) {
|
||||
console.log(data.properties);
|
||||
self.nodeName = data.name;
|
||||
for (var key in data.properties) {
|
||||
console.log(key + ' => ' + data[key]);
|
||||
self.metadata [key.replace('hc:', '')] = data.properties[key];
|
||||
}
|
||||
self.metadata.nodeId = self.nodeName;
|
||||
|
||||
}, function (error) {
|
||||
console.log('This node does not exist');
|
||||
});
|
||||
}
|
||||
|
||||
private generateUuid() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user