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

- UI : Système d'édition des modèles de jalons perso OK

 - UI : Fix, la date de référence modifiée s'applique pour les modèles appliqués après modification
 - UI : Rest mise en page
parent 7ce8fea9
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -102,8 +102,10 @@ class ActivityDateController extends AbstractOscarController implements UseServi

    protected function milestonesPutFlow( array $datas, Activity $activity ): Response
    {
        $this->getLoggerService()->info("milestonesPutFlow");
        try {
            foreach ($datas['elements'] as $element) {
            foreach ($datas['datetypes'] as $element) {
                $this->getLoggerService()->info("item");
                $this->getMilestoneService()->createFromArray(
                    [
                        'type_id'     => $element['datetype_id'],
@@ -113,7 +115,7 @@ class ActivityDateController extends AbstractOscarController implements UseServi
                    ]
                );
            }
            return $this->getResponseOk();
            return $this->getResponseOk("flow ajouté");
        }catch (\Exception $exception){
            return $this->jsonError($exception->getMessage());
        }
+9 −3
Original line number Diff line number Diff line
@@ -30,15 +30,21 @@ class ActivityDateFlowController extends AbstractOscarController
                case Request::METHOD_PUT:
                    $datas = $this->getJsonREST();
                    $this->getActivityDateFlowService()->putJsonDateFlow($datas, $creatorId);
                    return $this->getResponseOk();
                    return $this->jsonOutput([
                        'activitydateflows' => $this->getActivityDateFlowService()->getDateFlows($creatorId),
                    ]);
                case Request::METHOD_POST:
                    $datas = $this->getJsonPosted();
                    $this->getActivityDateFlowService()->postJsonDateFlow($datas, $creatorId);
                    return $this->getResponseOk();
                    return $this->jsonOutput([
                        'activitydateflows' => $this->getActivityDateFlowService()->getDateFlows($creatorId),
                    ]);
                case Request::METHOD_DELETE:
                    $dateflowId = $this->getRequest()->getQuery('id');
                    $this->getActivityDateFlowService()->deleteById($dateflowId, $creatorId);
                    return $this->getResponseOk();
                    return $this->jsonOutput([
                        'activitydateflows' => $this->getActivityDateFlowService()->getDateFlows($creatorId),
                    ]);
                case Request::METHOD_GET:
                    $data = [
                        'activitydateflows' => $this->getActivityDateFlowService()->getDateFlows($creatorId),
+6 −0
Original line number Diff line number Diff line
@@ -580,6 +580,7 @@
                      :types="milestonesTypes"
                      :urlFlowAdmin="urlFlowAdmin"
                      :debug-enabled="debugEnabled"
                      @updateflow="handlerUpdateFlow"
                      @update="handlerUpdateMilestones"
          />

@@ -871,11 +872,16 @@ export default {
      this.currencies = p.currencies;
      this.paymentsUrl = p.url;
    },

    handlerUpdateMilestones(milestones, milestonesFlow) {
      this.milestones = milestones;
      this.milestonesFlow = milestonesFlow;
    },

    handlerUpdateFlow(flows){
      this.milestonesFlow = flows.activitydateflows;
    },

    handlerUpdatePersons(d) {
      this.persons = d.datas.items;
    },
+13 −79
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
      <button class="btn btn-default" @click="handlerNew">
        Nouveau modèle
      </button>
      <article v-for="f in flow" class="flow-element-list">
      <article v-for="f in displayedFlow" class="flow-element-list">
        <h4>
          {{ f.label }}
          <i class="icon-globe" v-show="f.public"></i>
@@ -18,7 +18,7 @@
          </article>
        </section>
        <nav class="buttons-bar">
          <button class="btn btn-danger btn-xs">
          <button class="btn btn-danger btn-xs" @click="handlerDelete(f)">
            Supprimer
          </button>
          <button class="btn btn-default btn-xs" @click="handlerEdit(f)">
@@ -80,82 +80,6 @@
    </div>
  </div>

  <!--
  <div class="row">
    <div class="col-md-4">
      Mes flux :
      <button class="btn btn-default">
        Créer un flux
      </button>
      <pre>
        displayFlow: {{ displayedFlow }}<br>
        types: {{ types }}<br>
      </pre>
    </div>
    <div class="col-md-8">
      <div v-if="editFlow">
        <h1>
          <strong v-if="editFlow && editFlow.id">Modification du flux</strong>
          <em v-else>Nouveau flux de jalon</em>
        </h1>
        <div class="row">
          <div class="col-md-6">
            <div class="div">
              <label for="label">
                Intitulé
                <input type="text" class="form-control" v-model="form.label" />
              </label>
            </div>
            <div class="div">
              <label for="">
                Description
                <textarea class="form-control textarea" v-model="form.description" />
              </label>
            </div>
            <div class="div">
              <label for="">
                Publique {{ form }}
                <input type="checkbox" class="form-control" v-model="form.public" />
              </label>
            </div>
          </div>
        </div>


        <select name="" id="" @change="handlerSelectDateStype">
          <option value=""></option>
          <option :value="j.id" v-for="j in datetypes">{{ j.label }}</option>
        </select>

        <h3><i class="icon-calendar"></i>Jalons</h3>
        <section class="datetypes">
          <article class="card datetype-item" v-for="d in orderedDatetypes">
            <strong>{{ d.datetype.label }} ({{ d.order }})</strong>
            <input type="number" class="form-inline" v-model="d.interval" placeholder="Jours">
            <em> jours {{ d.interval >= 0 ? 'après' : 'avant' }} la date de référence</em>
            <nav style="display: inline-block">
              <a href="#" @click.prevent="handlerDown(d)">
                <i class="icon-down-outline"></i>
              </a>
              <a href="#" @click.prevent="handlerUp(d)">
                <i class="icon-up-outline"></i>
              </a>
              <a href="#" @click.prevent="handlerRemoveDateType(d)">
                <i class="icon-trash"></i>
              </a>
            </nav>
          </article>
        </section>

        <nav>
          <button class="btn btn-default" @click="editFlow = null">Annuler</button>
          <button class="btn btn-success" @click="handlerSave">Enregistrer</button>
        </nav>
      </div>
    </div>
  </div>
  -->
  {{ url }}
</template>
<script>
import axiosOscar from "../utils/AxiosOscar.js";
@@ -218,7 +142,17 @@ export default {
        promise = axiosOscar.put(this.url, datas);
      }
      promise.then(ok=>{
        console.log("DONE");
        console.log("DONE", ok);
        this.$emit('update', ok.data);
      })

    },
    handlerDelete(flow){
      let datas = JSON.parse(JSON.stringify(this.flow));
      let promise = axiosOscar.delete(this.url+'?id='+flow.id);
      promise.then(ok=>{
        console.log("DONE", ok);
        this.$emit('update', ok.data);
      })

    }
+9 −7
Original line number Diff line number Diff line
@@ -187,34 +187,37 @@ export default {
          </div>
          <div class="div">
            <label for="">
              Publique {{ form }}
              Publique (Disponible aux utilisateurs)
              <input type="checkbox" class="form-control" v-model="form.public" />
            </label>
          </div>
        </div>
      </div>


      <h3>
        <i class="icon-calendar"></i>
        Jalons</h3>
      <div>
        Ajouter
        <select name="" id="" @change="handlerSelectDateStype">
          <option value=""></option>
          <option :value="j.id" v-for="j in datetypes">{{ j.label }}</option>
        </select>

      <h3>
        <i class="icon-calendar"></i>
        Jalons</h3>
      </div>
      <section class="datetypes">
        <article class="card datetype-item" v-for="d in orderedDatetypes">
          <strong>{{ d.datetype.label }} ({{ d.order }})</strong>
          <input type="number" class="form-inline" v-model="d.interval" placeholder="Jours">
          <em> jours {{ d.interval >= 0 ? 'après' : 'avant' }} la date de référence</em>
          <nav style="display: inline-block">
            <!--
            <a href="#" @click.prevent="handlerDown(d)">
              <i class="icon-down-outline"></i>
            </a>
            <a href="#" @click.prevent="handlerUp(d)">
              <i class="icon-up-outline"></i>
            </a>
            -->
            <a href="#" @click.prevent="handlerRemoveDateType(d)">
              <i class="icon-trash"></i>
            </a>
@@ -233,7 +236,6 @@ export default {
<style scoped>
.datetype-item {
  display: flex;
  background: cyan;
  strong, em, nav{
    flex: 3
  }
Loading