Commit 82812524 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Gestion des jalons depuis la liste "Mes jalons"

parent ab3a0658
Loading
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
#!/bin/bash

sudo docker compose exec app-php php vendor/bin/doctrine-module orm:schema-tool:update --force --complete
docker compose exec app-php php vendor/bin/doctrine-module orm:schema-tool:update --force --complete

sudo docker compose exec app-php php bin/oscar.php check:sequences-num
docker compose exec app-php php bin/oscar.php check:sequences-num

# Chargement des organisations
sudo docker compose exec app-php php bin/oscar.php organizations:sync-json install/demo/organizations.json
docker compose exec app-php php bin/oscar.php organizations:sync-json install/demo/organizations.json

# Chargement des personnes
sudo docker compose exec app-php php bin/oscar.php persons:sync-json install/demo/persons.json
docker compose exec app-php php bin/oscar.php persons:sync-json install/demo/persons.json

# Chargement des comptes
sudo docker compose exec app-php php bin/oscar.php auth:sync install/demo/authentification.json
docker compose exec app-php php bin/oscar.php auth:sync install/demo/authentification.json

# Chargement des activités
sudo docker compose exec app-php php bin/oscar.php activity:import-json -f install/demo/activity.json
docker compose exec app-php php bin/oscar.php activity:import-json -f install/demo/activity.json

# Réindexation des activités
sudo docker compose exec app-php php bin/oscar.php activity:search-rebuild

# Réindexation des activités
sudo docker compose exec app-php php bin/oscar.php check:privileges -n
 No newline at end of file
docker compose exec app-php php bin/oscar.php activity:search-rebuild
 No newline at end of file
+8 −0
Original line number Diff line number Diff line
@@ -1680,6 +1680,14 @@ activitydate:
          id: '[0-9]+'
        defaults:
          action: change
    manage:
      type: segment
      options:
        route: /manage/:id
        constraints:
          id: '[0-9]+'
        defaults:
          action: manage
    delete:
      type: segment
      verb: delete
