Reservations

This commit is contained in:
2018-04-13 17:05:13 +02:00
parent 49bd541cb8
commit dbe736d941
14 changed files with 368 additions and 26 deletions
+19 -8
View File
@@ -304,11 +304,12 @@ $( function () {
var vm = dbo.editProjectModal;
var reservation = {
id : 0,
project_id : vm.projectID,
reservationamount: 0,
payed : 'UNPAYED',
inEdit : true
id : 0,
project_id : vm.projectID,
reservationamount : 0,
external_id : null,
inEdit : true,
invalidReservation: true
};
vm.reservations.push( new vm.Reservation( reservation ) );
@@ -485,15 +486,23 @@ $( function () {
var vm = dbo.editProjectModal;
if ( !self ) self = this;
if ( !self.external_id ) {
self.invalidReservation(true);
return;
}
var submitDATA = {
id : self.id,
project_id : self.project_id,
payed : self.payed(),
external_id : self.external_id(),
reservationamount: self.reservationamount()
}
dbo.projectDataService.saveReservation( submitDATA, function ( data ) {
if ( data.success ) self.id = data.reservationID;
if ( data.success ) {
self.invalidReservation(false);
self.id = data.reservationID;
}
} );
},
@@ -878,11 +887,13 @@ $( function () {
},
Reservation: function ( data ) {
console.log( data );
this.id = data.id;
this.project_id = data.project_id;
this.reservationamount = ko.observable( data.reservationamount );
this.payed = ko.observable( data.payed );
this.external_id = ko.observable( data.external_id );
this.inEdit = ko.observable( data.inEdit || false );
this.invalidReservation = ko.observable( data.invalidReservation || false );
},
addDocument: function ( data, evt ) {