Client - thenibirahmed/wp-client-management GitHub Wiki

Clients Overview

Note: this is for the topbar,

Endpoint

/clients-overview

Note: We need a API for changing currency

Endpoint

/select-currency

We can filter the overview with date format.

example ,

   /clients-overview?from=2010-09-15&to=2024-09-30
   also with the currency : 
   /clients-overview?from=2010-09-15&to=2024-09-30&currency=BDT

Note: We can pass the currency code with the endpoint & also the date range for filtering the client.

Endpoint

   /clients?search={name/email}&from={start_date}&to={end_date}

Clients table

Endpoint

/clients

We can filter clients data with date format + search.

example ,

   /clients?from=2010-09-15&to=2024-09-30
   also with the currency : 
   /clients?from=2010-09-15&to=2024-09-30&search=blablabla // search for client name , email, organization, 

Create a Client

Endpoint

/client/create

Payload for creating a client

    {
       name: '',
       email: '',
       phone: '',
       address: '',
       city: '',
       state: '',
       country: '',
       zip: '',
       organization: '',
    }

Update a Client

endpoint for getting the client details ,

   /client/{id}/edit

Endpoint

/client/update/{id}

Payload for updating a client

    {
       name: '',
       email: '',
       phone: '',
       address: '',
       city: '',
       state: '',
       country: '',
       zip: '',
       organization: '',
    }

Client Overview page tabs ->

Projects

Endpoint

/client/{id}/projects

We can filter projects with date range + status_id, priority_id + search.

example,

   /client/{id}/projects?from=2010-09-15&to=2024-09-30&status_id={id}&priority_id={id}&search=blablabla

Create a project ->

Note: We need a few API's according to the project create form need,

   /select-employee
   /select-client
   /select/project/status
   /select/project/priority
   /select-currency

payload for creating a project ->

  {
      title : '',
      manager_id: , // this will come from the "/select-employee" endpoint.
      client_id: , // In this case, the client_id should be autoselected.
      status_id: , // this will come from the "/select/project/status" endpoint.
      priority_id: , // this will come from the "/select/project/priority" endpoint.
      currency_id: , // this will come from the "/select-currency endpoint. /optional
      budget: ,
      start_date: '',
      due_date: '',
      description: ,
      assignee_ids: [], // we can assign employees while creating a project, Those ids will come from "/select-employee" endpoint, and it must be an 
                           array. Just pass the IDs of the employee. 
}
 

Update project ->

First, we need the project details for filling out the update form.

   /project/{id}/edit

Note: All assigned employee of the project should be selected.

Note: We need a few API's according to the project update form need,

   /select-employee
   /select-client
   /select/project/status
   /select/project/priority
   /select-currency

payload for updating a project ->

  {
      title : '',
      manager_id: , //This will come from the "/select-employee" endpoint.
      client_id: , // In this case, the client_id should be autoselected.
      status_id: , // this will come from the "/select/project/status" endpoint.
      priority_id: , // This will come from the "/select/project/priority" endpoint.
      currency_id: , // this will come from the "/select-currency endpoint. /optional
      budget: ,
      start_date: '',
      due_date: '',
      description: ,
      assignee_ids: [], // previous assigned ids will selected and we can reduce or add employees from the update page. / Just pass the id of the employee.
}
 

Invoices

Endpoint

/client/{id}/invoices

We can filter invoices with date range + currency + status_id + search.

example,

   /client/{id}/invoices?from=2010-09-15&to=2024-09-30&status_id={id}&currency=BDT&search=blablabla  // search with code, total or project title

Create an Invoice ->

Endpoint

   /invoice/create

Note: We need a few API's according to the invoice create form need,

   /select-project
   /select-currency
   /select-payment-method
   /select-employee // for showing the name in billing from 
   /select-client   // In this case, the client_id should auto-select
   /employee/{id}/details //for auto-filling address, phone number & email
   /client/{id}/details  // for auto-filling address , phone number & email 
   /select-client

Payload for creating an invoice

 {
    client_id: , // current selected client ID
    project_id : , // must be pre-selected from "/select-project" 
    title : '',
    invoice_number: '',
    payment_method_id : ,  // this will come from the "/select-payment-method" endpoint    
    currency_id : ,  // this will come from the "/select-currency" endpoint
    date: '',
    due_date: '',
    bill_to_id: , // the client id . 
    billing_address: '',  // this will come from "/client/{id}/details"
    billing_phone_number: , // "/client/{id}/details"
    billing_email: , // "/client/{id}/details"
    bill_from_id: , // the EicCrmUser id ,  
    bill_from_address: '',  // this will come from "/employee/{id}/details"
    bill_from_phone_number: , // "/client/{id}/details"
    bill_from_email: , // "/client/{id}/details"
    note: '', 

    // below data will come after the calculation of the Invoice item,
    sub_total: ,
    total: ,
    discount: ,
    tax: ,
    fee: ,
    
   // A single invoice might have multiple items, all items should pass as an array,
   invoice_items: [
            {
                details: '',  
                quantity: '',
                unit_price: '',
                discount_type: '',
                discount_value: '',
                tax_type: '',
                tax_value: '',
                line_total: ''
            },
            {
                details: '',  
                quantity: '',
                unit_price: '',
                discount_type: '',
                discount_value: '',
                tax_type: '',
                tax_value: '',
                line_total: ''
            }

     ]

 }

