Get Custom Code

Changed on
get/customization/custom_code

Request

  • Base URL
    https://dc-region.zuperpro.com/api
  • URL
    https://dc-region.zuperpro.com/api/customization/custom_code
  • Auth
    API key in header x-api-key

Response

200

typestring

Example response

{
  "type": "success",
  "data": [
    {
      "custom_code_uid": "6a8063b0-f012-11ed-93c5-07d7e4c1021b",
      "custom_code_type": "JS",
      "custom_code": "window.custom_code = {};\r\n\r\nwindow.custom_code.reports = Reports;\r\n\r\nfunction Reports() {\r\n\r\n    var panel = $(\".wrapper-md .panel-rounded\").first();\r\n\r\n    var ele = '<div class=\\\"col-md-2 col-lg-2 col-6\\\">';\r\n    ele += '<a class=\\\"text-center report_btn\\\" id=\\\"open_or_report_btn\\\">'\r\n    ele += '<img src=\\\"https://staging.zuperpro.com/assets/images/icons/settings/checklist.svg\\\" class=\\\"h-50\\\">'\r\n    ele += '<p class=\\\"m-t-xs report-title-name ng-binding\\\">Comission Report</p>'\r\n    ele += '</a></div>';\r\n\r\n    var _ele = $(ele);\r\n\r\n    _ele.click(function () {\r\n\r\n        bootbox.dialog({\r\n            title: \"Please choose the dates\",\r\n            message: `<div class=\\\"form-group\\\">\r\n            <label for=\\\"start_date\\\">From <span class=\\\"mandatory\\\">*</span></label>\r\n            <input type=\\\"date\\\" class=\\\"form-control date_picker\\\" autocomplete=\\\"off\\\" placeholder=\\\"Pick Date\\\" id=\\\"start_date_report\\\" required=\\\"true\\\">\r\n          </div>\r\n          <div class=\\\"form-group\\\">\r\n            <label for=\\\"end_date\\\">To <span class=\\\"mandatory\\\">*</span></label>\r\n            <input type=\\\"date\\\" class=\\\"form-control date_picker\\\" autocomplete=\\\"off\\\" placeholder=\\\"Pick Date\\\" id=\\\"to_date_report\\\" required=\\\"true\\\">\r\n          </div>`,\r\n            buttons: {\r\n                cancel: {\r\n                    label: \"Cancel\",\r\n                    className: 'btn-default',\r\n                    callback: function () {\r\n                    }\r\n                },\r\n                ok: {\r\n                    label: \"Get Report\",\r\n                    className: 'btn-primary',\r\n                    callback: function () {\r\n                        var start_date = $(\"#start_date_report\").val();\r\n                        var to_date = $(\"#to_date_report\").val();\r\n\r\n                        if (!start_date || !to_date) {\r\n                            bootbox.alert(\"Please select both dates.\");\r\n                            return false;\r\n                        }\r\n\r\n                        // Validate dates\r\n                        if (new Date(to_date) < new Date(start_date)) {\r\n                            bootbox.alert(\"From Date should be less than or equal to the To Date.\");\r\n                            return false;\r\n                        }\r\n        \r\n                        $('body').loader('show');\r\n        \r\n                        var url = `https://internalwf.zuper.co/webhook/c866c10f-8c00-46e8-8108-5e941ef31419?start_date=${start_date}&end_date=${to_date}`;\r\n        \r\n                        const link = document.createElement('a');\r\n                        link.href = url\r\n                        link.download = 'utilization.csv';\r\n                        link.target = '_blank';\r\n                        link.click();\r\n                        $('body').loader('hide');\r\n                    }\r\n                }\r\n            }\r\n        });\r\n    \r\n    });\r\n\r\n    panel.find('.row').last().append(_ele);\r\n\r\n}\r\n",
      "created_by": {
        "user_uid": "3414331d-3c69-4cbc-bd51-c00309be76cd",
        "first_name": "Nachivel",
        "last_name": "Kishore Kumar",
        "email": "nachivel@zuper.co",
        "designation": "Dev",
        "emp_code": "Z134",
        "profile_picture": "https://s3.ap-south-1.amazonaws.com/prod.app.zuperpro/assets/profile_picture.jpg",
        "hourly_labor_charge": 10,
        "is_active": true,
        "created_at": "2022-12-14T06:22:24.000Z",
        "updated_at": "2023-05-12T08:57:01.000Z"
      },
      "is_active": true,
      "created_at": "2023-05-11T15:42:20.525Z",
      "updated_at": "2023-05-11T15:42:20.528Z"
    }
  ]
}

Changes