Skip to content

Commit

Permalink
Fixed Project Report Remarks
Browse files Browse the repository at this point in the history
This commit keeps the project remark connected to
the newly selected items in a project report.
  • Loading branch information
RezaMohammadi99 authored and vmw committed May 30, 2023
1 parent fad4de7 commit 667c17a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
Empty file added Profile
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Ext.define('PartKeepr.Components.Project.MetaPartSubgrid', {
onApplyMetaPartsClick: function (button)
{
var parentRecord = button.up("grid").parentRecord;

this.convertMetaPartsToParts(parentRecord);
},
/**
Expand All @@ -97,7 +98,7 @@ Ext.define('PartKeepr.Components.Project.MetaPartSubgrid', {
{
var missing;

var i, projectReportItem, subPart, projectPart;
var i, projectReportItem, subPart;

for (i = 0; i < record.subParts().getCount(); i++)
{
Expand All @@ -112,15 +113,17 @@ Ext.define('PartKeepr.Components.Project.MetaPartSubgrid', {
} else {
missing = Math.abs(missing);
}


if(subPart.get("comment").indexOf("DO NOT CHANGE") == -1)
subPart.set("comment", subPart.get("comment") + "\nDO NOT CHANGE:" + record.data.report + record._part.data.name);
else if(subPart.get("comment").indexOf(record.data.report) != -1)
subPart.set("comment", subPart.get("comment") + record._part.data.name);
else
subPart.set("comment", subPart.get("comment").slice(0,subPart.get("comment").indexOf("DO NOT CHANGE")+14) + record.data.report + record._part.data.name);
projectReportItem = Ext.create("PartKeepr.ProjectBundle.Entity.ReportPart");
projectReportItem.setPart(subPart);
projectReportItem.set("quantity", subPart.get("stockToUse"));
projectReportItem.setReport(this.up("#projectReportResult").projectReport);

projectPart = Ext.create("PartKeepr.ProjectBundle.Entity.ProjectPart");
projectPart.setPart(subPart);
projectPart.set("remarks", "remark");
record.store.add(projectReportItem);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ Ext.define("PartKeepr.Components.Project.ProjectReportResultGrid", {
amount: item.get("quantity"),
comment: item.getReport().reportProjects().getFieldValues("project.name").join(", "),
lotNumber: item.projectParts().getFieldValues("lotNumber").join(", "),
projects: [] // item.getReport().reportProjects()
projects: []
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,40 @@ Ext.define("PartKeepr.Components.ProjectReport.Renderers.RemarksRenderer", {
getProjectParts: function (rec) {

var report = rec.getReport(),
i, j, project, projectPart, projectPartQuantities = [];
i, j, k, project, projectPart, projectPartQuantities = [];

for (i = 0; i < report.reportProjects().getCount(); i++)
{
project = report.reportProjects().getAt(i).getProject();

for (j = 0; j < project.parts().getCount(); j++)
{
projectPart = project.parts().getAt(j);



if (projectPart.getPart().getId() === rec.getPart().getId())
{
if (projectPart.get("remarks") !== "" && projectPart.get("remarks") !== null)
{
projectPartQuantities.push(project.get("name") + ": " + projectPart.get("remarks"));
}
}
else
{

if (rec.getPart().data.comment.includes(projectPart.getPart().data.name))
{
if (projectPart.get("remarks") !== "" && projectPart.get("remarks") !== null)
{
projectPartQuantities.push(project.get("name") + ": " + projectPart.get("remarks"));
}
}

}

}
}

return projectPartQuantities.join("&#013;&#010;")
},

Expand Down
1 change: 1 addition & 0 deletions src/PartKeepr/PartBundle/Entity/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/
class Part extends BaseEntity
{
private $origin;
/**
* The category of the part.
*
Expand Down

0 comments on commit 667c17a

Please sign in to comment.