-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from OpenLMIS-Angola/feature/OAM-201
OAM-201: add deleting orders
- Loading branch information
Showing
6 changed files
with
212 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
{ | ||
"requisition.orderCreate": "Create Orders", | ||
"requisition.orderCreate.create": "Create Order", | ||
"requisition.orderCreate.saveDraft": "Save Draft", | ||
"requisition.orderCreate.submitted": "Orders created successfully", | ||
"requisition.orderCreate.createdOrderSent.success": "Offline created order sent successfully.", | ||
"requisition.orderCreate.createdOrderSent.error": "Error occurred while sending offline created order.", | ||
"requisition.orderCreate.draftUpdate.success": "Draft order update success.", | ||
"requisition.orderCreate.draftUpdate.error": "Error occurred while updating draft order." | ||
"requisition.orderCreate.draftUpdate.error": "Error occurred while updating draft order.", | ||
"requisition.orderCreate.delete": "Delete", | ||
"requisition.orderCreate.deleteBatch": "Delete Batch", | ||
"requisition.orderCreate.delete.prompt": "Are you sure you want to delete this order?", | ||
"requisition.orderCreate.delete.prompt.batch": "Are you sure you want to delete available orders?", | ||
"requisition.orderCreate.delete.error": "Error occurred while deleting order(s).", | ||
"requisition.orderCreate.delete.success": "Order(s) deleted successfully." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,3 +74,7 @@ export const orderCreateFormTableColumns = [ | |
) | ||
} | ||
]; | ||
|
||
export const ORDER_STATUS = { | ||
CREATING: 'CREATING', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* This program is part of the OpenLMIS logistics management information system platform software. | ||
* Copyright © 2017 VillageReach | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under the terms | ||
* of the GNU Affero General Public License as published by the Free Software Foundation, either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. You should have received a copy of | ||
* the GNU Affero General Public License along with this program. If not, see | ||
* http://www.gnu.org/licenses. For additional information contact [email protected]. | ||
*/ | ||
|
||
(function() { | ||
|
||
'use strict'; | ||
|
||
/** | ||
* @ngdoc service | ||
* @name requisition-order-create.orderCreateService | ||
* | ||
* @description | ||
* Communicates with the /api/orders endpoint of the OpenLMIS server. | ||
*/ | ||
angular | ||
.module('requisition-order-create') | ||
.service('orderCreateService', service); | ||
|
||
service.$inject = ['$resource', '$http', 'openlmisUrlFactory']; | ||
|
||
function service($resource, $http, openlmisUrlFactory) { | ||
|
||
var resource = $resource(openlmisUrlFactory('/api/orders/:id'), {}, { | ||
update: { | ||
method: 'PUT' | ||
}, | ||
create: { | ||
url: openlmisUrlFactory('/api/orders/requisitionLess'), | ||
method: 'POST' | ||
}, | ||
send: { | ||
url: openlmisUrlFactory('/api/orders/:id/requisitionLess/send'), | ||
method: 'PUT' | ||
} | ||
}); | ||
|
||
this.get = get; | ||
this.create = create; | ||
this.update = update; | ||
this.send = send; | ||
this.delete = deleteOrders; | ||
|
||
function get(orderId) { | ||
return resource.get({ | ||
id: orderId | ||
}).$promise; | ||
} | ||
|
||
function create(orderId) { | ||
return resource.create(orderId).$promise; | ||
} | ||
|
||
function update(order) { | ||
return resource.update({ | ||
id: order.id | ||
}, order).$promise; | ||
} | ||
|
||
function send(order) { | ||
return resource.send({ | ||
id: order.id | ||
}, order).$promise; | ||
} | ||
|
||
function deleteOrders(orderIds) { | ||
return $http({ | ||
method: 'DELETE', | ||
url: openlmisUrlFactory('/api/orders'), | ||
data: { | ||
ids: orderIds | ||
}, | ||
headers: { | ||
'Content-Type': 'application/json;charset=utf-8' | ||
} | ||
}); | ||
} | ||
} | ||
})(); |