fixing radio button, writing css for check

This commit is contained in:
sanjayk03-dev
2024-01-29 02:50:53 +05:30
parent 30348187f5
commit 29e8812ca6
3 changed files with 47 additions and 8 deletions

View File

@@ -38,7 +38,7 @@ module.exports = {
return this.mach_state == "READY"; return this.mach_state == "READY";
}, },
macrosLength: function () { macrosLength: function () {
return this.config.macros.length > 1; return this.config.macros.length > 8;
}, },
macrosList: function () { macrosList: function () {
return this.config.macrosList.map(el => el.file_name); return this.config.macrosList.map(el => el.file_name);
@@ -196,6 +196,8 @@ module.exports = {
console.error("Restore Failed: ", error); console.error("Restore Failed: ", error);
alert("Restore failed"); alert("Restore failed");
} }
console.log("tab in saveMacros:",this.tab);
this.$set("tab", "1");
}, },
delete_current: async function () { delete_current: async function () {
const filename = this.config.macros[this.tab - 1].file_name; const filename = this.config.macros[this.tab - 1].file_name;
@@ -216,7 +218,8 @@ module.exports = {
console.error("Restore Failed: ", error); console.error("Restore Failed: ", error);
alert("Restore failed"); alert("Restore failed");
} }
this.tab = "1"; console.log("tab in delete_current:",this.tab);
this.$set("tab", "1");
this.deleteGCode = false; this.deleteGCode = false;
}, },
delete_all_macros: async function () { delete_all_macros: async function () {
@@ -280,7 +283,8 @@ module.exports = {
]; ];
this.delete_all_macros(); this.delete_all_macros();
this.cancelMacros(); this.cancelMacros();
this.tab = "1"; console.log("tab in delete all:",this.tab);
this.$set("tab", "1");
this.confirmReset = false; this.confirmReset = false;
try { try {
await api.put("config/save", this.config); await api.put("config/save", this.config);

View File

@@ -43,8 +43,8 @@ script#macros-template(type="text/x-template")
button.blue-button(title="Add a Macros", @click="addNewMacros", style="margin-left:5px") New Macros button.blue-button(title="Add a Macros", @click="addNewMacros", style="margin-left:5px") New Macros
// button.blue-button(title="Delete a Macros", @click="deleteSelected=true", style="margin-left:5px",:disabled="!macrosLength") Delete Selected // button.blue-button(title="Delete a Macros", @click="deleteSelected=true", style="margin-left:5px",:disabled="!macrosLength") Delete Selected
.tabs .macros-tabs
input#tab1(type="radio", name="tabs",checked="" @click="tab = '1'") input#tab1(type="radio", name="tabs",checked="", @click="tab = '1'")
label(for="tab1",style="height:50px;width:100px") Macros 1 label(for="tab1",style="height:50px;width:100px") Macros 1
template(v-for="(index,macros) in config.macros.slice(1)",:key="index+2") template(v-for="(index,macros) in config.macros.slice(1)",:key="index+2")

View File

@@ -538,8 +538,6 @@ span.unit
white-space nowrap white-space nowrap
.tabs .tabs
// padding-top 10px
section section
min-height 500px min-height 500px
overflow-x hidden overflow-x hidden
@@ -626,11 +624,12 @@ span.unit
justify-content flex-start justify-content flex-start
margin 10px margin 10px
margin-left 50px margin-left 50px
margin-right 50px
margin-bottom 30px margin-bottom 30px
.macros-button .macros-button
height 60px height 60px
width 90px width 115px
font-weight normal font-weight normal
border-radius 10px border-radius 10px
margin-left 1rem margin-left 1rem
@@ -666,6 +665,42 @@ span.unit
.tabs .tabs
margin-top 5px margin-top 5px
width 850px width 850px
clear both
> input
display none
> label
display block
float left
width 6em
font-weight bold
cursor pointer
text-decoration none
text-align center
background #f6f6f6
border-top-left-radius 5px
border-top-right-radius 5px
border-top 2px solid #f6f6f6
border-left 1px solid #f6f6f6
border-right 1px solid #f6f6f6
margin-right 2px
> section
display none
clear both
> input:checked ~ section
display block
[id^="tab"]:checked + label
background #fff
border-top 2px solid #ddd
border-left 1px solid #ddd
border-right 1px solid #ddd
border-bottom 1px solid #fff
margin-bottom -1px
.macros-view .macros-view