+7 −1
Original line number Diff line number Diff line
@@ -323,7 +323,11 @@ class ActivityDateController extends AbstractOscarController implements UseServi

                        ////////////////////////////////////////////////////////////
                        // Marquer le jalon comme terminé / non-terminé
                        if ($action == ActivityDate::PROGRESSION_VALID || $action == ActivityDate::PROGRESSION_UNVALID || $action == ActivityDate::PROGRESSION_INPROGRESS || $action == ActivityDate::PROGRESSION_CANCEL || $action == ActivityDate::PROGRESSION_REFUSED) {
                        if ($action == ActivityDate::PROGRESSION_VALID ||
                            $action == ActivityDate::PROGRESSION_UNVALID ||
                            $action == ActivityDate::PROGRESSION_INPROGRESS ||
                            $action == ActivityDate::PROGRESSION_CANCEL ||
                            $action == ActivityDate::PROGRESSION_REFUSED) {
                            $this->getOscarUserContextService()->check(
                                Privileges::ACTIVITY_MILESTONE_PROGRESSION,
                                $activity
@@ -469,6 +473,7 @@ class ActivityDateController extends AbstractOscarController implements UseServi

        /** @var Activity $activity */
        $activity = $this->getEntityManager()->getRepository(Activity::class)->find($idActivity);
        $this->getOscarUserContextService()->check(Privileges::ACTIVITY_MILESTONE_MANAGE, $activity);
        $activityDate = new ActivityDate();
        $activityDate->setActivity($activity)
            ->setDateStart(new \DateTime());
@@ -554,6 +559,7 @@ class ActivityDateController extends AbstractOscarController implements UseServi


                $formatter = new MilestoneToJsonFormatter($types);
                $formatter->setOscarUserContext($this->getOscarUserContextService());
                $formatter->setUrlPlugin($this->url());
                $out = $formatter->formatAllWithTypes($milestones, true);
                $out['organizationsDetails'] = $organizationsNamed;
+15 −0
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@ namespace Oscar\Formatter\json;
use Laminas\Mvc\Controller\Plugin\Url;
use Oscar\Entity\ActivityDate;
use Oscar\Entity\DateType;
use Oscar\Provider\Privileges;
use Oscar\Service\OscarUserContext;

class MilestoneToJsonFormatter
{
@@ -13,6 +15,7 @@ class MilestoneToJsonFormatter
    private array $typesArray;

    private ?Url $urlPlugin = null;
    private ?OscarUserContext $oscarUserContext = null;

    /**
     * @param array $types
@@ -74,8 +77,15 @@ class MilestoneToJsonFormatter
            ];
            if( $this->urlPlugin ){
                $data['activity']['url'] = $this->urlPlugin->fromRoute('contract/show', ['id' => $milestone->getActivity()->getId()]);
                $data['url'] = $this->urlPlugin->fromRoute('activitydate', [
                    'idactivity' => $milestone->getActivity()->getId()
                ]);
            }
        }
        if( $this->oscarUserContext && $this->urlPlugin ){
            $data["manage"] = $this->oscarUserContext->hasPrivileges(Privileges::ACTIVITY_MILESTONE_MANAGE, $milestone->getActivity());
            $data["progress"] = $this->oscarUserContext->hasPrivileges(Privileges::ACTIVITY_MILESTONE_PROGRESSION, $milestone->getActivity());
        }
        return $data;
    }

@@ -121,4 +131,9 @@ class MilestoneToJsonFormatter
    {
        $this->urlPlugin = $url;
    }

    public function setOscarUserContext(\Oscar\Service\OscarUserContext $getOscarUserContextService)
    {
        $this->oscarUserContext = $getOscarUserContextService;
    }
}
 No newline at end of file
+50 −3
Original line number Diff line number Diff line
@@ -24,6 +24,10 @@
          <i class="icon-calendar" v-else></i>
          {{ milestone.type.label }} - {{ $filters.dateFull(milestone.dateStart) }}
        </strong>
        <nav v-if="milestone.manage && false" class="right">
          <a href="" class="btn btn-danger">Supprimer</a>
          <a href="" class="btn btn-primary">Modifier</a>
        </nav>
      </h2>
      <div class="card-content">
        <div class="activity-info"
@@ -54,19 +58,45 @@
        <div v-if="milestone.comment">
          {{ milestone.comment }}
        </div>
        <nav class="milestone-progession" v-if="milestone.validable">
        <nav class="milestone-progession" v-if="milestone.validable" style="position: relative">
          <i class="icon-gauge"></i>
          <strong class="milestone-progression-label">
            <span v-if="milestone.finished">
              {{ progressions[milestone.finished] }} (val: {{ milestone.finished }})
              {{ progressions[milestone.finished] }}
            </span>
            <span v-else>
              A FAIRE
            </span>
          </strong>
          <span v-if="milestone.finishedBy">
            par <strong>{{ milestone.finishedBy }}</strong>
            par
            <strong class="oscar-tag">
              <i class="oscar-tag-icon icon-user"></i>
              {{ finishedPerson(milestone.finishedBy) }}
            </strong>

            <a href="#" @click.prevent="handlerProgression(milestone, 'unvalid')"
               style="position: absolute; right: 0"
               class="btn btn-xs btn-default right-0">
              <i class="icon-history"></i>reset
            </a>
          </span>
          <nav v-if="milestone.progress" class="">
            <span v-if="!(milestone.finished > 0)">
              <a href="" class="btn btn-default xs" @click.prevent="handlerProgression(milestone, 'inprogress')">
                <i class="icon-cw-outline"></i>
                En cours</a>
              <a href="" class="btn btn-success xs"  @click.prevent="handlerProgression(milestone, 'valid')">
                <i class="icon-ok-circled"></i>
                Terminé</a>
              <a href="" class="btn btn-default xs" @click.prevent="handlerProgression(milestone, 'cancel')">
                <i class="icon-archive"></i>
                Sans suite</a>
              <a href="" class="btn btn-danger xs"  @click.prevent="handlerProgression(milestone, 'refused')">
                <i class="icon-block"></i>
                Refusé</a>
            </span>
          </nav>
        </nav>
      </div>
    </article>
@@ -98,6 +128,23 @@ export default {
  },

  methods: {
    handlerProgression(milestone, action) {
      AxiosOscar.put(milestone.url, {'action': action, 'id': milestone.id}).then((response) => {
        console.log(response);
      }).then(response => {
        this.fetch()
      })
    },

    finishedPerson(text) {
      let regex = /\[Person:([0-9]*):(.*)\]/gm;
      let reg = regex.exec(text);
      if (reg !== null) {
        return reg[2];
      }
      return "";
    },

    getContext( activityMilestoneInfo){
      let info = {
        orgs: []