bugfixing modals
This commit is contained in:
@@ -14,9 +14,9 @@ export default class toolingEquipment extends Vue {
|
||||
public get tools(): server.Tool[] { return (this.$store.state as AppModel).tooling.tools; }
|
||||
|
||||
public searchText: string = "";
|
||||
public currentFilter : string = "";
|
||||
public currentFilter: string = "";
|
||||
|
||||
public applyFilter(){
|
||||
public applyFilter() {
|
||||
this.currentFilter = this.searchText.toLowerCase();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export default class toolingEquipment extends Vue {
|
||||
public selectedEquipment: any = null;
|
||||
|
||||
public get categories(): string[] {
|
||||
let cat: Set<string>= new Set<string>();
|
||||
let cat: Set<string> = new Set<string>();
|
||||
for (const key in this.toolsConfiguration) {
|
||||
let t = this.toolsConfiguration[key];
|
||||
cat.add(t.category);
|
||||
@@ -37,7 +37,7 @@ export default class toolingEquipment extends Vue {
|
||||
}
|
||||
|
||||
public get categoriesEdge(): string[] {
|
||||
let cat: Set<string>= new Set<string>();
|
||||
let cat: Set<string> = new Set<string>();
|
||||
for (const key in this.edgeConfiguration) {
|
||||
let t = this.edgeConfiguration[key];
|
||||
cat.add(t.category);
|
||||
@@ -65,7 +65,7 @@ export default class toolingEquipment extends Vue {
|
||||
});
|
||||
}
|
||||
|
||||
public selectTool(item){
|
||||
public selectTool(item) {
|
||||
this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration;
|
||||
this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration;
|
||||
this.selectedTool = item;
|
||||
@@ -75,60 +75,60 @@ export default class toolingEquipment extends Vue {
|
||||
this.enableModify = false;
|
||||
}
|
||||
|
||||
public modify(){
|
||||
public modify() {
|
||||
this.enableModify = true;
|
||||
this.disableList = true;
|
||||
}
|
||||
|
||||
public fieldTool(){
|
||||
public fieldTool() {
|
||||
this.toolsConfiguration = [];
|
||||
|
||||
for(let f in (this.$store.state as AppModel).tooling.toolsConfiguration){
|
||||
for (let f in (this.$store.state as AppModel).tooling.toolsConfiguration) {
|
||||
let element = (this.$store.state as AppModel).tooling.toolsConfiguration[f];
|
||||
if(!element.readOnly){
|
||||
if (!element.readOnly) {
|
||||
this.toolsConfiguration.push(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public addEquipment(){
|
||||
public addEquipment() {
|
||||
this.selectedTool = {};
|
||||
this.enableModify = true;
|
||||
this.disableList = true;
|
||||
this.fieldTool();
|
||||
}
|
||||
|
||||
public getDynamicFields(tooltype : string): Array<string>{
|
||||
public getDynamicFields(tooltype: string): Array<string> {
|
||||
var typeid = parseInt(tooltype);
|
||||
return (this.$store.state as AppModel).tooling.edgesAdditionalParamsConfiguration[typeid];
|
||||
}
|
||||
|
||||
public fieldEdge(obj){
|
||||
public fieldEdge(obj) {
|
||||
this.edgeConfiguration = [];
|
||||
|
||||
for (const key in (this.$store.state as AppModel).tooling.edgesConfiguration) {
|
||||
const element = (this.$store.state as AppModel).tooling.edgesConfiguration[key];
|
||||
if (!element.readOnly) {
|
||||
this.edgeConfiguration.push(element);
|
||||
}
|
||||
obj[element.name] = 0;
|
||||
const element = (this.$store.state as AppModel).tooling.edgesConfiguration[key];
|
||||
if (!element.readOnly) {
|
||||
this.edgeConfiguration.push(element);
|
||||
}
|
||||
obj[element.name] = 0;
|
||||
}
|
||||
|
||||
let fields = this.getDynamicFields(this.selectedTool.toolType);
|
||||
for (const key in fields) {
|
||||
const element = fields[key];
|
||||
obj.edgeAdditionalParams[element] = 0;
|
||||
const element = fields[key];
|
||||
obj.edgeAdditionalParams[element] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public selectTab(elem){
|
||||
if(elem == 'Parameters'){
|
||||
public selectTab(elem) {
|
||||
if (elem == 'Parameters') {
|
||||
this.enableParameters = true;
|
||||
this.enableEquipment = false;
|
||||
this.selectedEquipment = null;
|
||||
this.enableModify = false;
|
||||
}
|
||||
else if (elem.id <= 0){
|
||||
else if (elem.id <= 0) {
|
||||
this.fieldEdge(elem);
|
||||
this.selectedEquipment = elem;
|
||||
console.log(this.selectedEquipment);
|
||||
@@ -136,15 +136,15 @@ export default class toolingEquipment extends Vue {
|
||||
this.enableParameters = false;
|
||||
this.enableModify = true;
|
||||
}
|
||||
else if(elem.id > 0){
|
||||
this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration;
|
||||
else if (elem.id > 0) {
|
||||
this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration;
|
||||
this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration;
|
||||
this.selectedEquipment = elem;
|
||||
this.enableEquipment = true;
|
||||
this.enableParameters = false;
|
||||
this.enableModify = false;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.selectedEquipment = null;
|
||||
this.enableParameters = true;
|
||||
this.enableEquipment = false;
|
||||
@@ -159,22 +159,22 @@ export default class toolingEquipment extends Vue {
|
||||
}
|
||||
|
||||
public getToolIcon = function (id) {
|
||||
if(id == 9999)
|
||||
if (id == 9999)
|
||||
return "../assets/images/list-undefined.PNG"
|
||||
else if(id == 151 || id == 700 )
|
||||
return "../assets/images/list-blade.PNG"
|
||||
else if (id == 151 || id == 700)
|
||||
return "../assets/images/list-blade.PNG"
|
||||
else
|
||||
return "../assets/images/list-tool.PNG"
|
||||
}
|
||||
|
||||
private internalCounter = -1;
|
||||
public addEdge(){
|
||||
public addEdge() {
|
||||
|
||||
this.disableList = true;
|
||||
this.enableModify = true;
|
||||
var obj = { edgeAdditionalParams:{}};
|
||||
var obj = { edgeAdditionalParams: {} };
|
||||
this.fieldEdge(obj);
|
||||
obj["id"] = -1;
|
||||
obj["id"] = -1;
|
||||
this.selectedTool.edgesData.push(obj);
|
||||
this.selectTab(obj);
|
||||
console.log(this.selectedTool.edgesData);
|
||||
@@ -200,10 +200,10 @@ export default class toolingEquipment extends Vue {
|
||||
});
|
||||
}
|
||||
|
||||
async saveEdge(tool, model){
|
||||
async saveEdge(tool, model) {
|
||||
|
||||
delete model.id;
|
||||
new ToolingService().SetEdgeData(tool,model).then(response => {
|
||||
new ToolingService().SetEdgeData(tool, model).then(response => {
|
||||
this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration;
|
||||
this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration;
|
||||
this.selectTab(response);
|
||||
@@ -211,48 +211,51 @@ export default class toolingEquipment extends Vue {
|
||||
});
|
||||
}
|
||||
|
||||
async modifyEdge(tool, model){
|
||||
async modifyEdge(tool, model) {
|
||||
|
||||
new ToolingService().UpdateEdgeData(tool,model).then(response => {
|
||||
new ToolingService().UpdateEdgeData(tool, model).then(response => {
|
||||
this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration;
|
||||
this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration;
|
||||
this.disableList = false;
|
||||
});
|
||||
}
|
||||
|
||||
async buttonSave(tool: any, edge: any){
|
||||
async buttonSave(tool: any, edge: any) {
|
||||
|
||||
if(tool.id){
|
||||
if(edge && edge.id > 0){
|
||||
if (tool.id) {
|
||||
if (edge && edge.id > 0) {
|
||||
this.modifyEdge(tool, edge);
|
||||
}
|
||||
else if ( edge && edge.id <= 0){
|
||||
else if (edge && edge.id <= 0) {
|
||||
this.saveEdge(tool, edge);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.modifyTool(tool);
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.save(tool);
|
||||
}
|
||||
}
|
||||
|
||||
async deleteTool(model) {
|
||||
ModalHelper.AskConfirm(this.$options.filters.localize("modal_confirm_delete", "Richiesta di conferma"),
|
||||
this.$options.filters.localize("modal_confirm_delete_tool", "Confermi la cancellazione del tool?"),
|
||||
()=>{
|
||||
new ToolingService().DeleteTool(model).then(response => {
|
||||
this.selectedTool = null;
|
||||
});
|
||||
}, null);
|
||||
this.$options.filters.localize("modal_confirm_delete_tool", "Confermi la cancellazione del tool?"),
|
||||
() => {
|
||||
new ToolingService().DeleteTool(model).then(response => {
|
||||
this.selectedTool = null;
|
||||
});
|
||||
}, null);
|
||||
}
|
||||
|
||||
async deleteEdgeData(tool, model){
|
||||
|
||||
new ToolingService().DeleteEdgeData(tool, model).then(response => {
|
||||
this.selectedTool = null;
|
||||
});
|
||||
async deleteEdgeData(tool, model) {
|
||||
ModalHelper.AskConfirm(this.$options.filters.localize("modal_confirm_delete", "Richiesta di conferma"),
|
||||
this.$options.filters.localize("modal_confirm_delete_edge", "Confermi la cancellazione del tagliente?"),
|
||||
() => {
|
||||
new ToolingService().DeleteEdgeData(tool, model).then(response => {
|
||||
this.selectedTool = null;
|
||||
});
|
||||
}, null);
|
||||
}
|
||||
|
||||
// async save(item){
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ToolingService } from "../services/toolingService";
|
||||
import { store, AppModel } from "src/store";
|
||||
import { toolingActions } from "../store/tooling.store";
|
||||
import { DepotService } from "../services/depotService";
|
||||
import { ModalHelper } from "src/modules/base-components";
|
||||
|
||||
declare let $: any;
|
||||
|
||||
@@ -17,17 +18,17 @@ export default class toolingShanks extends Vue {
|
||||
public childToolsShank: server.ToolsConfiguration[] = null;
|
||||
|
||||
public searchText: string = "";
|
||||
public currentFilter : string = "";
|
||||
public currentFilter: string = "";
|
||||
|
||||
|
||||
public applyFilter(){
|
||||
public applyFilter() {
|
||||
this.currentFilter = this.searchText.toLowerCase();
|
||||
}
|
||||
|
||||
public get availableTools(): server.Tools[] { return (this.$store.state as AppModel).depot.availableTool; }
|
||||
|
||||
public get categories(): string[] {
|
||||
let cat: Set<string>= new Set<string>();
|
||||
let cat: Set<string> = new Set<string>();
|
||||
for (const key in this.shankConfiguration) {
|
||||
let t = this.shankConfiguration[key];
|
||||
cat.add(t.category);
|
||||
@@ -66,27 +67,27 @@ export default class toolingShanks extends Vue {
|
||||
});
|
||||
}
|
||||
|
||||
public modify(){
|
||||
public modify() {
|
||||
this.enableModify = true;
|
||||
this.disableList = true;
|
||||
}
|
||||
|
||||
|
||||
public addShank(){
|
||||
public addShank() {
|
||||
this.selectedTool = {};
|
||||
this.shankConfiguration = [];
|
||||
this.enableModify = true;
|
||||
|
||||
for(let f in (this.$store.state as AppModel).tooling.shankConfiguration){
|
||||
for (let f in (this.$store.state as AppModel).tooling.shankConfiguration) {
|
||||
let element = (this.$store.state as AppModel).tooling.shankConfiguration[f];
|
||||
if(!element.readOnly){
|
||||
if (!element.readOnly) {
|
||||
this.shankConfiguration.push(element);
|
||||
}
|
||||
}
|
||||
this.disableList = true;
|
||||
}
|
||||
|
||||
public selectTool(item){
|
||||
public selectTool(item) {
|
||||
this.selectedTool = item;
|
||||
this.enableParameters = true;
|
||||
this.enableEquipment = false;
|
||||
@@ -98,16 +99,16 @@ export default class toolingShanks extends Vue {
|
||||
}
|
||||
|
||||
|
||||
public selectTab(elem){
|
||||
public selectTab(elem) {
|
||||
|
||||
if(elem == 'Parameters'){
|
||||
if (elem == 'Parameters') {
|
||||
this.enableParameters = true;
|
||||
this.enableEquipment = false;
|
||||
this.enableAddToolToShank = false;
|
||||
this.enableModify = false;
|
||||
this.selectedEquipment = null;
|
||||
}
|
||||
else if(elem.id <= 0){
|
||||
else if (elem.id <= 0) {
|
||||
this.childToolsShank = (this.$store.state as AppModel).tooling.childToolsShank;
|
||||
this.enableParameters = false;
|
||||
this.enableEquipment = false;
|
||||
@@ -115,7 +116,7 @@ export default class toolingShanks extends Vue {
|
||||
this.selectedEquipment = elem;
|
||||
this.enableModify = true;
|
||||
}
|
||||
else if (elem.id > 0){
|
||||
else if (elem.id > 0) {
|
||||
this.shankConfiguration = (this.$store.state as AppModel).tooling.shankConfiguration;
|
||||
this.childToolsShank = (this.$store.state as AppModel).tooling.childToolsShank;
|
||||
this.selectedEquipment = elem;
|
||||
@@ -124,7 +125,7 @@ export default class toolingShanks extends Vue {
|
||||
this.enableModify = false;
|
||||
this.enableAddToolToShank = false;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.enableParameters = true;
|
||||
this.enableEquipment = false;
|
||||
this.enableModify = false;
|
||||
@@ -133,12 +134,12 @@ export default class toolingShanks extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
public addToolToShank(){
|
||||
public addToolToShank() {
|
||||
|
||||
new DepotService().GetToolAvailable().then(response => {
|
||||
this.disableList = true;
|
||||
var obj = {};
|
||||
obj["id"] = -1;
|
||||
obj["id"] = -1;
|
||||
this.selectedTool.childsTools.push(obj);
|
||||
// this.enableEquipment = false;
|
||||
// this.enableParameters = false;
|
||||
@@ -156,9 +157,9 @@ export default class toolingShanks extends Vue {
|
||||
}
|
||||
|
||||
public cancel = function () {
|
||||
for(let l in this.selectedTool.childsTools){
|
||||
if(this.selectedTool.childsTools[l].id <= 0){
|
||||
this.selectedTool.childsTools.splice(l,1);
|
||||
for (let l in this.selectedTool.childsTools) {
|
||||
if (this.selectedTool.childsTools[l].id <= 0) {
|
||||
this.selectedTool.childsTools.splice(l, 1);
|
||||
}
|
||||
}
|
||||
this.enableModify = false;
|
||||
@@ -167,12 +168,12 @@ export default class toolingShanks extends Vue {
|
||||
}
|
||||
|
||||
|
||||
async buttonSave(tool: any){
|
||||
async buttonSave(tool: any) {
|
||||
|
||||
if(tool.id){
|
||||
if (tool.id) {
|
||||
this.modifyShank(tool);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.save(tool);
|
||||
}
|
||||
}
|
||||
@@ -196,22 +197,22 @@ export default class toolingShanks extends Vue {
|
||||
});
|
||||
}
|
||||
|
||||
public addToolsToShank(shank){
|
||||
public addToolsToShank(shank) {
|
||||
|
||||
let model = this.toolSelected;
|
||||
for(let l in this.selectedTool.childsTools){
|
||||
if(this.selectedTool.childsTools[l].multitoolId){
|
||||
for (let l in this.selectedTool.childsTools) {
|
||||
if (this.selectedTool.childsTools[l].multitoolId) {
|
||||
model.multitoolId = this.selectedTool.childsTools[l].multitoolId + 1;
|
||||
}
|
||||
if(this.selectedTool.childsTools.length == 0){
|
||||
if (this.selectedTool.childsTools.length == 0) {
|
||||
model.multitoolId = 1;
|
||||
}
|
||||
}
|
||||
new ToolingService().addToolToShank(shank, model).then(response => {
|
||||
this.selectTab(response);
|
||||
for(let l in this.selectedTool.childsTools){
|
||||
if(this.selectedTool.childsTools[l].id <= 0){
|
||||
this.selectedTool.childsTools.splice(l,1);
|
||||
for (let l in this.selectedTool.childsTools) {
|
||||
if (this.selectedTool.childsTools[l].id <= 0) {
|
||||
this.selectedTool.childsTools.splice(l, 1);
|
||||
}
|
||||
}
|
||||
this.disableList = false;
|
||||
@@ -223,13 +224,16 @@ export default class toolingShanks extends Vue {
|
||||
// this.disableList = false;
|
||||
// });
|
||||
}
|
||||
public removeToolsToShank(shank){
|
||||
|
||||
let model = this.selectedEquipment;
|
||||
new ToolingService().removeToolToShank(shank, model).then(response => {
|
||||
this.disableList = false;
|
||||
this.selectedTool = null;
|
||||
})
|
||||
public removeToolsToShank(shank) {
|
||||
ModalHelper.AskConfirm(this.$options.filters.localize("modal_confirm_delete", "Richiesta di conferma"),
|
||||
this.$options.filters.localize("modal_confirm_delete_tool", "Confermi la cancellazione del tool?"),
|
||||
() => {
|
||||
let model = this.selectedEquipment;
|
||||
new ToolingService().removeToolToShank(shank, model).then(response => {
|
||||
this.disableList = false;
|
||||
this.selectedTool = null;
|
||||
})
|
||||
}, null);
|
||||
// new ToolingService().SetEdgeData(tool,model).then(response => {
|
||||
// this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration;
|
||||
// this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration;
|
||||
@@ -239,8 +243,12 @@ export default class toolingShanks extends Vue {
|
||||
}
|
||||
|
||||
async deleteShank(model) {
|
||||
new ToolingService().DeleteShank(model).then(response => {
|
||||
this.selectedTool = null;
|
||||
});
|
||||
ModalHelper.AskConfirm(this.$options.filters.localize("modal_confirm_delete", "Richiesta di conferma"),
|
||||
this.$options.filters.localize("modal_confirm_delete_shank", "Confermi la cancellazione del codolo?"),
|
||||
() => {
|
||||
new ToolingService().DeleteShank(model).then(response => {
|
||||
this.selectedTool = null;
|
||||
});
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user