Created
March 30, 2016 19:29
-
-
Save anonymous/a1a65eeefbc873b493da03eedf134c33 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> | |
$(document).ready(function(){ | |
$('#addButton').click(addPosition()); | |
}); | |
function addPosition(){ | |
var posCount = $('#positions').children().length()+1; | |
$('#positions').children().last().after("<div id='position" + posCount + "'>" + $('#position').html() + "</div>"); | |
} | |
src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> | |
// Код запустится, когда страница будет загружена | |
$(function() { | |
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>'); | |
} | |
} | |
</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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment