-
-
Save oshliaer/752c386068e6b90a9c96d7e751df1cbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<!--?!= include('CSS'); ?--> | |
<?!= include('JS'); ?> | |
<base target="_top"> | |
</head> | |
<body> | |
<div> | |
<form> | |
<div id="positions"> | |
<div id="position"> | |
<label>Наименование: | |
<select id="names"> | |
<option>Загрузка...</option> | |
</select> | |
</label> | |
<label>Количество: | |
<input type='number' /> | |
</label> | |
<label>Единица измерения: | |
<select> | |
<option>тн.</option> | |
<option>шт.</option> | |
<option>кв.м.</option> | |
<option>пог.м.</option> | |
</select> | |
</label> | |
</div> | |
</div> | |
<div id="addButton">Добавить позицию</div> | |
</form> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script> | |
$(document).ready(function() { | |
$('#addButton').click(addPosition); | |
}); | |
function addPosition() { | |
var posCount = $('#positions').children().length + 1; | |
$('#positions').children().last().after("<div id='position" + posCount + "'>" + $('#position').html() + "<span onclick='removPosition(event)'>[X]</span></div>"); | |
} | |
function removPosition(event) { | |
$(event.target).parent("div[id^='position']").remove(); | |
} | |
// Код запустится, когда страница будет загружена | |
$(function() { | |
console.log('loading ...', $('#positions').children().length); | |
google.script.run.withSuccessHandler(showNames) | |
.getMetallNames(); | |
}); | |
function showNames(names) { | |
var options = $('#names'); | |
options.empty(); | |
for (var i = 0; i < names.length; i++) { | |
options.append('<option>' + names[i] + '</option>'); | |
} | |
console.log('Done!'); | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var configs = { | |
nomTableId: '1wBvmPRSj-r8FhqQ85119FFEbO5uJQOIUWCq8-NNYSIA' | |
} | |
function doGet() { | |
return HtmlService.createTemplateFromFile('bidForm') | |
.evaluate() | |
.setSandboxMode(HtmlService.SandboxMode.IFRAME); | |
} | |
function include(filename) { | |
return HtmlService.createHtmlOutputFromFile(filename) | |
.getContent(); | |
} | |
function getMetallNames() { | |
// var nomenclatureTable = SpreadsheetApp.openById('1wBvmPRSj-r8FhqQ85119FFEbO5uJQOIUWCq8-NNYSIA'); | |
// var sortament = nomenclatureTable.getSheetByName('sortament'); | |
// return sortament.getSheetValues(1, 1, sortament.getLastRow(), 1); | |
return [['Oh'],['Ah'],['Uh']]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment