finished npc vendor template basic editor
This commit is contained in:
parent
76b72a9f74
commit
a8f018e593
@ -20,6 +20,32 @@ function init_saimod_mojotrollz_npc_vendor_template(){
|
||||
comments: $('#input_search_comments').val()}
|
||||
system.load('mojotrollz_npc_vendor_template;search.'+JSON.stringify(search),true);
|
||||
});
|
||||
|
||||
$('#btn_add').click(function() {
|
||||
var entry = $('#input_entry').val();
|
||||
var item = $('#input_item').val();
|
||||
var maxcount = $('#input_maxcount').val();
|
||||
var incrtime = $('#input_incrtime').val();
|
||||
var extendedcost = $('#input_extendedcost').val();
|
||||
var condition_id = $('#input_condition_id').val();
|
||||
$.ajax({url: './sai.php',
|
||||
data: { sai_mod: '.SAI.saimod_mojotrollz_npc_vendor_template',
|
||||
action: 'add',
|
||||
entry: entry,
|
||||
item: item,
|
||||
maxcount: maxcount,
|
||||
incrtime: incrtime,
|
||||
extendedcost: extendedcost,
|
||||
condition_id: condition_id},
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
if(data.status){
|
||||
system.reload()
|
||||
}else{
|
||||
alert('Problem: '+data);}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function init_saimod_mojotrollz_npc_vendor_template_vendor(){
|
||||
@ -32,4 +58,54 @@ function init_saimod_mojotrollz_npc_vendor_template_vendor(){
|
||||
condition_id: $('#input_search_condition_id').val()}
|
||||
system.load('mojotrollz_npc_vendor_template_vendor;entry.'+entry+';search.'+JSON.stringify(search),true);
|
||||
});
|
||||
|
||||
$('.btn_del').click(function(){
|
||||
$.ajax({ type :'GET',
|
||||
url : './sai.php?sai_mod=.SAI.saimod_mojotrollz_npc_vendor_template&action=del'+
|
||||
'&entry='+$(this).attr('_entry')+
|
||||
'&item='+$(this).attr('_item'),
|
||||
success : function(data) {
|
||||
if(data.status){
|
||||
system.reload()
|
||||
}else{
|
||||
alert('Problem: '+data);}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.btn_edit').click(function(){
|
||||
$('#input_entry').val($(this).attr('_entry'));
|
||||
$('#input_item').val($(this).attr('_item'));
|
||||
$('#input_maxcount').val($(this).attr('_maxcount'));
|
||||
$('#input_incrtime').val($(this).attr('_incrtime'));
|
||||
$('#input_extendedcost').val($(this).attr('_extendedcost'));
|
||||
$('#input_condition_id').val($(this).attr('_condition_id'));
|
||||
$("#btn_add").focus();
|
||||
});
|
||||
|
||||
$('#btn_add').click(function() {
|
||||
var entry = $(this).attr('_entry');
|
||||
var item = $('#input_item').val();
|
||||
var maxcount = $('#input_maxcount').val();
|
||||
var incrtime = $('#input_incrtime').val();
|
||||
var extendedcost = $('#input_extendedcost').val();
|
||||
var condition_id = $('#input_condition_id').val();
|
||||
$.ajax({url: './sai.php',
|
||||
data: { sai_mod: '.SAI.saimod_mojotrollz_npc_vendor_template',
|
||||
action: 'add',
|
||||
entry: entry,
|
||||
item: item,
|
||||
maxcount: maxcount,
|
||||
incrtime: incrtime,
|
||||
extendedcost: extendedcost,
|
||||
condition_id: condition_id},
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
if(data.status){
|
||||
system.reload()
|
||||
}else{
|
||||
alert('Problem: '+data);}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -3,8 +3,14 @@ namespace SAI;
|
||||
class saimod_mojotrollz_npc_vendor_template extends \SYSTEM\SAI\SaiModule {
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_npc_vendor_template_action_comment($entry,$comment){
|
||||
\SQL\NPC_VENDOR_TEMPLATE_COMMENT::QI(array($entry,$comment));
|
||||
return \JsonResult::ok();
|
||||
}
|
||||
return \JsonResult::ok();}
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_npc_vendor_template_action_add($entry,$item,$maxcount,$incrtime,$extendedcost,$condition_id){
|
||||
\SQL\NPC_VENDOR_TEMPLATE_ADD::QI(array($entry,$item,$maxcount,$incrtime,$extendedcost,$condition_id),new \SQL\mangos_one_world_test());
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_npc_vendor_template_action_del($entry,$item){
|
||||
\SQL\NPC_VENDOR_TEMPLATE_DEL::QI(array($entry,$item),new \SQL\mangos_one_world_test());
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_npc_vendor_template_action_vendor($entry,$search='{}',$page=0){
|
||||
$vars = array();
|
||||
$vars['search_item'] = $vars['search_maxcount'] = $vars['search_incrtime'] = $vars['search_extendedcost'] = $vars['search_condition_id'] = '';
|
||||
|
||||
@ -5,4 +5,12 @@ REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `na
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5311, 42, 2, 5300, 'comment', 'comment', 'STRING');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5320, 42, 2, 5300, 'vendor', 'entry', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5321, 42, 3, 5300, 'vendor', 'search', 'JSON');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5322, 42, 3, 5300, 'vendor', 'page', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5322, 42, 3, 5300, 'vendor', 'page', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5330, 42, 2, 5300, 'del', 'entry', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5331, 42, 2, 5300, 'del', 'item', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5340, 42, 2, 5300, 'add', 'entry', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5341, 42, 2, 5300, 'add', 'item', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5342, 42, 2, 5300, 'add', 'maxcount', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5343, 42, 2, 5300, 'add', 'incrtime', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5344, 42, 2, 5300, 'add', 'extendedcost', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5345, 42, 2, 5300, 'add', 'condition_id', 'INT');
|
||||
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class NPC_VENDOR_TEMPLATE_ADD extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'INSERT INTO npc_vendor_template (entry, item, maxcount, incrtime, ExtendedCost, condition_id) VALUES (?, ?, ?, ?, ?, ?)'.
|
||||
' ON DUPLICATE KEY UPDATE `maxcount`=VALUES(`maxcount`),`incrtime`=VALUES(`incrtime`),`ExtendedCost`=VALUES(`ExtendedCost`),`condition_id`=VALUES(`condition_id`);';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class NPC_VENDOR_TEMPLATE_DEL extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'DELETE FROM npc_vendor_template WHERE entry = ? AND item = ?;';
|
||||
}
|
||||
}
|
||||
@ -21,6 +21,17 @@
|
||||
</td>
|
||||
</tr>
|
||||
${entries}
|
||||
<tr>
|
||||
<td><input class="form-control" type="text" id="input_entry" placeholder="entry"></td>
|
||||
<td><input class="form-control" type="text" id="input_item" placeholder="item"></td>
|
||||
<td>
|
||||
<input class="form-control" type="text" id="input_maxcount" placeholder="maxcount" style="width: 50px; float: left;">
|
||||
<input class="form-control" type="text" id="input_incrtime" placeholder="incrtime" style="width: 50px; float: left;">
|
||||
<input class="form-control" type="text" id="input_extendedcost" placeholder="ExtendedCost" style="width: 50px; float: left;">
|
||||
<input class="form-control" type="text" id="input_condition_id" placeholder="condition_id" style="width: 50px; float: left;">
|
||||
</td>
|
||||
<td><button type="button" class="btn-sm btn btn-success" id="btn_add"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> ${basic_add}</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
<ul class="pagination">
|
||||
<li><a href="#!mojotrollz_npc_vendor_template;search.${search};page.0">«</a></li>
|
||||
|
||||
@ -33,6 +33,15 @@
|
||||
</td>
|
||||
</tr>
|
||||
${entries}
|
||||
<tr>
|
||||
<td><a href="#!mojotrollz_npc_vendor_template_vendor;entry.${entry}">${entry}</a></td>
|
||||
<td><input class="form-control" type="text" id="input_item" placeholder="item"></td>
|
||||
<td><input class="form-control" type="text" id="input_maxcount" placeholder="maxcount" value="0"></td>
|
||||
<td><input class="form-control" type="text" id="input_incrtime" placeholder="incrtime" value="0"></td>
|
||||
<td><input class="form-control" type="text" id="input_extendedcost" placeholder="ExtendedCost" value="0"></td>
|
||||
<td><input class="form-control" type="text" id="input_condition_id" placeholder="condition_id" value="0"></td>
|
||||
<td><button type="button" class="btn-sm btn btn-success" id="btn_add" _entry="${entry}"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> ${basic_add}</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
<ul class="pagination">
|
||||
<li><a href="#!mojotrollz_npc_vendor_template_vendor;entry.${entry};search.${search};page.0">«</a></li>
|
||||
|
||||
@ -6,5 +6,7 @@
|
||||
<td>${ExtendedCost}</td>
|
||||
<td>${condition_id}</td>
|
||||
<td>
|
||||
<button type="button" class="btn-sm btn btn-success btn_edit" _entry="${entry}" _item="${item}" _maxcount="${maxcount}" _incrtime="${incrtime}" _extendedcost="${extendedcost}" _condition_id="${condition_id}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></button>
|
||||
<button type="button" class="btn-sm btn btn-danger btn_del" _entry="${entry}" _item="${item}"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
|
||||
</td>
|
||||
</tr>
|
||||
Loading…
x
Reference in New Issue
Block a user