Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Commit

Permalink
code clean and kitchen assign bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Garcia Marin committed Oct 6, 2016
1 parent cd4e110 commit b83330d
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 135 deletions.
Empty file added coverage/coverage.lcov
Empty file.
22 changes: 0 additions & 22 deletions npm-debug.log

This file was deleted.

58 changes: 2 additions & 56 deletions oasp4js-sample/config/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,3 @@
// module.exports = function (config) {
//
// var configuration = {
// basePath: '..',
// frameworks: ['jasmine'],
// plugins: [
// require('karma-jasmine'),
// require('karma-chrome-launcher')
// ],
// customLaunchers: {
// // chrome setup for travis CI using chromium
// Chrome_travis_ci: {
// base: 'Chrome',
// flags: ['--no-sandbox']
// }
// },
// files: [
// { pattern: 'dist/vendor/es6-shim/es6-shim.js', included: true, watched: false },
// { pattern: 'dist/vendor/zone.js/dist/zone.js', included: true, watched: false },
// { pattern: 'dist/vendor/reflect-metadata/Reflect.js', included: true, watched: false },
// { pattern: 'dist/vendor/systemjs/dist/system-polyfills.js', included: true, watched: false },
// { pattern: 'dist/vendor/systemjs/dist/system.src.js', included: true, watched: false },
// { pattern: 'dist/vendor/zone.js/dist/async-test.js', included: true, watched: false },
//
// { pattern: 'config/karma-test-shim.js', included: true, watched: true },
//
// // Distribution folder.
// { pattern: 'dist/**/*', included: false, watched: true }
// ],
// exclude: [
// // Vendor packages might include spec files. We don't want to use those.
// 'dist/vendor/**/*.spec.js'
// ],
// preprocessors: {},
// reporters: ['progress'],
// port: 9876,
// colors: true,
// logLevel: config.LOG_INFO,
// autoWatch: false,
// browsers: ['Chrome'],
// singleRun: true
// };
//
// if (process.env.TRAVIS) {
// configuration.browsers = ['Chrome_travis_ci'];
// }
//
// config.set(configuration);
// };


// // Karma configuration file, see link for more information
// // https://karma-runner.github.io/0.13/config/configuration-file.html
//
module.exports = function (config) {
configuration = {
basePath: '',
Expand Down Expand Up @@ -84,8 +30,6 @@ module.exports = function (config) {
config: './angular-cli.json',
environment: 'dev'
},


reporters: ['progress', 'karma-remap-istanbul'],
port: 9876,
colors: true,
Expand All @@ -100,4 +44,6 @@ if (process.env.TRAVIS) {
}

config.set(configuration);


};
3 changes: 0 additions & 3 deletions oasp4js-sample/src/app/app.component.html

This file was deleted.

9 changes: 0 additions & 9 deletions oasp4js-sample/src/app/app.component.ts

This file was deleted.

4 changes: 1 addition & 3 deletions oasp4js-sample/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { routing } from './app.routing';
import { AppComponent } from './app.component.ts';
import { OaspModule } from './oasp/oasp.module'

import { CrudComponent } from './main/components/crud/view/Crud.component'
Expand All @@ -26,8 +25,7 @@ import { KitchenRestService } from './main/components/kitchen/service/Kitchen.se
HeaderComponent,
KitchenComponent,
LoginComponent,
NotFoundComponent,
AppComponent
NotFoundComponent
],
imports: [
BrowserModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<button type="button" class="btn btn-pagination" (click)="changeState('RESERVED')" [disabled]="myState !== 1">{{i18n.tables.btns.reserve}}</button>
<button type="button" class="btn btn-pagination" (click)="changeState('FREE')" [disabled]="myState != 3">{{i18n.tables.btns.cancel}}</button>
<button type="button" class="btn btn-pagination" (click)="changeState('OCCUPIED')" [disabled]="myState !== 3">{{i18n.tables.btns.occupy}}</button>
<button type="button" class="btn btn-pagination" (click)="changeState('FREE')" [disabled]="myState === 1 || myState === -1">{{i18n.tables.btns.free}}</button>
<button type="button" class="btn btn-pagination" (click)="changeState('FREE')" [disabled]="myState <= 1">{{i18n.tables.btns.free}}</button>
</div>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class CrudComponent{

constructor(private securityService: SecurityService, private oaspI18n: OaspI18n, private crudRestService: CrudRestService){
if(!this.securityService.getUser()){
debugger
this.security = false;
this.securityService.logOut();
}else {
Expand All @@ -55,7 +54,8 @@ export class CrudComponent{
this.numItems = data.pagination.total;
this.tables = data.result
this.crudRestService.disableLoading();
});
},
err => { this.crudRestService.disableLoading()});
}

openEditModal(){
Expand All @@ -69,7 +69,8 @@ export class CrudComponent{
this.numItems = data.pagination.total;
this.tables = data.result;
this.crudRestService.disableLoading();
}
},
err => { this.crudRestService.disableLoading()}
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class DetailsRestService {
}
this.http.post(this.BO.orderPOST, JSON.stringify(data))
.map(res => res.json())
.subscribe(data => {this.http.disableLoading()})
.subscribe(data => {this.http.disableLoading()},
err => { this.http.disableLoading()})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,12 @@ export class KitchenRestService {
.map(res => res.json())
}

assignOrderPosition(obj){
obj.cookId = 1;
this.http.post(this.BO.orderPositionPOST, JSON.stringify(obj))
.map(res => res.json())
.subscribe(data => {this.http.disableLoading()})
}

returnOrderPosition(obj){
obj.cookId = null;
this.http.post(this.BO.orderPositionPOST, JSON.stringify(obj))
.map(res => res.json())
.subscribe(data => {this.http.disableLoading()})
.subscribe(data => {this.http.disableLoading()},
err => { this.http.disableLoading()})
}

doneOrderPosition(obj){
Expand All @@ -79,20 +73,21 @@ export class KitchenRestService {
obj.state = "CANCELLED"
this.http.post(this.BO.orderPositionPOST, JSON.stringify(obj))
.map(res => res.json())
.subscribe(data => {this.http.disableLoading()})
.subscribe(data => {this.http.disableLoading()},
err => { this.http.disableLoading()})
}

moveOrderPosition(obj, cookId){
obj.cookId = cookId;
this.http.post(this.BO.orderPositionPOST, JSON.stringify(obj))
return this.http.post(this.BO.orderPositionPOST, JSON.stringify(obj))
.map(res => res.json())
.subscribe(data => {this.http.disableLoading()})
}

finishOrderPosition(obj, state){
obj.state = state
this.http.post(this.BO.orderPositionPOST, JSON.stringify(obj))
.map(res => res.json())
.subscribe(data => {this.http.disableLoading()})
.subscribe(data => {this.http.disableLoading()},
err => { this.http.disableLoading()})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export class KitchenComponent{
this.offerList.push(data.result[i].name)
}
this.kitchenRestService.disableLoading();
});
},
err => { this.kitchenRestService.disableLoading()});

this.kitchenRestService
.getProducts(this.pageData)
Expand All @@ -65,7 +66,8 @@ export class KitchenComponent{
}
}
this.kitchenRestService.disableLoading();
});
},
err => { this.kitchenRestService.disableLoading()});
this.getLists();
this.headers = [this.i18n.kitchen.id,this.i18n.kitchen.orderID, this.i18n.kitchen.offerName, this.i18n.kitchen.mealName, this.i18n.kitchen.sideDishName];
}
Expand All @@ -80,9 +82,12 @@ export class KitchenComponent{
this.orderPositions = data
this.fillKitchenTables();
this.kitchenRestService.disableLoading();
});
});
});
},
err => { this.kitchenRestService.disableLoading()});
},
err => { this.kitchenRestService.disableLoading()});
},
err => { this.kitchenRestService.disableLoading()});
}

fillKitchenTables(){
Expand Down Expand Up @@ -138,7 +143,8 @@ export class KitchenComponent{
}
this.fillKitchenTables();
this.kitchenRestService.disableLoading();
});
},
err => { this.kitchenRestService.disableLoading()});

}

Expand All @@ -163,10 +169,11 @@ export class KitchenComponent{
assign(){
for(let i = 0 ; i < this.orderPositions.length ; i++){
if(this.selectedAvailableCommand.id === this.orderPositions[i].id){
this.kitchenRestService.moveOrderPosition(this.orderPositions[i], 1);
this.kitchenRestService.moveOrderPosition(this.orderPositions[i], 1).subscribe(data => {
this.kitchenRestService.disableLoading(); this.getLists()},
err => { this.kitchenRestService.disableLoading()})
}
}
this.getLists();

this.selectedAssignedCommand = undefined;
this.selectedAvailableCommand = undefined;
Expand All @@ -175,10 +182,11 @@ export class KitchenComponent{
return(){
for(let i = 0 ; i < this.orderPositions.length ; i++){
if(this.selectedAssignedCommand.id === this.orderPositions[i].id){
this.kitchenRestService.moveOrderPosition(this.orderPositions[i], null);
this.kitchenRestService.moveOrderPosition(this.orderPositions[i], null).subscribe(data => {
this.kitchenRestService.disableLoading(); this.getLists()},
err => { this.kitchenRestService.disableLoading()});
}
}
this.getLists();

this.selectedAssignedCommand = undefined;
this.selectedAvailableCommand = undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h1>{{i18n.loginPage.intro}}</h1>
<img src="app/main/img/login_logo.png">
</div>

<form (ngSubmit)="validateLogin()" #loginForm="ngForm">
<form (ngSubmit)="validateLogin(loginForm)" #loginForm="ngForm">
<h2>{{i18n.loginPage.signIn}}</h2>

<div class="cuadroUsuario">
Expand All @@ -17,12 +17,12 @@ <h2>{{i18n.loginPage.signIn}}</h2>
<div [hidden]="username.valid || username.pristine" class ="login-alert">
{{i18n.loginPage.form.usernameError}}
</div>
<input type="text" [placeholder]="i18n.loginPage.form.usernamePlaceHolder" [(ngModel)]="user.username" style="margin-bottom:10px;" #username="ngModel" name="username" class="form-control" required>
<input type="text" [placeholder]="i18n.loginPage.form.usernamePlaceHolder" ngModel #username="ngModel" name="username" class="form-control propertyMargin-bottom" required>

<div [hidden]="password.valid || password.pristine" class ="login-alert">
{{i18n.loginPage.form.passwordError}}
</div>
<input type="password" [placeholder]="i18n.loginPage.form.passwordPlaceHolder" [(ngModel)]="user.password" style="margin-bottom:10px;" #password="ngModel" name="password" class="form-control" required>
<input type="password" [placeholder]="i18n.loginPage.form.passwordPlaceHolder" ngModel #password="ngModel" name="password" class="form-control propertyMargin-bottom" required>

</div>
<button type="submit" class="btn btn-success" [disabled] ="!loginForm.form.valid">{{i18n.buttons.submitBtn}}</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { OaspI18n } from '../../../oasp/oasp-i18n/oasp-i18n.service';

export class LoginComponent{

user: User = new User(0, "", "", 0);
i18n

constructor(private oaspI18n: OaspI18n, private securityService:SecurityService){
Expand All @@ -21,8 +20,8 @@ export class LoginComponent{
this.securityService.closeErrorLogin();
}

validateLogin(){
this.securityService.funcionLogin(this.user);
validateLogin(form){
this.securityService.funcionLogin(form.value.username, form.value.password);
this.securityService.functionsesionExpired();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
[modal]=true
[TITLE]=autoLogInfo
class="modaldialog">
<form (ngSubmit)="validateLogin()" #loginForm="ngForm">
<form (ngSubmit)="validateLogin(loginForm)" #loginForm="ngForm">
<h2>{{i18n.loginPage.signIn}}</h2>

<div class="cuadroUsuario">
Expand All @@ -29,12 +29,12 @@ <h2>{{i18n.loginPage.signIn}}</h2>
<div [hidden]="username.valid || username.pristine" class ="login-alert">
{{i18n.loginPage.form.usernameError}}
</div>
<input type="text" [placeholder]="i18n.loginPage.form.usernamePlaceHolder" [(ngModel)]="user.username" style="margin-bottom:10px;" #username="ngModel" name="username" class="form-control" required>
<input type="text" [placeholder]="i18n.loginPage.form.usernamePlaceHolder" ngModel #username="ngModel" name="username" class="form-control propertyMargin-bottom" required>

<div [hidden]="password.valid || password.pristine" class ="login-alert">
{{i18n.loginPage.form.passwordError}}
</div>
<input type="password" [placeholder]="i18n.loginPage.form.passwordPlaceHolder" [(ngModel)]="user.password" style="margin-bottom:10px;" #password="ngModel" name="password" class="form-control" required>
<input type="password" [placeholder]="i18n.loginPage.form.passwordPlaceHolder" ngModel #password="ngModel" name="password" class="form-control propertyMargin-bottom" required>

</div>
<button type="submit" class="btn btn-success" [disabled] ="!loginForm.form.valid">{{i18n.buttons.submitBtn}}</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ export class Oasp4jsSampleAppComponent {
this.i18n = this.oaspI18n.getI18n();
}

validateLogin(username, password){
this.securityService.funcionLogin(this.user);
validateLogin(form){
this.securityService.funcionLogin(form.value.username, form.value.password);
this.securityService.functionsesionExpired();
}


hideAlertLogin(){
this.securityService.closeErrorLogin();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ export class SecurityService{
constructor(private router: Router, private http:HttpClient) {
}

funcionLogin(u){
funcionLogin(username, password){
let formData={
j_username: u.username,
j_password: u.password
j_username: username,
j_password: password
};

this.http.post(this.BO.loginPOST,JSON.stringify(formData))
Expand Down
Loading

0 comments on commit b83330d

Please sign in to comment.