---
# System prepended metadata

title: Create Form2 Memo

---

# Create Form2 Memo


1. CREATE MEMO 🔗 **PATCH: api/memos-real/**
```
{
    "form": 2
    "memo_number": null,
    "loa": "",  # input loa custom 
    "is_permission": false,
    "loa_group": null,   # input loa not custom 
    "from_profile": {profile_id},
    "cc_list": [{profile_id}, ..],
    "to": [{profile_id}, ..],
    "announce_location": [{location_id}, ..],
    "announce_division": [{division_id}, ..],
    "announce_department": [{department_id}, ..],
    "ready": True,
}
```


2. CREATE FORM2 🔗 **POST: api/memos-form2/**
```
type_of_vehicle choices: Company, Private Car

{
            "memo": {memo_id},
            "type_of_vehicle": "Company",
            "plate_number": null,
            "purpose": null,
            "date_from": "2020-08-06",
            "date_to": "2020-08-07",
            "estimated_expense": 0,
            "employee_detail": [
                {profile_id}, ..
            ],
            "jop_detail": [
                {
                    "jop_number": null,
                    "customer": null,
                    "province": null
                },
                ...
            ]
        }
```

3. UPDATE 🔗 **PATCH: api/memos-form2/{id}/**

<hr>

4. Update Jop Detail 🔗 **PATCH: api/memos-form2/{id}/**

🔘 ตัวอย่าง ของเดิมมี Jop Detail อันเดียว
```

{
            "memo": 1,
            "type_of_vehicle": "Company",
            "plate_number": "ABC 123",
            "purpose": "ทำไมมันเยอะขนาดนี้ =_=",
            "date_from": "2020-08-06",
            "date_to": "2020-08-07",
            "estimated_expense": 0,
            "employee_detail": [
                1, 2, 5
            ],
            "jop_detail": [
                {
                    "id": 1,
                    "jop_number": "1",
                    "customer": "Kim Doyoung",
                    "province": "Korean"
                }
            ]
        }
```

✅ Case อยากเพิ่ม Job detail ให้เป็น 2 อัน 
อันใหม่ที่เพิ่มมาต้องใส่ id = null เพราะยังไม่ create

```
{
            "memo": 1,
            "type_of_vehicle": "Company",
            "plate_number": "ABC 123",
            "purpose": "ทำไมมันเยอะขนาดนี้ =_=",
            "date_from": "2020-08-06",
            "date_to": "2020-08-07",
            "estimated_expense": 0,
            "employee_detail": [
                1, 2, 5
            ],
            "jop_detail": [
                {
                    "id": 1,
                    "jop_number": "1",
                    "customer": "Kim Doyoung",
                    "province": "Korean"
                },
                {
                    "id": null,
                    "jop_number": "2",
                    "customer": "Jeong Jaehyun",
                    "province": "Korean"
                },
            ]
        }
```

✅ Case อยากอัพเดทค่า Job detail
ก็อัพเดทปกติเลยแต่ต้องใส่ id ของมันส่งไปด้วย

```
{
            "memo": 1,
            "type_of_vehicle": "Company",
            "plate_number": "ABC 123",
            "purpose": "ทำไมมันเยอะขนาดนี้ =_=",
            "date_from": "2020-08-06",
            "date_to": "2020-08-07",
            "estimated_expense": 0,
            "employee_detail": [
                1, 2, 5
            ],
            "jop_detail": [
                {
                    "id": 1,
                    "jop_number": "1",
                    "customer": "Kim Doyoung",
                    "province": "ประเทศไทย"
                },
                {
                    "id": 2,
                    "jop_number": "2",
                    "customer": "Jeong Jaehyun",
                    "province": "ประเทศไทย"
                },
            ]
        }
```

✅ Case อยากลบตัวนึงออก

```
{
            "memo": 1,
            "type_of_vehicle": "Company",
            "plate_number": "ABC 123",
            "purpose": "ทำไมมันเยอะขนาดนี้ =_=",
            "date_from": "2020-08-06",
            "date_to": "2020-08-07",
            "estimated_expense": 0,
            "employee_detail": [
                1, 2, 5
            ],
            "jop_detail": [
                {
                    "id": 1,
                    "jop_number": "1",
                    "customer": "Kim Doyoung",
                    "province": "ประเทศไทย"
                }
            ]
        }
```

5. Example Context PDF Form 2 📝

```
{
   "memo_number":"None",
   "division":"TEST",
   "type_of_vehicle":"Company",
   "plate_number":"ABC 123",
   "purpose":"ทำไมมันเยอะขนาดนี้ =_=",
   "date_from":"06-Aug-2020",
   "date_to":"07-Aug-2020",
   "estimated_expense": Decimal("0.00"),
   "employee_detail":[
       {
          "id":2,
          "employee_id",
          "None",
          "full_name":"master master"
       }
    ],
   "jop_detail": [
       {
           "jop_number": '1', 
           "customer": "Kim Doyoung",
           "province": "Korean"
       }
   ]
   "host_url":"http://localhost:4200",
   "host_name":"localhost:4200",
   "url_image":"http://localhost:8000",
   "company_name":"Bankgkok Komatsu Sales",
   "display_pdf": "",
   "display_email": "",
   "signatures_data": [
       {
           'full_name': 'CODIUM Tester', 
           'position': 'Dev', 
           'profile': 5, 
           'padding': 0, 
           'contact_name': None, 
           'level_id': 8, 
           'level': 1, 
           'comment': '', 
           'text': 'Prepared by'
       }
    ],
   "signature_odd": 1,
}

```