---
# System prepended metadata

title: Project documentation template
tags: [Documentation, Templates]

---

---
title: 'Project documentation template'
disqus: hackmd
---

Nautical POS API
===
Dokumentasi dan break down API terkait project Nautical POS
Take me to [pookie](#pookie)


[TOC]

## Login
#### Endpoint
`[POST]`
`{api_url}/login`
#### Header
`Tidak ada`

#### Parameter
`Body [raw json]`
```json=
{
    "username": "johndoesianying", //[min=6][max=50]
    "password": "1234567890", //[min=8][max=20]
    "captcha": "" //[optional]
}
```

#### Response
`status 201`
:::spoiler
```json=
{
   "message": "sukses",
   "error": false,
   "results": {
       "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJiZWFyZXIiLCJzdWIiOlsxLCJTdXBlcnVzZXIiXSwiaWF0IjoxNjM2NDM4NzYwLCJleHAiOjE2MzY1MjUxNjB9._MTlqFc9Te0AemIhBbTHzSCSJ4mPfhuCUXGiPPrMyCc",
       "user_id": 1,
       "user_username": "johndoesianying",
       "user_fullname": "John Anying",
       "user_email": "john@gmail.com",
       "user_phone_number":"08912345689"
       "user_image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Microsoft_Account.svg/512px-Microsoft_Account.svg.png",
       "user_role":"Superuser",
       "created_at":"2021-10-06 06:54:15"   
   }
}
```
:::


---

## Dashboard
#### Endpoint
`[GET]`
`{api_url}/dashboard`
#### Header
| Key | Value |
| -------- | -------- |
| Authorization | Bearer {token} |
#### Parameter
`Tidak ada parameter`

#### Response
`status 200`
:::spoiler
```json=
{
   {
        "message": "sukses",
        "error": false,
        "results": {
            "summary": {
                "total_transaction": 200,
                "total_bruto": 5000000,
                "total_netto": 4000000,
                "total_profit": 3500000
            },
            "top_product": [
                {
                    "product_id": 1,
                    "product_name": "Kopi Susu",
                    "product_sale_qty": 200
                },
                {
                    "product_id": 2,
                    "product_name": "Jus Jeruk",
                    "product_sale_qty": 300
                },
                {
                    "product_id": 3,
                    "product_name": "Ayam Goreng",
                    "product_sale_qty": 250
                },
            ],
            "top_sales_type": [
                {
                    "sales_type_id": 1,
                    "sales_type_name": "Dine In"
                    "sales_total": 100
                },
                {
                    "sales_type_id": 2,
                    "sales_type_name": "Take Away"
                    "sales_total": 200
                },
                {
                    "sales_type_id": 3,
                    "sales_type_name": "Delivery"
                    "sales_total": 50
                },
            ],
            "top_payment_method": [
                {
                    "payment_method_id": 1
                    "payment_method_name": "Tunai",
                    "total_struck": 200
                },
                {
                    "payment_method_id": 2
                    "payment_method_name": "Gopay",
                    "total_struck": 200
                },
                {
                    "payment_method_id": 3
                    "payment_method_name": "Ovo",
                    "total_struck": 200
                },
                {
                    "payment_method_id": 4
                    "payment_method_name": "Transfer",
                    "total_struck": 200
                },
            ],
            "total_selling_chart": [
                {
                    "date": "2020-11-07",
                    "total_transaction": 200,
                    "total_bruto": 5000000,
                    "total_netto": 4000000,
                    "total_profit": 3500000
                },
                {
                    "date": "2020-11-08",
                    "total_transaction": 200,
                    "total_bruto": 5000000,
                    "total_netto": 4000000,
                    "total_profit": 3500000
                },
            ],
            "stock_alert": [
                {
                    "product_id": 1,
                    "product_name": "Susu",
                    "product_unit": "Mililiter",
                    "stock_balance": -2,
                    "category_name": "Bahan"
                },
                {
                    "product_id": 2,
                    "product_name": "Gula",
                    "product_unit": "Gram",
                    "stock_balance": -30,
                    "category_name": "Bahan"
                },
            ]
        }
    }
}
```
:::

---
## Tipe Penjualan

### List

#### Endpoint
`[GET]`
`{api_url}/sales-types`
#### Header
| Key           | Value          |
|:------------- | -------------- |
| Authorization | Bearer {token} |

#### Parameter
`Params`

| Key                     | Value      | Description |
|:----------------------- |:---------- |:----------- |
| limit                   | 1          | optional    |
| sort[sales_type_id]     | desc       | default     |
| sort[sales_type_name]   | asc        | optional    |
| sales_type_name[like]   | Dine In    | optional    |
| search[sales_type_name] | Dine       | optional    |
| created_at[date]        | 2021-10-05 | optional    |
| page                    | 5          | optional    |


#### Response
`status 200`
:::spoiler
```json=
{
   "message": "sukses",
   "error": false,
   "results": {
        "data": [
            {
            	"sales_type_id": "2",
            	"sales_type_name": "Take Away",
            	"sales_type_slug": "take_away",
            	"sales_type_margin": "percent",
            	"sales_type_value": "0"
            },
            {
            	"sales_type_id": "4",
            	"sales_type_name": "Grab Food",
            	"sales_type_slug": "grab_food",
            	"sales_type_margin": "percent",
            	"sales_type_value": "0"
            }
        ]
        "current_page": 1,
        "first_page_url": "{api_url}/sales-types?page=1",
        "next_page_url": "",
        "prev_page_url": "",
        "path": "{api_url}/sales-types",
        "per_page": 10,
        "total_page": 1,
        "all_page_url": [
            "{api_url}/sales-types?page=1"
        ]
   }
}
```
:::

---

### Create

#### Endpoint
`[POST]`
`{api_url}/sales-types`
#### Header
| Key           | Value          |
|:------------- | -------------- |
| Authorization | Bearer {token} |

#### Parameter
`Body [raw json]`
```json=
{
    "name": "Dine In", //[max=50]
    "margin": "percent", //[percent,nominal]
    "value": 0 //[optional]
}
```

#### Response
`status 201`
:::spoiler
```json=
{
   "message": "sukses",
   "error": false,
   "results": {
        "sales_type_id": "2",
        "sales_type_name": "Take Away",
        "sales_type_slug": "take_away",
        "sales_type_margin": "percent",
        "sales_type_value": "0"
    }
}
```
:::

---

### Update

#### Endpoint
`[PUT]`
`{api_url}/sales-types/{sales_type_id}`
#### Header
| Key           | Value          |
|:------------- | -------------- |
| Authorization | Bearer {token} |

#### Parameter
`Body [raw json]`
```json=
{
    "name": "Dine In", //[max=50]
    "margin": "percent", //[percent,nominal]
    "value": 0 //[optional]
}
```

#### Response
`status 200`
:::spoiler
```json=
{
   "message": "sukses",
   "error": false,
   "results": {
        "sales_type_id": "2",
        "sales_type_name": "Take Away",
        "sales_type_slug": "take_away",
        "sales_type_margin": "percent",
        "sales_type_value": "0"
    }
}
```
:::

---

### Delete

#### Endpoint
`[DELETE]`
`{api_url}/sales-types/{sales_type_id}`
#### Header
| Key           | Value          |
|:------------- | -------------- |
| Authorization | Bearer {token} |

#### Parameter

#### Response
`status 204`

---



## User

### List

#### Endpoint
`[GET]`
:::success
`{api_url}/users`
:::

#### Header
| Key | Value |
| -------- | -------- |
| Authorization | Bearer {token} |

#### Parameter
[Dokumentasi parameter GET](#pookie)
#### Response
`status 200`
:::spoiler
```json=
{
   "message": "sukses",
   "error": false,
   "results": {
        "data": [
            {
                "user_id": 1,
                "user_username": "johndoesianying",
                "user_fullname": "John Doe Si Anying",
                "user_email": "johndoe@nautical.com",
                "user_mobilephone": "081234567890",
                "user_image": "https://demo.next-pos.my.id/media/images/1631862174_28ef695ebdf99cdb91bf.jpg",
                "user_last_login": "2020-11-16 03:21:19",
                "user_is_active": "1",
                "store_id": 1,
                "store_name": "Nautical",
                "user_group_id": 3,
                "user_group_name": "Kasir"
            },
        ]
        "current_page": 1,
        "first_page_url": "http://10.10.0.80:8081/users?page=1",
        "next_page_url": "http://10.10.0.80:8081/users?page=2",
        "prev_page_url": "",
        "path": "http://10.10.0.80:8081/users",
        "per_page": 10,
        "total_page": 1,
        "all_page_url": ["http://10.10.0.80:8081/users?page=1"]
   }
}
```
:::

### Create

#### Endpoint
`[POST]`
:::success
`{api_url}/users`
:::

#### Header
| Key | Value |
| -------- | -------- |
| Authorization | Bearer {token} |

#### Parameter
```json=
{
    "store_id": 1,
    "user_group_id": 3,
    "user_username": "johndoesianying",
    "user_fullname": "John Doe Si Anying",
    "user_email": "johndoe@nautical.com",
    "user_image": "",
    "user_mobilephone": "081234567890"
    "user_password": "12345678"
}
```
#### Response
`status 201`
:::spoiler
```json=
{
   "message": "sukses",
   "error": false,
   "results": {
        "user_id": 1,
        "user_username": "johndoesianying",
        "user_fullname": "John Doe Si Anying",
        "user_email": "johndoe@nautical.com",
        "user_mobilephone": "081234567890",
        "user_image": "https://demo.next-pos.my.id/media/images/1631862174_28ef695ebdf99cdb91bf.jpg",
        "user_last_login": "2020-11-16 03:21:19",
        "user_is_active": "1",
        "store_id": 1,
        "store_name": "Nautical",
        "user_group_id": 3,
        "user_group_name": "Kasir"
   }
}
```
:::
### Update

#### Endpoint
`[PUT]`
:::success
`{api_url}/users/{user_id}`
:::

#### Header
| Key | Value |
| -------- | -------- |
| Authorization | Bearer {token} |

#### Parameter
```json=
{
    "store_id": 1,
    "user_group_id": 3,
    "user_username": "johndoesianying",
    "user_fullname": "John Doe Si Anying",
    "user_email": "johndoe@nautical.com",
    "user_image": "",
    "user_mobilephone": "081234567890"
    "user_password": "12345678"
}
```
#### Response
`status 200`
:::spoiler
```json=
{
   "message": "sukses",
   "error": false,
   "results": {
        "user_id": 1,
        "user_username": "johndoesianying",
        "user_fullname": "John Doe Si Anying",
        "user_email": "johndoe@nautical.com",
        "user_mobilephone": "081234567890",
        "user_image": "https://demo.next-pos.my.id/media/images/1631862174_28ef695ebdf99cdb91bf.jpg",
        "user_last_login": "2020-11-16 03:21:19",
        "user_is_active": "1",
        "store_id": 1,
        "store_name": "Nautical",
        "user_group_id": 3,
        "user_group_name": "Kasir"
   }
}
```
:::
### Delete

#### Endpoint
`[DELETE]`
:::success
`{api_url}/users/{user_id}`
:::
#### Header
| Key           | Value          |
|:------------- | -------------- |
| Authorization | Bearer {token} |

#### Parameter

#### Response
`status 204`

---



## Shift

### List

#### Endpoint
`[GET]`
`{api_url}/shift`
#### Header
| Key           | Value          |
|:------------- | -------------- |
| Authorization | Bearer {token} |

#### Parameter
`Params`

#### Response
`status 200`
:::spoiler
```json=
{
   "message": "sukses",
   "error": false,
   "results": {
        "data": [
            {
                "shift_start_date": "2020-11-07 00:10:15"
                "close_register_id": "1",
                "close_register_store_id": "1",
                "close_register_code": "001",
                "close_register_date": "2020-11-07",
                "close_register_total_cashier_cash_in": "0.00",
                "close_register_total_cash_received": "0.00",
                "close_register_total_income_cash": "63000.00",
                "close_register_total_income_non_cash": "0.00",
                "close_register_total_income_detail_json": "{\"edc\":0,\"transfer\":0,\"ovo\":0,\"gopay\":0}",
                "close_register_total_cashier_cash_out": "0.00",
                "close_register_grand_total": "63000.00",
                "close_register_input_datetime": "2020-11-07 21:16:16",
                "close_register_input_user_id": "16",
                "close_register_input_user_fullname": "dede",
                "close_register_input_user_username": "dede123",
                "close_register_update_datetime": "2020-11-07 21:16:16",
                "close_register_update_user_fullname": "dede",
                "close_register_update_user_username": "dede123",
            }
        ]
        "current_page": 1,
        "first_page_url": "{api_url}/shift?page=1",
        "next_page_url": "",
        "prev_page_url": "",
        "path": "{api_url}/shift",
        "per_page": 10,
        "total_page": 1,
        "all_page_url": [
            "{api_url}/shift?page=1"
        ]
   }
}
```
:::

---

### Detail

#### Endpoint
`[GET]`
`{api_url}/shift/detail/{close_register_id}`
#### Header
| Key           | Value          |
|:------------- | -------------- |
| Authorization | Bearer {token} |

#### Parameter
`Params`

#### Response
`status 200`
:::spoiler
```json=
{
   "message": "sukses",
   "error": false,
   "results": {
        "data": [
            {
                "sales_order_id": "1",
                "sales_order_store_id": "1",
                "sales_order_number": "001",
                "sales_order_transaction_number": "INV/201107001",
                "sales_order_table_number": "Dine In",
                "sales_order_note": null,
                "sales_order_sales_type_slug": "dine_in",
                "sales_order_sales_type_name": "Dine In",
                "sales_order_payment_method": "cash",
                "sales_order_payment_bank_name": null,
                "sales_order_payment_ref_number": null,
                "sales_order_date": "2020-11-07",
                "sales_order_total_product_qty": "1",
                "sales_order_total_product_price": "15000",
                "sales_order_total_discount_percent": "0",
                "sales_order_total_discount_nominal": "0",
                "sales_order_total_discount_item_nominal": "0",
                "sales_order_total_nett_price": "15000",
                "sales_order_total_charge_percent": null,
                "sales_order_total_charge_nominal": null,
                "sales_order_total_tax_percent": null,
                "sales_order_total_tax_nominal": null,
                "sales_order_grand_total": "15000",
                "sales_order_customer_id": "0",
                "sales_order_customer_name": "Umum",
                "sales_order_input_datetime": "2020-11-07 21:05:35",
                "sales_order_input_user_id": "16",
                "sales_order_input_user_fullname": "dede itel",
                "sales_order_input_user_username": "dede123",
                "sales_order_status": "complete"
            },
            {
                "sales_order_id": "2",
                "sales_order_store_id": "1",
                "sales_order_number": "002",
                "sales_order_transaction_number": "INV/201107002",
                "sales_order_table_number": "Meja 1",
                "sales_order_note": null,
                "sales_order_sales_type_slug": "dine_in",
                "sales_order_sales_type_name": "Dine In",
                "sales_order_payment_method": "cash",
                "sales_order_payment_bank_name": null,
                "sales_order_payment_ref_number": null,
                "sales_order_date": "2020-11-07",
                "sales_order_total_product_qty": "3",
                "sales_order_total_product_price": "48000",
                "sales_order_total_discount_percent": "0",
                "sales_order_total_discount_nominal": "0",
                "sales_order_total_discount_item_nominal": "0",
                "sales_order_total_nett_price": "48000",
                "sales_order_total_charge_percent": null,
                "sales_order_total_charge_nominal": null,
                "sales_order_total_tax_percent": null,
                "sales_order_total_tax_nominal": null,
                "sales_order_grand_total": "48000",
                "sales_order_customer_id": "0",
                "sales_order_customer_name": "Umum",
                "sales_order_input_datetime": "2020-11-07 21:14:18",
                "sales_order_input_user_id": "16",
                "sales_order_input_user_fullname": "dede",
                "sales_order_input_user_username": "dede123",
                "sales_order_status": "complete"
            }
        ]
        "current_page": 1,
        "first_page_url": "{api_url}/shift/detail/{close_register_id}?page=1",
        "next_page_url": "",
        "prev_page_url": "",
        "path": "{api_url}/shift/detail/{close_register_id}",
        "per_page": 10,
        "total_page": 1,
        "all_page_url": [
            "{api_url}/shift/detail/{close_register_id}?page=1"
        ]
   }
}
```
:::

---

### Open Shift

#### Endpoint
`[POST]`
`{api_url}/shift/open`
#### Header
| Key           | Value          |
|:------------- | -------------- |
| Authorization | Bearer {token} |

#### Parameter
`Body [raw json]`
```json=
{
    "nominal": 1200000, //[boleh nol]
    "note": "catatan ",
}
```

#### Response
`status 201`
:::spoiler
```json=
{
   "message": "sukses membuka shift",
   "error": false,
   "results": {}
}
```
:::

---

### Close Shift

#### Endpoint
`[POST]`
`{api_url}/shift/close`
#### Header
| Key           | Value          |
|:------------- | -------------- |
| Authorization | Bearer {token} |

#### Parameter
`Body [raw json]`
```json=
{
    "nominal": 1200000, //[boleh nol]
    "note": "catatan ",
}
```

#### Response
`status 201`
:::spoiler
```json=
{
   "message": "sukses menutup shift",
   "error": false,
   "results": {
        "shift_start_date": "2020-11-07 00:10:15"
        "close_register_id": "1",
        "close_register_store_id": "1",
        "close_register_code": "001",
        "close_register_date": "2020-11-07",
        "close_register_total_cashier_cash_in": "0.00",
        "close_register_total_cash_received": "0.00",
        "close_register_total_income_cash": "63000.00",
        "close_register_total_income_non_cash": "0.00",
        "close_register_total_income_detail_json": "{\"edc\":0,\"transfer\":0,\"ovo\":0,\"gopay\":0}",
        "close_register_total_cashier_cash_out": "0.00",
        "close_register_grand_total": "63000.00",
        "close_register_input_datetime": "2020-11-07 21:16:16",
        "close_register_input_user_id": "16",
        "close_register_input_user_fullname": "dede",
        "close_register_input_user_username": "dede123",
        "close_register_update_datetime": "2020-11-07 21:16:16",
        "close_register_update_user_fullname": "dede",
        "close_register_update_user_username": "dede123"
    }
}
```
:::

---

User story
---

```php=
$asu = 1;
Feature: Guess the word

  # The first example has two steps
  Scenario: Maker starts a game
    When the Maker starts a game
    Then the Maker waits for a Breaker to join

  # The second example has three steps
  Scenario: Breaker joins a game
    Given the Maker has started a game with the word "silky"
    When the Breaker joins the Maker's game
    Then the Breaker must guess a word with 5 characters
```
> I choose a lazy person to do a hard job. Because a lazy person will find an easy way to do it. [name=Bill Gates]


```gherkin=
Feature: Shopping Cart
  As a Shopper
  I want to put items in my shopping cart
  Because I want to manage items before I check out

  Scenario: User adds item to cart
    Given I'm a logged-in User
    When I go to the Item page
    And I click "Add item to cart"
    Then the quantity of items in my cart should go up
    And my subtotal should increment
    And the warehouse inventory should decrement
```

> Read more about Gherkin here: https://docs.cucumber.io/gherkin/reference/

User flows
---
```sequence
Alice->Bob: Hello Bob, how are you?
Note right of Bob: Bob thinks
Bob-->Alice: I am good thanks!
Note left of Alice: Alice responds
Alice->Bob: Where have you been?
```

> Read more about sequence-diagrams here: http://bramp.github.io/js-sequence-diagrams/

Project Timeline
---
```mermaid
gantt
    title A Gantt Diagram

    section Section
    A task           :a1, 2014-01-01, 30d
    Another task     :after a1  , 20d
    section Another
    Task in sec      :2014-01-12  , 12d
    anther task      : 24d
```

> Read more about mermaid here: http://mermaid-js.github.io/mermaid/

## Appendix and FAQ

:::info
**Find this document incomplete?** Leave a comment!
:::

###### tags: `Templates` `Documentation`
### <a id="pookie"></a>This is the Heading
