Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $scope.existingFlowObject = flowFactory.create({
- singleFile: true,
- target: base_url + 'file',
- testChunks: false
- });
- $scope.deleteImage = function () {
- $scope.existingFlowObject.cancel();
- $scope.infant.imageId = null;
- };
- $scope.uploadLogEvent = function (image_id) {
- if (!isNaN(image_id) && image_id !== null) {
- $scope.newLogEvent.imageId = image_id;
- }
- var sendData = {
- infant_id: $scope.infant.infantId,
- duration: $scope.dur.days + ' ' + $scope.dur.hours + ':' + $scope.dur.minutes,
- start_date: $scope.prepareDate($scope.newLogEvent.startDate, $scope.newLogEvent.startDate),
- event_category: $scope.newLogEvent.eventCategory,
- event_type: $scope.newLogEvent.eventType,
- sickness_type: $scope.newLogEvent.sicknessType,
- number_detail: $scope.newLogEvent.numberDetail,
- text_detail: $scope.newLogEvent.textDetail,
- comment: $scope.newLogEvent.comment,
- file_id: $scope.newLogEvent.imageId
- };
- if (sendData.duration === "0 0:0") {
- sendData.duration = null;
- }
- rest.post('event')
- .preload('event')
- .data(sendData)
- .success(function (data) {
- if (data.status === 'ok') {
- //$scope.showAlert();
- self.reset();
- $scope.reloadPage();
- }
- })
- .send();
- };
- $scope.save() {
- //...
- if ($scope.existingFlowObject.files.length)
- // po zakońceniu żądania automatycznie wywolywana funkcja uploadLogEvent(image_id)
- existingFlowObject.upload()
- }
- else {
- $scope.uploadLogEvent(null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement