From 5bd1d1796e06aa05d186efcd22757fb970a68c63 Mon Sep 17 00:00:00 2001 From: Super Proyectos Date: Tue, 11 Dec 2018 19:47:39 -0400 Subject: [PATCH 1/5] =?UTF-8?q?=C3=B3rdenes=20de=20recolecci=C3=B3n=20en?= =?UTF-8?q?=20curso?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- collection_order/views.py | 5 +- pages/mappy_board/home.html | 110 ++++++++++++++++---------- resources/css/panels.css | 19 +++++ resources/js/collectionorderdao.js | 9 ++- resources/js/createcollectionorder.js | 4 + resources/mappy_board/css/main.css | 10 +-- resources/mappy_board/js/card.js | 46 +++++++++++ resources/mappy_board/js/dialogs.js | 70 ++++++++++++++++ resources/mappy_board/js/main.js | 38 ++++----- resources/mappy_board/js/queries.js | 17 +++- 10 files changed, 251 insertions(+), 77 deletions(-) create mode 100644 resources/css/panels.css create mode 100644 resources/js/createcollectionorder.js create mode 100644 resources/mappy_board/js/card.js create mode 100644 resources/mappy_board/js/dialogs.js diff --git a/collection_order/views.py b/collection_order/views.py index 4032e30..34d6b0f 100644 --- a/collection_order/views.py +++ b/collection_order/views.py @@ -33,7 +33,8 @@ class RemoveCollectionOrder(generics.DestroyAPIView): def delete(self, request, *args, **kwargs): instance = self.get_object() # just the user can delete his own collection order - if instance.user_id == request.user.user_id: - return self.destroy(request, *args, **kwargs) + if instance.user_id == request.user: + self.destroy(request, *args, **kwargs) + return Response(data = "Deleted") else: return Response(data = "Error") diff --git a/pages/mappy_board/home.html b/pages/mappy_board/home.html index 2037ddf..9838485 100644 --- a/pages/mappy_board/home.html +++ b/pages/mappy_board/home.html @@ -1,6 +1,6 @@ {%load staticfiles%} - + Mappy @@ -8,6 +8,7 @@ + @@ -52,7 +53,7 @@
  • - Historial + Órdenes en curso
  • @@ -98,11 +99,12 @@
  • - + - -
    + + +
    @@ -351,14 +353,66 @@
    + + + +
    +
    +
    + No hay órdenes de recolección en curso
    + +
    +
    +
    + - -
    -
    - -
    + + +
    + +
    + + + + + + + + + + + + +
    +
    +
    +
    +
    + Espere un momento por favor... +
    +
    + +
    @@ -413,39 +467,7 @@

    Tile with a label

    - - - - -
    -
    -
    -
    -
    - Espere un momento por favor... -
    -
    - - @@ -456,11 +478,13 @@ + - + + diff --git a/resources/css/panels.css b/resources/css/panels.css new file mode 100644 index 0000000..98b90e3 --- /dev/null +++ b/resources/css/panels.css @@ -0,0 +1,19 @@ +.historyOfCollectionOrders{ + display: none; +} +.deleteOrderInfo{ + background: #ff9d3a; + border-radius: 5px; + width: 100%; + padding: 5px; + margin: 5px; + border: none; + transition: all .3s ease-in-out; +} +.deleteOrderInfo:hover{ + background: #ff5847; +} +.noHistory{ + text-align: center; + color: #DC8502; +} \ No newline at end of file diff --git a/resources/js/collectionorderdao.js b/resources/js/collectionorderdao.js index 8151c50..c16b2c2 100644 --- a/resources/js/collectionorderdao.js +++ b/resources/js/collectionorderdao.js @@ -1,7 +1,8 @@ class CollectionOrder { - constructor(collectionAddress, deliveryAddress, recipientsName, recipientsSurname) + constructor(id, collectionAddress, deliveryAddress, recipientsName, recipientsSurname) { + this.id=id; this.packages=[]; this.collectionAddress=collectionAddress; this.deliveryAddress=deliveryAddress; @@ -32,11 +33,13 @@ class CollectionOrderDAO async getAll() { const request=new GetRequest('api/collection_order/getAll'); - return request.execute(); + return await request.execute(); } - delete(collectionAddress) + async delete(collectionOrder) { + const request=new GetRequest('DELETE api/collection_order/remove/'+collectionOrder.id) + return await request.execute(); } findById(id) { diff --git a/resources/js/createcollectionorder.js b/resources/js/createcollectionorder.js new file mode 100644 index 0000000..a866d9e --- /dev/null +++ b/resources/js/createcollectionorder.js @@ -0,0 +1,4 @@ +async function createAnOrder() +{ + +} \ No newline at end of file diff --git a/resources/mappy_board/css/main.css b/resources/mappy_board/css/main.css index 111e228..c7fe2ec 100644 --- a/resources/mappy_board/css/main.css +++ b/resources/mappy_board/css/main.css @@ -514,7 +514,7 @@ body, html{ margin-left: 60px; border-radius: 0.25em; padding: 1em; - background-color: #01579B; + background-color: #DC8502; color: #fff; } .cd-timeline-content::after { @@ -541,7 +541,7 @@ body, html{ height: 0; width: 0; border: 7px solid transparent; - border-right: 7px solid #01579B; + border-right: 7px solid #DC8502; } @media (min-width: 1200px) { #cd-timeline { @@ -574,7 +574,7 @@ body, html{ height: 60px; } .cd-timeline-content .cd-date { - color: #01579B; + color: #DC8502; } .cd-timeline-content { margin-left: 0; @@ -584,7 +584,7 @@ body, html{ top: 24px; left: 100%; border-color: transparent; - border-left-color: #01579B; + border-left-color: #DC8502; } .cd-timeline-content .cd-date { position: absolute; @@ -602,7 +602,7 @@ body, html{ left: auto; right: 100%; border-color: transparent; - border-right-color: #01579B; + border-right-color: #DC8502; } .cd-timeline-block:nth-child(even) .cd-timeline-content .cd-date { left: auto; diff --git a/resources/mappy_board/js/card.js b/resources/mappy_board/js/card.js new file mode 100644 index 0000000..81237ab --- /dev/null +++ b/resources/mappy_board/js/card.js @@ -0,0 +1,46 @@ +class CollectionOrderCard +{ + constructor(collectionOrder) + { + const img="\"/static/mappy_board/assets/img/user.png\""; + const description=this.getPackages(collectionOrder); + $(".collectionHistory").remove(".noCollectionOrder"); + $(".collectionHistory").append('
    ' + + '
    \n' + + 'user-picture' + + '
    ' + + '
    \n' + + '

    \n'+ + description+ + '

    \n' + + '

    \n' + + '' + + 'Para: '+collectionOrder.recipientsName+' '+ + collectionOrder.recipientsSurname+'
    ' + + '\n' + + 'Sitio de recolección: '+collectionOrder.collectionAddress.line1+'
    \n' + + '' + + '

    \n' + + '' + + collectionOrder.deliveryAddress.line1 +', '+collectionOrder.deliveryAddress.line2+ + '. '+ collectionOrder.deliveryAddress.city+', '+collectionOrder.deliveryAddress.country+ + '\n' + + '
    \n' + + '
    ') + } + getPackages(collectionOrder) + { + let description=""; + for(let i=0;i' + + collectionOrder.packages[i].description+ + ''; + } + return description; + } +} \ No newline at end of file diff --git a/resources/mappy_board/js/dialogs.js b/resources/mappy_board/js/dialogs.js new file mode 100644 index 0000000..b92562f --- /dev/null +++ b/resources/mappy_board/js/dialogs.js @@ -0,0 +1,70 @@ +class Dialog +{ + constructor(modal) + { + this.modal=modal; + } + + setToAButton(button) + { + button.on('click', function() + { + this.modal.modal('show'); + }); + } + + show() + { + this.modal.modal('show'); + } + + hide() + { + this.modal.hide(); + } + +} + +class SwalModal +{ + constructor(title,text,type,showCancelButton, confirmButtonColor, + cancelButtonColor, confirmButtonText, cancelButtonText, action) + { + this.title= title; + this.text= text; + this.type=type; + this.showCancelButton= showCancelButton; + this.confirmButtonColor= confirmButtonColor; + this.cancelButtonColor= cancelButtonColor; + this.confirmButtonText=confirmButtonText; + this.cancelButtonText= cancelButtonText; + this.action=action; + } + show() + { + swal({ + title: this.title, + text: this.text, + type: this.type, + showCancelButton: this.showCancelButton, + confirmButtonColor: this.confirmButtonColor, + cancelButtonColor: this.cancelButtonColor, + confirmButtonText: this.confirmButtonText, + cancelButtonText: this.cancelButtonText + }).then(this.action); + } +} + +var exitWindow=new SwalModal( + '¿Estás seguro?', + 'La sesión actual será cerrada', + 'warning', + true, + '#DC8502', + '#F44336', + 'Sí, ¡quiero salir!', + 'No, cancelar!', + function () { + window.location="api/v/logout"; + } +); diff --git a/resources/mappy_board/js/main.js b/resources/mappy_board/js/main.js index 77fa597..5cc8d67 100644 --- a/resources/mappy_board/js/main.js +++ b/resources/mappy_board/js/main.js @@ -1,20 +1,4 @@ -function exitWindow() -{ - swal({ - title: '¿Estás seguro?', - text: "La sesión actual será cerrada", - type: 'warning', - showCancelButton: true, - confirmButtonColor: '#DC8502', - cancelButtonColor: '#F44336', - confirmButtonText: 'Sí, ¡quiero salir!', - cancelButtonText: 'No, cancelar!' - }).then(function () { - window.location="api/v/logout"; - }); -} - - +var emptyCollectionOrder; $(document).ready(function(){ $('.btn-sideBar-SubMenu').on('click', function(){ @@ -28,9 +12,9 @@ $(document).ready(function(){ SubMenu.addClass('show-sideBar-SubMenu'); } }); - $('.btn-exit-system').on('click', exitWindow); + $('.btn-exit-system').on('click', function(){exitWindow.show()}); - $('.exitSideBar').on('click', exitWindow); + $('.exitSideBar').on('click', function(){exitWindow.show()}); $('.btn-menu-dashboard').on('click', function(){ var body=$('.dashboard-contentPage'); @@ -71,14 +55,14 @@ $(document).ready(function(){ ) }); }); - $('.btn-modal-help').on('click', function(){ - $('#Dialog-Help').modal('show'); - }); + + emptyCollectionOrder=new Dialog($('#Dialog-Help')); $('.viewSideBar').on('click', function() { $('.navbar-text').text("ÓRDENES DE RECOLECCIÓN"); $('.makeACollectionOrder').hide(300); + $('.historyOfCollectionOrders').hide(300); $('#mapMain').show(300); }); @@ -86,8 +70,18 @@ $(document).ready(function(){ { $('.navbar-text').text("CREAR ORDEN DE RECOLECCIÓN"); $('#mapMain').hide(300); + $('.historyOfCollectionOrders').hide(300); $('.makeACollectionOrder').show(300); }); + + $('.historySideBar').on('click', function() + { + $('.navbar-text').text("ÓRDENES EN CURSO"); + $('#mapMain').hide(300); + $('.makeACollectionOrder').hide(300); + $('.historyOfCollectionOrders').show(300); + }); + }); (function($){ $(window).on("load",async function(){ diff --git a/resources/mappy_board/js/queries.js b/resources/mappy_board/js/queries.js index 449d846..8f9352a 100644 --- a/resources/mappy_board/js/queries.js +++ b/resources/mappy_board/js/queries.js @@ -15,8 +15,16 @@ function addOrder(order) const deliveryAddress= new DeliveryAddress(da.country, da.city, da.line1, da.line2, da.zipCode, da.description); deliveryAddress.addCoordinates(new Coordinates(da.latitude, da.longitude)); - myOrders.push(new CollectionOrder(collectionAddress,deliveryAddress, - order.recipientsName, order.recipientsSurname)); + let newOrder=new CollectionOrder(order.collection_order_id, collectionAddress,deliveryAddress, + order.recipientsName, order.recipientsSurname); + for (let i=0;i Date: Tue, 11 Dec 2018 20:18:03 -0400 Subject: [PATCH 2/5] =?UTF-8?q?Porgramado=20bot=C3=B3n=20"Realizar=20una"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/mappy_board/home.html | 4 +-- resources/mappy_board/js/card.js | 8 +++-- resources/mappy_board/js/main.js | 54 ++++++++++++++++++-------------- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/pages/mappy_board/home.html b/pages/mappy_board/home.html index 9838485..97d4350 100644 --- a/pages/mappy_board/home.html +++ b/pages/mappy_board/home.html @@ -360,7 +360,7 @@
    No hay órdenes de recolección en curso
    - +
    @@ -394,7 +394,7 @@

    diff --git a/resources/mappy_board/js/card.js b/resources/mappy_board/js/card.js index 81237ab..ae9d4f3 100644 --- a/resources/mappy_board/js/card.js +++ b/resources/mappy_board/js/card.js @@ -4,7 +4,7 @@ class CollectionOrderCard { const img="\"/static/mappy_board/assets/img/user.png\""; const description=this.getPackages(collectionOrder); - $(".collectionHistory").remove(".noCollectionOrder"); + $(".collectionHistory").remove(".noHistory"); $(".collectionHistory").append('
    ' + '
    \n' + 'user-picture' + @@ -29,7 +29,7 @@ class CollectionOrderCard '. '+ collectionOrder.deliveryAddress.city+', '+collectionOrder.deliveryAddress.country+ '\n' + '
    \n' + - '
    ') + ''); } getPackages(collectionOrder) { @@ -43,4 +43,8 @@ class CollectionOrderCard } return description; } + clear() + { + $(".collectionHistory").clean(); + } } \ No newline at end of file diff --git a/resources/mappy_board/js/main.js b/resources/mappy_board/js/main.js index 5cc8d67..3bfd585 100644 --- a/resources/mappy_board/js/main.js +++ b/resources/mappy_board/js/main.js @@ -58,32 +58,17 @@ $(document).ready(function(){ emptyCollectionOrder=new Dialog($('#Dialog-Help')); - $('.viewSideBar').on('click', function() - { - $('.navbar-text').text("ÓRDENES DE RECOLECCIÓN"); - $('.makeACollectionOrder').hide(300); - $('.historyOfCollectionOrders').hide(300); - $('#mapMain').show(300); - }); + $('.viewSideBar').on('click', changeToMap); - $('.collectionOrderSideBar').on('click', function() - { - $('.navbar-text').text("CREAR ORDEN DE RECOLECCIÓN"); - $('#mapMain').hide(300); - $('.historyOfCollectionOrders').hide(300); - $('.makeACollectionOrder').show(300); - }); + $('.collectionOrderSideBar').on('click', changeToCollectionOrder); - $('.historySideBar').on('click', function() - { - $('.navbar-text').text("ÓRDENES EN CURSO"); - $('#mapMain').hide(300); - $('.makeACollectionOrder').hide(300); - $('.historyOfCollectionOrders').show(300); - }); + $('.historySideBar').on('click', changeToHistory); + + $('.doOne').on('click', changeToCollectionOrder); }); (function($){ + $('.loading').show(); $(window).on("load",async function(){ $(".dashboard-sideBar-ct").mCustomScrollbar({ theme:"light-thin", @@ -97,10 +82,33 @@ $(document).ready(function(){ autoHideScrollbar: true, scrollButtons: {enable: true} }); - $('.loading').show(); + await setEmail(); await getAllCollectionOrders(); $('.loading').hide(); }); -})(jQuery); \ No newline at end of file +})(jQuery); + +function changeToMap() +{ + $('.navbar-text').text("ÓRDENES DE RECOLECCIÓN"); + $('.makeACollectionOrder').hide(300); + $('.historyOfCollectionOrders').hide(300); + $('#mapMain').show(300); +} + +function changeToCollectionOrder() +{ + $('.navbar-text').text("CREAR ORDEN DE RECOLECCIÓN"); + $('#mapMain').hide(300); + $('.historyOfCollectionOrders').hide(300); + $('.makeACollectionOrder').show(300); +} +function changeToHistory() +{ + $('.navbar-text').text("ÓRDENES EN CURSO"); + $('#mapMain').hide(300); + $('.makeACollectionOrder').hide(300); + $('.historyOfCollectionOrders').show(300); +} From bdafb67bee0f1ca9c8a02625721c740906c434a4 Mon Sep 17 00:00:00 2001 From: Super Proyectos Date: Wed, 12 Dec 2018 18:48:57 -0400 Subject: [PATCH 3/5] Pop-ups de los marcadores --- delivery_address/views.py | 4 --- resources/mappy_board/js/card.js | 15 +++++++++-- resources/mappy_board/js/dialogs.js | 14 ++++++++++ resources/mappy_board/js/main.js | 2 +- resources/mappy_board/js/map.js | 41 +++++++++++++++++++++++++++-- resources/mappy_board/js/queries.js | 14 ++-------- 6 files changed, 69 insertions(+), 21 deletions(-) diff --git a/delivery_address/views.py b/delivery_address/views.py index 75bed16..72b4b85 100644 --- a/delivery_address/views.py +++ b/delivery_address/views.py @@ -9,10 +9,6 @@ class DeliveryAddressCreate(generics.ListCreateAPIView): queryset = models.DeliveryAddress.objects.all() serializer_class = serializers.DeliveryAddressSerializer - def create(self, request, *args, **kwargs): - request.data["delivery_address_id"] = request.deliveryAddress.delivery_address_id - return super(generics.ListCreateAPIView, self).create(request, *args, **kwargs) - class DeliveryAddressRetrieve(generics.ListAPIView): queryset = models.DeliveryAddress.objects.all() diff --git a/resources/mappy_board/js/card.js b/resources/mappy_board/js/card.js index ae9d4f3..35edf2c 100644 --- a/resources/mappy_board/js/card.js +++ b/resources/mappy_board/js/card.js @@ -4,7 +4,7 @@ class CollectionOrderCard { const img="\"/static/mappy_board/assets/img/user.png\""; const description=this.getPackages(collectionOrder); - $(".collectionHistory").remove(".noHistory"); + $(".noHistory").remove(); $(".collectionHistory").append('
    ' + '
    \n' + 'user-picture' + @@ -25,12 +25,22 @@ class CollectionOrderCard '' + '

    \n' + '' + - collectionOrder.deliveryAddress.line1 +', '+collectionOrder.deliveryAddress.line2+ + this.getText(collectionOrder.deliveryAddress.line1)+ + this.getText(", "+collectionOrder.deliveryAddress.line2)+ '. '+ collectionOrder.deliveryAddress.city+', '+collectionOrder.deliveryAddress.country+ '\n' + '
    \n' + '
    '); } + + getText(text) + { + if(text==", null") + return ""; + else + return text; + } + getPackages(collectionOrder) { let description=""; @@ -43,6 +53,7 @@ class CollectionOrderCard } return description; } + clear() { $(".collectionHistory").clean(); diff --git a/resources/mappy_board/js/dialogs.js b/resources/mappy_board/js/dialogs.js index b92562f..89940b0 100644 --- a/resources/mappy_board/js/dialogs.js +++ b/resources/mappy_board/js/dialogs.js @@ -68,3 +68,17 @@ var exitWindow=new SwalModal( window.location="api/v/logout"; } ); + +var informationWindow=new SwalModal( + 'Maleta', + '02:23 PM\tNo R interpreter defined: Many R related features like completion, code checking and help won\'t be available. You can set an interpreter under Preferences->Languages->R\n ', + 'info', + true, + '#DC8502', + '#F44336', + 'Sí, ¡quiero salir!', + 'No, cancelar!', + function () { + window.location="api/v/logout"; + } +); diff --git a/resources/mappy_board/js/main.js b/resources/mappy_board/js/main.js index 3bfd585..bd9f778 100644 --- a/resources/mappy_board/js/main.js +++ b/resources/mappy_board/js/main.js @@ -1,5 +1,5 @@ var emptyCollectionOrder; - +var aMark; $(document).ready(function(){ $('.btn-sideBar-SubMenu').on('click', function(){ var SubMenu=$(this).next('ul'); diff --git a/resources/mappy_board/js/map.js b/resources/mappy_board/js/map.js index 29a251a..e145189 100644 --- a/resources/mappy_board/js/map.js +++ b/resources/mappy_board/js/map.js @@ -1,8 +1,45 @@ -var mymap = L.map('mapMain').setView([10.4642, -66.9758], 15); +class Map +{ + constructor(container) + { + this.map = L.map(container).setView([10.4642, -66.9758], 15); + L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { +}).addTo(this.map); + } + + addMarker(order) + { + console.log(order); + let marker = L.marker([order.deliveryAddress.coordinates.latitude, order.deliveryAddress.coordinates.longitude]).addTo(this.map); + marker.on('click',function() + { + new SwalModal( + "Maleta", + "Para: "+order.recipientsName+" "+order.recipientsSurname+"
    " + + "Dirección de recoleción: "+order.collectionAddress.line1+"
    "+ + "Dirección de envío: "+order.deliveryAddress.line1+"
    ", + "info", + false, + "#DC8502", + null, + "Ok", + null, + null + + ).show(); + }); + } +} + + + +var myMap=new Map('mapMain'); + +/*var mymap = L.map('mapMain').setView([10.4642, -66.9758], 15); L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { }).addTo(mymap); -/* + //mymap.on('click', onMapClick); //map.invalidateSize(); diff --git a/resources/mappy_board/js/queries.js b/resources/mappy_board/js/queries.js index 8f9352a..84fc115 100644 --- a/resources/mappy_board/js/queries.js +++ b/resources/mappy_board/js/queries.js @@ -43,16 +43,6 @@ async function getAllCollectionOrders() { const coord=myOrders[i].deliveryAddress.coordinates; new CollectionOrderCard(myOrders[i]); - mainMap.addMarker(coord); + myMap.addMarker(myOrders[i]); } -} - - -class Map -{ - addMarker(coordinates) - { - L.marker([coordinates.latitude, coordinates.longitude]).addTo(mymap); - } -} -var mainMap=new Map(); \ No newline at end of file +} \ No newline at end of file From 9e44557445875eb76667cba7a3a30da95ae6a571 Mon Sep 17 00:00:00 2001 From: Super Proyectos Date: Wed, 12 Dec 2018 19:41:15 -0400 Subject: [PATCH 4/5] =?UTF-8?q?Mejoras=20de=20dise=C3=B1o=20en=20marcadore?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/js/collectionorderdao.js | 10 ++++++++ resources/mappy_board/js/card.js | 39 +++++++++++++++++++++-------- resources/mappy_board/js/dialogs.js | 23 +++++++++++++++++ resources/mappy_board/js/map.js | 16 +----------- 4 files changed, 63 insertions(+), 25 deletions(-) diff --git a/resources/js/collectionorderdao.js b/resources/js/collectionorderdao.js index c16b2c2..240f242 100644 --- a/resources/js/collectionorderdao.js +++ b/resources/js/collectionorderdao.js @@ -14,6 +14,16 @@ class CollectionOrder { this.packages.push(packages); } + + getPackagesResume() + { + let ret=""; + for(let i=0;i' + '
    \n' + 'user-picture' + '
    ' + '
    \n' + - '

    \n'+ - description+ - '

    \n' + + this.thePackageText(collectionOrder)+ '

    \n' + '' + - 'Para: '+collectionOrder.recipientsName+' '+ - collectionOrder.recipientsSurname+'
    ' + + this.theRecipientsText(collectionOrder)+ '\n' + - 'Sitio de recolección: '+collectionOrder.collectionAddress.line1+'
    \n' + + this.theCollectionAddressText(collectionOrder)+ '' + '

    \n' + '' + - this.getText(collectionOrder.deliveryAddress.line1)+ - this.getText(", "+collectionOrder.deliveryAddress.line2)+ - '. '+ collectionOrder.deliveryAddress.city+', '+collectionOrder.deliveryAddress.country+ + this.theDeliveryAddressText(collectionOrder)+ '\n' + '
    \n' + ''); @@ -54,6 +49,30 @@ class CollectionOrderCard return description; } + + thePackageText(order) + { + return '

    '+ + this.getPackages(order)+ + '

    '; + } + + theRecipientsText(order) + { + return 'Para: '+order.recipientsName+' '+ + order.recipientsSurname+'
    '; + } + theCollectionAddressText(order) + { + return 'Sitio de recolección: '+order.collectionAddress.line1+'
    \n'; + } + theDeliveryAddressText(order) + { + return this.getText(order.deliveryAddress.line1)+ + this.getText(", "+order.deliveryAddress.line2)+ + '.
    '+ order.deliveryAddress.zipCode+" "+order.deliveryAddress.city+ + ', '+order.deliveryAddress.country; + } clear() { $(".collectionHistory").clean(); diff --git a/resources/mappy_board/js/dialogs.js b/resources/mappy_board/js/dialogs.js index 89940b0..e64acc7 100644 --- a/resources/mappy_board/js/dialogs.js +++ b/resources/mappy_board/js/dialogs.js @@ -82,3 +82,26 @@ var informationWindow=new SwalModal( window.location="api/v/logout"; } ); + +class InfoOfMarker extends SwalModal +{ + constructor(order) + { + super( + order.getPackagesResume(), + "Para: "+order.recipientsName+" "+order.recipientsSurname+"
    " + + "Dirección de recoleción: "+order.collectionAddress.line1+"
    "+ + "Dirección de envío: "+order.deliveryAddress.line1+"
    "+ + order.deliveryAddress.zipCode+" "+ + order.deliveryAddress.city+", "+order.deliveryAddress.country+"
    ", + "info", + false, + "#DC8502", + null, + "Ok", + null, + null + + ); + } +} \ No newline at end of file diff --git a/resources/mappy_board/js/map.js b/resources/mappy_board/js/map.js index e145189..201d90b 100644 --- a/resources/mappy_board/js/map.js +++ b/resources/mappy_board/js/map.js @@ -9,24 +9,10 @@ class Map addMarker(order) { - console.log(order); let marker = L.marker([order.deliveryAddress.coordinates.latitude, order.deliveryAddress.coordinates.longitude]).addTo(this.map); marker.on('click',function() { - new SwalModal( - "Maleta", - "Para: "+order.recipientsName+" "+order.recipientsSurname+"
    " + - "Dirección de recoleción: "+order.collectionAddress.line1+"
    "+ - "Dirección de envío: "+order.deliveryAddress.line1+"
    ", - "info", - false, - "#DC8502", - null, - "Ok", - null, - null - - ).show(); + new InfoOfMarker(order).show(); }); } } From 5076fb1f10260bb3580753de36654451eeb0ac6b Mon Sep 17 00:00:00 2001 From: Super Proyectos Date: Wed, 12 Dec 2018 20:19:44 -0400 Subject: [PATCH 5/5] =?UTF-8?q?Eliminar=20orden=20de=20recolecci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/js/collectionorderdao.js | 20 ++++++++++++++++++-- resources/js/requests.js | 26 ++++++++++++++++++++++++++ resources/mappy_board/js/card.js | 11 +++++++++-- resources/mappy_board/js/dialogs.js | 1 + 4 files changed, 54 insertions(+), 4 deletions(-) diff --git a/resources/js/collectionorderdao.js b/resources/js/collectionorderdao.js index 240f242..0489104 100644 --- a/resources/js/collectionorderdao.js +++ b/resources/js/collectionorderdao.js @@ -24,6 +24,22 @@ class CollectionOrder } return ret.substr(0,ret.length-2); } + + getWeight() + { + let ret=0; + for(let i=0;i + response.json()).then(json => { + return json;}).catch(e => {return e}); + } } \ No newline at end of file diff --git a/resources/mappy_board/js/card.js b/resources/mappy_board/js/card.js index b24237d..58578ad 100644 --- a/resources/mappy_board/js/card.js +++ b/resources/mappy_board/js/card.js @@ -16,7 +16,8 @@ class CollectionOrderCard this.theRecipientsText(collectionOrder)+ '\n' + this.theCollectionAddressText(collectionOrder)+ - '' + @@ -26,6 +27,11 @@ class CollectionOrderCard '\n' + '\n' + ''); + + $("#deleteOrderInfo"+collectionOrder.id).on("click",async function () + { + console.log(await collectionOrder.delete()); + }) } getText(text) @@ -43,7 +49,8 @@ class CollectionOrderCard { description+='

    ' + '' + - collectionOrder.packages[i].description+ + collectionOrder.packages[i].description+" ("+ + collectionOrder.packages[i].weight.substr(0, collectionOrder.packages[i].weight.indexOf(".")+2)+" kg)"+ '

    '; } return description; diff --git a/resources/mappy_board/js/dialogs.js b/resources/mappy_board/js/dialogs.js index e64acc7..53bb549 100644 --- a/resources/mappy_board/js/dialogs.js +++ b/resources/mappy_board/js/dialogs.js @@ -92,6 +92,7 @@ class InfoOfMarker extends SwalModal "Para: "+order.recipientsName+" "+order.recipientsSurname+"
    " + "Dirección de recoleción: "+order.collectionAddress.line1+"
    "+ "Dirección de envío: "+order.deliveryAddress.line1+"
    "+ + "Peso total: "+order.getWeight()+" kg
    "+ order.deliveryAddress.zipCode+" "+ order.deliveryAddress.city+", "+order.deliveryAddress.country+"
    ", "info",