src/ApplicationBundle/Resources/views/inc/ajax_route_library.html.twig line 1

Open in your IDE?
  1. <script>
  2.     var product_list = [
  3.         {
  4.             pid: 6,
  5.             igId: 5,
  6.             brandId: 2,
  7.             categoryId: 3,
  8.             name: 'product 2'
  9.         },
  10.     ];
  11.     var structuredData = {
  12.         //groubyId: object
  13.         1: {
  14.             name: 'PV Module',
  15.             childDataList: {
  16.                 //groubyId: object
  17.                 3: {
  18.                     name: 'Huawei',
  19.                     childDataList: [
  20.                         {
  21.                             pid: 5,
  22.                             igId: 1,
  23.                             brandId: 3,
  24.                             categoryId: 3,
  25.                             name: 'product 1'
  26.                         },
  27.                         {
  28.                             pid: 1,
  29.                             igId: 3,
  30.                             brandId: 4,
  31.                             categoryId: 3,
  32.                             name: 'product 4'
  33.                         },
  34.                     ]
  35.                 },
  36.                 4: {
  37.                     name: 'Xiaomi',
  38.                     childDataList:[
  39.                         {
  40.                             pid: 1,
  41.                             igId: 4,
  42.                             brandId: 1,
  43.                             categoryId: 3,
  44.                             name: 'product 3'
  45.                         },
  46.                     ]
  47.                 },
  48.             },
  49.         },
  50.         5: {
  51.             name: 'Inverter',
  52.             childDataList: [
  53.                 {
  54.                     2: {
  55.                         name: 'Lenovo',
  56.                         childDataList: [
  57.                             {
  58.                                 pid: 6,
  59.                                 igId: 1,
  60.                                 brandId: 2,
  61.                                 categoryId: 3,
  62.                                 name: 'product 2'
  63.                             }
  64.                         ]
  65.                     }
  66.                 }
  67.             ]
  68.         }
  69.     }
  70.     {% set ajaxRoutes='check_for_product_in_warehouse,
  71. select_data_ajax,
  72. product_list_select_ajax,
  73. '|split(',\n') %}
  74.     console.log({{ ajaxRoutes|json_encode|raw }})
  75.     var ajaxRouteList = {
  76.     {% for rts in ajaxRoutes %}
  77.     {% if rts !='\n' and rts !='' %}
  78.     {{ rts }}:
  79.     '{{ url(rts) }}',
  80.     {% endif %}
  81.     {% endfor %}
  82.     }
  83.     function url_path(pathName) {
  84.         if (typeof ajaxRouteList[pathName] !== 'undefined')
  85.             return ajaxRouteList[pathName]
  86.         else
  87.             return '{{ url('dashboard') }}'
  88.     }
  89. </script>