JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.1.js"></script>
<ul data-bind="foreach: allItems">
    <li>
        <span data-bind="text: nombrePrestacion"> </span>
        <span data-bind="text: orden"> </span>
    </li>
</ul>
 
<button data-bind="click: sortItems">Sort</button>

<button data-bind="click: add">add</button>

JavaScript

var prefijoDiaCama = "202";

var Prestaciones = function (op, prestacion) {
    var self = this;
    
    cantidadIntervenciones = $("#tblIntervencion tbody tr").size();
    cantidadPrestaciones = $("#tblPrestacion tbody tr").size() + 1;
    cantidadPabellones = $("#tblPrestacion tbody tr.pabellon").size() + 1;
    cantidadDiasCama = $("#tblPrestacion tbody tr.cama").size() + 1;
    
    if (op == 0) {
        self.interid = "p" + 0;
        self.clase = ko.computed(function () {
            if (prestacion.codClinica.includes(prefijoDiaCama)) return "cama"; else return "";
        });
        self.codFonasa = prestacion.codFonasa;
        self.codClinica = prestacion.codClinica;
        self.nombrePrestacion = prestacion.nombrePrestacion;
        self.tipo = "P"
        self.orden = ko.computed(function () {
            if (prestacion.codClinica.includes(prefijoDiaCama)) return cantidadDiasCama; else return cantidadPrestaciones;
        });
        self.descuentoPrestacion = ko.observable(0);
        self.valorUnitarioPrestacion = ko.observable(prestacion.valor.replace(/\./g, ""));
        self.activado = true;
        self.eliminable = true;
        self.nombreIntervencion = "";
        prestacion.dias = 0;
    } else if(op == 1) {
        self.interid = "p" + cantidadIntervenciones;
        self.clase = "pabellon";
        self.codFonasa = prestacion.codFonasa;
        self.codClinica = prestacion.codClinica;
        self.nombrePrestacion = "Pabellon" + cantidadIntervenciones;
        self.tipo = "I"
        self.orden = ko.observable(cantidadDiasCama + cantidadPabellones);
        self.descuentoPrestacion = ko.observable(0);
        self.valorUnitarioPrestacion = ko.observable(0);
        self.activado = false;
        self.eliminable = false;
        self.nombreIntervencion = prestacion.nombreIntervencion;
        prestacion.dias = 0;
    } else if (op == 2) {
        self.interid = "c" + 0;
        self.clase = "concepto";
        self.codFonasa =...