From: Alexander Smirnov Date: Thu, 25 Apr 2024 14:19:28 +0000 (+0300) Subject: add products/products-1c X-Git-Tag: 1.1~104^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=773144da3b2458afe897e50c34836340bfcdf518;p=erp24_rep%2Fyii-erp24%2F.git add products/products-1c --- diff --git a/erp24/controllers/ProductsController.php b/erp24/controllers/ProductsController.php new file mode 100755 index 00000000..429e8153 --- /dev/null +++ b/erp24/controllers/ProductsController.php @@ -0,0 +1,19 @@ +render('products-1c'); } + public function actionAjaxProductProvider() { return $this->renderPartial('ajax-product-provider'); } + public function actionAjaxGroupConfig() { return $this->renderPartial('ajax-group-config'); } + public function actionAjaxProductsInGroup() { return $this->renderPartial('ajax-products-in-group'); } + public function actionAjaxClassGroup() { return $this->renderPartial('ajax-class-group'); } + public function actionAjaxClassGroupRemove() { return $this->renderPartial('ajax-class-group-remove'); } + public function actionAjaxAddProduct() { return $this->renderPartial('ajax-add-product'); } + public function actionAjaxRemoveProduct() { return $this->renderPartial('ajax-remove-product'); } + public function actionAjaxRemoveExport() { return $this->renderPartial('ajax-remove-export'); } + public function actionAjaxProductProviderAdd() { return $this->renderPartial('ajax-product-provider-add'); } +} \ No newline at end of file diff --git a/erp24/modul/products/ajaxRemoveExport.php b/erp24/modul/products/ajaxRemoveExport.php index e7730d52..6212e224 100644 --- a/erp24/modul/products/ajaxRemoveExport.php +++ b/erp24/modul/products/ajaxRemoveExport.php @@ -1,8 +1,10 @@ -lastInsertId(); +$db::sql($insert,[$id,$name,$price]); +$entity_id=$db->lastInsertId(); $insert="INSERT INTO export_import_table (export_id, entity, export_val, entity_id) VALUES ('1','products',?,?)"; -$db2::sql($insert,[$id,$entity_id]); +$db::sql($insert,[$id,$entity_id]); } catch (Exception $e) { echo $e->getMessage(); } diff --git a/erp24/modul/products/ajax_class_group.php b/erp24/modul/products/ajax_class_group.php index 0346b58f..3138f927 100644 --- a/erp24/modul/products/ajax_class_group.php +++ b/erp24/modul/products/ajax_class_group.php @@ -1,14 +1,16 @@ -"Голландия/Израиль", 2=>"Кения", 3=>"Эквадор/Коллубмия", 4 => "Россия", 5 => "Горшечка", 6 => "Сопутка", 7 => "Фейерверки", 10 => "Матрица"); @@ -27,11 +29,11 @@ echo'
'; echo'
Поставщик
"; @@ -39,7 +41,7 @@ echo'
Поставщик
echo'
Группа
"; @@ -52,13 +54,13 @@ echo""; echo' -
срок хранения в днях
+
срок хранения в днях
минимальный лот деления в шт. (кол-во шт в месте) -
-
минимальный заказ в шт.
-
Цена закупки в долл. или евро (зависит от поставщика) пример 1.25
-
Цвета разделитель ;
-
Опции
+
+
минимальный заказ в шт.
+
Цена закупки в долл. или евро (зависит от поставщика) пример 1.25
+
Цвета разделитель ;
+
Опции
@@ -93,13 +95,17 @@ echo'
function save_providerder(){ + +const param3 = $('meta[name=csrf-param]').attr('content'); +const token3 = $('meta[name=csrf-token]').attr('content'); + $.ajax({ - url: '/products/ajax_product_provider_add/', + url: '/products/ajax-product-provider-add/', method: 'post', dataType: 'html', data: {id: '', provider_id: $('#provider_id').val(), options: $('#options').val(), expiration_days: $('#expiration_days').val(), - min_lot: $('#min_lot').val(), colors: $('#colors').val(), min_order: $('#min_order').val(), price_zakup: $('#price_zakup').val(), group_id: $('#group_id').val() , main: $('#main').val() , view: $('#view').val() }, + min_lot: $('#min_lot').val(), colors: $('#colors').val(), min_order: $('#min_order').val(), price_zakup: $('#price_zakup').val(), group_id: $('#group_id').val() , main: $('#main').val() , view: $('#view').val(), [param3]:token3 }, success: function(data){ $('#result_prov').html(data); }}); diff --git a/erp24/modul/products/ajax_product_provider_add.php b/erp24/modul/products/ajax_product_provider_add.php index 849dc4ae..d83130be 100644 --- a/erp24/modul/products/ajax_product_provider_add.php +++ b/erp24/modul/products/ajax_product_provider_add.php @@ -1,8 +1,10 @@ -'; //echo count($data2); echo"шт "; - echo'
+ поставщика '.$providers[$row['id']].'
'; + echo'
+ поставщика '.($providers[$row['id']]??'').'
'; if(!empty($colorsProducts[$row["id"]])) { $s=0; @@ -82,7 +83,7 @@ if($s>0) echo"внести цена '.$prices[$row['id']].''; else { - echo'
внести цена '.$prices[$row['id']].'
'; + echo'
внести цена '.($prices[$row['id']]??'').'
'; diff --git a/erp24/modul/products/ajax_remove_product.php b/erp24/modul/products/ajax_remove_product.php index 249ab8f8..7c7cdb30 100644 --- a/erp24/modul/products/ajax_remove_product.php +++ b/erp24/modul/products/ajax_remove_product.php @@ -1,8 +1,10 @@ -'; if($only_parent==false){ - foreach($cats[$parent_id] as $cat){ + foreach($cats[$parent_id] ?? [] as $cat){ $tree .= '
  • '; $tree .= ''); @@ -130,11 +138,15 @@ $.ajax({ } function ajax_class_group(parent_id, tip){ + +const param3 = $('meta[name=csrf-param]').attr('content'); +const token3 = $('meta[name=csrf-token]').attr('content'); + $.ajax({ - url: '/products/ajax_class_group/', + url: '/products/ajax-class-group/', method: 'post', dataType: 'html', - data: {parent_id: ''+parent_id+'',tip: ''+tip+''}, + data: {parent_id: ''+parent_id+'',tip: ''+tip+'', [param3]:token3}, success: function(data){ $('.dd'+parent_id+''+tip+'').html(data); @@ -143,11 +155,15 @@ $.ajax({ function ajax_class_group_remove(id, tip){ + +const param3 = $('meta[name=csrf-param]').attr('content'); +const token3 = $('meta[name=csrf-token]').attr('content'); + $.ajax({ - url: '/products/ajax_class_group_remove/', + url: '/products/ajax-class-group-remove/', method: 'post', dataType: 'html', - data: {id: ''+id+'', tip: ''+tip+''}, + data: {id: ''+id+'', tip: ''+tip+'', [param3]:token3}, success: function(data){ $('.dd'+id+''+tip+'').html(data); }}); @@ -156,22 +172,30 @@ $.ajax({ function ajax_add_product(id,parent_id,name,price){ + +const param3 = $('meta[name=csrf-param]').attr('content'); +const token3 = $('meta[name=csrf-token]').attr('content'); + $.ajax({ - url: '/products/ajax_add_product/', + url: '/products/ajax-add-product/', method: 'post', dataType: 'html', - data: {id: ''+id+'', name: ''+name+'',parent_id: ''+parent_id+'',price: ''+price+''}, + data: {id: ''+id+'', name: ''+name+'',parent_id: ''+parent_id+'',price: ''+price+'', [param3]:token3}, success: function(data){ $('#diver_'+id+'').html(data); }}); } function ajax_remove_product(id){ + +const param3 = $('meta[name=csrf-param]').attr('content'); +const token3 = $('meta[name=csrf-token]').attr('content'); + $.ajax({ - url: '/products/ajax_remove_product/', + url: '/products/ajax-remove-product/', method: 'post', dataType: 'html', - data: {id: ''+id+''}, + data: {id: ''+id+'', [param3]:token3}, success: function(data){ $('#diver_'+id+'').html(data); @@ -180,11 +204,15 @@ $.ajax({ function ajaxRemoveExport(id){ + +const param3 = $('meta[name=csrf-param]').attr('content'); +const token3 = $('meta[name=csrf-token]').attr('content'); + $.ajax({ - url: '/products/ajaxRemoveExport/', + url: '/products/ajax-remove-export/', method: 'post', dataType: 'html', - data: {id: ''+id+''}, + data: {id: ''+id+'', [param3]:token3}, success: function(data){ $('#diver2_'+id+'').html(data); @@ -217,11 +245,11 @@ $.ajax({ -'; - +'; + -include"templates/bottom.php"; \ No newline at end of file +include_once dirname(__DIR__, 2) . '/templates/bottom_light.php'; \ No newline at end of file diff --git a/erp24/views/products/ajax-add-product.php b/erp24/views/products/ajax-add-product.php new file mode 100644 index 00000000..0bc5aa1f --- /dev/null +++ b/erp24/views/products/ajax-add-product.php @@ -0,0 +1,5 @@ +
    + '.$cat['name'].''; - foreach($products_class_row[$cat['id']] as $kk => $tipi) { + foreach($products_class_row[$cat['id']] ?? [] as $kk => $tipi) { $tree .= ' '.$products_class[$tipi].' '; } @@ -87,12 +86,15 @@ $_CONFIG["jscss"]=" function ajax_product_provider(id){ jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text('Поставщики'); - + +const param3 = $('meta[name=csrf-param]').attr('content'); +const token3 = $('meta[name=csrf-token]').attr('content'); + $.ajax({ - url: '/products/ajax_product_provider/', + url: '/products/ajax-product-provider/', method: 'post', dataType: 'html', - data: {id: ''+id+''}, + data: {id: ''+id+'', [param3]:token3}, success: function(data){ $('#modal-7 .modal-body').html(data); }}); @@ -105,12 +107,15 @@ $.ajax({ function ajax_group_config(id){ jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text('Настрока категории'); - + +const param3 = $('meta[name=csrf-param]').attr('content'); +const token3 = $('meta[name=csrf-token]').attr('content'); + $.ajax({ - url: '/products/ajax_group_config/', + url: '/products/ajax-group-config/', method: 'post', dataType: 'html', - data: {id: ''+id+''}, + data: {id: ''+id+'', [param3]:token3}, success: function(data){ $('#modal-7 .modal-body').html(data); }}); @@ -118,11 +123,14 @@ $.ajax({ function ajax_products_in_group(parent_id){ +const param3 = $('meta[name=csrf-param]').attr('content'); +const token3 = $('meta[name=csrf-token]').attr('content'); + $.ajax({ - url: '/products/ajax_products_in_group/', + url: '/products/ajax-products-in-group/', method: 'post', dataType: 'html', - data: {parent_id: ''+parent_id+''}, + data: {parent_id: ''+parent_id+'', [param3]:token3}, success: function(data){ $('#tr_'+parent_id+'').after('
    '+data+'