Skip to content

Commit

Permalink
Merge pull request #533 from ShoppinPal/develop
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
rishabh1635 authored Oct 30, 2024
2 parents b253a1e + ca77541 commit 9246b6a
Show file tree
Hide file tree
Showing 20 changed files with 652 additions and 595 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Standard measures for security like IP whitelisting will be used to allow access
# Remote Dev Machine
1. Setup dropbox on local machine
1. [Setup dropbox on remote machine](https://training.shoppinpal.com/setup-a-machine-in-the-cloud/setup-box/shared-filesystem/dropbox.html)
1. [Setup dropbox on remote machine](https://training.linktoany.com/setup-a-machine-in-the-cloud/setup-box/shared-filesystem/dropbox.html)
1. Create a directory on your local machine to house any and all projects meant for remote development: `mkdir -p ~/Dropbox/rDev`
1. Go to the directory where you cloned warehouse locally, for example: `cd ~/dev/warehouse`
1. Then wire it up to your local Dropbox folder:
Expand Down
738 changes: 362 additions & 376 deletions admin/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "Warehouse Admin",
"author": "Kamal Khatwani",
"homepage": "http://shoppinpal.com",
"homepage": "http://linktoany.com",
"license": "MIT",
"scripts": {
"ng": "./node_modules/@angular/cli/bin/ng",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</main>
</div>
<app-footer>
<span><a href="https://stockup.shoppinpal.com">Stockup</a> &copy; 2018</span>
<span><a href="https://stockup.linktoany.com">Stockup</a> &copy; 2018</span>
<span>&nbsp;Version: {{appVersion}}</span>
<span class="ml-auto">Powered by <a href="https://shoppinpal.com">Shoppinpal</a></span>
<span class="ml-auto">Powered by <a href="https://linktoany.com">Link</a></span>
</app-footer>
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@
</button>
</span>
</div>
<div class="col-sm-3">
<span class="input-group-btn">
<button class="btn btn-warning btn-block" type="button" (click)="regenerateOrder()">
<i class="fa fa-refresh"></i>
Regenerate Order
</button>
</span>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,18 @@ export class ReceiveComponent implements OnInit, OnDestroy {
})
}

regenerateOrder(){
this.loading = true;
this.orgModelApi.regenerateOrder(this.userProfile.orgModelId, this.order.id).subscribe((data)=>{
this.loading = false;
this.toastr.info('Regenerating Order...');
this._router.navigate(['/orders/stock-orders']);
}, err=>{
this.loading = false;
console.log(err);
});
}

ngOnDestroy(): void {
this.subscriptions.forEach(subscription => {
if (subscription) {
Expand Down
2 changes: 1 addition & 1 deletion admin/src/app/signup/signup.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>Sign Up</h1>
name="orgName"
(blur)="findExistingOrganisation(user.orgName)"
required>
<span class="org-suffix">.shoppinpal.com</span> <!--todo: make it come from env variable -->
<span class="org-suffix">.linktoany.com</span> <!--todo: make it come from env variable -->
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
Expand Down
22 changes: 22 additions & 0 deletions common/models/org-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,28 @@ module.exports = function (OrgModel) {
});
};

OrgModel.remoteMethod('regenerateOrder', {
accepts: [
{arg: 'id', type: 'string', required: true},
{arg: 'reportModelId', type: 'string', required: true},
{arg: 'options', type: 'object', http: 'optionsFromRequest'}
],
http: { path: '/:id/regenerateOrder', verb: 'put'},
returns: { arg: 'regenerateOrderInstance', type: 'object', root: true}
});

OrgModel.regenerateOrder = function (id, reportModelId, options) {
return OrgModel.app.models.ReportModel.regenerateOrder(id, reportModelId, options)
.catch(function(error){
logger.error({
error,
options,
functionName: 'regenerateOrder'
});
return Promise.reject(error);
});
}

OrgModel.remoteMethod('setReportStatus', {
accepts: [
{arg: 'id', type: 'string', required: true},
Expand Down
14 changes: 14 additions & 0 deletions common/models/org-model.json
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,20 @@
"permission": "ALLOW",
"property": "setReportStatus"
},
{
"accessType": "EXECUTE",
"principalType": "ROLE",
"principalId": "orgAdmin",
"permission": "ALLOW",
"property": "regenerateOrder"
},
{
"accessType": "EXECUTE",
"principalType": "ROLE",
"principalId": "storeManager",
"permission": "ALLOW",
"property": "regenerateOrder"
},
{
"accessType": "EXECUTE",
"principalType": "ROLE",
Expand Down
32 changes: 30 additions & 2 deletions common/models/report-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ module.exports = function (ReportModel) {
id: stockOrderInstance.id
},
{
vendConsignmentProductId: vendConsignmentProduct.id,
vendConsignmentProductId: vendConsignmentProduct.id ? vendConsignmentProduct.id : null,
vendConsignmentProduct: vendConsignmentProduct
}
);
Expand Down Expand Up @@ -1574,7 +1574,7 @@ module.exports = function (ReportModel) {
productModelSku: product.sku, //need for sorting
storeInventory: quantityOnHand,
desiredStockLevel: desiredStockLevel,
orderQuantity: product.orderQuantity || 0,
orderQuantity: product.orderQuantity ? product.orderQuantity : (product.quantity ? product.quantity : 0),
originalOrderQuantity: orderQuantity,
fulfilledQuantity: product.fulfilledQuantity || 0,
receivedQuantity: product.receivedQuantity || 0,
Expand Down Expand Up @@ -1615,6 +1615,34 @@ module.exports = function (ReportModel) {
});
}

ReportModel.regenerateOrder = function (orgModelId, reportModelId, options){
logger.debug({
message: "will change state to generated",
orgModelId,
reportModelId,
options,
functionName: 'regenerateOrder'
});
var reportModelInstance;
return ReportModel.findById(reportModelId)
.catch(function (error) {
logger.error({
message: 'Could not find report model instance',
reportModelId,
options,
error,
functionName: 'regenerateOrder'
});
return Promise.reject('Could not find report model instance');
})
.then( function(response) {
reportModelInstance = response;
return reportModelInstance.updateAttributes({
state: REPORT_STATES.GENERATED
});
})
}

ReportModel.deleteStockOrderVend = function (orgModelId, reportModelId, options) {
logger.debug({
message: 'Looking for stock order',
Expand Down
4 changes: 2 additions & 2 deletions common/models/user-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ module.exports = function (UserModel) {
// transporter.send = transporter.sendMail;
// var verifyOptions = {
// type: 'email',
// to: 'kamal@shoppinpal.com',
// to: 'kamal@linktoany.com',
// // to: ctx.instance.email,
// subject: 'Thank you for registering.',
// from: UserModel.app.get('verificationEmail') || process.env.VERIFICATION_EMAIL,
// // from: 'kamal@shoppinpal.com',
// // from: 'kamal@linktoany.com',
// redirect: '/',
// user: ctx.instance,
// mailer: transporter
Expand Down
15 changes: 8 additions & 7 deletions common/utils/vend.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,14 @@ var setDesiredStockLevelForVend = function (orgModelId, outletId, productId, des
id: productId //'3aab7379-15a2-11e3-a415-bc764e10976c'
};
var updateData = {
id: product.id,
inventory: [
{
'outlet_id': outletId, //'aea67e1a-b85c-11e2-a415-bc764e10976c',
'reorder_point': desiredStockLevel
}
]
details: {
inventory: [
{
'outlet_id': outletId, //'aea67e1a-b85c-11e2-a415-bc764e10976c',
'reorder_point': desiredStockLevel
}
]
}
};
return vendSdk.products.update({apiId: {value: product.id}, body: {value: updateData}}, connectionInfo);
})
Expand Down
2 changes: 1 addition & 1 deletion docs/local-ide-remote-docker.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Deploy

1. [Setup dropbox on remote machine](https://training.shoppinpal.com/setup-box-on-azure/setup-dropbox-on-azure.html)
1. [Setup dropbox on remote machine](https://training.linktoany.com/setup-box-on-azure/setup-dropbox-on-azure.html)
1. On your remote machine, execute the instructions from the [Deploy](https://github.com/ShoppinPal/warehouse#deploy) section above.
1. On remote, setup the following env variables:

Expand Down
Loading

0 comments on commit 9246b6a

Please sign in to comment.