Preset Shifts 
INFO
 Make sure to add /api prefix in the API endpoint. 
Get Preset Shifts Index Endpoint 
http
GET /preset_shiftsGET /preset_shiftsHeaders 
- Content-Type: application/json
 - Authorization: Bearer {token}
 
Query Parameter 
| Name | Type | Description | Nullable | 
|---|---|---|---|
| page | int | Page number | false | 
| search_per_page | int | Search by per page | false | 
Response 
200 OK
json
{
    "data": [
        {
            "id": 1,
            "name": "1",
            "start_dmy": "22/10/2023 06:00",
            "end_dmy": "22/10/2023 13:00",
            "start_date_ymd": "2023-10-22 06:00:00",
            "end_date_ymd": "2023-10-22 13:00:00"
        },
        {
            "id": 2,
            "name": "2",
            "start_dmy": "22/10/2023 13:00",
            "end_dmy": "22/10/2023 20:00",
            "start_date_ymd": "2023-10-22 13:00:00",
            "end_date_ymd": "2023-10-22 20:00:00"
        },
        {
            "id": 3,
            "name": "3",
            "start_dmy": "22/10/2023 20:00",
            "end_dmy": "23/10/2023 06:00",
            "start_date_ymd": "2023-10-22 20:00:00",
            "end_date_ymd": "2023-10-23 06:00:00"
        },
        // and so on
    ],
    "links": {
        "first": "http://espbu.test/api/presetShifts?page=1",
        "last": "http://espbu.test/api/presetShifts?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "links": [
            {
                "url": null,
                "label": "« Sebelumnya",
                "active": false
            },
            {
                "url": "http://espbu.test/api/presetShifts?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Berikutnya »",
                "active": false
            }
        ],
        "path": "http://espbu.test/api/presetShifts",
        "per_page": 7,
        "to": 7,
        "total": 7
    }
}{
    "data": [
        {
            "id": 1,
            "name": "1",
            "start_dmy": "22/10/2023 06:00",
            "end_dmy": "22/10/2023 13:00",
            "start_date_ymd": "2023-10-22 06:00:00",
            "end_date_ymd": "2023-10-22 13:00:00"
        },
        {
            "id": 2,
            "name": "2",
            "start_dmy": "22/10/2023 13:00",
            "end_dmy": "22/10/2023 20:00",
            "start_date_ymd": "2023-10-22 13:00:00",
            "end_date_ymd": "2023-10-22 20:00:00"
        },
        {
            "id": 3,
            "name": "3",
            "start_dmy": "22/10/2023 20:00",
            "end_dmy": "23/10/2023 06:00",
            "start_date_ymd": "2023-10-22 20:00:00",
            "end_date_ymd": "2023-10-23 06:00:00"
        },
        // and so on
    ],
    "links": {
        "first": "http://espbu.test/api/presetShifts?page=1",
        "last": "http://espbu.test/api/presetShifts?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "links": [
            {
                "url": null,
                "label": "« Sebelumnya",
                "active": false
            },
            {
                "url": "http://espbu.test/api/presetShifts?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Berikutnya »",
                "active": false
            }
        ],
        "path": "http://espbu.test/api/presetShifts",
        "per_page": 7,
        "to": 7,
        "total": 7
    }
}403 Forbidden
json
{
    "message": "Unauthorized"
}{
    "message": "Unauthorized"
}404 Not Found
json
{
    "message": "Preset Shift tidak ditemukan"
}{
    "message": "Preset Shift tidak ditemukan"
}Used on pages 
/tasks
Create Preset Shift Endpoint 
http
POST /presetShiftsPOST /presetShiftsHeaders 
- Content-Type: application/json
 - Authorization: Bearer {token}
 