Update Invoice,

Note: Endpoint for getting the invoice data,

   /invoice/{id}/edit

Note: We need a few API's according to the project create form need,

   /select-project
   /select-currency
   /select-payment-method
   /select-employee // for showing the name in billing from 
   /select-client   // In this case, the client_id should auto-select
   /employee/{id}/details //for auto-filling address, phone number & email
   /client/{id}/details  // for auto-filling address , phone number & email 
   /select-client

Update endpoint,

   /invoice/update/{id}

Payload for updating an invoice

 {
    client_id: , // current selected client ID
    project_id : , // must be pre-selected from "/select-project" 
    title : '',
    invoice_number: '',
    payment_method_id : ,  // this will come from the "/select-payment-method" endpoint    
    currency_id : ,  // this will come from the "/select-currency" endpoint
    date: '',
    due_date: '',
    billing_address: '',  // this will come from "/client/{id}/details"
    billing_phone_number: , // "/client/{id}/details"
    billing_email: , // "/client/{id}/details"
    bill_from_address: '',  // this will come from "/employee/{id}/details"
    bill_from_phone_number: , // "/client/{id}/details"
    bill_from_email: , // "/client/{id}/details"
    note: '', 

    // below data will come after the calculation of the Invoice item,
    sub_total: ,
    total: ,
    discount: ,
    tax: ,
    fee: ,
    
   // A single invoice might have multiple items, all items should pass as a array,
   invoice_items: [
            {
                details: '',  
                quantity: '',
                unit_price: '',
                discount_type: '',
                discount_value: '',
                tax_type: '',
                tax_value: '',
                line_total: ''
            },
            {
                details: '',  
                quantity: '',
                unit_price: '',
                discount_type: '',
                discount_value: '',
                tax_type: '',
                tax_value: '',
                line_total: ''
            }

     ]

 }

Note: Previous invoice items will be retrieved from the "/invoice/{id}/edit" endpoint. If a new invoice item is added, it will not have an ID. All previous items must have an ID to update themselves properly.

Example:


 invoice_items: [
           // this is already added in this invoice , 
            {
                id: ,
                details: '',  
                quantity: '',
                unit_price: '',
                discount_type: '',
                discount_value: '',
                tax_type: '',
                tax_value: '',
                line_total: ''
            },
           // this is a new item we are adding,
            {
                details: '',  
                quantity: '',
                unit_price: '',
                discount_type: '',
                discount_value: '',
                tax_type: '',
                tax_value: '',
                line_total: ''
            }

     ]

Notes

Endpoint

/client/{id}/notes

We can filter notes with date range + search.

example,

   /client/{id}/notes?from=2010-09-15&to=2024-09-30&search=blablabla  // Search with note, creator 

Creating a note

Endpoint

/note/create

Payload for creating a note

 {
    client_id : ,  // selected client id
    note: ''
 }

Update a note

Endpoint for getting the note value

   /note/{id}/edit

Endpoint

/note/update/{id}

Payload for updating note

 {
    client_id : ,  // selected client id
    note: ''
 }

Files

Endpoint

/client/{id}/files

We can filter files with date range + search.

example,

   /client/{id}/files?from=2010-09-15&to=2024-09-30&search=blablabla // search with title, url, author name

Create a file

Payload for creating a file

 {
    client_id : ,  // selected client_id
    title : '',
    url : '' 
}

Update File

Endpoint for getting the file value

   /file/{id}/edit

Endpoint

/file/update/{id}

Payload for updating a file

 {
     client_id : ,  // selected client_id
    title : '',
    url : '' 
}

Emails

Endpoint

/client/{id}/emails

We can filter emails with date range + search.

example,

   /client/{id}/emails?from=2010-09-15&to=2024-09-30&search=blablabla // search with title, subject, body, name

Create a email

Payload for creating email

 {
    client_id : ,  // must be auto-selected
    subject : '',
    body : ,
 }

Delete Client

Endpoint (DELETE)

/client/delete/{id}