manual override for pump
This commit is contained in:
@@ -91,6 +91,14 @@
|
||||
<label for="day_7">Nedjelja</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<input type="checkbox" value="true" id="manual_inflow" name="manual_inflow" class="manual_inflow_checkbox form_control" checked="{{ manualInflowChecked }}" /> Ručna kontrola pumpe
|
||||
</div>
|
||||
<div class="bg-danger">
|
||||
PAŽNJA! Ako pumpa predugo bude radila - rezervoar se može prepuniti.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
||||
@@ -25,6 +25,11 @@ Template.settings.helpers({
|
||||
return days.includes(day)
|
||||
},
|
||||
|
||||
manualInflowChecked: function(day) {
|
||||
var config = controller_state().config;
|
||||
return config.manualInflow;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -38,8 +43,10 @@ Template.settings.events({
|
||||
selectedDays.push(instance.$(this).val());
|
||||
}
|
||||
});
|
||||
var manualInflow = instance.$('#manual_inflow').is(':checked');
|
||||
console.log("MI ", manualInflow);
|
||||
var controller_id = Session.get('controller_id');
|
||||
Meteor.call('saveControllerConfig', controller_id, selectedTime, selectedDays);
|
||||
Meteor.call('saveControllerConfig', controller_id, selectedTime, selectedDays, manualInflow);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
<div>
|
||||
<button id="water_now" class="{{ water_now_button_class }}">Zalij sada</button>
|
||||
<button id="stop_water_now" class="{{ stop_button_class }}">Prekini zalijevanje</button>
|
||||
<button id="start_inflow_now" class="{{ start_inflow_button_class }}">Počni punjenje</button>
|
||||
<button id="stop_inflow_now" class="{{ stop_inflow_button_class }}">Prekini punjenje</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -90,6 +90,25 @@ Template.state.helpers({
|
||||
}
|
||||
},
|
||||
|
||||
start_inflow_button_class: function() {
|
||||
var stateObject = controller_state();
|
||||
if(stateObject.config && stateObject.config.manualInflow && stateObject.state.out_valve === 'closed' && ( stateObject.state.in_valve === 'closed' || stateObject.state.in_valve === 'closing')) {
|
||||
return 'btn btn-danger'
|
||||
} else {
|
||||
return 'hidden btn btn-danger'
|
||||
}
|
||||
},
|
||||
|
||||
stop_inflow_button_class: function() {
|
||||
var stateObject = controller_state();
|
||||
if(stateObject.config && stateObject.config.manualInflow && stateObject.state.out_valve === 'closed' && ( stateObject.state.in_valve === 'open' || stateObject.state.in_valve === 'opening')) {
|
||||
return 'btn btn-danger'
|
||||
} else {
|
||||
return 'hidden btn btn-danger'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
pretty_days: function(daysInNumbers) {
|
||||
var days = ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"];
|
||||
if (!daysInNumbers || daysInNumbers.length == 0) {
|
||||
@@ -125,6 +144,16 @@ Template.state.events({
|
||||
Meteor.call('closeOutValve', controller_id)
|
||||
},
|
||||
|
||||
'click #start_inflow_now': function() {
|
||||
var controller_id = Session.get('controller_id');
|
||||
Meteor.call('openInValve', controller_id)
|
||||
},
|
||||
|
||||
'click #stop_inflow_now': function() {
|
||||
var controller_id = Session.get('controller_id');
|
||||
Meteor.call('closeInValve', controller_id)
|
||||
},
|
||||
|
||||
'click #run_settings': function() {
|
||||
Modal.show('settings');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user