Body 
JSON Body
json
{
    "name": "1",
    "start_date_ymd": "2023-10-22 06:00:00",
    "end_date_ymd": "2023-10-22 13:00:00"
}{
    "name": "1",
    "start_date_ymd": "2023-10-22 06:00:00",
    "end_date_ymd": "2023-10-22 13:00:00"
}| Name | Type | Description | Nullable | 
|---|---|---|---|
| name | string | Preset Shift name | false | 
| start_date_ymd | string | Preset Shift start date | false | 
| end_date_ymd | string | Preset Shift end date | false | 
Response 
200 OK
json
{
    "message": "Preset Shift berhasil ditambahkan"
}{
    "message": "Preset Shift berhasil ditambahkan"
}403 Forbidden
json
{
    "message": "Unauthorized"
}{
    "message": "Unauthorized"
}422 Unprocessable Entity
json
{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "Nama Preset Shift harus diisi."
        ],
        "start_date_ymd": [
            "Tanggal Mulai harus diisi."
        ],
        "end_date_ymd": [
            "Tanggal Selesai harus diisi."
        ]
    }
}{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "Nama Preset Shift harus diisi."
        ],
        "start_date_ymd": [
            "Tanggal Mulai harus diisi."
        ],
        "end_date_ymd": [
            "Tanggal Selesai harus diisi."
        ]
    }
}Used on pages 
/tasks
Update Preset Shift Endpoint 
http
PUT /presetShifts/{id}PUT /presetShifts/{id}Headers 
- Content-Type: application/json
 - Authorization: Bearer {token}
 
Path Variable 
| Name | Type | Description | 
|---|---|---|
| id | int | Preset Shift ID | 
Body 
JSON Body
json
{
    "name": "1",
    "start_date_ymd": "2023-10-22 07:00:00",
    "end_date_ymd": "2023-10-22 14:00:00"
}{
    "name": "1",
    "start_date_ymd": "2023-10-22 07:00:00",
    "end_date_ymd": "2023-10-22 14:00:00"
}| Name | Type | Description | Nullable | 
|---|---|---|---|
| name | string | Preset Shift name | false | 
| start_date_ymd | string | Preset Shift start date | false | 
| end_date_ymd | string | Preset Shift end date | false | 
Response 
200 OK
json
{
    "message": "Preset Shift berhasil diubah"
}{
    "message": "Preset Shift berhasil diubah"
}403 Forbidden
json
{
    "message": "Unauthorized"
}{
    "message": "Unauthorized"
}Delete Preset Shift Endpoint 
http
DELETE /presetShifts/{id}DELETE /presetShifts/{id}Headers 
- Content-Type: application/json
 - Authorization: Bearer {token}
 
Path Variable 
| Name | Type | Description | 
|---|---|---|
| id | int | Preset Shift ID | 
Response 
200 OK
json
{
    "message": "Preset Shift berhasil dihapus"
}{
    "message": "Preset Shift berhasil dihapus"
}403 Forbidden
json
{
    "message": "Unauthorized"
}{
    "message": "Unauthorized"
}Get Preset Shift Options Endpoint 
http
GET `/presetShifts/select`GET `/presetShifts/select`Headers 
- Content-Type: application/json
 - Authorization: Bearer {token}
 
Response 
200 OK
json
{
    "message": "Daftar preset shift ditemukan",
    "data": [
        {
            "label": "1",
            "range": [
                "2023-10-22 06:01:00",
                "2023-10-22 12:59:00"
            ]
        },
        {
            "label": "2",
            "range": [
                "2023-10-22 13:01:00",
                "2023-10-22 19:59:00"
            ]
        },
        {
            "label": "3",
            "range": [
                "2023-10-22 20:01:00",
                "2023-10-23 05:59:00"
            ]
        },
        // and so on
    ]
}{
    "message": "Daftar preset shift ditemukan",
    "data": [
        {
            "label": "1",
            "range": [
                "2023-10-22 06:01:00",
                "2023-10-22 12:59:00"
            ]
        },
        {
            "label": "2",
            "range": [
                "2023-10-22 13:01:00",
                "2023-10-22 19:59:00"
            ]
        },
        {
            "label": "3",
            "range": [
                "2023-10-22 20:01:00",
                "2023-10-23 05:59:00"
            ]
        },
        // and so on
    ]
}403 Forbidden
json
{
    "message": "Unauthorized"
}{
    "message": "Unauthorized"
}Used on pages 
/tasks/create/tasks/edit/{id}/opnames/create