diff --git a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/js/saimod_mojotrollz_npc_vendor_template.js b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/js/saimod_mojotrollz_npc_vendor_template.js index 11dcb57..c45c2e2 100644 --- a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/js/saimod_mojotrollz_npc_vendor_template.js +++ b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/js/saimod_mojotrollz_npc_vendor_template.js @@ -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);} + } + }); + }); } \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/saimod_mojotrollz_npc_vendor_template.php b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/saimod_mojotrollz_npc_vendor_template.php index cc22887..2a87779 100644 --- a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/saimod_mojotrollz_npc_vendor_template.php +++ b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/saimod_mojotrollz_npc_vendor_template.php @@ -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'] = ''; diff --git a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/system_api.sql b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/system_api.sql index 9d4206c..4f9a57c 100644 --- a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/system_api.sql +++ b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/system_api.sql @@ -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'); \ No newline at end of file +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'); \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/qq/NPC_VENDOR_TEMPLATE_ADD.php b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/qq/NPC_VENDOR_TEMPLATE_ADD.php new file mode 100644 index 0000000..b6859b9 --- /dev/null +++ b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/qq/NPC_VENDOR_TEMPLATE_ADD.php @@ -0,0 +1,9 @@ + ${entries} + + + + + + + + + + +