Merge pull request #3908 from betagouv/fix-3899-view-admin-vip

- Manager : ajout de colonnes "nombre de dossiers par an" et "échéance souhaitée".
This commit is contained in:
Pierre de La Morinerie 2019-06-04 17:04:51 +02:00 committed by GitHub
commit b8b88201fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View file

@ -1,6 +1,8 @@
class Pipedrive::PersonAdapter
PIPEDRIVE_POSTE_ATTRIBUTE_ID = '33a790746f1713d712fe97bcce9ac1ca6374a4d6'
PIPEDRIVE_SOURCE_ATTRIBUTE_ID = '2fa7864f467ffa97721cbcd08df5a3d591b15f50'
PIPEDRIVE_NB_DOSSIERS_ATTRIBUTE_ID = '2734a3ff19f4b88bd0d7b4cf02c47c7545617207'
PIPEDRIVE_DEADLINE_ATTRIBUTE_ID = 'ef766dd14de7da246fb5fc1704f45d1f1830f6c9'
PIPEDRIVE_ROBOT_ID = '2748449'
def self.get_demandes_from_persons_owned_by_robot
@ -11,7 +13,9 @@ class Pipedrive::PersonAdapter
poste: datum[PIPEDRIVE_POSTE_ATTRIBUTE_ID],
email: datum.dig('email', 0, 'value'),
tel: datum.dig('phone', 0, 'value'),
organisation: datum['org_name']
organisation: datum['org_name'],
nb_dossiers: datum[PIPEDRIVE_NB_DOSSIERS_ATTRIBUTE_ID],
deadline: datum[PIPEDRIVE_DEADLINE_ATTRIBUTE_ID]
}
end
end
@ -22,7 +26,7 @@ class Pipedrive::PersonAdapter
Pipedrive::API.put_person(person_id, params)
end
def self.add_person(email, phone, name, organization_id, poste, source)
def self.add_person(email, phone, name, organization_id, poste, source, nb_of_dossiers, deadline)
params = {
email: email,
phone: phone,
@ -30,7 +34,9 @@ class Pipedrive::PersonAdapter
org_id: organization_id,
owner_id: PIPEDRIVE_ROBOT_ID,
"#{PIPEDRIVE_POSTE_ATTRIBUTE_ID}": poste,
"#{PIPEDRIVE_SOURCE_ATTRIBUTE_ID}": source
"#{PIPEDRIVE_SOURCE_ATTRIBUTE_ID}": source,
"#{PIPEDRIVE_NB_DOSSIERS_ATTRIBUTE_ID}": nb_of_dossiers,
"#{PIPEDRIVE_DEADLINE_ATTRIBUTE_ID}": deadline
}
response = Pipedrive::API.post_person(params)

View file

@ -19,7 +19,7 @@ class PipedriveService
def self.add_demande(email, phone, name, poste, source, organization_name, address, nb_of_procedures, nb_of_dossiers, deadline)
organization_id = Pipedrive::OrganizationAdapter.add_organization(organization_name, address)
person_id = Pipedrive::PersonAdapter.add_person(email, phone, name, organization_id, poste, source)
person_id = Pipedrive::PersonAdapter.add_person(email, phone, name, organization_id, poste, source, nb_of_dossiers, deadline)
Pipedrive::DealAdapter.add_deal(organization_id, person_id, organization_name, nb_of_procedures, nb_of_dossiers, deadline)
end
end

View file

@ -34,13 +34,7 @@
<%= form_tag(manager_demandes_create_administrateur_path) do -%>
<%= select_tag "stage_id",
options_for_select({
"suspect" => Pipedrive::DealAdapter::PIPEDRIVE_SUSPECTS_COMPTE_CREE_STAGE_ID,
"administration centrale" => Pipedrive::DealAdapter::PIPEDRIVE_ADMIN_CENTRAL_STOCK_STAGE_ID,
"service déco. régional" => Pipedrive::DealAdapter::PIPEDRIVE_SERVICE_DECO_REGIONAL_STOCK_STAGE_ID,
"service déco. départemental" => Pipedrive::DealAdapter::PIPEDRIVE_SERVICE_DECO_DEPARTEMENTAL_STOCK_STAGE_ID,
"collectivité dép. ou rég." =>Pipedrive::DealAdapter::PIPEDRIVE_COLLECTIVITE_DEP_OU_REG_STOCK_STAGE_ID,
"collectivité locale" => Pipedrive::DealAdapter::PIPEDRIVE_COLLECTIVITE_LOCALE_STOCK_STAGE_ID,
"organisme" => Pipedrive::DealAdapter::PIPEDRIVE_ORGANISMES_STOCK_STAGE_ID
"suspect" => Pipedrive::DealAdapter::PIPEDRIVE_SUSPECTS_COMPTE_CREE_STAGE_ID
}),
style: 'margin-bottom: 20px; width: inherit;' %>